T3-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 424 discussions
[Git][ultreiaio/ird-t3][develop] use t3-data 1.4 at last + still improving tests
by Tony CHEMIT 10 Mar '18
by Tony CHEMIT 10 Mar '18
10 Mar '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
3e46bd01 by Tony CHEMIT at 2018-03-10T16:43:09Z
use t3-data 1.4 at last + still improving tests
- - - - -
9 changed files:
- pom.xml
- t3-actions/src/main/java/fr/ird/t3/FakeT3ServiceContext.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/FakeT3AvdthServiceContext.java
- t3-actions/src/test/resources/log4j.properties
- t3-domain/src/main/java/fr/ird/t3/test/T3PostgresqlDatabase.java
- t3-domain/src/test/resources/log4j.properties
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
- t3-input-avdthv35/src/test/resources/log4j.properties
- t3-installer/src/main/resources/log4j.properties
Changes:
=====================================
pom.xml
=====================================
--- a/pom.xml
+++ b/pom.xml
@@ -99,7 +99,7 @@
<projectId>ird-t3</projectId>
<stageId>frirdt3</stageId>
<applicationName>t3</applicationName>
- <t3-data.version>1.4-SNAPSHOT</t3-data.version>
+ <t3-data.version>1.4</t3-data.version>
<env>dev</env>
<skipITs>true</skipITs>
=====================================
t3-actions/src/main/java/fr/ird/t3/FakeT3ServiceContext.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/FakeT3ServiceContext.java
+++ b/t3-actions/src/main/java/fr/ird/t3/FakeT3ServiceContext.java
@@ -174,6 +174,7 @@ public class FakeT3ServiceContext implements TestRule, T3ServiceContext, Closeab
public void evaluate() throws Throwable {
try {
starting(description);
+ initOk=true;
} catch (Exception e) {
Assume.assumeNoException("Can't start test: " + e.getMessage(), e);
}
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/FakeT3AvdthServiceContext.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/FakeT3AvdthServiceContext.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/FakeT3AvdthServiceContext.java
@@ -192,12 +192,13 @@ public class FakeT3AvdthServiceContext implements TestRule, T3ServiceContext, Cl
}
}
rootContext = T3TopiaApplicationContextBuilder.forH2Referential(testDir.toPath(), injectReferential ? t3DataVersion : null).build();
+ initOk=true;
}
@Override
public void close() {
- if (transaction != null) {
- transaction.close();
+ if (rootContext != null && rootContext.isOpened()) {
+ rootContext.close();
}
}
=====================================
t3-actions/src/test/resources/log4j.properties
=====================================
--- a/t3-actions/src/test/resources/log4j.properties
+++ b/t3-actions/src/test/resources/log4j.properties
@@ -26,5 +26,11 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t] (%F:%L) %M - %m%n
# package level
-log4j.logger.fr.ird.t3=INFO
log4j.logger.fr.ird.t3.actions=DEBUG
+log4j.logger.fr.ird.t3=INFO
+log4j.logger.org.nuiton.topia=INFO
+log4j.logger.org.hibernate=WARN
+log4j.logger.org.hibernate.orm.deprecation=ERROR
+log4j.logger.com.zaxxer.hikari.HikariDataSource=ERROR
+log4j.logger.org.nuiton.topia.persistence.internal.HibernateProvider=ERROR
+log4j.logger.org.nuiton.topia.migration=INFO
=====================================
t3-domain/src/main/java/fr/ird/t3/test/T3PostgresqlDatabase.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/test/T3PostgresqlDatabase.java
+++ b/t3-domain/src/main/java/fr/ird/t3/test/T3PostgresqlDatabase.java
@@ -51,7 +51,7 @@ public class T3PostgresqlDatabase implements TestRule {
try {
topiaApplicationContext = T3TopiaApplicationContextBuilder.forPgTest().checkConnexion().build();
} catch (Exception e) {
- Assume.assumeTrue("Skip test " + description + ", could not connect to database", true);
+ Assume.assumeNoException("Skip test " + description + ", could not connect to database", e);
}
return new Statement() {
@Override
=====================================
t3-domain/src/test/resources/log4j.properties
=====================================
--- a/t3-domain/src/test/resources/log4j.properties
+++ b/t3-domain/src/test/resources/log4j.properties
@@ -27,4 +27,9 @@ log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t]
# package level
log4j.logger.fr.ird.t3=INFO
+log4j.logger.org.nuiton.topia=INFO
+log4j.logger.org.hibernate=WARN
+log4j.logger.org.hibernate.orm.deprecation=ERROR
+log4j.logger.com.zaxxer.hikari.HikariDataSource=ERROR
+log4j.logger.org.nuiton.topia.persistence.internal.HibernateProvider=ERROR
log4j.logger.org.nuiton.topia.migration=INFO
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
@@ -33,7 +33,7 @@ import org.junit.Test;
*
* @author Tony Chemit - dev(a)tchemit.fr
*/
-//@Ignore
+@Ignore
public class AnalyzeInputSourceActionTest extends AnalyzeInputSourceActionTestSupport {
@Override
=====================================
t3-input-avdthv35/src/test/resources/log4j.properties
=====================================
--- a/t3-input-avdthv35/src/test/resources/log4j.properties
+++ b/t3-input-avdthv35/src/test/resources/log4j.properties
@@ -27,11 +27,8 @@ log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t]
# package level
log4j.logger.fr.ird.t3=INFO
-#log4j.logger.fr.ird.t3.actions=DEBUG
-#log4j.logger.fr.ird.t3.entities.T3EntityHelper=DEBUG
-#log4j.logger.RemoveProxyEntityVisitor=DEBUG
-#log4j.logger.T3DataEntityVisitor=DEBUG
-
-#log4j.logger.org.nuiton.topia.persistence.util=INFO
-#log4j.logger.org.nuiton.util=INFO
-#log4j.logger.org.nuiton.topia.persistence.util.Collector=DEBUG
+log4j.logger.org.nuiton.topia=INFO
+log4j.logger.org.hibernate=WARN
+log4j.logger.org.hibernate.orm.deprecation=ERROR
+log4j.logger.com.zaxxer.hikari.HikariDataSource=ERROR
+log4j.logger.org.nuiton.topia.persistence.internal.HibernateProvider=ERROR
\ No newline at end of file
=====================================
t3-installer/src/main/resources/log4j.properties
=====================================
--- a/t3-installer/src/main/resources/log4j.properties
+++ b/t3-installer/src/main/resources/log4j.properties
@@ -34,7 +34,10 @@ log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t] (%c:%L) %M - %m%n
# levels
-
+log4j.logger.fr.ird.t3=INFO
+log4j.logger.org.nuiton.topia=INFO
log4j.logger.org.hibernate=WARN
log4j.logger.org.hibernate.orm.deprecation=ERROR
log4j.logger.com.zaxxer.hikari.HikariDataSource=ERROR
+log4j.logger.org.nuiton.topia.persistence.internal.HibernateProvider=ERROR
+log4j.logger.org.nuiton.topia.migration=INFO
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/3e46bd0161e31456cf5f8c5fd5764342…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/3e46bd0161e31456cf5f8c5fd5764342…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][develop] use t3-data 1.4 at last + still improving tests
by Tony CHEMIT 10 Mar '18
by Tony CHEMIT 10 Mar '18
10 Mar '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
468c32d5 by Tony CHEMIT at 2018-03-10T16:42:49Z
use t3-data 1.4 at last + still improving tests
- - - - -
10 changed files:
- pom.xml
- t3-actions/src/main/java/fr/ird/t3/FakeT3ServiceContext.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/FakeT3AvdthServiceContext.java
- t3-actions/src/test/resources/log4j.properties
- t3-domain/src/main/java/fr/ird/t3/entities/T3TopiaApplicationContextBuilder.java
- t3-domain/src/main/java/fr/ird/t3/test/T3PostgresqlDatabase.java
- t3-domain/src/test/resources/log4j.properties
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
- t3-input-avdthv35/src/test/resources/log4j.properties
- t3-installer/src/main/resources/log4j.properties
Changes:
=====================================
pom.xml
=====================================
--- a/pom.xml
+++ b/pom.xml
@@ -99,7 +99,7 @@
<projectId>ird-t3</projectId>
<stageId>frirdt3</stageId>
<applicationName>t3</applicationName>
- <t3-data.version>1.4-SNAPSHOT</t3-data.version>
+ <t3-data.version>1.4</t3-data.version>
<env>dev</env>
<skipITs>true</skipITs>
=====================================
t3-actions/src/main/java/fr/ird/t3/FakeT3ServiceContext.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/FakeT3ServiceContext.java
+++ b/t3-actions/src/main/java/fr/ird/t3/FakeT3ServiceContext.java
@@ -174,6 +174,7 @@ public class FakeT3ServiceContext implements TestRule, T3ServiceContext, Closeab
public void evaluate() throws Throwable {
try {
starting(description);
+ initOk=true;
} catch (Exception e) {
Assume.assumeNoException("Can't start test: " + e.getMessage(), e);
}
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/FakeT3AvdthServiceContext.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/FakeT3AvdthServiceContext.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/FakeT3AvdthServiceContext.java
@@ -192,12 +192,13 @@ public class FakeT3AvdthServiceContext implements TestRule, T3ServiceContext, Cl
}
}
rootContext = T3TopiaApplicationContextBuilder.forH2Referential(testDir.toPath(), injectReferential ? t3DataVersion : null).build();
+ initOk=true;
}
@Override
public void close() {
- if (transaction != null) {
- transaction.close();
+ if (rootContext != null && rootContext.isOpened()) {
+ rootContext.close();
}
}
=====================================
t3-actions/src/test/resources/log4j.properties
=====================================
--- a/t3-actions/src/test/resources/log4j.properties
+++ b/t3-actions/src/test/resources/log4j.properties
@@ -26,5 +26,11 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t] (%F:%L) %M - %m%n
# package level
-log4j.logger.fr.ird.t3=INFO
log4j.logger.fr.ird.t3.actions=DEBUG
+log4j.logger.fr.ird.t3=INFO
+log4j.logger.org.nuiton.topia=INFO
+log4j.logger.org.hibernate=WARN
+log4j.logger.org.hibernate.orm.deprecation=ERROR
+log4j.logger.com.zaxxer.hikari.HikariDataSource=ERROR
+log4j.logger.org.nuiton.topia.persistence.internal.HibernateProvider=ERROR
+log4j.logger.org.nuiton.topia.migration=INFO
=====================================
t3-domain/src/main/java/fr/ird/t3/entities/T3TopiaApplicationContextBuilder.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/entities/T3TopiaApplicationContextBuilder.java
+++ b/t3-domain/src/main/java/fr/ird/t3/entities/T3TopiaApplicationContextBuilder.java
@@ -84,7 +84,7 @@ public class T3TopiaApplicationContextBuilder {
JdbcConfiguration jdbcConfiguration = new JdbcConfiguration();
jdbcConfiguration.setUrl("jdbc:postgresql:t3");
jdbcConfiguration.setLogin("t3-admin");
- jdbcConfiguration.setPassword("a");
+ jdbcConfiguration.setPassword("sa");
return forPg(jdbcConfiguration);
}
=====================================
t3-domain/src/main/java/fr/ird/t3/test/T3PostgresqlDatabase.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/test/T3PostgresqlDatabase.java
+++ b/t3-domain/src/main/java/fr/ird/t3/test/T3PostgresqlDatabase.java
@@ -51,7 +51,7 @@ public class T3PostgresqlDatabase implements TestRule {
try {
topiaApplicationContext = T3TopiaApplicationContextBuilder.forPgTest().checkConnexion().build();
} catch (Exception e) {
- Assume.assumeTrue("Skip test " + description + ", could not connect to database", true);
+ Assume.assumeNoException("Skip test " + description + ", could not connect to database", e);
}
return new Statement() {
@Override
=====================================
t3-domain/src/test/resources/log4j.properties
=====================================
--- a/t3-domain/src/test/resources/log4j.properties
+++ b/t3-domain/src/test/resources/log4j.properties
@@ -27,4 +27,9 @@ log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t]
# package level
log4j.logger.fr.ird.t3=INFO
+log4j.logger.org.nuiton.topia=INFO
+log4j.logger.org.hibernate=WARN
+log4j.logger.org.hibernate.orm.deprecation=ERROR
+log4j.logger.com.zaxxer.hikari.HikariDataSource=ERROR
+log4j.logger.org.nuiton.topia.persistence.internal.HibernateProvider=ERROR
log4j.logger.org.nuiton.topia.migration=INFO
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
@@ -33,7 +33,7 @@ import org.junit.Test;
*
* @author Tony Chemit - dev(a)tchemit.fr
*/
-//@Ignore
+@Ignore
public class AnalyzeInputSourceActionTest extends AnalyzeInputSourceActionTestSupport {
@Override
=====================================
t3-input-avdthv35/src/test/resources/log4j.properties
=====================================
--- a/t3-input-avdthv35/src/test/resources/log4j.properties
+++ b/t3-input-avdthv35/src/test/resources/log4j.properties
@@ -27,11 +27,8 @@ log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t]
# package level
log4j.logger.fr.ird.t3=INFO
-#log4j.logger.fr.ird.t3.actions=DEBUG
-#log4j.logger.fr.ird.t3.entities.T3EntityHelper=DEBUG
-#log4j.logger.RemoveProxyEntityVisitor=DEBUG
-#log4j.logger.T3DataEntityVisitor=DEBUG
-
-#log4j.logger.org.nuiton.topia.persistence.util=INFO
-#log4j.logger.org.nuiton.util=INFO
-#log4j.logger.org.nuiton.topia.persistence.util.Collector=DEBUG
+log4j.logger.org.nuiton.topia=INFO
+log4j.logger.org.hibernate=WARN
+log4j.logger.org.hibernate.orm.deprecation=ERROR
+log4j.logger.com.zaxxer.hikari.HikariDataSource=ERROR
+log4j.logger.org.nuiton.topia.persistence.internal.HibernateProvider=ERROR
\ No newline at end of file
=====================================
t3-installer/src/main/resources/log4j.properties
=====================================
--- a/t3-installer/src/main/resources/log4j.properties
+++ b/t3-installer/src/main/resources/log4j.properties
@@ -34,7 +34,10 @@ log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t] (%c:%L) %M - %m%n
# levels
-
+log4j.logger.fr.ird.t3=INFO
+log4j.logger.org.nuiton.topia=INFO
log4j.logger.org.hibernate=WARN
log4j.logger.org.hibernate.orm.deprecation=ERROR
log4j.logger.com.zaxxer.hikari.HikariDataSource=ERROR
+log4j.logger.org.nuiton.topia.persistence.internal.HibernateProvider=ERROR
+log4j.logger.org.nuiton.topia.migration=INFO
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/468c32d58f5c00f92e5110de98f08e15…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/468c32d58f5c00f92e5110de98f08e15…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][develop] use t3-data 1.4 at last + still improving tests
by Tony CHEMIT 10 Mar '18
by Tony CHEMIT 10 Mar '18
10 Mar '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
f0c9598a by Tony CHEMIT at 2018-03-10T16:33:18Z
use t3-data 1.4 at last + still improving tests
- - - - -
8 changed files:
- pom.xml
- t3-actions/src/main/java/fr/ird/t3/FakeT3ServiceContext.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/FakeT3AvdthServiceContext.java
- t3-actions/src/test/resources/log4j.properties
- t3-domain/src/test/resources/log4j.properties
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
- t3-input-avdthv35/src/test/resources/log4j.properties
- t3-installer/src/main/resources/log4j.properties
Changes:
=====================================
pom.xml
=====================================
--- a/pom.xml
+++ b/pom.xml
@@ -99,7 +99,7 @@
<projectId>ird-t3</projectId>
<stageId>frirdt3</stageId>
<applicationName>t3</applicationName>
- <t3-data.version>1.4-SNAPSHOT</t3-data.version>
+ <t3-data.version>1.4</t3-data.version>
<env>dev</env>
<skipITs>true</skipITs>
=====================================
t3-actions/src/main/java/fr/ird/t3/FakeT3ServiceContext.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/FakeT3ServiceContext.java
+++ b/t3-actions/src/main/java/fr/ird/t3/FakeT3ServiceContext.java
@@ -174,6 +174,7 @@ public class FakeT3ServiceContext implements TestRule, T3ServiceContext, Closeab
public void evaluate() throws Throwable {
try {
starting(description);
+ initOk=true;
} catch (Exception e) {
Assume.assumeNoException("Can't start test: " + e.getMessage(), e);
}
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/FakeT3AvdthServiceContext.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/FakeT3AvdthServiceContext.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/FakeT3AvdthServiceContext.java
@@ -192,12 +192,13 @@ public class FakeT3AvdthServiceContext implements TestRule, T3ServiceContext, Cl
}
}
rootContext = T3TopiaApplicationContextBuilder.forH2Referential(testDir.toPath(), injectReferential ? t3DataVersion : null).build();
+ initOk=true;
}
@Override
public void close() {
- if (transaction != null) {
- transaction.close();
+ if (rootContext != null && rootContext.isOpened()) {
+ rootContext.close();
}
}
=====================================
t3-actions/src/test/resources/log4j.properties
=====================================
--- a/t3-actions/src/test/resources/log4j.properties
+++ b/t3-actions/src/test/resources/log4j.properties
@@ -26,5 +26,11 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t] (%F:%L) %M - %m%n
# package level
-log4j.logger.fr.ird.t3=INFO
log4j.logger.fr.ird.t3.actions=DEBUG
+log4j.logger.fr.ird.t3=INFO
+log4j.logger.org.nuiton.topia=INFO
+log4j.logger.org.hibernate=WARN
+log4j.logger.org.hibernate.orm.deprecation=ERROR
+log4j.logger.com.zaxxer.hikari.HikariDataSource=ERROR
+log4j.logger.org.nuiton.topia.persistence.internal.HibernateProvider=ERROR
+log4j.logger.org.nuiton.topia.migration=INFO
=====================================
t3-domain/src/test/resources/log4j.properties
=====================================
--- a/t3-domain/src/test/resources/log4j.properties
+++ b/t3-domain/src/test/resources/log4j.properties
@@ -27,4 +27,9 @@ log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t]
# package level
log4j.logger.fr.ird.t3=INFO
+log4j.logger.org.nuiton.topia=INFO
+log4j.logger.org.hibernate=WARN
+log4j.logger.org.hibernate.orm.deprecation=ERROR
+log4j.logger.com.zaxxer.hikari.HikariDataSource=ERROR
+log4j.logger.org.nuiton.topia.persistence.internal.HibernateProvider=ERROR
log4j.logger.org.nuiton.topia.migration=INFO
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
@@ -33,7 +33,7 @@ import org.junit.Test;
*
* @author Tony Chemit - dev(a)tchemit.fr
*/
-//@Ignore
+@Ignore
public class AnalyzeInputSourceActionTest extends AnalyzeInputSourceActionTestSupport {
@Override
=====================================
t3-input-avdthv35/src/test/resources/log4j.properties
=====================================
--- a/t3-input-avdthv35/src/test/resources/log4j.properties
+++ b/t3-input-avdthv35/src/test/resources/log4j.properties
@@ -27,11 +27,8 @@ log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t]
# package level
log4j.logger.fr.ird.t3=INFO
-#log4j.logger.fr.ird.t3.actions=DEBUG
-#log4j.logger.fr.ird.t3.entities.T3EntityHelper=DEBUG
-#log4j.logger.RemoveProxyEntityVisitor=DEBUG
-#log4j.logger.T3DataEntityVisitor=DEBUG
-
-#log4j.logger.org.nuiton.topia.persistence.util=INFO
-#log4j.logger.org.nuiton.util=INFO
-#log4j.logger.org.nuiton.topia.persistence.util.Collector=DEBUG
+log4j.logger.org.nuiton.topia=INFO
+log4j.logger.org.hibernate=WARN
+log4j.logger.org.hibernate.orm.deprecation=ERROR
+log4j.logger.com.zaxxer.hikari.HikariDataSource=ERROR
+log4j.logger.org.nuiton.topia.persistence.internal.HibernateProvider=ERROR
\ No newline at end of file
=====================================
t3-installer/src/main/resources/log4j.properties
=====================================
--- a/t3-installer/src/main/resources/log4j.properties
+++ b/t3-installer/src/main/resources/log4j.properties
@@ -34,7 +34,10 @@ log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t] (%c:%L) %M - %m%n
# levels
-
+log4j.logger.fr.ird.t3=INFO
+log4j.logger.org.nuiton.topia=INFO
log4j.logger.org.hibernate=WARN
log4j.logger.org.hibernate.orm.deprecation=ERROR
log4j.logger.com.zaxxer.hikari.HikariDataSource=ERROR
+log4j.logger.org.nuiton.topia.persistence.internal.HibernateProvider=ERROR
+log4j.logger.org.nuiton.topia.migration=INFO
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/f0c9598afbeb383f946b53b8dd10c541…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/f0c9598afbeb383f946b53b8dd10c541…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][develop] 6 commits: Improve installer API + Spatialisation de la table Harbour (closes #290)
by Tony CHEMIT 10 Mar '18
by Tony CHEMIT 10 Mar '18
10 Mar '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
990b66b1 by Tony CHEMIT at 2018-03-09T19:36:18Z
Improve installer API + Spatialisation de la table Harbour (closes #290)
- - - - -
410d676c by Tony CHEMIT at 2018-03-09T21:24:48Z
ignore some tests (since imports does not change any more)
- - - - -
4020362b by Tony CHEMIT at 2018-03-09T21:25:20Z
improve test api
- - - - -
4ddf2581 by Tony CHEMIT at 2018-03-09T22:22:17Z
fix avdth imports
- - - - -
856a8b23 by Tony CHEMIT at 2018-03-10T15:50:15Z
start to update struts
- - - - -
a9cae859 by Tony CHEMIT at 2018-03-10T15:50:29Z
yet improve test api (and remove a module)
- - - - -
30 changed files:
- pom.xml
- t3-actions/pom.xml
- t3-test/src/main/java/fr/ird/t3/FakeT3ServiceContext.java → t3-actions/src/main/java/fr/ird/t3/FakeT3ServiceContext.java
- t3-test/src/main/java/fr/ird/t3/T3ActionFixtures.java → t3-actions/src/main/java/fr/ird/t3/T3ActionFixtures.java
- − t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
- − t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionITSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/FakeT3AvdthServiceContext.java
- t3-domain/pom.xml
- t3-domain/src/main/java/fr/ird/t3/T3SqlScriptsImporter.java
- t3-domain/src/main/java/fr/ird/t3/entities/T3JdbcHelper.java
- t3-domain/src/main/java/fr/ird/t3/entities/T3TopiaApplicationContext.java
- + t3-domain/src/main/java/fr/ird/t3/entities/T3TopiaApplicationContextBuilder.java
- t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractOceanTopiaDao.java
- t3-domain/src/main/java/fr/ird/t3/entities/user/JdbcConfiguration.java
- t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_3.java
- + t3-domain/src/main/java/fr/ird/t3/test/T3H2Database.java
- + t3-domain/src/main/java/fr/ird/t3/test/T3PostgresqlDatabase.java
- + t3-domain/src/main/resources/db/migration/V_2_3_05-spatialize-harbour.sql
- t3-domain/src/main/resources/t3-internaldb.properties → t3-domain/src/main/resources/t3-topia-config.properties
- t3-domain/src/main/resources/t3-datadb.properties → t3-domain/src/main/resources/t3-topia-migration.properties
- t3-domain/src/test/java/fr/ird/t3/entities/AbstractDatabaseTest.java
- + t3-domain/src/test/java/fr/ird/t3/entities/reference/OceanTopiaDaoPgTest.java
- t3-domain/src/test/java/fr/ird/t3/services/migration/T3MigrationTest.java
- t3-input-avdthv33/pom.xml
- t3-input-avdthv35/pom.xml
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/ImportInputSourceActionTest.java
- − t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanIT.java
- − t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanRecentIT.java
- − t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionIndianOceanIT.java
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/fbdd9e09a4535d061cb16aa2c3d2ec7…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/fbdd9e09a4535d061cb16aa2c3d2ec7…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][develop] Marées sans logbooks : gestion de leurs échantillons - amélioration de…
by Tony CHEMIT 09 Mar '18
by Tony CHEMIT 09 Mar '18
09 Mar '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
fbdd9e09 by Tony CHEMIT at 2018-03-09T13:33:47Z
Marées sans logbooks : gestion de leurs échantillons - amélioration de l'interface uitlisation de configuration (See #116)
- - - - -
27 changed files:
- .gitlab-ci.yml
- pom.xml
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/InputSourceConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionITSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeAvdthTestSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeInputSourceActionTestSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/ImportInputSourceActionTestSupport.java
- t3-domain/src/main/java/fr/ird/t3/entities/data/TripType.java
- t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractOceanTopiaDao.java
- t3-domain/src/main/java/fr/ird/t3/io/input/T3InputConfiguration.java
- − t3-input-avdthv33/.mvn/load-test-data
- t3-input-avdthv33/pom.xml
- − t3-input-avdthv33/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionIT.java
- − t3-input-avdthv33/src/test/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionIT.java
- − t3-input-avdthv33/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV33Test.java
- t3-web/src/main/java/fr/ird/t3/web/actions/io/input/AnalyzeImportDataAction.java
- t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ConfigureImportDataAction.java
- t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ImportDataAction.java
- t3-web/src/main/resources/i18n/t3-web_en_GB.properties
- t3-web/src/main/resources/i18n/t3-web_fr_FR.properties
- t3-web/src/main/webapp/WEB-INF/jsp/io/input/analyzeImportDataResult.jsp
- t3-web/src/main/webapp/WEB-INF/jsp/io/input/configureImportData.jsp
- t3-web/src/main/webapp/WEB-INF/jsp/io/input/importDataConfigResume.jsp
Changes:
=====================================
.gitlab-ci.yml
=====================================
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -28,13 +28,13 @@ image: registry.gitlab.com/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/docker:lat
environment:
name: test
script:
- - if [ -n "${BUILD_FOR_RELEASE}" ]; then ultreiaio-maven-execute 'clean verify -U -DperformRelease -Dmaven.source.skip -Dmaven.javadoc.skip'; fi
+ - if [ -n "${BUILD_FOR_RELEASE}" ]; then ultreiaio-maven-execute 'clean verify -U -DperformRelease -Psnapshot'; fi
.deploy-snapshot: &deploy-snapshot
environment:
name: snapshot
script:
- - if [ -n "${DEPLOY_SNAPSHOT}" ]; then ultreiaio-maven-execute 'clean deploy -am -pl t3-domain -DperformRelease -Dmaven.source.skip -Dmaven.javadoc.skip'; fi
+ - if [ -n "${DEPLOY_SNAPSHOT}" ]; then ultreiaio-maven-execute 'clean deploy -am -pl t3-domain -DperformRelease -Psnapshot'; fi
.publish-site: &publish-site
environment:
=====================================
pom.xml
=====================================
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>io.ultreia.maven</groupId>
<artifactId>pom</artifactId>
- <version>2018.21</version>
+ <version>2018.22</version>
</parent>
<groupId>fr.ird.t3</groupId>
@@ -145,14 +145,6 @@
<dependencies>
<dependency>
- <groupId>com.healthmarketscience.jackcess</groupId>
- <artifactId>jackcess</artifactId>
- <version>1.2.0</version>
- </dependency>
-
- <!-- Struts 2 -->
-
- <dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts2Version}</version>
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceConfiguration.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceConfiguration.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceConfiguration.java
@@ -8,12 +8,12 @@
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -43,22 +43,42 @@ public class AnalyzeInputSourceConfiguration implements InputSourceConfiguration
protected boolean createVirtualVessel;
protected T3InputProvider inputProvider;
protected File inputFile;
+ /**
+ * Flag to load only samples only trips
+ *
+ * @see TripType#SAMPLEONLY
+ */
+ private boolean useSamplesOnly;
+ /**
+ * Flag to authorize virtual activity creation (when logbooks are missing).
+ * <p>
+ * By default, let's always authorize it.
+ * <p>
+ * <b>Note:</b> This option is always at false if {@link #useSamplesOnly} is on.
+ *
+ * @see TripType#LOGBOOKMISSING
+ * @see TripType#STANDARD
+ */
+ private boolean canCreateVirtualActivity;
private TripType tripType;
public static AnalyzeInputSourceConfiguration newConfiguration(
T3InputProvider inputProvider,
File inputFile,
boolean useWells,
- TripType tripType,
boolean canCreateVessel,
- boolean createVirtualVessel) {
+ boolean createVirtualVessel,
+ boolean useSamplesOnly,
+ boolean canCreateVirtualActivity) {
AnalyzeInputSourceConfiguration result = new AnalyzeInputSourceConfiguration();
result.setInputFile(inputFile);
result.setInputProvider(inputProvider);
result.setUseWells(useWells);
- result.setTripType(tripType);
+ result.setTripType(TripType.getTripType(useSamplesOnly, canCreateVirtualActivity));
result.setCanCreateVessel(canCreateVessel);
result.setCreateVirtualVessel(createVirtualVessel);
+ result.setCanCreateVirtualActivity(canCreateVirtualActivity);
+ result.setUseSamplesOnly(useSamplesOnly);
return result;
}
@@ -127,12 +147,34 @@ public class AnalyzeInputSourceConfiguration implements InputSourceConfiguration
return l(locale, "t3.input.AnalyzeInputSource");
}
+ @Override
+ public boolean isUseSamplesOnly() {
+ return useSamplesOnly;
+ }
+
+ @Override
+ public void setUseSamplesOnly(boolean useSamplesOnly) {
+ this.useSamplesOnly = useSamplesOnly;
+ }
+
+ @Override
+ public boolean isCanCreateVirtualActivity() {
+ return canCreateVirtualActivity;
+ }
+
+ @Override
+ public void setCanCreateVirtualActivity(boolean canCreateVirtualActivity) {
+ this.canCreateVirtualActivity = canCreateVirtualActivity;
+ }
+
T3InputConfiguration toInputConfiguration() {
T3InputConfiguration result = new T3InputConfiguration();
result.setCanCreateVessel(canCreateVessel);
result.setCreateVirtualVessel(createVirtualVessel);
result.setTripType(tripType);
result.setUseWells(useWells);
+ result.setCanCreateVirtualActivity(canCreateVirtualActivity);
+ result.setUseSamplesOnly(useSamplesOnly);
result.setInputFile(inputFile);
return result;
}
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceAction.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceAction.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceAction.java
@@ -25,7 +25,6 @@ import fr.ird.t3.entities.T3EntityEnum;
import fr.ird.t3.entities.T3TopiaApplicationContext;
import fr.ird.t3.entities.T3TopiaPersistenceContext;
import fr.ird.t3.entities.data.Activity;
-import fr.ird.t3.entities.data.ActivityTopiaDao;
import fr.ird.t3.entities.data.T3DataEntity;
import fr.ird.t3.entities.data.Trip;
import fr.ird.t3.entities.data.TripTopiaDao;
@@ -60,15 +59,11 @@ import static org.nuiton.i18n.I18n.l;
*/
public class ImportInputSourceAction extends T3Action<ImportInputSourceConfiguration> {
- // public static final String PARAM_TRIPS_TO_IMPORT = "tripsToImport";
-// public static final String PARAM_TRIPS_TO_DELETE = "tripsToDelete";
private static final Log log = LogFactory.getLog(ImportInputSourceAction.class);
@InjectDAO(entityType = Trip.class)
private TripTopiaDao tripDAO;
@InjectDAO(entityType = Vessel.class)
private VesselTopiaDao vesselDAO;
- @InjectDAO(entityType = Activity.class)
- private ActivityTopiaDao activityDAO;
@InjectDAO(entityType = Ocean.class)
private OceanTopiaDao oceanDAO;
private Set<Trip> tripToDelete;
@@ -88,13 +83,10 @@ public class ImportInputSourceAction extends T3Action<ImportInputSourceConfigura
@Override
protected boolean executeAction() {
-
if (CollectionUtils.isEmpty(trips)) {
- // no trips at all to import
- // no commit to do, skip the action
+ // no trips at all to import, no commit to do, skip the action
return false;
}
-
int nbSteps = 0;
if (CollectionUtils.isNotEmpty(trips)) {
nbSteps += trips.size();
@@ -102,7 +94,6 @@ public class ImportInputSourceAction extends T3Action<ImportInputSourceConfigura
if (CollectionUtils.isNotEmpty(tripToDelete)) {
nbSteps += tripToDelete.size();
}
-
setNbSteps(nbSteps);
log.info(String.format("Nb steps : %d", getNbSteps()));
if (CollectionUtils.isNotEmpty(tripToDelete)) {
@@ -154,8 +145,6 @@ public class ImportInputSourceAction extends T3Action<ImportInputSourceConfigura
// Need to flush as we are going to query new data
getT3TopiaPersistenceContext().get().getHibernateSupport().getHibernateSession().flush();
-
- String prefix = Activity.class.getName() + "#";
for (Activity activity : ids) {
Ocean ocean = oceanDAO.findOceanByActivity(activity);
activity.setOcean(ocean);
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceConfiguration.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceConfiguration.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceConfiguration.java
@@ -8,12 +8,12 @@
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -45,6 +45,23 @@ public class ImportInputSourceConfiguration implements InputSourceConfiguration
protected boolean createVirtualVessel;
protected T3InputProvider inputProvider;
protected File inputFile;
+ /**
+ * Flag to load only samples only trips
+ *
+ * @see TripType#SAMPLEONLY
+ */
+ private boolean useSamplesOnly;
+ /**
+ * Flag to authorize virtual activity creation (when logbooks are missing).
+ * <p>
+ * By default, let's always authorize it.
+ * <p>
+ * <b>Note:</b> This option is always at false if {@link #useSamplesOnly} is on.
+ *
+ * @see TripType#LOGBOOKMISSING
+ * @see TripType#STANDARD
+ */
+ private boolean canCreateVirtualActivity;
private Set<Trip> tripsToImport;
private Set<Trip> tripsToDelete;
@@ -124,6 +141,27 @@ public class ImportInputSourceConfiguration implements InputSourceConfiguration
return l(locale, "t3.input.ImportInputSource");
}
+
+ @Override
+ public boolean isUseSamplesOnly() {
+ return useSamplesOnly;
+ }
+
+ @Override
+ public void setUseSamplesOnly(boolean useSamplesOnly) {
+ this.useSamplesOnly = useSamplesOnly;
+ }
+
+ @Override
+ public boolean isCanCreateVirtualActivity() {
+ return canCreateVirtualActivity;
+ }
+
+ @Override
+ public void setCanCreateVirtualActivity(boolean canCreateVirtualActivity) {
+ this.canCreateVirtualActivity = canCreateVirtualActivity;
+ }
+
public Set<Trip> getTripsToImport() {
return tripsToImport;
}
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/InputSourceConfiguration.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/InputSourceConfiguration.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/InputSourceConfiguration.java
@@ -50,6 +50,14 @@ public interface InputSourceConfiguration extends T3ActionConfiguration {
void setCreateVirtualVessel(boolean createVirtualVessel);
+ boolean isUseSamplesOnly();
+
+ void setUseSamplesOnly(boolean useSamplesOnly);
+
+ boolean isCanCreateVirtualActivity();
+
+ void setCanCreateVirtualActivity(boolean canCreateVirtualActivity);
+
T3InputProvider getInputProvider();
void setInputProvider(T3InputProvider inputProvider);
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
@@ -94,7 +94,7 @@ public abstract class AnalyzeInputSourceActionITSupport {
if (doIt) {
String dbName = msConfig.dbName;
log.debug("Do test for db " + dbName);
- outputFile = new File(serviceContext.getTestDir().getParentFile().getParentFile(), dbName.replace(".mdb","-result.txt"));
+ outputFile = new File(serviceContext.getTestDir().getParentFile().getParentFile(), dbName.replace(".mdb", "-result.txt"));
log.info("Will save result in file : " + outputFile);
outputWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile)));
File workingDirectory = serviceContext.getApplicationConfiguration().getTreatmentWorkingDirectory("yo", true);
@@ -116,12 +116,14 @@ public abstract class AnalyzeInputSourceActionITSupport {
log.info(new String(Files.readAllBytes(outputFile.toPath())));
}
}
+
void testExecute(OceanFixtures fixture) throws Exception {
testExecute(fixture, TripType.STANDARD);
}
+
void testExecute(OceanFixtures fixture, TripType tripType) throws Exception {
serviceContext.getMsConfig().setUseWells(false);
- testExecute(fixture.nbSafe(), fixture.nbUnsafe(), fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), tripType, false, false);
+ testExecute(fixture.nbSafe(), fixture.nbUnsafe(), fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), tripType);
// serviceContext.getMsConfig().setUseWells(true);
// testExecute(fixture.nbSafe(), fixture.nbUnsafe(), fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), TripType.STANDARD, false, false);
}
@@ -136,9 +138,7 @@ public abstract class AnalyzeInputSourceActionITSupport {
nbUnsafe,
nbSafeWithoutWell,
nbUnsafeWithoutWell,
- TripType.STANDARD,
- false,
- false
+ TripType.STANDARD
);
}
@@ -146,14 +146,18 @@ public abstract class AnalyzeInputSourceActionITSupport {
int nbUnsafe,
int nbSafeWithoutWell,
int nbUnsafeWithoutWell,
- TripType tripType,
- boolean canCreateVessel,
- boolean createVirtualVessel) throws Exception {
+ TripType tripType) throws Exception {
MSAccessTestConfiguration msConfig = serviceContext.getMsConfig();
if (msConfig.doTest(serviceContext.getTestName())) {
T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
AnalyzeInputSourceConfiguration actionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
- inputProvider, target, true, tripType, canCreateVessel, createVirtualVessel);
+ inputProvider,
+ target,
+ msConfig.isUseWells(),
+ false,
+ false,
+ tripType != null && tripType == TripType.SAMPLEONLY,
+ tripType == null || tripType == TripType.LOGBOOKMISSING);
T3ActionContext<AnalyzeInputSourceConfiguration> context = serviceFactory.newT3ActionContext(actionConfiguration, serviceContext);
outputWriter.write("----------------------------------------------------\n");
outputWriter.write(msConfig.accessFile + "\n");
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionITSupport.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionITSupport.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionITSupport.java
@@ -8,12 +8,12 @@
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -89,22 +89,25 @@ public abstract class ImportInputSourceActionITSupport {
}
public void testExecute(OceanFixtures fixtures) throws Exception {
- testExecute(fixtures.nbSafeWithoutWell(), fixtures.nbUnsafeWithoutWell(), TripType.STANDARD, false, false);
+ testExecute(fixtures.nbSafeWithoutWell(), fixtures.nbUnsafeWithoutWell(), TripType.STANDARD);
}
public void testExecute(int nbSafe, int nbUnsafe) throws Exception {
- testExecute(nbSafe, nbUnsafe, TripType.STANDARD, false, false);
+ testExecute(nbSafe, nbUnsafe, TripType.STANDARD);
}
public void testExecute(int nbSafe, int nbUnsafe,
- TripType tripType,
- boolean canCreateVessel,
- boolean createVirtualVessel) throws Exception {
+ TripType tripType) throws Exception {
MSAccessTestConfiguration msConfig = serviceContext.getMsConfig();
if (msConfig.doTest(serviceContext.getTestName())) {
AnalyzeInputSourceConfiguration analyzeActionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
- inputProvider, target, true, tripType, canCreateVessel, createVirtualVessel);
-
+ inputProvider,
+ target,
+ msConfig.isUseWells(),
+ false,
+ false,
+ tripType != null && tripType == TripType.SAMPLEONLY,
+ tripType == null || tripType == TripType.LOGBOOKMISSING);
T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
T3ActionContext<AnalyzeInputSourceConfiguration> analyzeContext = serviceFactory.newT3ActionContext(analyzeActionConfiguration, serviceContext);
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeAvdthTestSupport.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeAvdthTestSupport.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeAvdthTestSupport.java
@@ -119,7 +119,13 @@ public abstract class AnalyzeAvdthTestSupport {
T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
AnalyzeInputSourceConfiguration actionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
- getInputProvider(), getTarget(), useWells, tripType, false, false);
+ inputProvider,
+ target,
+ msConfig.isUseWells(),
+ false,
+ false,
+ tripType == TripType.SAMPLEONLY,
+ tripType == TripType.LOGBOOKMISSING);
T3ActionContext<AnalyzeInputSourceConfiguration> context = serviceFactory.newT3ActionContext(actionConfiguration, serviceContext);
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeInputSourceActionTestSupport.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeInputSourceActionTestSupport.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeInputSourceActionTestSupport.java
@@ -100,9 +100,7 @@ public abstract class AnalyzeInputSourceActionTestSupport {
fixture.nbUnsafe(),
fixture.nbSafeWithoutWell(),
fixture.nbUnsafeWithoutWell(),
- tripType,
- false,
- false);
+ tripType);
}
public FakeT3AvdthServiceContext getServiceContext() {
@@ -129,16 +127,20 @@ public abstract class AnalyzeInputSourceActionTestSupport {
int nbUnsafe,
int nbSafeWithoutWell,
int nbUnsafeWithoutWell,
- TripType tripType,
- boolean canCreateVessel,
- boolean createVirtualVessel) throws Exception {
+ TripType tripType) throws Exception {
MSAccessTestConfiguration msConfig = getMsConfig();
FakeT3AvdthServiceContext serviceContext = getServiceContext();
if (msConfig.doTest(serviceContext.getTestName())) {
T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
AnalyzeInputSourceConfiguration actionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
- getInputProvider(), getTarget(), true, tripType, canCreateVessel, createVirtualVessel);
+ inputProvider,
+ target,
+ msConfig.isUseWells(),
+ false,
+ false,
+ tripType != null && tripType == TripType.SAMPLEONLY,
+ tripType == null || tripType == TripType.LOGBOOKMISSING);
T3ActionContext<AnalyzeInputSourceConfiguration> context = serviceFactory.newT3ActionContext(actionConfiguration, serviceContext);
BufferedWriter outputWriter = getOutputWriter();
@@ -184,55 +186,4 @@ public abstract class AnalyzeInputSourceActionTestSupport {
}
}
- protected void testExecute2(OceanFixtures fixture, TripType tripType) throws Exception {
-
- MSAccessTestConfiguration msConfig = getMsConfig();
- boolean useWells = msConfig.isUseWells();
- int nbSafe = fixture.nbSafe(useWells);
- int nbUnsafe = fixture.nbUnsafe(useWells);
-
- FakeT3AvdthServiceContext serviceContext = getServiceContext();
-
- T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
- AnalyzeInputSourceConfiguration actionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
- getInputProvider(), getTarget(), useWells, tripType, false, false);
-
- T3ActionContext<AnalyzeInputSourceConfiguration> context = serviceFactory.newT3ActionContext(actionConfiguration, serviceContext);
-
- BufferedWriter outputWriter = getOutputWriter();
- outputWriter.write("----------------------------------------------------\n");
- outputWriter.write(msConfig.getAccessFile() + "\n");
- T3Action<AnalyzeInputSourceConfiguration> action;
-
- action = serviceFactory.newT3Action(AnalyzeInputSourceAction.class, context);
- Assert.assertNotNull(action);
- action.run();
-
- Set<Trip> safeTrips = action.getResultAsSet(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, Trip.class);
- Assert.assertNotNull(safeTrips);
- outputWriter.write(String.format("found %d safe trip(s).\n", safeTrips.size()));
- Set<Trip> unsafeTrips = action.getResultAsSet(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, Trip.class);
- Assert.assertNotNull(unsafeTrips);
- outputWriter.write(String.format("found %d unsafe trip(s).\n", unsafeTrips.size()));
- List<String> messages;
- if (msConfig.isLogWarnings() && log.isWarnEnabled()) {
- messages = action.getWarnMessages();
- if (CollectionUtils.isNotEmpty(messages)) {
- for (String message : messages) {
- outputWriter.write(String.format("[WARNING] %s\n", message));
- }
- }
- }
- if (log.isErrorEnabled()) {
- messages = action.getErrorMessages();
- if (CollectionUtils.isNotEmpty(messages)) {
- for (String message : messages) {
- outputWriter.write(String.format("[ERROR] %s\n", message));
- }
- }
- }
- log.info(String.format("\n[%s] (useWells?%b) safe : %d - unsafe : %d\n", msConfig.getDbName(), useWells, safeTrips.size(), unsafeTrips.size()));
- Assert.assertEquals(nbSafe, safeTrips.size());
- Assert.assertEquals(nbUnsafe, unsafeTrips.size());
- }
}
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/ImportInputSourceActionTestSupport.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/ImportInputSourceActionTestSupport.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/ImportInputSourceActionTestSupport.java
@@ -85,18 +85,21 @@ public abstract class ImportInputSourceActionTestSupport {
}
protected void testExecute(OceanFixtures fixture, TripType tripType) throws Exception {
- testExecute(fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), tripType, false, false);
+ testExecute(fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), tripType);
}
- public void testExecute(int nbSafe, int nbUnsafe,
- TripType tripType,
- boolean canCreateVessel,
- boolean createVirtualVessel) throws Exception {
+ public void testExecute(int nbSafe, int nbUnsafe, TripType tripType) throws Exception {
MSAccessTestConfiguration msConfig = serviceContext.getMsConfig();
if (msConfig.doTest(serviceContext.getTestName())) {
AnalyzeInputSourceConfiguration analyzeActionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
- inputProvider, target, true, tripType, canCreateVessel, createVirtualVessel);
+ inputProvider,
+ target,
+ msConfig.isUseWells(),
+ false,
+ false,
+ tripType != null && tripType == TripType.SAMPLEONLY,
+ tripType == null || tripType == TripType.LOGBOOKMISSING);
T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
T3ActionContext<AnalyzeInputSourceConfiguration> analyzeContext =
serviceFactory.newT3ActionContext(analyzeActionConfiguration, serviceContext);
=====================================
t3-domain/src/main/java/fr/ird/t3/entities/data/TripType.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/entities/data/TripType.java
+++ b/t3-domain/src/main/java/fr/ird/t3/entities/data/TripType.java
@@ -10,12 +10,12 @@ package fr.ird.t3.entities.data;
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -23,13 +23,21 @@ package fr.ird.t3.entities.data;
import fr.ird.t3.t3.domain.I18nEnumHelper;
-import static org.nuiton.i18n.I18n.t;
-
public enum TripType {
STANDARD,
SAMPLEONLY,
LOGBOOKMISSING;
+ public static TripType getTripType(boolean useSamplesOnly, boolean canCreateVirtualActivity) {
+ TripType tripType;
+ if (useSamplesOnly) {
+ tripType = SAMPLEONLY;
+ } else {
+ tripType = canCreateVirtualActivity ? LOGBOOKMISSING : STANDARD;
+ }
+ return tripType;
+ }
+
public String getLabel() {
return I18nEnumHelper.getLabel(this);
}
=====================================
t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractOceanTopiaDao.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractOceanTopiaDao.java
+++ b/t3-domain/src/main/java/fr/ird/t3/entities/reference/AbstractOceanTopiaDao.java
@@ -59,16 +59,16 @@ public class AbstractOceanTopiaDao<E extends Ocean> extends GeneratedOceanTopiaD
}
public E findOceanByActivity(Activity activity) {
- GetOceanIdByActivityCoordinateQuery query = new GetOceanIdByActivityCoordinateQuery(activity.getTopiaId());
+ GetOceanIdByCoordinateQuery query = new GetOceanIdByCoordinateQuery(activity.getTopiaId());
String oceanId = topiaSqlSupport.findSingleResult(query);
return forTopiaIdEquals(oceanId).findUnique();
}
- private static class GetOceanIdByActivityCoordinateQuery extends TopiaSqlQuery<String> {
+ private static class GetOceanIdByCoordinateQuery extends TopiaSqlQuery<String> {
private final String activity;
- GetOceanIdByActivityCoordinateQuery(String activity) {
+ GetOceanIdByCoordinateQuery(String activity) {
this.activity = activity;
}
=====================================
t3-domain/src/main/java/fr/ird/t3/io/input/T3InputConfiguration.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/io/input/T3InputConfiguration.java
+++ b/t3-domain/src/main/java/fr/ird/t3/io/input/T3InputConfiguration.java
@@ -8,12 +8,12 @@
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -33,15 +33,13 @@ import java.io.File;
*/
public class T3InputConfiguration {
- protected boolean useWells;
-
- protected boolean canCreateVessel;
-
- protected boolean createVirtualVessel;
-
- protected TripType tripType;
-
- protected File inputFile;
+ private boolean useWells;
+ private boolean canCreateVessel;
+ private boolean createVirtualVessel;
+ private boolean useSamplesOnly;
+ private boolean canCreateVirtualActivity;
+ private TripType tripType;
+ private File inputFile;
private T3TopiaApplicationContext topiaApplicationContext;
@@ -85,6 +83,22 @@ public class T3InputConfiguration {
this.inputFile = inputFile;
}
+ public boolean isUseSamplesOnly() {
+ return useSamplesOnly;
+ }
+
+ public void setUseSamplesOnly(boolean useSamplesOnly) {
+ this.useSamplesOnly = useSamplesOnly;
+ }
+
+ public boolean isCanCreateVirtualActivity() {
+ return canCreateVirtualActivity;
+ }
+
+ public void setCanCreateVirtualActivity(boolean canCreateVirtualActivity) {
+ this.canCreateVirtualActivity = canCreateVirtualActivity;
+ }
+
public T3TopiaApplicationContext getTopiaApplicationContext() {
return topiaApplicationContext;
}
=====================================
t3-input-avdthv33/.mvn/load-test-data deleted
=====================================
--- a/t3-input-avdthv33/.mvn/load-test-data
+++ /dev/null
=====================================
t3-input-avdthv33/pom.xml
=====================================
--- a/t3-input-avdthv33/pom.xml
+++ b/t3-input-avdthv33/pom.xml
@@ -18,7 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses />.
#L%
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -47,11 +48,6 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>t3-actions</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
<artifactId>t3-msaccess-importer</artifactId>
<version>${project.version}</version>
</dependency>
@@ -68,14 +64,6 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
<dependency>
<groupId>com.google.guava</groupId>
@@ -128,65 +116,7 @@
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
-
+
</dependencies>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <environmentVariables>
- <doAccessImport>${doAccessImport}</doAccessImport>
- <executeAll>${executeAll}</executeAll>
- <lastYear>${lastYear}</lastYear>
- <exactYear>${exactYear}</exactYear>
- <!--<jvm>-Xmx2048m</jvm>-->
- </environmentVariables>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <profiles>
-
- <profile>
- <id>run-access-its</id>
- <activation>
- <property>
- <name>performRelease</name>
- <value>true</value>
- </property>
- </activation>
- <build>
-
- <defaultGoal>integration-test</defaultGoal>
- <plugins>
-
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
-
- <execution>
- <id>all-integration-tests</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>${skipITs}</skip>
- <includes>
- <include>**/*IT.java</include>
- </includes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- </profiles>
</project>
=====================================
t3-input-avdthv33/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionIT.java deleted
=====================================
--- a/t3-input-avdthv33/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionIT.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- * #%L
- * T3 :: Input AVDTH v 33
- * %%
- * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ird.t3.actions.io.input.it;
-
-import fr.ird.t3.actions.T3Action;
-import fr.ird.t3.actions.T3ActionContext;
-import fr.ird.t3.actions.io.input.AnalyzeInputSourceAction;
-import fr.ird.t3.actions.io.input.AnalyzeInputSourceConfiguration;
-import fr.ird.t3.actions.io.input.test.FakeT3AvdthServiceContext;
-import fr.ird.t3.actions.io.input.test.MSAccessTestConfiguration;
-import fr.ird.t3.entities.data.Trip;
-import fr.ird.t3.entities.data.TripType;
-import fr.ird.t3.io.input.T3InputProvider;
-import fr.ird.t3.io.input.avdth.v33.T3InputProviderAvdth33;
-import fr.ird.t3.services.T3InputService;
-import fr.ird.t3.services.T3ServiceFactory;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Tests the action {@link AnalyzeInputSourceAction}.
- *
- * @author Tony Chemit - dev(a)tchemit.fr
- * @since 1.0
- */
-public class AnalyzeInputSourceActionIT implements T3AVDTHV33Test {
-
- /** Logger */
- private static final Log log = LogFactory.getLog(AnalyzeInputSourceActionIT.class);
- protected static boolean useWells;
- protected BufferedWriter outputWriter;
- private final MSAccessTestConfiguration msConfig = new MSAccessTestConfiguration("testExecute_([^_]*)_(.*)", "%s_%s_V33.mdb", T3InputProviderAvdth33.ID);
- @Rule
- public final FakeT3AvdthServiceContext serviceContext = new FakeT3AvdthServiceContext(true, msConfig);
- private File target;
-
- private T3InputProvider inputProvider;
-
- @Before
- public void setUp() throws Exception {
-
- boolean initOk = serviceContext.isInitOk();
- Assume.assumeTrue("Could not init db", initOk);
-
- boolean doIt = msConfig.setup(serviceContext.getTestName());
-
- if (doIt) {
-
- String dbName = msConfig.dbName;
-
- if (log.isDebugEnabled()) {
- log.debug("Do test for db " + dbName);
- }
-
- File outputFile = new File(serviceContext.getTestDir(), "result.txt");
-
- if (log.isInfoEnabled()) {
- log.info("Will save result in file : " + outputFile);
- }
-
- outputWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile)));
-
- File workingDirectory =
- serviceContext.getApplicationConfiguration().getTreatmentWorkingDirectory("yo", true);
-
- // push in treatment directory the base to import
-
- target = new File(workingDirectory, dbName);
- if (log.isDebugEnabled()) {
- log.debug("Will copy msaccess from " + msConfig.accessFile + " to " + target);
- }
- FileUtils.copyFile(msConfig.accessFile, target);
-
- inputProvider = serviceContext.newService(T3InputService.class).getProvider(T3InputProviderAvdth33.ID);
- }
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- serviceContext.close();
-
- if (outputWriter != null) {
-
- outputWriter.flush();
- outputWriter.close();
-
- }
- }
-
- public void testExecute(int nbSafe,
- int nbUnsafe,
- int nbSafeWithoutWell,
- int nbUnsafeWithoutWell) throws Exception {
- testExecute(
- nbSafe,
- nbUnsafe,
- nbSafeWithoutWell,
- nbUnsafeWithoutWell,
- TripType.STANDARD,
- false,
- false
- );
- }
-
- public void testExecute(int nbSafe,
- int nbUnsafe,
- int nbSafeWithoutWell,
- int nbUnsafeWithoutWell,
- TripType tripType,
- boolean canCreateVessel,
- boolean createVirtualVessel) throws Exception {
-
- if (msConfig.doTest(serviceContext.getTestName())) {
-
- T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
-
- AnalyzeInputSourceConfiguration actionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
- inputProvider, target, useWells, tripType, canCreateVessel, createVirtualVessel
- );
- T3ActionContext<AnalyzeInputSourceConfiguration> context =
- serviceFactory.newT3ActionContext(actionConfiguration, serviceContext);
-
-
- outputWriter.write("----------------------------------------------------\n");
- outputWriter.write(msConfig.accessFile + "\n");
- T3Action<AnalyzeInputSourceConfiguration> action;
-
- action = serviceFactory.newT3Action(AnalyzeInputSourceAction.class, context);
-
- Assert.assertNotNull(action);
-
- action.run();
-
- Set<Trip> safeTrips = action.getResultAsSet(
- AnalyzeInputSourceAction.RESULT_SAFE_TRIPS,
- Trip.class
- );
- Assert.assertNotNull(safeTrips);
- outputWriter.write("found " + safeTrips.size() + " safe trip(s).\n");
- Set<Trip> unsafeTrips = action.getResultAsSet(
- AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS,
- Trip.class
- );
- Assert.assertNotNull(unsafeTrips);
- outputWriter.write("found " + unsafeTrips.size() + " unsafe trip(s).\n");
- List<String> messages;
-
- if (log.isWarnEnabled()) {
- messages = action.getWarnMessages();
- if (CollectionUtils.isNotEmpty(messages)) {
- for (String message : messages) {
- outputWriter.write("[WARNING] " + message + "\n");
- }
- }
- }
-
- if (log.isErrorEnabled()) {
- messages = action.getErrorMessages();
- if (CollectionUtils.isNotEmpty(messages)) {
- for (String message : messages) {
- outputWriter.write("[ERROR] " + message + "\n");
- }
- }
- }
-
- if (log.isInfoEnabled()) {
- log.info("\n[" + msConfig.dbName + "] safe : " + safeTrips.size() +
- " - unsafe : " + unsafeTrips.size() + "\n");
- }
-
- if (useWells) {
- Assert.assertEquals(nbSafe, safeTrips.size());
- Assert.assertEquals(nbUnsafe, unsafeTrips.size());
- } else {
- Assert.assertEquals(nbSafeWithoutWell, safeTrips.size());
- Assert.assertEquals(nbUnsafeWithoutWell, unsafeTrips.size());
- }
-
- }
-
-
- }
-
- public void testExecute(int nbSafe, int nbUnsafe) throws Exception {
- testExecute(nbSafe, nbUnsafe, nbSafe, nbUnsafe);
- }
-
- @Test
- @Override
- public void testExecute_OI_2000() throws Exception {
- testExecute(155, 65, 220, 0);
- }
-
- @Test
- @Override
- public void testExecute_OI_2001() throws Exception {
- testExecute(70, 118, 188, 0);
- }
-
- @Test
- @Override
- public void testExecute_OI_2002() throws Exception {
- testExecute(103, 125, 227, 1);
- }
-
- @Test
- @Override
- public void testExecute_OI_2003() throws Exception {
- testExecute(83, 136, 219, 0);
- }
-
- @Test
- @Override
- public void testExecute_OI_2004() throws Exception {
- testExecute(78, 118, 196, 0);
- }
-
- @Test
- @Override
- public void testExecute_OI_2005() throws Exception {
- testExecute(78, 110, 186, 2);
- }
-
- @Test
- @Override
- public void testExecute_OI_2006() throws Exception {
- testExecute(181, 12, 188, 5);
- }
-
- @Test
- @Override
- public void testExecute_OI_2007() throws Exception {
- testExecute(155, 12, 162, 5);
- }
-
- @Test
- @Override
- public void testExecute_OI_2008() throws Exception {
- testExecute(146, 34, 174, 6);
- }
-
- @Test
- @Override
- public void testExecute_OI_2009() throws Exception {
- testExecute(122, 19, 141, 0);
- }
-
- @Test
- @Override
- public void testExecute_OI_2011() throws Exception {
- testExecute(141, 0, 126, 0);
- }
-
- @Test
- @Override
- public void testExecute_ATL_2000() throws Exception {
- testExecute(318, 36, 354, 0);
- }
-
- @Test
- @Override
- public void testExecute_ATL_2001() throws Exception {
- testExecute(298, 63, 361, 0);
- }
-
- @Test
- @Override
- public void testExecute_ATL_2002() throws Exception {
- testExecute(184, 133, 317, 0);
- }
-
- @Test
- @Override
- public void testExecute_ATL_2003() throws Exception {
- testExecute(218, 157, 375, 0);
- }
-
- @Test
- @Override
- public void testExecute_ATL_2004() throws Exception {
- testExecute(121, 61, 182, 0);
- }
-
- @Test
- @Override
- public void testExecute_ATL_2005() throws Exception {
- testExecute(93, 31, 124, 0);
- }
-
- @Test
- @Override
- public void testExecute_ATL_2006() throws Exception {
- testExecute(70, 27, 97, 0);
- }
-
- @Test
- @Override
- public void testExecute_ATL_2007() throws Exception {
- testExecute(53, 27, 80, 0);
- }
-
- @Test
- @Override
- public void testExecute_ATL_2008() throws Exception {
- testExecute(46, 14, 60, 0);
- }
-
- @Test
- @Override
- public void testExecute_ATL_2009() throws Exception {
- testExecute(64, 21, 85, 0);
- }
-
- @Test
- @Override
- public void testExecute_ATL_2010() throws Exception {
- testExecute(75, 13, 80, 8);
- }
-
- @Test
- @Override
- public void testExecute_ESATL_2006() throws Exception {
- testExecute(70, 27, 97, 0, TripType.SAMPLEONLY, true, true);
- }
-
- @Test
- @Override
- public void testExecute_ESATL_2007() throws Exception {
- testExecute(273, 27, 238, 0, TripType.SAMPLEONLY, true, true);
- }
-
- @Test
- @Override
- public void testExecute_ESATL_2008() throws Exception {
- testExecute(46, 14, 60, 0, TripType.SAMPLEONLY, true, true);
- }
-
- @Test
- @Override
- public void testExecute_ESATL_2009() throws Exception {
- testExecute(64, 21, 85, 0, TripType.SAMPLEONLY, true, true);
- }
-
- @Test
- @Override
- public void testExecute_ESATL_2010() throws Exception {
- testExecute(75, 13, 80, 8, TripType.SAMPLEONLY, true, true);
- }
-}
=====================================
t3-input-avdthv33/src/test/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionIT.java deleted
=====================================
--- a/t3-input-avdthv33/src/test/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionIT.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * #%L
- * T3 :: Input AVDTH v 33
- * %%
- * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ird.t3.actions.io.input.it;
-
-import fr.ird.t3.actions.T3ActionContext;
-import fr.ird.t3.actions.io.input.AnalyzeInputSourceAction;
-import fr.ird.t3.actions.io.input.AnalyzeInputSourceConfiguration;
-import fr.ird.t3.actions.io.input.ImportInputSourceAction;
-import fr.ird.t3.actions.io.input.ImportInputSourceConfiguration;
-import fr.ird.t3.actions.io.input.test.FakeT3AvdthServiceContext;
-import fr.ird.t3.actions.io.input.test.MSAccessTestConfiguration;
-import fr.ird.t3.entities.data.Trip;
-import fr.ird.t3.entities.data.TripType;
-import fr.ird.t3.io.input.T3InputProvider;
-import fr.ird.t3.io.input.avdth.v33.T3InputProviderAvdth33;
-import fr.ird.t3.services.T3InputService;
-import fr.ird.t3.services.T3ServiceFactory;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.io.File;
-import java.util.Set;
-
-/**
- * Tests the action {@link AnalyzeInputSourceAction}.
- *
- * @author Tony Chemit - dev(a)tchemit.fr
- * @since 1.0
- */
-public class ImportInputSourceActionIT implements T3AVDTHV33Test {
-
- /** Logger */
- private static final Log log =
- LogFactory.getLog(ImportInputSourceActionIT.class);
-
- private static final MSAccessTestConfiguration msConfig = new MSAccessTestConfiguration("testExecute_([^_]*)_(.*)", "%s_%s_V33.mdb", T3InputProviderAvdth33.ID);
-
- @Rule
- public final FakeT3AvdthServiceContext serviceContext = new FakeT3AvdthServiceContext(true, msConfig);
-
- private T3InputProvider inputProvider;
-
- private File target;
-
- @Before
- public void setUp() throws Exception {
-
- boolean initOk = serviceContext.isInitOk();
- Assume.assumeTrue("Could not init db", initOk);
-
- boolean doIt = msConfig.setup(serviceContext.getTestName());
- Assume.assumeTrue("Could not init msaccess configuration", doIt);
-
- String dbName = msConfig.dbName;
-
- if (log.isDebugEnabled()) {
- log.debug("Do test for db " + dbName);
- }
-
- File workingDirectory =
- serviceContext.getApplicationConfiguration().getTreatmentWorkingDirectory("yo", true);
-
- // push in treatment directory the base to import
-
- target = new File(workingDirectory, dbName);
- if (log.isDebugEnabled()) {
- log.debug("Will copy msaccess from " + msConfig.accessFile + " to " + target);
- }
- FileUtils.copyFile(msConfig.accessFile, target);
-
- inputProvider = serviceContext.newService(T3InputService.class).getProvider(msConfig.getProviderId());
-
- }
-
- @After
- public void tearDown() {
-
- serviceContext.close();
- }
-
- public void testExecute(int nbSafe, int nbUnsafe) throws Exception {
- testExecute(nbSafe, nbUnsafe, TripType.STANDARD, false, false);
- }
-
- public void testExecute(int nbSafe, int nbUnsafe,
- TripType tripType,
- boolean canCreateVessel,
- boolean createVirtualVessel) throws Exception {
-
- if (msConfig.doTest(serviceContext.getTestName())) {
-
- AnalyzeInputSourceConfiguration analyzeActionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
- inputProvider, target, true, tripType, canCreateVessel, createVirtualVessel
- );
-
- T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
-
- T3ActionContext<AnalyzeInputSourceConfiguration> analyzeContext =
- serviceFactory.newT3ActionContext(analyzeActionConfiguration, serviceContext);
-
- AnalyzeInputSourceAction analyzeAction;
-
- analyzeAction = serviceFactory.newT3Action(AnalyzeInputSourceAction.class, analyzeContext);
-
- Assert.assertNotNull(analyzeAction);
- analyzeAction.run();
-
- Set<Trip> safeTrips = analyzeAction.getResultAsSet(
- AnalyzeInputSourceAction.RESULT_SAFE_TRIPS,
- Trip.class
- );
- Assert.assertNotNull(safeTrips);
- Assert.assertEquals(nbSafe, safeTrips.size());
-
- Set<Trip> unsafeTrips = analyzeAction.getResultAsSet(
- AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS,
- Trip.class
- );
- Assert.assertNotNull(unsafeTrips);
- Assert.assertEquals(nbUnsafe, unsafeTrips.size());
-
- if (log.isInfoEnabled()) {
- log.info("[" + msConfig.dbName + "] safe : " + safeTrips.size() + " - unsafe : " + unsafeTrips.size());
- }
-
- ImportInputSourceConfiguration importActionConfiguration = ImportInputSourceConfiguration.newConfiguration(
- analyzeActionConfiguration
- );
- importActionConfiguration.setTripsToImport(safeTrips);
-
- T3ActionContext<ImportInputSourceConfiguration> importContext =
- serviceFactory.newT3ActionContext(importActionConfiguration, serviceContext);
-
- // input db is safe, import it in h2 db
-
- long oldNbTrips;
- long newNbTrips;
-
- importActionConfiguration.setTripsToImport(safeTrips);
-
- oldNbTrips = serviceContext.getT3TopiaPersistenceContext().get().getTripDao().count();
-
- ImportInputSourceAction importAction =
- serviceFactory.newT3Action(ImportInputSourceAction.class, importContext);
-
- importAction.run();
-
- newNbTrips = serviceContext.getT3TopiaPersistenceContext().get().getTripDao().count();
-
- Assert.assertEquals(oldNbTrips + safeTrips.size(), newNbTrips);
-
- }
-
-
- }
-
- @Override
- @Test
- public void testExecute_ATL_2000() throws Exception {
- testExecute(347, 7);
- }
-
- @Override
- @Test
- public void testExecute_ATL_2001() throws Exception {
- testExecute(351, 10);
- }
-
- @Override
- @Test
- public void testExecute_ATL_2002() throws Exception {
- testExecute(310, 7);
- }
-
- @Override
- @Test
- public void testExecute_ATL_2003() throws Exception {
- testExecute(373, 2);
- }
-
- @Override
- @Test
- public void testExecute_ATL_2004() throws Exception {
- testExecute(179, 3);
- }
-
- @Override
- @Test
- public void testExecute_ATL_2005() throws Exception {
- testExecute(123, 1);
- }
-
- @Override
- @Test
- public void testExecute_ATL_2006() throws Exception {
- testExecute(95, 2);
- }
-
- @Override
- @Test
- public void testExecute_ATL_2007() throws Exception {
- testExecute(80, 0);
- }
-
- @Override
- @Test
- public void testExecute_ATL_2008() throws Exception {
- testExecute(59, 1);
- }
-
- @Override
- @Test
- public void testExecute_ATL_2009() throws Exception {
- testExecute(81, 4);
- }
-
- @Override
- @Test
- public void testExecute_ATL_2010() throws Exception {
- testExecute(80, 8);
- }
-
- @Override
- @Test
- public void testExecute_OI_2000() throws Exception {
- testExecute(217, 3);
- }
-
- @Override
- @Test
- public void testExecute_OI_2001() throws Exception {
- testExecute(169, 19);
- }
-
- @Override
- @Test
- public void testExecute_OI_2002() throws Exception {
- testExecute(116, 112);
- }
-
- @Override
- @Test
- public void testExecute_OI_2003() throws Exception {
- testExecute(99, 120);
- }
-
- @Override
- @Test
- public void testExecute_OI_2004() throws Exception {
- testExecute(81, 115);
- }
-
- @Override
- @Test
- public void testExecute_OI_2005() throws Exception {
- testExecute(78, 110);
- }
-
- @Override
- @Test
- public void testExecute_OI_2006() throws Exception {
- testExecute(181, 12);
- }
-
- @Override
- @Test
- public void testExecute_OI_2007() throws Exception {
- testExecute(156, 11);
- }
-
- @Override
- @Test
- public void testExecute_OI_2008() throws Exception {
- testExecute(148, 32);
- }
-
- @Override
- @Test
- public void testExecute_OI_2009() throws Exception {
- testExecute(127, 14);
- }
-
- @Test
- @Override
- public void testExecute_OI_2011() throws Exception {
- testExecute(126, 0);
- }
-
- @Test
- @Override
- public void testExecute_ESATL_2006() throws Exception {
- testExecute(70, 27, TripType.SAMPLEONLY, true, true);
- }
-
- @Test
- @Override
- public void testExecute_ESATL_2007() throws Exception {
- testExecute(53, 27, TripType.SAMPLEONLY, true, true);
- }
-
- @Test
- @Override
- public void testExecute_ESATL_2008() throws Exception {
- testExecute(46, 14, TripType.SAMPLEONLY, true, true);
- }
-
- @Test
- @Override
- public void testExecute_ESATL_2009() throws Exception {
- testExecute(64, 21, TripType.SAMPLEONLY, true, true);
- }
-
- @Test
- @Override
- public void testExecute_ESATL_2010() throws Exception {
- testExecute(75, 13, TripType.SAMPLEONLY, true, true);
- }
-}
=====================================
t3-input-avdthv33/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV33Test.java deleted
=====================================
--- a/t3-input-avdthv33/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV33Test.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * #%L
- * T3 :: Input AVDTH v 33
- * %%
- * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ird.t3.actions.io.input.it;
-
-/**
- * Contract to use for all tests on avdth database
- *
- * @author Tony Chemit - dev(a)tchemit.fr
- * @since 1.0
- */
-public interface T3AVDTHV33Test {
-
- void testExecute_OI_2000() throws Exception;
-
- void testExecute_OI_2001() throws Exception;
-
- void testExecute_OI_2002() throws Exception;
-
- void testExecute_OI_2003() throws Exception;
-
- void testExecute_OI_2004() throws Exception;
-
- void testExecute_OI_2005() throws Exception;
-
- void testExecute_OI_2006() throws Exception;
-
- void testExecute_OI_2007() throws Exception;
-
- void testExecute_OI_2008() throws Exception;
-
- void testExecute_OI_2009() throws Exception;
-
- void testExecute_OI_2011() throws Exception;
-
- void testExecute_ATL_2000() throws Exception;
-
- void testExecute_ATL_2001() throws Exception;
-
- void testExecute_ATL_2002() throws Exception;
-
- void testExecute_ATL_2003() throws Exception;
-
- void testExecute_ATL_2004() throws Exception;
-
- void testExecute_ATL_2005() throws Exception;
-
- void testExecute_ATL_2006() throws Exception;
-
- void testExecute_ATL_2007() throws Exception;
-
- void testExecute_ATL_2008() throws Exception;
-
- void testExecute_ATL_2009() throws Exception;
-
- void testExecute_ATL_2010() throws Exception;
-
- void testExecute_ESATL_2006() throws Exception;
-
- void testExecute_ESATL_2007() throws Exception;
-
- void testExecute_ESATL_2008() throws Exception;
-
- void testExecute_ESATL_2009() throws Exception;
-
- void testExecute_ESATL_2010() throws Exception;
-}
=====================================
t3-web/src/main/java/fr/ird/t3/web/actions/io/input/AnalyzeImportDataAction.java
=====================================
--- a/t3-web/src/main/java/fr/ird/t3/web/actions/io/input/AnalyzeImportDataAction.java
+++ b/t3-web/src/main/java/fr/ird/t3/web/actions/io/input/AnalyzeImportDataAction.java
@@ -8,12 +8,12 @@
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -27,13 +27,14 @@ import fr.ird.t3.entities.data.Trip;
import fr.ird.t3.io.input.T3InputProvider;
import fr.ird.t3.services.DecoratorService;
import fr.ird.t3.web.actions.AbstractRunAction;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.MapUtils;
+
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.MapUtils;
/**
* Analyze the given input source.
@@ -45,15 +46,11 @@ public class AnalyzeImportDataAction extends AbstractRunAction<AnalyzeInputSourc
private static final long serialVersionUID = 1L;
- protected int nbUnsafeTrips;
-
- protected int nbSafeTrips;
-
- protected int nbTripsToReplace;
-
- protected boolean needReplace;
-
- protected boolean valid;
+ private int nbUnsafeTrips;
+ private int nbSafeTrips;
+ private int nbTripsToReplace;
+ private boolean needReplace;
+ private boolean valid;
/** List of all known input providers. */
private List<T3InputProvider> inputProviders;
@@ -64,111 +61,75 @@ public class AnalyzeImportDataAction extends AbstractRunAction<AnalyzeInputSourc
@Override
public void prepare() throws Exception {
-
getT3Session().removeTripListModel();
-
super.prepare();
-
inputProviders = Collections.singletonList(getConfiguration().getInputProvider());
}
- public final List<T3InputProvider> getInputProviders() {
- return inputProviders;
- }
-
public String prepareResult() {
-
- T3ActionContext<AnalyzeInputSourceConfiguration> context =
- getT3ActionContext();
-
- Set<Trip> safeTrips = context.getResultAsSet(
- AnalyzeInputSourceAction.RESULT_SAFE_TRIPS,
- Trip.class
- );
+ T3ActionContext<AnalyzeInputSourceConfiguration> context = getT3ActionContext();
+ Set<Trip> safeTrips = context.getResultAsSet(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, Trip.class);
nbSafeTrips = safeTrips.size();
-
- Set<Trip> unsafeTrips = context.getResultAsSet(
- AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS,
- Trip.class
- );
+ Set<Trip> unsafeTrips = context.getResultAsSet(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, Trip.class);
nbUnsafeTrips = unsafeTrips.size();
-
- boolean canImport = CollectionUtils.isEmpty(unsafeTrips) &&
- CollectionUtils.isNotEmpty(safeTrips);
-
+ boolean canImport = CollectionUtils.isEmpty(unsafeTrips) && CollectionUtils.isNotEmpty(safeTrips);
// action is valid, only if there is some safe trips and no unsafe trip
valid = canImport;
-
Map<Trip, Trip> tripsToReplace;
-
if (canImport) {
-
// find out if there is some existing trip to re-import
-
- tripsToReplace = context.getResultAsMap(
- AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE
- );
+ tripsToReplace = context.getResultAsMap(AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE);
} else {
-
// no trip to replace
tripsToReplace = Collections.emptyMap();
}
-
nbTripsToReplace = tripsToReplace.size();
-
needReplace = MapUtils.isNotEmpty(tripsToReplace);
-
return INPUT;
}
+ @Override
+ protected Map<String, Object> prepareResumeParameters(AnalyzeInputSourceAction action, Exception error, Date startDate, Date endDate) {
+ Map<String, Object> map = super.prepareResumeParameters(action, error, startDate, endDate);
+ T3ActionContext<AnalyzeInputSourceConfiguration> actionContext = getT3ActionContext();
+ Set<Trip> safeTrips = actionContext.getResultAsSet(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, Trip.class);
+ map.put(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, safeTrips);
+ Set<Trip> unsafeTrips = actionContext.getResultAsSet(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, Trip.class);
+ map.put(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, unsafeTrips);
+ Map<Trip, Trip> tripsToReplace = actionContext.getResultAsMap(AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE);
+ map.put(AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE, tripsToReplace);
+ map.put("tripDecorator", getDecorator(Trip.class));
+ map.put("tripDecorator2", getDecorator(Trip.class, DecoratorService.WITH_ID));
+ return map;
+ }
+
+ @SuppressWarnings("unused")
+ public List<T3InputProvider> getInputProviders() {
+ return inputProviders;
+ }
+
+ @SuppressWarnings("unused")
public int getNbUnsafeTrips() {
return nbUnsafeTrips;
}
+ @SuppressWarnings("unused")
public int getNbSafeTrips() {
return nbSafeTrips;
}
+ @SuppressWarnings("unused")
public int getNbTripsToReplace() {
return nbTripsToReplace;
}
+ @SuppressWarnings("unused")
public boolean isValid() {
return valid;
}
+ @SuppressWarnings("unused")
public boolean isNeedReplace() {
return needReplace;
}
-
- @Override
- protected Map<String, Object> prepareResumeParameters(AnalyzeInputSourceAction action,
- Exception error,
- Date startDate,
- Date endDate) {
- Map<String, Object> map = super.prepareResumeParameters(action, error, startDate, endDate);
-
- T3ActionContext<AnalyzeInputSourceConfiguration> actionContext = getT3ActionContext();
-
- Set<Trip> safeTrips = actionContext.getResultAsSet(
- AnalyzeInputSourceAction.RESULT_SAFE_TRIPS,
- Trip.class
- );
- map.put(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, safeTrips);
- Set<Trip> unsafeTrips = actionContext.getResultAsSet(
- AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS,
- Trip.class
- );
- map.put(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, unsafeTrips);
- Map<Trip, Trip> tripsToReplace = actionContext.getResultAsMap(
- AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE
- );
- map.put(AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE, tripsToReplace);
-
- map.put("tripDecorator", getDecorator(Trip.class));
-
- map.put("tripDecorator2",
- getDecorator(Trip.class, DecoratorService.WITH_ID));
- return map;
- }
}
=====================================
t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ConfigureImportDataAction.java
=====================================
--- a/t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ConfigureImportDataAction.java
+++ b/t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ConfigureImportDataAction.java
@@ -8,12 +8,12 @@
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -55,22 +55,21 @@ import java.util.zip.ZipFile;
*/
public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeInputSourceConfiguration> {
- // public static final String RELOAD_ACTION = "reload";
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(ConfigureImportDataAction.class);
- /** Input file that was just uploaded on server */
+ /**
+ * Input file that was just uploaded on server.
+ */
private File sourceToLoad;
- /** Name of file to upload */
+ /**
+ * Name of file to upload.
+ */
private String sourceToLoadFileName;
- /** flag to use strict mode with wells. */
- private boolean useWells;
/**
- * Trip type to use
- *
- * @since 2.3
+ * Flag to use strict mode with wells.
*/
- private TripType tripType = TripType.STANDARD;
+ private boolean useWells;
/**
* flag to authorize creation of missing vessels.
*
@@ -83,6 +82,24 @@ public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeIn
* @since 1.3.1
*/
private boolean createVirtualVessel;
+ /**
+ * Flag to load only samples only trips
+ *
+ * @see TripType#SAMPLEONLY
+ */
+ private boolean useSamplesOnly;
+ /**
+ * Flag to authorize virtual activity creation (when logbooks are missing).
+ * <p>
+ * By default, let's always authorize it.
+ * <p>
+ * <b>Note:</b> This option is always at false if {@link #useSamplesOnly} is on.
+ *
+ * @see TripType#LOGBOOKMISSING
+ * @see TripType#STANDARD
+ */
+ private boolean canCreateVirtualActivity;
+
private long maxSize;
/** List of all known input providers. */
private List<T3InputProvider> inputProviders;
@@ -100,139 +117,79 @@ public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeIn
super(AnalyzeInputSourceConfiguration.class);
}
- public String getMaxSize() {
- return StringUtil.convertMemory(maxSize);
- }
-
- @Inject(StrutsConstants.STRUTS_MULTIPART_MAXSIZE)
- public void setMaxSize(String maxSize) {
- this.maxSize = Long.parseLong(maxSize);
- }
-
@Override
public void prepare() throws Exception {
-
injectOnly(InjectDAO.class);
-
if (!isConfigurationInSession()) {
-
// no yet configuration, can use all input providers
inputProviders = Arrays.asList(getT3InputService().getProviders());
-
} else {
- // as soon as there is a configuration, can only use the
- // inputProvider from it
-
+ // as soon as there is a configuration, can only use the inputProvider from it
inputProviders = Collections.singletonList(getConfiguration().getInputProvider());
}
-
injectOnly(InjectDecoratedBeans.class);
-
if (getTreatmentDirectoryPath() == null) {
-
// first time coming here get a new treatment directory path
-
File workingDirectory = getApplicationConfig().getTreatmentWorkingDirectory();
-
long l = System.nanoTime();
-
File treatmentDirectory = new File(workingDirectory, "importData-" + l);
-
FileUtil.createDirectoryIfNecessary(treatmentDirectory);
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Create a new treatment directory path : %s", treatmentDirectory));
- }
-
+ log.info(String.format("Create a new treatment directory path : %s", treatmentDirectory));
setTreatmentDirectoryPath(treatmentDirectory.getAbsolutePath());
} else {
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Use existing treatment directory %s", getTreatmentDirectoryPath()));
- }
+ log.info(String.format("Use existing treatment directory %s", getTreatmentDirectoryPath()));
}
}
public String doAddSource() throws Exception {
-
- // this action execution purpose is to add a new source to the
- // treatment configuration
- // It will upload the file and place it the correct place (says the
- // temporary directory of the treatment configuration)
-
- // file uploaded on server
+ // this action execution purpose is to add a new source to the treatment configuration
+ // It will upload the file and place it the correct place (says the temporary directory of the treatment configuration)
File upload = getSourceToLoad();
-
if (upload == null) {
-
String message = t("t3.error.required.file.to.upload");
addFieldError("sourceToLoad", message);
log.error(message);
return ERROR;
}
-
// treatment directory
File targetDirectory = getTreatmentDirectory();
-
String filename = getSourceToLoadFileName();
-
if (ZipUtil.isZipFile(upload)) {
-
// let's decompress input stream it
ZipFile zipfile = new ZipFile(upload);
-
Enumeration<? extends ZipEntry> entries = zipfile.entries();
-
if (!entries.hasMoreElements()) {
String message = t("t3.error.required.one.entry.in.zip.to.upload");
addFieldError("sourceToLoad", message);
log.error(message);
return ERROR;
}
-
// get first entry
ZipEntry zipEntry = entries.nextElement();
-
// keep the filename of the zip entry
filename = zipEntry.getName();
-
File target = new File(targetDirectory, filename);
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Will copy loaded zipped entry file %s to treatment configuration directory %s", filename, target));
- }
+ log.info(String.format("Will copy loaded zipped entry file %s to treatment configuration directory %s", filename, target));
try (InputStream in = zipfile.getInputStream(zipEntry)) {
FileUtils.copyInputStreamToFile(in, target);
}
} else {
-
// target file
File target = new File(targetDirectory, filename);
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Will copy loaded file %s to treatment configuration directory %s", upload, target));
- }
-
+ log.info(String.format("Will copy loaded file %s to treatment configuration directory %s", upload, target));
// just copy file
FileUtils.copyFile(upload, target);
}
-
// add the new file to the sources
setLoadedSource(filename);
-
// go back to the configuration definition
return INPUT;
}
public String doDeleteSource() throws Exception {
-
String filename = getLoadedSource();
-
File targetDirectory = getTreatmentDirectory();
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Will delete loaded file %s from %s", filename, targetDirectory));
- }
+ log.info(String.format("Will delete loaded file %s from %s", filename, targetDirectory));
File f = new File(targetDirectory, filename);
if (f.exists()) {
boolean delete = f.delete();
@@ -240,9 +197,7 @@ public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeIn
throw new IOException(String.format("Could not delete file %s on server.", f));
}
}
-
setLoadedSource(null);
-
// go back to the configuration definition
return INPUT;
}
@@ -251,107 +206,143 @@ public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeIn
T3InputProvider inputProvider = getT3InputService().getProvider(getInputProviderId());
File path = getTreatmentDirectory();
String name = getLoadedSource();
-
File inputFile = new File(path, name);
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Will use input provider : %s", inputProvider));
- log.info(String.format("Will use input file : %s", inputFile));
- }
-
- // prepare a new action configuration
- configuration = AnalyzeInputSourceConfiguration.newConfiguration(
- inputProvider,
- inputFile,
- useWells,
- tripType,
- canCreateVessel,
- createVirtualVessel);
-
+ TripType tripType = TripType.getTripType(useSamplesOnly, canCreateVirtualActivity);
+ log.info(String.format("input provider : %s", inputProvider));
+ log.info(String.format("input file : %s", inputFile));
+ log.info(String.format("userWells : %s", useWells));
+ log.info(String.format("tripType : %s", tripType));
+ log.info(String.format("canCreateVessel : %s", canCreateVessel));
+ log.info(String.format("createVirtualVessel : %s", createVirtualVessel));
+ log.info(String.format("canCreateVirtualActivity : %s", canCreateVirtualActivity));
+ log.info(String.format("useSamplesOnly : %s", useSamplesOnly));
+ configuration = AnalyzeInputSourceConfiguration.newConfiguration(inputProvider, inputFile, useWells, canCreateVessel, createVirtualVessel, useSamplesOnly, canCreateVirtualActivity);
prepareActionContext();
return SUCCESS;
}
- public TripType getTripType() {
- return tripType;
+ @SuppressWarnings("unused")
+ public String getMaxSize() {
+ return StringUtil.convertMemory(maxSize);
}
- public void setTripType(TripType tripType) {
- this.tripType = tripType;
+ @SuppressWarnings("unused")
+ @Inject(StrutsConstants.STRUTS_MULTIPART_MAXSIZE)
+ public void setMaxSize(String maxSize) {
+ this.maxSize = Long.parseLong(maxSize);
}
+ @SuppressWarnings("unused")
public Map<String, String> getTripTypes() {
return tripTypes;
}
+ @SuppressWarnings("unused")
public void setTripTypes(Map<String, String> tripTypes) {
this.tripTypes = tripTypes;
}
+ @SuppressWarnings({"unused", "WeakerAccess"})
public File getSourceToLoad() {
return sourceToLoad;
}
+ @SuppressWarnings("unused")
public void setSourceToLoad(File sourceToLoad) {
this.sourceToLoad = sourceToLoad;
}
+ @SuppressWarnings({"unused", "WeakerAccess"})
public String getSourceToLoadFileName() {
return sourceToLoadFileName;
}
+ @SuppressWarnings("unused")
public void setSourceToLoadFileName(String sourceToLoadFileName) {
this.sourceToLoadFileName = sourceToLoadFileName;
}
+ @SuppressWarnings("unused")
public boolean isUseWells() {
return useWells;
}
+ @SuppressWarnings("unused")
public void setUseWells(boolean useWells) {
this.useWells = useWells;
}
+ @SuppressWarnings("unused")
public boolean isCanCreateVessel() {
return canCreateVessel;
}
+ @SuppressWarnings("unused")
public void setCanCreateVessel(boolean canCreateVessel) {
this.canCreateVessel = canCreateVessel;
}
+ @SuppressWarnings("unused")
public boolean isCreateVirtualVessel() {
return createVirtualVessel;
}
+ @SuppressWarnings("unused")
public void setCreateVirtualVessel(boolean createVirtualVessel) {
this.createVirtualVessel = createVirtualVessel;
}
+ @SuppressWarnings({"unused", "WeakerAccess"})
public String getInputProviderId() {
return inputProviderId;
}
+ @SuppressWarnings("unused")
public void setInputProviderId(String inputProviderId) {
this.inputProviderId = inputProviderId;
}
+ @SuppressWarnings({"unused", "WeakerAccess"})
public String getLoadedSource() {
return loadedSource;
}
+ @SuppressWarnings({"unused", "WeakerAccess"})
public void setLoadedSource(String loadedSource) {
this.loadedSource = loadedSource;
}
+ @SuppressWarnings({"unused", "WeakerAccess"})
public String getTreatmentDirectoryPath() {
return treatmentDirectoryPath;
}
+ @SuppressWarnings({"unused", "WeakerAccess"})
public void setTreatmentDirectoryPath(String treatmentDirectoryPath) {
this.treatmentDirectoryPath = treatmentDirectoryPath;
}
+ @SuppressWarnings("unused")
+ public boolean isUseSamplesOnly() {
+ return useSamplesOnly;
+ }
+
+ @SuppressWarnings("unused")
+ public void setUseSamplesOnly(boolean useSamplesOnly) {
+ this.useSamplesOnly = useSamplesOnly;
+ }
+
+ @SuppressWarnings("unused")
+ public boolean isCanCreateVirtualActivity() {
+ return canCreateVirtualActivity;
+ }
+
+ @SuppressWarnings("unused")
+ public void setCanCreateVirtualActivity(boolean canCreateVirtualActivity) {
+ this.canCreateVirtualActivity = canCreateVirtualActivity;
+ }
+
+ @SuppressWarnings("unused")
public final List<T3InputProvider> getInputProviders() {
return inputProviders;
}
=====================================
t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ImportDataAction.java
=====================================
--- a/t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ImportDataAction.java
+++ b/t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ImportDataAction.java
@@ -49,15 +49,15 @@ import java.util.Set;
public class ImportDataAction extends AbstractRunAction<ImportInputSourceConfiguration, ImportInputSourceAction> {
private static final long serialVersionUID = 1L;
-
private static final Log log = LogFactory.getLog(ImportDataAction.class);
private boolean replaceTrip;
private boolean valid;
private int nbImportedTrips;
private int nbDeletedTrips;
-
- /** List of all known input providers. */
+ /**
+ * List of all known input providers.
+ */
private List<T3InputProvider> inputProviders;
public ImportDataAction() {
@@ -70,132 +70,101 @@ public class ImportDataAction extends AbstractRunAction<ImportInputSourceConfigu
inputProviders = Collections.singletonList(getIncomingConfiguration().getInputProvider());
}
- public final List<T3InputProvider> getInputProviders() {
- return inputProviders;
- }
-
- public InputSourceConfiguration getIncomingConfiguration() {
- Object configuration = getT3ActionContext().getConfiguration();
- return (InputSourceConfiguration) configuration;
- }
-
public String prepareImport() {
-
// get the action context from analyze
-
- T3ActionContext<ImportInputSourceConfiguration> actionContext =
- getT3ActionContext();
-
- Set<Trip> safeTrips = actionContext.getResultAsSet(
- AnalyzeInputSourceAction.RESULT_SAFE_TRIPS,
- Trip.class);
-
- Map<Trip, Trip> tripToReplace = actionContext.getResultAsMap(
- AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE
- );
-
- if (log.isInfoEnabled()) {
- log.info("--> Prepare import");
- log.info("Input provider : " + getIncomingConfiguration().getInputProvider());
- log.info("Input file : " + getIncomingConfiguration().getInputFile());
- log.info("Use well : " + getIncomingConfiguration().isUseWells());
- log.info("Trip type : " + getIncomingConfiguration().getTripType());
- log.info("Can Create vessel: " + getIncomingConfiguration().isCanCreateVessel());
- if (getIncomingConfiguration().isCanCreateVessel()) {
- log.info("Create virtual vessel: " + getIncomingConfiguration().isCreateVirtualVessel());
- }
- log.info("Trips to import : " + safeTrips.size());
- log.info("Trips to replace : " + tripToReplace.size());
+ T3ActionContext<ImportInputSourceConfiguration> actionContext = getT3ActionContext();
+ Set<Trip> safeTrips = actionContext.getResultAsSet(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, Trip.class);
+ Map<Trip, Trip> tripToReplace = actionContext.getResultAsMap(AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE);
+ log.info("--> Prepare import");
+ log.info("Input provider : " + getIncomingConfiguration().getInputProvider());
+ log.info("Input file : " + getIncomingConfiguration().getInputFile());
+ log.info("Use well : " + getIncomingConfiguration().isUseWells());
+ log.info("Trip type : " + getIncomingConfiguration().getTripType());
+ log.info("Can Create vessel: " + getIncomingConfiguration().isCanCreateVessel());
+ if (getIncomingConfiguration().isCanCreateVessel()) {
+ log.info("Create virtual vessel: " + getIncomingConfiguration().isCreateVirtualVessel());
}
-
+ log.info("Trips to import : " + safeTrips.size());
+ log.info("Trips to replace : " + tripToReplace.size());
Set<Trip> toImportTrips = new HashSet<>();
Set<Trip> toDeleteTrips = new HashSet<>();
-
if (isReplaceTrip()) {
-
- // will replace existing trips
- // so need to delete before all old trips
+ // will replace existing trips, so need to delete before all old trips
toDeleteTrips.addAll(tripToReplace.keySet());
-
// can import all safe trips
toImportTrips.addAll(safeTrips);
-
} else {
-
// do NOT replace old trip
-
// get all importable trips
toImportTrips.addAll(safeTrips);
-
if (MapUtils.isNotEmpty(tripToReplace)) {
-
// remove the one which reflect existing trips
toImportTrips.removeAll(tripToReplace.values());
}
}
-
// creates the new configuration
-
ImportInputSourceConfiguration configuration = ImportInputSourceConfiguration.newConfiguration(getIncomingConfiguration());
-
configuration.setTripsToImport(toImportTrips);
-
configuration.setTripsToDelete(toDeleteTrips);
-
- t3ActionContext = getServiceFactory().newT3ActionContext(configuration, getServiceContext()
- );
- if (log.isInfoEnabled()) {
- log.info("Created action context " + t3ActionContext);
- }
+ t3ActionContext = getServiceFactory().newT3ActionContext(configuration, getServiceContext());
+ log.info("Created action context " + t3ActionContext);
getT3Session().setActionContext(t3ActionContext);
-
return SUCCESS;
}
public String prepareResult() {
-
Set<Trip> importedTrips = getConfiguration().getTripsToImport();
-
nbImportedTrips = importedTrips.size();
+ Set<Trip> deletedTrips = getConfiguration().getTripsToDelete();
+ nbDeletedTrips = deletedTrips.size();
+ return INPUT;
+ }
- Set<Trip> deletedeTrips = getConfiguration().getTripsToDelete();
+ @Override
+ protected Map<String, Object> prepareResumeParameters(ImportInputSourceAction action, Exception error, Date startDate, Date endDate) {
+ Map<String, Object> map = super.prepareResumeParameters(action, error, startDate, endDate);
+ map.put("tripDecorator", getDecorator(Trip.class, DecoratorService.WITH_ID));
+ return map;
+ }
- nbDeletedTrips = deletedeTrips.size();
+ @SuppressWarnings("unused")
+ public List<T3InputProvider> getInputProviders() {
+ return inputProviders;
+ }
- return INPUT;
+ @SuppressWarnings("WeakerAccess")
+ public InputSourceConfiguration getIncomingConfiguration() {
+ Object configuration = getT3ActionContext().getConfiguration();
+ return (InputSourceConfiguration) configuration;
}
+ @SuppressWarnings("unused")
public boolean isValid() {
return valid;
}
+ @SuppressWarnings("unused")
public void setValid(boolean valid) {
this.valid = valid;
}
+ @SuppressWarnings("unused")
public int getNbImportedTrips() {
return nbImportedTrips;
}
+ @SuppressWarnings("unused")
public int getNbDeletedTrips() {
return nbDeletedTrips;
}
+ @SuppressWarnings("WeakerAccess")
public boolean isReplaceTrip() {
return replaceTrip;
}
+ @SuppressWarnings("unused")
public void setReplaceTrip(boolean replaceTrip) {
this.replaceTrip = replaceTrip;
}
-
- @Override
- protected Map<String, Object> prepareResumeParameters(ImportInputSourceAction action,
- Exception error,
- Date startDate,
- Date endDate) {
- Map<String, Object> map = super.prepareResumeParameters(action, error, startDate, endDate);
- map.put("tripDecorator", getDecorator(Trip.class, DecoratorService.WITH_ID));
- return map;
- }
}
=====================================
t3-web/src/main/resources/i18n/t3-web_en_GB.properties
=====================================
--- a/t3-web/src/main/resources/i18n/t3-web_en_GB.properties
+++ b/t3-web/src/main/resources/i18n/t3-web_en_GB.properties
@@ -44,6 +44,7 @@ t3.common.available.harbours=Ports disponibles
t3.common.available.vesselSimpleTypes=Types simplifiés de navire disponibles
t3.common.available.vessels=Navires disponibles
t3.common.canCreateVessel=Authorise to create vessels
+t3.common.canCreateVirtualActivity=Authorize to create virtaul activities (for trips with missing logbook)
t3.common.catchFleet=Flotte des captures
t3.common.checkPassword=repeat password
t3.common.configuration=Préférences
=====================================
t3-web/src/main/resources/i18n/t3-web_fr_FR.properties
=====================================
--- a/t3-web/src/main/resources/i18n/t3-web_fr_FR.properties
+++ b/t3-web/src/main/resources/i18n/t3-web_fr_FR.properties
@@ -44,6 +44,7 @@ t3.common.available.harbours=Ports disponibles
t3.common.available.vesselSimpleTypes=Types simplifiés de navire disponibles
t3.common.available.vessels=Navires disponibles
t3.common.canCreateVessel=Autoriser la création de bateaux
+t3.common.canCreateVirtualActivity=Autoriser la création d'acitivités fictive (pour les marées sans livre de bord)
t3.common.catchFleet=Flotte des captures
t3.common.checkPassword=Répéter le mot de passe
t3.common.configuration=Préférences
=====================================
t3-web/src/main/webapp/WEB-INF/jsp/io/input/analyzeImportDataResult.jsp
=====================================
--- a/t3-web/src/main/webapp/WEB-INF/jsp/io/input/analyzeImportDataResult.jsp
+++ b/t3-web/src/main/webapp/WEB-INF/jsp/io/input/analyzeImportDataResult.jsp
@@ -29,9 +29,7 @@
<jsp:include page="importDataConfigResume.jsp"/>
<s:if test="valid">
-
<%-- Can do the import --%>
-
<p>
<s:text name="t3.label.message.trips.safe.to.import">
<s:param>
@@ -39,27 +37,20 @@
</s:param>
</s:text>
</p>
-
- <s:form method="post" validate="true" namespace="/io">
+ <s:form method="post" validate="true" namespace="/io">
<s:if test="needReplace">
<strong>
- <s:text name="t3.label.message.trips.to.replace">
- <s:param>
- <s:property value="%{nbTripsToReplace}"/>
- </s:param>
- </s:text>
+ <s:text name="t3.label.message.trips.to.replace">
+ <s:param>
+ <s:property value="%{nbTripsToReplace}"/>
+ </s:param>
+ </s:text>
</strong>
<s:checkbox name="replaceTrip" key="t3.question.confirm.to.replace.trip" value="%{false}"/>
-
</s:if>
-
- <s:submit action="prepareImportData"
- key="t3.action.importData.doImport"
- align="right"/>
-
+ <s:submit action="prepareImportData" key="t3.action.importData.doImport" align="right"/>
</s:form>
-
</s:if>
<s:else>
<p>
=====================================
t3-web/src/main/webapp/WEB-INF/jsp/io/input/configureImportData.jsp
=====================================
--- a/t3-web/src/main/webapp/WEB-INF/jsp/io/input/configureImportData.jsp
+++ b/t3-web/src/main/webapp/WEB-INF/jsp/io/input/configureImportData.jsp
@@ -25,41 +25,47 @@
<script type="text/javascript">
- jQuery(document).ready(function () {
-
- function changeCanCreateVessel(val) {
- var container = $('[name="createVirtualVessel"]');
- if (val) {
- container.attr('disabled', false);
- container.prop('checked', true);
- } else {
- container.attr('disabled', true);
- }
- }
-
- $('[name="canCreateVessel"]').change(function () {
- changeCanCreateVessel($(this).prop('checked'));
+ jQuery(document).ready(function () {
+ function changeCanCreateVessel(val) {
+ var container = $('[name="createVirtualVessel"]');
+ if (val) {
+ container.attr('disabled', false);
+ container.prop('checked', true);
+ } else {
+ container.attr('disabled', true);
+ }
+ }
+ function changeUseSamplesOnly(val) {
+ var container = $('[name="canCreateVirtualActivity"]');
+ if (val) {
+ container.attr('disabled', false);
+ container.prop('checked', true);
+ } else {
+ container.attr('disabled', true);
+ container.attr('checked', true);
+ }
+ }
+
+ $('[name="canCreateVessel"]').change(function () {
+ changeCanCreateVessel($(this).prop('checked'));
+ });
+ $('[name="useSamplesOnly"]').change(function () {
+ changeUseSamplesOnly($(this).prop('checked'));
+ });
+ changeCanCreateVessel(<s:property value="%{canCreateVessel}"/>);
+ changeUseSamplesOnly(<s:property value="%{useSamplesOnly}"/>);
});
-
- changeCanCreateVessel(<s:property value="%{canCreateVessel}"/>);
- });
</script>
<title><s:text name="t3.label.data.configureImportData"/></title>
-
<h2><s:text name="t3.label.data.configureImportData"/></h2>
<s:form method="post" validate="true" enctype="multipart/form-data" namespace="/io">
-
<s:hidden key="treatmentDirectoryPath" label=''/>
-
- <s:select key="inputProviderId" list="inputProviders" label='%{getText("t3.common.inputProvider")}' listKey="id" listValue="libelle" requiredLabel="true"/>
-
+ <s:select key="inputProviderId" list="inputProviders" label='%{getText("t3.common.inputProvider")}' listKey="id"
+ listValue="libelle" requiredLabel="true"/>
<s:if test="loadedSource==null">
-
<s:hidden name="useWells" value="%{useWells}"/>
-
<s:file name="sourceToLoad" requiredLabel="true" label='%{getText("t3.common.sourceToUpload")} (*)'/>
-
<s:submit action="configureImportData!doAddSource" key="t3.action.importData.addSource" align="right"/>
<br/>
@@ -68,17 +74,14 @@
<s:param value="%{maxSize}"/>
</s:text>
</div>
-
</s:if>
<s:else>
-
<s:hidden key="loadedSource" label=''/>
-
- <s:textfield value="%{loadedSource}" key="t3.common.uploaded.source" disabled="true" requiredLabel="true" size="40"/>
-
+ <s:textfield value="%{loadedSource}" key="t3.common.uploaded.source" disabled="true" requiredLabel="true"
+ size="40"/>
<s:checkbox key="useWells" label='%{getText("t3.common.force.useWells")}'/>
-
- <s:select key="tripType" list="tripTypes" label='%{getText("t3.common.tripType")}' requiredLabel="true"/>
+ <s:checkbox key="samplesOnly" label='%{getText("t3.common.useSamplesOnly")}'/>
+ <s:checkbox key="canCreateVirtualActivity" label='%{getText("t3.common.canCreateVirtualActivity")}'/>
<s:checkbox key="canCreateVessel" label='%{getText("t3.common.canCreateVessel")}'/>
<s:checkbox key="createVirtualVessel" label='%{getText("t3.common.createVirtualVessel")}'/>
<s:submit action="configureImportData!doDeleteSource" key="t3.action.importData.deleteSource" align="right"/>
=====================================
t3-web/src/main/webapp/WEB-INF/jsp/io/input/importDataConfigResume.jsp
=====================================
--- a/t3-web/src/main/webapp/WEB-INF/jsp/io/input/importDataConfigResume.jsp
+++ b/t3-web/src/main/webapp/WEB-INF/jsp/io/input/importDataConfigResume.jsp
@@ -22,21 +22,23 @@
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
<fieldset>
-
<legend>
<s:text name="t3.label.importData.config.resume"/>
</legend>
-
<s:form>
- <s:select key="t3.common.inputProvider" list="inputProviders" listKey="id" listValue="libelle" value="%{configuration.inputProvider.id}" disabled="true"/>
+ <s:select key="t3.common.inputProvider" list="inputProviders" listKey="id" listValue="libelle"
+ value="%{configuration.inputProvider.id}" disabled="true"/>
<s:textfield value="%{configuration.inputFile.name}" key="t3.common.uploaded.source" disabled="true" size="40"/>
<s:label key="t3.common.useWells" value=""/>
<s:checkbox name="useWells" value="%{configuration.useWells}" disabled="true" key="t3.common.force.useWells"/>
- <s:select key="tripType" list="tripTypes" label='%{getText("t3.common.tripType")}' disabled="true" value="%{configuration.tripType}" />
- <s:checkbox name="canCreateVessel" value="%{configuration.canCreateVessel}" disabled="true" key="t3.common.canCreateVessel"/>
+ <s:checkbox name="samplesOnly" value="%{configuration.samplesOnly}" disabled="true" key="t3.common.samplesOnly"/>
+ <s:checkbox name="canCreateVirtualActivity" value="%{configuration.canCreateVirtualActivity}" disabled="true"
+ key="t3.common.canCreateVirtualActivity"/>
+ <s:checkbox name="canCreateVessel" value="%{configuration.canCreateVessel}" disabled="true"
+ key="t3.common.canCreateVessel"/>
<s:if test="configuration.canCreateVessel">
- <s:checkbox name="createVirtualVessel" value="%{configuration.createVirtualVessel}" disabled="true" key="t3.common.createVirtualVessel"/>
+ <s:checkbox name="createVirtualVessel" value="%{configuration.createVirtualVessel}" disabled="true"
+ key="t3.common.createVirtualVessel"/>
</s:if>
</s:form>
-
</fieldset>
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/fbdd9e09a4535d061cb16aa2c3d2ec7a…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/fbdd9e09a4535d061cb16aa2c3d2ec7a…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][develop] Marées sans logbooks : gestion de leurs échantillons - amélioration de…
by Tony CHEMIT 09 Mar '18
by Tony CHEMIT 09 Mar '18
09 Mar '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
61b98792 by Tony CHEMIT at 2018-03-09T12:02:40Z
Marées sans logbooks : gestion de leurs échantillons - amélioration de l'interface uitlisation de configuration (See #116)
- - - - -
14 changed files:
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/InputSourceConfiguration.java
- t3-domain/src/main/java/fr/ird/t3/entities/data/TripType.java
- t3-domain/src/main/java/fr/ird/t3/io/input/T3InputConfiguration.java
- t3-web/src/main/java/fr/ird/t3/web/actions/io/input/AnalyzeImportDataAction.java
- t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ConfigureImportDataAction.java
- t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ImportDataAction.java
- t3-web/src/main/resources/i18n/t3-web_en_GB.properties
- t3-web/src/main/resources/i18n/t3-web_fr_FR.properties
- t3-web/src/main/webapp/WEB-INF/jsp/io/input/analyzeImportDataResult.jsp
- t3-web/src/main/webapp/WEB-INF/jsp/io/input/configureImportData.jsp
- t3-web/src/main/webapp/WEB-INF/jsp/io/input/importDataConfigResume.jsp
Changes:
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceConfiguration.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceConfiguration.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceConfiguration.java
@@ -8,12 +8,12 @@
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -43,22 +43,42 @@ public class AnalyzeInputSourceConfiguration implements InputSourceConfiguration
protected boolean createVirtualVessel;
protected T3InputProvider inputProvider;
protected File inputFile;
+ /**
+ * Flag to load only samples only trips
+ *
+ * @see TripType#SAMPLEONLY
+ */
+ private boolean useSamplesOnly;
+ /**
+ * Flag to authorize virtual activity creation (when logbooks are missing).
+ * <p>
+ * By default, let's always authorize it.
+ * <p>
+ * <b>Note:</b> This option is always at false if {@link #useSamplesOnly} is on.
+ *
+ * @see TripType#LOGBOOKMISSING
+ * @see TripType#STANDARD
+ */
+ private boolean canCreateVirtualActivity;
private TripType tripType;
public static AnalyzeInputSourceConfiguration newConfiguration(
T3InputProvider inputProvider,
File inputFile,
boolean useWells,
- TripType tripType,
boolean canCreateVessel,
- boolean createVirtualVessel) {
+ boolean createVirtualVessel,
+ boolean useSamplesOnly,
+ boolean canCreateVirtualActivity) {
AnalyzeInputSourceConfiguration result = new AnalyzeInputSourceConfiguration();
result.setInputFile(inputFile);
result.setInputProvider(inputProvider);
result.setUseWells(useWells);
- result.setTripType(tripType);
+ result.setTripType(TripType.getTripType(useSamplesOnly, canCreateVirtualActivity));
result.setCanCreateVessel(canCreateVessel);
result.setCreateVirtualVessel(createVirtualVessel);
+ result.setCanCreateVirtualActivity(canCreateVirtualActivity);
+ result.setUseSamplesOnly(useSamplesOnly);
return result;
}
@@ -127,12 +147,34 @@ public class AnalyzeInputSourceConfiguration implements InputSourceConfiguration
return l(locale, "t3.input.AnalyzeInputSource");
}
+ @Override
+ public boolean isUseSamplesOnly() {
+ return useSamplesOnly;
+ }
+
+ @Override
+ public void setUseSamplesOnly(boolean useSamplesOnly) {
+ this.useSamplesOnly = useSamplesOnly;
+ }
+
+ @Override
+ public boolean isCanCreateVirtualActivity() {
+ return canCreateVirtualActivity;
+ }
+
+ @Override
+ public void setCanCreateVirtualActivity(boolean canCreateVirtualActivity) {
+ this.canCreateVirtualActivity = canCreateVirtualActivity;
+ }
+
T3InputConfiguration toInputConfiguration() {
T3InputConfiguration result = new T3InputConfiguration();
result.setCanCreateVessel(canCreateVessel);
result.setCreateVirtualVessel(createVirtualVessel);
result.setTripType(tripType);
result.setUseWells(useWells);
+ result.setCanCreateVirtualActivity(canCreateVirtualActivity);
+ result.setUseSamplesOnly(useSamplesOnly);
result.setInputFile(inputFile);
return result;
}
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceAction.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceAction.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceAction.java
@@ -25,7 +25,6 @@ import fr.ird.t3.entities.T3EntityEnum;
import fr.ird.t3.entities.T3TopiaApplicationContext;
import fr.ird.t3.entities.T3TopiaPersistenceContext;
import fr.ird.t3.entities.data.Activity;
-import fr.ird.t3.entities.data.ActivityTopiaDao;
import fr.ird.t3.entities.data.T3DataEntity;
import fr.ird.t3.entities.data.Trip;
import fr.ird.t3.entities.data.TripTopiaDao;
@@ -60,15 +59,11 @@ import static org.nuiton.i18n.I18n.l;
*/
public class ImportInputSourceAction extends T3Action<ImportInputSourceConfiguration> {
- // public static final String PARAM_TRIPS_TO_IMPORT = "tripsToImport";
-// public static final String PARAM_TRIPS_TO_DELETE = "tripsToDelete";
private static final Log log = LogFactory.getLog(ImportInputSourceAction.class);
@InjectDAO(entityType = Trip.class)
private TripTopiaDao tripDAO;
@InjectDAO(entityType = Vessel.class)
private VesselTopiaDao vesselDAO;
- @InjectDAO(entityType = Activity.class)
- private ActivityTopiaDao activityDAO;
@InjectDAO(entityType = Ocean.class)
private OceanTopiaDao oceanDAO;
private Set<Trip> tripToDelete;
@@ -88,13 +83,10 @@ public class ImportInputSourceAction extends T3Action<ImportInputSourceConfigura
@Override
protected boolean executeAction() {
-
if (CollectionUtils.isEmpty(trips)) {
- // no trips at all to import
- // no commit to do, skip the action
+ // no trips at all to import, no commit to do, skip the action
return false;
}
-
int nbSteps = 0;
if (CollectionUtils.isNotEmpty(trips)) {
nbSteps += trips.size();
@@ -102,7 +94,6 @@ public class ImportInputSourceAction extends T3Action<ImportInputSourceConfigura
if (CollectionUtils.isNotEmpty(tripToDelete)) {
nbSteps += tripToDelete.size();
}
-
setNbSteps(nbSteps);
log.info(String.format("Nb steps : %d", getNbSteps()));
if (CollectionUtils.isNotEmpty(tripToDelete)) {
@@ -154,8 +145,6 @@ public class ImportInputSourceAction extends T3Action<ImportInputSourceConfigura
// Need to flush as we are going to query new data
getT3TopiaPersistenceContext().get().getHibernateSupport().getHibernateSession().flush();
-
- String prefix = Activity.class.getName() + "#";
for (Activity activity : ids) {
Ocean ocean = oceanDAO.findOceanByActivity(activity);
activity.setOcean(ocean);
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceConfiguration.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceConfiguration.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/ImportInputSourceConfiguration.java
@@ -8,12 +8,12 @@
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -45,6 +45,23 @@ public class ImportInputSourceConfiguration implements InputSourceConfiguration
protected boolean createVirtualVessel;
protected T3InputProvider inputProvider;
protected File inputFile;
+ /**
+ * Flag to load only samples only trips
+ *
+ * @see TripType#SAMPLEONLY
+ */
+ private boolean useSamplesOnly;
+ /**
+ * Flag to authorize virtual activity creation (when logbooks are missing).
+ * <p>
+ * By default, let's always authorize it.
+ * <p>
+ * <b>Note:</b> This option is always at false if {@link #useSamplesOnly} is on.
+ *
+ * @see TripType#LOGBOOKMISSING
+ * @see TripType#STANDARD
+ */
+ private boolean canCreateVirtualActivity;
private Set<Trip> tripsToImport;
private Set<Trip> tripsToDelete;
@@ -124,6 +141,27 @@ public class ImportInputSourceConfiguration implements InputSourceConfiguration
return l(locale, "t3.input.ImportInputSource");
}
+
+ @Override
+ public boolean isUseSamplesOnly() {
+ return useSamplesOnly;
+ }
+
+ @Override
+ public void setUseSamplesOnly(boolean useSamplesOnly) {
+ this.useSamplesOnly = useSamplesOnly;
+ }
+
+ @Override
+ public boolean isCanCreateVirtualActivity() {
+ return canCreateVirtualActivity;
+ }
+
+ @Override
+ public void setCanCreateVirtualActivity(boolean canCreateVirtualActivity) {
+ this.canCreateVirtualActivity = canCreateVirtualActivity;
+ }
+
public Set<Trip> getTripsToImport() {
return tripsToImport;
}
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/InputSourceConfiguration.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/InputSourceConfiguration.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/InputSourceConfiguration.java
@@ -50,6 +50,14 @@ public interface InputSourceConfiguration extends T3ActionConfiguration {
void setCreateVirtualVessel(boolean createVirtualVessel);
+ boolean isUseSamplesOnly();
+
+ void setUseSamplesOnly(boolean useSamplesOnly);
+
+ boolean isCanCreateVirtualActivity();
+
+ void setCanCreateVirtualActivity(boolean canCreateVirtualActivity);
+
T3InputProvider getInputProvider();
void setInputProvider(T3InputProvider inputProvider);
=====================================
t3-domain/src/main/java/fr/ird/t3/entities/data/TripType.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/entities/data/TripType.java
+++ b/t3-domain/src/main/java/fr/ird/t3/entities/data/TripType.java
@@ -10,12 +10,12 @@ package fr.ird.t3.entities.data;
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -23,13 +23,21 @@ package fr.ird.t3.entities.data;
import fr.ird.t3.t3.domain.I18nEnumHelper;
-import static org.nuiton.i18n.I18n.t;
-
public enum TripType {
STANDARD,
SAMPLEONLY,
LOGBOOKMISSING;
+ public static TripType getTripType(boolean useSamplesOnly, boolean canCreateVirtualActivity) {
+ TripType tripType;
+ if (useSamplesOnly) {
+ tripType = SAMPLEONLY;
+ } else {
+ tripType = canCreateVirtualActivity ? LOGBOOKMISSING : STANDARD;
+ }
+ return tripType;
+ }
+
public String getLabel() {
return I18nEnumHelper.getLabel(this);
}
=====================================
t3-domain/src/main/java/fr/ird/t3/io/input/T3InputConfiguration.java
=====================================
--- a/t3-domain/src/main/java/fr/ird/t3/io/input/T3InputConfiguration.java
+++ b/t3-domain/src/main/java/fr/ird/t3/io/input/T3InputConfiguration.java
@@ -8,12 +8,12 @@
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -33,15 +33,13 @@ import java.io.File;
*/
public class T3InputConfiguration {
- protected boolean useWells;
-
- protected boolean canCreateVessel;
-
- protected boolean createVirtualVessel;
-
- protected TripType tripType;
-
- protected File inputFile;
+ private boolean useWells;
+ private boolean canCreateVessel;
+ private boolean createVirtualVessel;
+ private boolean useSamplesOnly;
+ private boolean canCreateVirtualActivity;
+ private TripType tripType;
+ private File inputFile;
private T3TopiaApplicationContext topiaApplicationContext;
@@ -85,6 +83,22 @@ public class T3InputConfiguration {
this.inputFile = inputFile;
}
+ public boolean isUseSamplesOnly() {
+ return useSamplesOnly;
+ }
+
+ public void setUseSamplesOnly(boolean useSamplesOnly) {
+ this.useSamplesOnly = useSamplesOnly;
+ }
+
+ public boolean isCanCreateVirtualActivity() {
+ return canCreateVirtualActivity;
+ }
+
+ public void setCanCreateVirtualActivity(boolean canCreateVirtualActivity) {
+ this.canCreateVirtualActivity = canCreateVirtualActivity;
+ }
+
public T3TopiaApplicationContext getTopiaApplicationContext() {
return topiaApplicationContext;
}
=====================================
t3-web/src/main/java/fr/ird/t3/web/actions/io/input/AnalyzeImportDataAction.java
=====================================
--- a/t3-web/src/main/java/fr/ird/t3/web/actions/io/input/AnalyzeImportDataAction.java
+++ b/t3-web/src/main/java/fr/ird/t3/web/actions/io/input/AnalyzeImportDataAction.java
@@ -8,12 +8,12 @@
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -27,13 +27,14 @@ import fr.ird.t3.entities.data.Trip;
import fr.ird.t3.io.input.T3InputProvider;
import fr.ird.t3.services.DecoratorService;
import fr.ird.t3.web.actions.AbstractRunAction;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.MapUtils;
+
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.MapUtils;
/**
* Analyze the given input source.
@@ -45,15 +46,11 @@ public class AnalyzeImportDataAction extends AbstractRunAction<AnalyzeInputSourc
private static final long serialVersionUID = 1L;
- protected int nbUnsafeTrips;
-
- protected int nbSafeTrips;
-
- protected int nbTripsToReplace;
-
- protected boolean needReplace;
-
- protected boolean valid;
+ private int nbUnsafeTrips;
+ private int nbSafeTrips;
+ private int nbTripsToReplace;
+ private boolean needReplace;
+ private boolean valid;
/** List of all known input providers. */
private List<T3InputProvider> inputProviders;
@@ -64,111 +61,75 @@ public class AnalyzeImportDataAction extends AbstractRunAction<AnalyzeInputSourc
@Override
public void prepare() throws Exception {
-
getT3Session().removeTripListModel();
-
super.prepare();
-
inputProviders = Collections.singletonList(getConfiguration().getInputProvider());
}
- public final List<T3InputProvider> getInputProviders() {
- return inputProviders;
- }
-
public String prepareResult() {
-
- T3ActionContext<AnalyzeInputSourceConfiguration> context =
- getT3ActionContext();
-
- Set<Trip> safeTrips = context.getResultAsSet(
- AnalyzeInputSourceAction.RESULT_SAFE_TRIPS,
- Trip.class
- );
+ T3ActionContext<AnalyzeInputSourceConfiguration> context = getT3ActionContext();
+ Set<Trip> safeTrips = context.getResultAsSet(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, Trip.class);
nbSafeTrips = safeTrips.size();
-
- Set<Trip> unsafeTrips = context.getResultAsSet(
- AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS,
- Trip.class
- );
+ Set<Trip> unsafeTrips = context.getResultAsSet(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, Trip.class);
nbUnsafeTrips = unsafeTrips.size();
-
- boolean canImport = CollectionUtils.isEmpty(unsafeTrips) &&
- CollectionUtils.isNotEmpty(safeTrips);
-
+ boolean canImport = CollectionUtils.isEmpty(unsafeTrips) && CollectionUtils.isNotEmpty(safeTrips);
// action is valid, only if there is some safe trips and no unsafe trip
valid = canImport;
-
Map<Trip, Trip> tripsToReplace;
-
if (canImport) {
-
// find out if there is some existing trip to re-import
-
- tripsToReplace = context.getResultAsMap(
- AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE
- );
+ tripsToReplace = context.getResultAsMap(AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE);
} else {
-
// no trip to replace
tripsToReplace = Collections.emptyMap();
}
-
nbTripsToReplace = tripsToReplace.size();
-
needReplace = MapUtils.isNotEmpty(tripsToReplace);
-
return INPUT;
}
+ @Override
+ protected Map<String, Object> prepareResumeParameters(AnalyzeInputSourceAction action, Exception error, Date startDate, Date endDate) {
+ Map<String, Object> map = super.prepareResumeParameters(action, error, startDate, endDate);
+ T3ActionContext<AnalyzeInputSourceConfiguration> actionContext = getT3ActionContext();
+ Set<Trip> safeTrips = actionContext.getResultAsSet(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, Trip.class);
+ map.put(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, safeTrips);
+ Set<Trip> unsafeTrips = actionContext.getResultAsSet(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, Trip.class);
+ map.put(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, unsafeTrips);
+ Map<Trip, Trip> tripsToReplace = actionContext.getResultAsMap(AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE);
+ map.put(AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE, tripsToReplace);
+ map.put("tripDecorator", getDecorator(Trip.class));
+ map.put("tripDecorator2", getDecorator(Trip.class, DecoratorService.WITH_ID));
+ return map;
+ }
+
+ @SuppressWarnings("unused")
+ public List<T3InputProvider> getInputProviders() {
+ return inputProviders;
+ }
+
+ @SuppressWarnings("unused")
public int getNbUnsafeTrips() {
return nbUnsafeTrips;
}
+ @SuppressWarnings("unused")
public int getNbSafeTrips() {
return nbSafeTrips;
}
+ @SuppressWarnings("unused")
public int getNbTripsToReplace() {
return nbTripsToReplace;
}
+ @SuppressWarnings("unused")
public boolean isValid() {
return valid;
}
+ @SuppressWarnings("unused")
public boolean isNeedReplace() {
return needReplace;
}
-
- @Override
- protected Map<String, Object> prepareResumeParameters(AnalyzeInputSourceAction action,
- Exception error,
- Date startDate,
- Date endDate) {
- Map<String, Object> map = super.prepareResumeParameters(action, error, startDate, endDate);
-
- T3ActionContext<AnalyzeInputSourceConfiguration> actionContext = getT3ActionContext();
-
- Set<Trip> safeTrips = actionContext.getResultAsSet(
- AnalyzeInputSourceAction.RESULT_SAFE_TRIPS,
- Trip.class
- );
- map.put(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, safeTrips);
- Set<Trip> unsafeTrips = actionContext.getResultAsSet(
- AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS,
- Trip.class
- );
- map.put(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, unsafeTrips);
- Map<Trip, Trip> tripsToReplace = actionContext.getResultAsMap(
- AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE
- );
- map.put(AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE, tripsToReplace);
-
- map.put("tripDecorator", getDecorator(Trip.class));
-
- map.put("tripDecorator2",
- getDecorator(Trip.class, DecoratorService.WITH_ID));
- return map;
- }
}
=====================================
t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ConfigureImportDataAction.java
=====================================
--- a/t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ConfigureImportDataAction.java
+++ b/t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ConfigureImportDataAction.java
@@ -8,12 +8,12 @@
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -55,22 +55,21 @@ import java.util.zip.ZipFile;
*/
public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeInputSourceConfiguration> {
- // public static final String RELOAD_ACTION = "reload";
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(ConfigureImportDataAction.class);
- /** Input file that was just uploaded on server */
+ /**
+ * Input file that was just uploaded on server.
+ */
private File sourceToLoad;
- /** Name of file to upload */
+ /**
+ * Name of file to upload.
+ */
private String sourceToLoadFileName;
- /** flag to use strict mode with wells. */
- private boolean useWells;
/**
- * Trip type to use
- *
- * @since 2.3
+ * Flag to use strict mode with wells.
*/
- private TripType tripType = TripType.STANDARD;
+ private boolean useWells;
/**
* flag to authorize creation of missing vessels.
*
@@ -83,6 +82,24 @@ public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeIn
* @since 1.3.1
*/
private boolean createVirtualVessel;
+ /**
+ * Flag to load only samples only trips
+ *
+ * @see TripType#SAMPLEONLY
+ */
+ private boolean useSamplesOnly;
+ /**
+ * Flag to authorize virtual activity creation (when logbooks are missing).
+ * <p>
+ * By default, let's always authorize it.
+ * <p>
+ * <b>Note:</b> This option is always at false if {@link #useSamplesOnly} is on.
+ *
+ * @see TripType#LOGBOOKMISSING
+ * @see TripType#STANDARD
+ */
+ private boolean canCreateVirtualActivity;
+
private long maxSize;
/** List of all known input providers. */
private List<T3InputProvider> inputProviders;
@@ -100,139 +117,79 @@ public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeIn
super(AnalyzeInputSourceConfiguration.class);
}
- public String getMaxSize() {
- return StringUtil.convertMemory(maxSize);
- }
-
- @Inject(StrutsConstants.STRUTS_MULTIPART_MAXSIZE)
- public void setMaxSize(String maxSize) {
- this.maxSize = Long.parseLong(maxSize);
- }
-
@Override
public void prepare() throws Exception {
-
injectOnly(InjectDAO.class);
-
if (!isConfigurationInSession()) {
-
// no yet configuration, can use all input providers
inputProviders = Arrays.asList(getT3InputService().getProviders());
-
} else {
- // as soon as there is a configuration, can only use the
- // inputProvider from it
-
+ // as soon as there is a configuration, can only use the inputProvider from it
inputProviders = Collections.singletonList(getConfiguration().getInputProvider());
}
-
injectOnly(InjectDecoratedBeans.class);
-
if (getTreatmentDirectoryPath() == null) {
-
// first time coming here get a new treatment directory path
-
File workingDirectory = getApplicationConfig().getTreatmentWorkingDirectory();
-
long l = System.nanoTime();
-
File treatmentDirectory = new File(workingDirectory, "importData-" + l);
-
FileUtil.createDirectoryIfNecessary(treatmentDirectory);
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Create a new treatment directory path : %s", treatmentDirectory));
- }
-
+ log.info(String.format("Create a new treatment directory path : %s", treatmentDirectory));
setTreatmentDirectoryPath(treatmentDirectory.getAbsolutePath());
} else {
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Use existing treatment directory %s", getTreatmentDirectoryPath()));
- }
+ log.info(String.format("Use existing treatment directory %s", getTreatmentDirectoryPath()));
}
}
public String doAddSource() throws Exception {
-
- // this action execution purpose is to add a new source to the
- // treatment configuration
- // It will upload the file and place it the correct place (says the
- // temporary directory of the treatment configuration)
-
- // file uploaded on server
+ // this action execution purpose is to add a new source to the treatment configuration
+ // It will upload the file and place it the correct place (says the temporary directory of the treatment configuration)
File upload = getSourceToLoad();
-
if (upload == null) {
-
String message = t("t3.error.required.file.to.upload");
addFieldError("sourceToLoad", message);
log.error(message);
return ERROR;
}
-
// treatment directory
File targetDirectory = getTreatmentDirectory();
-
String filename = getSourceToLoadFileName();
-
if (ZipUtil.isZipFile(upload)) {
-
// let's decompress input stream it
ZipFile zipfile = new ZipFile(upload);
-
Enumeration<? extends ZipEntry> entries = zipfile.entries();
-
if (!entries.hasMoreElements()) {
String message = t("t3.error.required.one.entry.in.zip.to.upload");
addFieldError("sourceToLoad", message);
log.error(message);
return ERROR;
}
-
// get first entry
ZipEntry zipEntry = entries.nextElement();
-
// keep the filename of the zip entry
filename = zipEntry.getName();
-
File target = new File(targetDirectory, filename);
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Will copy loaded zipped entry file %s to treatment configuration directory %s", filename, target));
- }
+ log.info(String.format("Will copy loaded zipped entry file %s to treatment configuration directory %s", filename, target));
try (InputStream in = zipfile.getInputStream(zipEntry)) {
FileUtils.copyInputStreamToFile(in, target);
}
} else {
-
// target file
File target = new File(targetDirectory, filename);
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Will copy loaded file %s to treatment configuration directory %s", upload, target));
- }
-
+ log.info(String.format("Will copy loaded file %s to treatment configuration directory %s", upload, target));
// just copy file
FileUtils.copyFile(upload, target);
}
-
// add the new file to the sources
setLoadedSource(filename);
-
// go back to the configuration definition
return INPUT;
}
public String doDeleteSource() throws Exception {
-
String filename = getLoadedSource();
-
File targetDirectory = getTreatmentDirectory();
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Will delete loaded file %s from %s", filename, targetDirectory));
- }
+ log.info(String.format("Will delete loaded file %s from %s", filename, targetDirectory));
File f = new File(targetDirectory, filename);
if (f.exists()) {
boolean delete = f.delete();
@@ -240,9 +197,7 @@ public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeIn
throw new IOException(String.format("Could not delete file %s on server.", f));
}
}
-
setLoadedSource(null);
-
// go back to the configuration definition
return INPUT;
}
@@ -251,107 +206,143 @@ public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeIn
T3InputProvider inputProvider = getT3InputService().getProvider(getInputProviderId());
File path = getTreatmentDirectory();
String name = getLoadedSource();
-
File inputFile = new File(path, name);
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Will use input provider : %s", inputProvider));
- log.info(String.format("Will use input file : %s", inputFile));
- }
-
- // prepare a new action configuration
- configuration = AnalyzeInputSourceConfiguration.newConfiguration(
- inputProvider,
- inputFile,
- useWells,
- tripType,
- canCreateVessel,
- createVirtualVessel);
-
+ TripType tripType = TripType.getTripType(useSamplesOnly, canCreateVirtualActivity);
+ log.info(String.format("input provider : %s", inputProvider));
+ log.info(String.format("input file : %s", inputFile));
+ log.info(String.format("userWells : %s", useWells));
+ log.info(String.format("tripType : %s", tripType));
+ log.info(String.format("canCreateVessel : %s", canCreateVessel));
+ log.info(String.format("createVirtualVessel : %s", createVirtualVessel));
+ log.info(String.format("canCreateVirtualActivity : %s", canCreateVirtualActivity));
+ log.info(String.format("useSamplesOnly : %s", useSamplesOnly));
+ configuration = AnalyzeInputSourceConfiguration.newConfiguration(inputProvider, inputFile, useWells, canCreateVessel, createVirtualVessel, useSamplesOnly, canCreateVirtualActivity);
prepareActionContext();
return SUCCESS;
}
- public TripType getTripType() {
- return tripType;
+ @SuppressWarnings("unused")
+ public String getMaxSize() {
+ return StringUtil.convertMemory(maxSize);
}
- public void setTripType(TripType tripType) {
- this.tripType = tripType;
+ @SuppressWarnings("unused")
+ @Inject(StrutsConstants.STRUTS_MULTIPART_MAXSIZE)
+ public void setMaxSize(String maxSize) {
+ this.maxSize = Long.parseLong(maxSize);
}
+ @SuppressWarnings("unused")
public Map<String, String> getTripTypes() {
return tripTypes;
}
+ @SuppressWarnings("unused")
public void setTripTypes(Map<String, String> tripTypes) {
this.tripTypes = tripTypes;
}
+ @SuppressWarnings({"unused", "WeakerAccess"})
public File getSourceToLoad() {
return sourceToLoad;
}
+ @SuppressWarnings("unused")
public void setSourceToLoad(File sourceToLoad) {
this.sourceToLoad = sourceToLoad;
}
+ @SuppressWarnings({"unused", "WeakerAccess"})
public String getSourceToLoadFileName() {
return sourceToLoadFileName;
}
+ @SuppressWarnings("unused")
public void setSourceToLoadFileName(String sourceToLoadFileName) {
this.sourceToLoadFileName = sourceToLoadFileName;
}
+ @SuppressWarnings("unused")
public boolean isUseWells() {
return useWells;
}
+ @SuppressWarnings("unused")
public void setUseWells(boolean useWells) {
this.useWells = useWells;
}
+ @SuppressWarnings("unused")
public boolean isCanCreateVessel() {
return canCreateVessel;
}
+ @SuppressWarnings("unused")
public void setCanCreateVessel(boolean canCreateVessel) {
this.canCreateVessel = canCreateVessel;
}
+ @SuppressWarnings("unused")
public boolean isCreateVirtualVessel() {
return createVirtualVessel;
}
+ @SuppressWarnings("unused")
public void setCreateVirtualVessel(boolean createVirtualVessel) {
this.createVirtualVessel = createVirtualVessel;
}
+ @SuppressWarnings({"unused", "WeakerAccess"})
public String getInputProviderId() {
return inputProviderId;
}
+ @SuppressWarnings("unused")
public void setInputProviderId(String inputProviderId) {
this.inputProviderId = inputProviderId;
}
+ @SuppressWarnings({"unused", "WeakerAccess"})
public String getLoadedSource() {
return loadedSource;
}
+ @SuppressWarnings({"unused", "WeakerAccess"})
public void setLoadedSource(String loadedSource) {
this.loadedSource = loadedSource;
}
+ @SuppressWarnings({"unused", "WeakerAccess"})
public String getTreatmentDirectoryPath() {
return treatmentDirectoryPath;
}
+ @SuppressWarnings({"unused", "WeakerAccess"})
public void setTreatmentDirectoryPath(String treatmentDirectoryPath) {
this.treatmentDirectoryPath = treatmentDirectoryPath;
}
+ @SuppressWarnings("unused")
+ public boolean isUseSamplesOnly() {
+ return useSamplesOnly;
+ }
+
+ @SuppressWarnings("unused")
+ public void setUseSamplesOnly(boolean useSamplesOnly) {
+ this.useSamplesOnly = useSamplesOnly;
+ }
+
+ @SuppressWarnings("unused")
+ public boolean isCanCreateVirtualActivity() {
+ return canCreateVirtualActivity;
+ }
+
+ @SuppressWarnings("unused")
+ public void setCanCreateVirtualActivity(boolean canCreateVirtualActivity) {
+ this.canCreateVirtualActivity = canCreateVirtualActivity;
+ }
+
+ @SuppressWarnings("unused")
public final List<T3InputProvider> getInputProviders() {
return inputProviders;
}
=====================================
t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ImportDataAction.java
=====================================
--- a/t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ImportDataAction.java
+++ b/t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ImportDataAction.java
@@ -49,15 +49,15 @@ import java.util.Set;
public class ImportDataAction extends AbstractRunAction<ImportInputSourceConfiguration, ImportInputSourceAction> {
private static final long serialVersionUID = 1L;
-
private static final Log log = LogFactory.getLog(ImportDataAction.class);
private boolean replaceTrip;
private boolean valid;
private int nbImportedTrips;
private int nbDeletedTrips;
-
- /** List of all known input providers. */
+ /**
+ * List of all known input providers.
+ */
private List<T3InputProvider> inputProviders;
public ImportDataAction() {
@@ -70,132 +70,101 @@ public class ImportDataAction extends AbstractRunAction<ImportInputSourceConfigu
inputProviders = Collections.singletonList(getIncomingConfiguration().getInputProvider());
}
- public final List<T3InputProvider> getInputProviders() {
- return inputProviders;
- }
-
- public InputSourceConfiguration getIncomingConfiguration() {
- Object configuration = getT3ActionContext().getConfiguration();
- return (InputSourceConfiguration) configuration;
- }
-
public String prepareImport() {
-
// get the action context from analyze
-
- T3ActionContext<ImportInputSourceConfiguration> actionContext =
- getT3ActionContext();
-
- Set<Trip> safeTrips = actionContext.getResultAsSet(
- AnalyzeInputSourceAction.RESULT_SAFE_TRIPS,
- Trip.class);
-
- Map<Trip, Trip> tripToReplace = actionContext.getResultAsMap(
- AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE
- );
-
- if (log.isInfoEnabled()) {
- log.info("--> Prepare import");
- log.info("Input provider : " + getIncomingConfiguration().getInputProvider());
- log.info("Input file : " + getIncomingConfiguration().getInputFile());
- log.info("Use well : " + getIncomingConfiguration().isUseWells());
- log.info("Trip type : " + getIncomingConfiguration().getTripType());
- log.info("Can Create vessel: " + getIncomingConfiguration().isCanCreateVessel());
- if (getIncomingConfiguration().isCanCreateVessel()) {
- log.info("Create virtual vessel: " + getIncomingConfiguration().isCreateVirtualVessel());
- }
- log.info("Trips to import : " + safeTrips.size());
- log.info("Trips to replace : " + tripToReplace.size());
+ T3ActionContext<ImportInputSourceConfiguration> actionContext = getT3ActionContext();
+ Set<Trip> safeTrips = actionContext.getResultAsSet(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, Trip.class);
+ Map<Trip, Trip> tripToReplace = actionContext.getResultAsMap(AnalyzeInputSourceAction.RESULT_TRIPS_TO_REPLACE);
+ log.info("--> Prepare import");
+ log.info("Input provider : " + getIncomingConfiguration().getInputProvider());
+ log.info("Input file : " + getIncomingConfiguration().getInputFile());
+ log.info("Use well : " + getIncomingConfiguration().isUseWells());
+ log.info("Trip type : " + getIncomingConfiguration().getTripType());
+ log.info("Can Create vessel: " + getIncomingConfiguration().isCanCreateVessel());
+ if (getIncomingConfiguration().isCanCreateVessel()) {
+ log.info("Create virtual vessel: " + getIncomingConfiguration().isCreateVirtualVessel());
}
-
+ log.info("Trips to import : " + safeTrips.size());
+ log.info("Trips to replace : " + tripToReplace.size());
Set<Trip> toImportTrips = new HashSet<>();
Set<Trip> toDeleteTrips = new HashSet<>();
-
if (isReplaceTrip()) {
-
- // will replace existing trips
- // so need to delete before all old trips
+ // will replace existing trips, so need to delete before all old trips
toDeleteTrips.addAll(tripToReplace.keySet());
-
// can import all safe trips
toImportTrips.addAll(safeTrips);
-
} else {
-
// do NOT replace old trip
-
// get all importable trips
toImportTrips.addAll(safeTrips);
-
if (MapUtils.isNotEmpty(tripToReplace)) {
-
// remove the one which reflect existing trips
toImportTrips.removeAll(tripToReplace.values());
}
}
-
// creates the new configuration
-
ImportInputSourceConfiguration configuration = ImportInputSourceConfiguration.newConfiguration(getIncomingConfiguration());
-
configuration.setTripsToImport(toImportTrips);
-
configuration.setTripsToDelete(toDeleteTrips);
-
- t3ActionContext = getServiceFactory().newT3ActionContext(configuration, getServiceContext()
- );
- if (log.isInfoEnabled()) {
- log.info("Created action context " + t3ActionContext);
- }
+ t3ActionContext = getServiceFactory().newT3ActionContext(configuration, getServiceContext());
+ log.info("Created action context " + t3ActionContext);
getT3Session().setActionContext(t3ActionContext);
-
return SUCCESS;
}
public String prepareResult() {
-
Set<Trip> importedTrips = getConfiguration().getTripsToImport();
-
nbImportedTrips = importedTrips.size();
+ Set<Trip> deletedTrips = getConfiguration().getTripsToDelete();
+ nbDeletedTrips = deletedTrips.size();
+ return INPUT;
+ }
- Set<Trip> deletedeTrips = getConfiguration().getTripsToDelete();
+ @Override
+ protected Map<String, Object> prepareResumeParameters(ImportInputSourceAction action, Exception error, Date startDate, Date endDate) {
+ Map<String, Object> map = super.prepareResumeParameters(action, error, startDate, endDate);
+ map.put("tripDecorator", getDecorator(Trip.class, DecoratorService.WITH_ID));
+ return map;
+ }
- nbDeletedTrips = deletedeTrips.size();
+ @SuppressWarnings("unused")
+ public List<T3InputProvider> getInputProviders() {
+ return inputProviders;
+ }
- return INPUT;
+ @SuppressWarnings("WeakerAccess")
+ public InputSourceConfiguration getIncomingConfiguration() {
+ Object configuration = getT3ActionContext().getConfiguration();
+ return (InputSourceConfiguration) configuration;
}
+ @SuppressWarnings("unused")
public boolean isValid() {
return valid;
}
+ @SuppressWarnings("unused")
public void setValid(boolean valid) {
this.valid = valid;
}
+ @SuppressWarnings("unused")
public int getNbImportedTrips() {
return nbImportedTrips;
}
+ @SuppressWarnings("unused")
public int getNbDeletedTrips() {
return nbDeletedTrips;
}
+ @SuppressWarnings("WeakerAccess")
public boolean isReplaceTrip() {
return replaceTrip;
}
+ @SuppressWarnings("unused")
public void setReplaceTrip(boolean replaceTrip) {
this.replaceTrip = replaceTrip;
}
-
- @Override
- protected Map<String, Object> prepareResumeParameters(ImportInputSourceAction action,
- Exception error,
- Date startDate,
- Date endDate) {
- Map<String, Object> map = super.prepareResumeParameters(action, error, startDate, endDate);
- map.put("tripDecorator", getDecorator(Trip.class, DecoratorService.WITH_ID));
- return map;
- }
}
=====================================
t3-web/src/main/resources/i18n/t3-web_en_GB.properties
=====================================
--- a/t3-web/src/main/resources/i18n/t3-web_en_GB.properties
+++ b/t3-web/src/main/resources/i18n/t3-web_en_GB.properties
@@ -1,3 +1,4 @@
+t3.common.canCreateVirtualActivity=Authorize to create virtaul activities (for trips with missing logbook)
t3.action.applyFilter=Apply
t3.action.back.to.configuration.step1=Back to step 1 of configuration
t3.action.back.to.configuration.step2=Back to step 2 of configuration
=====================================
t3-web/src/main/resources/i18n/t3-web_fr_FR.properties
=====================================
--- a/t3-web/src/main/resources/i18n/t3-web_fr_FR.properties
+++ b/t3-web/src/main/resources/i18n/t3-web_fr_FR.properties
@@ -13,6 +13,7 @@ t3.action.delete=Supprimer
t3.action.deleteComputedData=Suppression des données calculées
t3.action.deleteTrips=Suppression des marées
t3.action.detail=Détails
+t3.common.canCreateVirtualActivity=Autoriser la création d'acitivités fictive (pour les marées sans livre de bord)
t3.action.dolog=S'authentifier
t3.action.edit=Editer
t3.action.getUserLog=Télécharger le fichier de logs
=====================================
t3-web/src/main/webapp/WEB-INF/jsp/io/input/analyzeImportDataResult.jsp
=====================================
--- a/t3-web/src/main/webapp/WEB-INF/jsp/io/input/analyzeImportDataResult.jsp
+++ b/t3-web/src/main/webapp/WEB-INF/jsp/io/input/analyzeImportDataResult.jsp
@@ -29,9 +29,7 @@
<jsp:include page="importDataConfigResume.jsp"/>
<s:if test="valid">
-
<%-- Can do the import --%>
-
<p>
<s:text name="t3.label.message.trips.safe.to.import">
<s:param>
@@ -39,27 +37,20 @@
</s:param>
</s:text>
</p>
-
- <s:form method="post" validate="true" namespace="/io">
+ <s:form method="post" validate="true" namespace="/io">
<s:if test="needReplace">
<strong>
- <s:text name="t3.label.message.trips.to.replace">
- <s:param>
- <s:property value="%{nbTripsToReplace}"/>
- </s:param>
- </s:text>
+ <s:text name="t3.label.message.trips.to.replace">
+ <s:param>
+ <s:property value="%{nbTripsToReplace}"/>
+ </s:param>
+ </s:text>
</strong>
<s:checkbox name="replaceTrip" key="t3.question.confirm.to.replace.trip" value="%{false}"/>
-
</s:if>
-
- <s:submit action="prepareImportData"
- key="t3.action.importData.doImport"
- align="right"/>
-
+ <s:submit action="prepareImportData" key="t3.action.importData.doImport" align="right"/>
</s:form>
-
</s:if>
<s:else>
<p>
=====================================
t3-web/src/main/webapp/WEB-INF/jsp/io/input/configureImportData.jsp
=====================================
--- a/t3-web/src/main/webapp/WEB-INF/jsp/io/input/configureImportData.jsp
+++ b/t3-web/src/main/webapp/WEB-INF/jsp/io/input/configureImportData.jsp
@@ -25,41 +25,47 @@
<script type="text/javascript">
- jQuery(document).ready(function () {
-
- function changeCanCreateVessel(val) {
- var container = $('[name="createVirtualVessel"]');
- if (val) {
- container.attr('disabled', false);
- container.prop('checked', true);
- } else {
- container.attr('disabled', true);
- }
- }
-
- $('[name="canCreateVessel"]').change(function () {
- changeCanCreateVessel($(this).prop('checked'));
+ jQuery(document).ready(function () {
+ function changeCanCreateVessel(val) {
+ var container = $('[name="createVirtualVessel"]');
+ if (val) {
+ container.attr('disabled', false);
+ container.prop('checked', true);
+ } else {
+ container.attr('disabled', true);
+ }
+ }
+ function changeUseSamplesOnly(val) {
+ var container = $('[name="canCreateVirtualActivity"]');
+ if (val) {
+ container.attr('disabled', false);
+ container.prop('checked', true);
+ } else {
+ container.attr('disabled', true);
+ container.attr('checked', true);
+ }
+ }
+
+ $('[name="canCreateVessel"]').change(function () {
+ changeCanCreateVessel($(this).prop('checked'));
+ });
+ $('[name="useSamplesOnly"]').change(function () {
+ changeUseSamplesOnly($(this).prop('checked'));
+ });
+ changeCanCreateVessel(<s:property value="%{canCreateVessel}"/>);
+ changeUseSamplesOnly(<s:property value="%{useSamplesOnly}"/>);
});
-
- changeCanCreateVessel(<s:property value="%{canCreateVessel}"/>);
- });
</script>
<title><s:text name="t3.label.data.configureImportData"/></title>
-
<h2><s:text name="t3.label.data.configureImportData"/></h2>
<s:form method="post" validate="true" enctype="multipart/form-data" namespace="/io">
-
<s:hidden key="treatmentDirectoryPath" label=''/>
-
- <s:select key="inputProviderId" list="inputProviders" label='%{getText("t3.common.inputProvider")}' listKey="id" listValue="libelle" requiredLabel="true"/>
-
+ <s:select key="inputProviderId" list="inputProviders" label='%{getText("t3.common.inputProvider")}' listKey="id"
+ listValue="libelle" requiredLabel="true"/>
<s:if test="loadedSource==null">
-
<s:hidden name="useWells" value="%{useWells}"/>
-
<s:file name="sourceToLoad" requiredLabel="true" label='%{getText("t3.common.sourceToUpload")} (*)'/>
-
<s:submit action="configureImportData!doAddSource" key="t3.action.importData.addSource" align="right"/>
<br/>
@@ -68,17 +74,14 @@
<s:param value="%{maxSize}"/>
</s:text>
</div>
-
</s:if>
<s:else>
-
<s:hidden key="loadedSource" label=''/>
-
- <s:textfield value="%{loadedSource}" key="t3.common.uploaded.source" disabled="true" requiredLabel="true" size="40"/>
-
+ <s:textfield value="%{loadedSource}" key="t3.common.uploaded.source" disabled="true" requiredLabel="true"
+ size="40"/>
<s:checkbox key="useWells" label='%{getText("t3.common.force.useWells")}'/>
-
- <s:select key="tripType" list="tripTypes" label='%{getText("t3.common.tripType")}' requiredLabel="true"/>
+ <s:checkbox key="samplesOnly" label='%{getText("t3.common.useSamplesOnly")}'/>
+ <s:checkbox key="canCreateVirtualActivity" label='%{getText("t3.common.canCreateVirtualActivity")}'/>
<s:checkbox key="canCreateVessel" label='%{getText("t3.common.canCreateVessel")}'/>
<s:checkbox key="createVirtualVessel" label='%{getText("t3.common.createVirtualVessel")}'/>
<s:submit action="configureImportData!doDeleteSource" key="t3.action.importData.deleteSource" align="right"/>
=====================================
t3-web/src/main/webapp/WEB-INF/jsp/io/input/importDataConfigResume.jsp
=====================================
--- a/t3-web/src/main/webapp/WEB-INF/jsp/io/input/importDataConfigResume.jsp
+++ b/t3-web/src/main/webapp/WEB-INF/jsp/io/input/importDataConfigResume.jsp
@@ -22,21 +22,23 @@
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
<fieldset>
-
<legend>
<s:text name="t3.label.importData.config.resume"/>
</legend>
-
<s:form>
- <s:select key="t3.common.inputProvider" list="inputProviders" listKey="id" listValue="libelle" value="%{configuration.inputProvider.id}" disabled="true"/>
+ <s:select key="t3.common.inputProvider" list="inputProviders" listKey="id" listValue="libelle"
+ value="%{configuration.inputProvider.id}" disabled="true"/>
<s:textfield value="%{configuration.inputFile.name}" key="t3.common.uploaded.source" disabled="true" size="40"/>
<s:label key="t3.common.useWells" value=""/>
<s:checkbox name="useWells" value="%{configuration.useWells}" disabled="true" key="t3.common.force.useWells"/>
- <s:select key="tripType" list="tripTypes" label='%{getText("t3.common.tripType")}' disabled="true" value="%{configuration.tripType}" />
- <s:checkbox name="canCreateVessel" value="%{configuration.canCreateVessel}" disabled="true" key="t3.common.canCreateVessel"/>
+ <s:checkbox name="samplesOnly" value="%{configuration.samplesOnly}" disabled="true" key="t3.common.samplesOnly"/>
+ <s:checkbox name="canCreateVirtualActivity" value="%{configuration.canCreateVirtualActivity}" disabled="true"
+ key="t3.common.canCreateVirtualActivity"/>
+ <s:checkbox name="canCreateVessel" value="%{configuration.canCreateVessel}" disabled="true"
+ key="t3.common.canCreateVessel"/>
<s:if test="configuration.canCreateVessel">
- <s:checkbox name="createVirtualVessel" value="%{configuration.createVirtualVessel}" disabled="true" key="t3.common.createVirtualVessel"/>
+ <s:checkbox name="createVirtualVessel" value="%{configuration.createVirtualVessel}" disabled="true"
+ key="t3.common.createVirtualVessel"/>
</s:if>
</s:form>
-
</fieldset>
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/61b98792f5980af836d9efdac66bf290…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/61b98792f5980af836d9efdac66bf290…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-t3][develop] 2 commits: Marées sans logbooks : gestion de leurs échantillons - ajout de check de…
by Tony CHEMIT 09 Mar '18
by Tony CHEMIT 09 Mar '18
09 Mar '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
9eb8f862 by Tony CHEMIT at 2018-03-09T09:45:26Z
Marées sans logbooks : gestion de leurs échantillons - ajout de check de cohérence sur Trip.logbookAvaibility (See #116) + fix typo
- - - - -
86b9dff7 by Tony CHEMIT at 2018-03-09T09:45:29Z
update test fixtures for ATL and IND
- - - - -
30 changed files:
- .gitlab-ci.yml
- t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF1Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceAction.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionITSupport.java
- + t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeAvdthTestSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeInputSourceActionTestSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/ImportInputSourceActionTestSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/MSAccessTestConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/OceanFixtures.java
- t3-actions/src/main/resources/ftl/fr/ird/t3/actions/data/level3/Level3Action_en.ftl
- t3-actions/src/main/resources/i18n/t3-actions_en_GB.properties
- t3-actions/src/main/resources/i18n/t3-actions_fr_FR.properties
- t3-actions/src/test/java/fr/ird/t3/actions/data/level0/ComputeRF1ActionResumeTest.java
- t3-domain/src/main/java/fr/ird/t3/entities/T3Predicates.java
- t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java
- t3-domain/src/main/java/fr/ird/t3/entities/data/TripImpl.java
- t3-domain/src/main/java/fr/ird/t3/io/input/T3Input.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/AbstractT3InputMSAccess.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AccessDataSource.java
- t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AvdthDataEntityVisitor.java
- t3-domain/src/main/resources/db/migration/V2_3_01_add-Trip-tripType.sql
- t3-domain/src/main/xmi/t3-persistence.zargo
- t3-domain/src/test/java/fr/ird/t3/entities/reference/WeightCategoryTreatmentImplTest.java
- t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3InputAvdth33.java
- + t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeAvdthTestV35Atlantic.java
- + t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeAvdthTestV35Indian.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AtlanticOceanFixtures.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/IndianOceanFixtures.java
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/36231216ca3c310b355506044f36d03…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/36231216ca3c310b355506044f36d03…
You're receiving this email because of your account on gitlab.com.
1
0
08 Mar '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
36231216 by Tony CHEMIT at 2018-03-08T23:39:09Z
update test fixtures for ATL and IND
- - - - -
15 changed files:
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
- + t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeAvdthTestSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeInputSourceActionTestSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/MSAccessTestConfiguration.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/OceanFixtures.java
- + t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeAvdthTestV35Atlantic.java
- + t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeAvdthTestV35Indian.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AtlanticOceanFixtures.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/IndianOceanFixtures.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanIT.java
- + t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanRecentIT.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionAtlanticOceanIT.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV35TestAtlanticOcean.java
- + t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV35TestAtlanticOceanRecent.java
Changes:
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
@@ -94,7 +94,7 @@ public abstract class AnalyzeInputSourceActionITSupport {
if (doIt) {
String dbName = msConfig.dbName;
log.debug("Do test for db " + dbName);
- outputFile = new File(serviceContext.getTestDir(), "result.txt");
+ outputFile = new File(serviceContext.getTestDir().getParentFile().getParentFile(), dbName.replace(".mdb","-result.txt"));
log.info("Will save result in file : " + outputFile);
outputWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile)));
File workingDirectory = serviceContext.getApplicationConfiguration().getTreatmentWorkingDirectory("yo", true);
@@ -113,30 +113,28 @@ public abstract class AnalyzeInputSourceActionITSupport {
if (outputWriter != null) {
outputWriter.flush();
outputWriter.close();
+ log.info(new String(Files.readAllBytes(outputFile.toPath())));
}
}
-
void testExecute(OceanFixtures fixture) throws Exception {
- testExecute(
- fixture.nbSafe(),
- fixture.nbUnsafe(),
- fixture.nbSafeWithoutWell(),
- fixture.nbUnsafeWithoutWell(),
- TripType.STANDARD,
- false,
- false
- );
+ testExecute(fixture, TripType.STANDARD);
+ }
+ void testExecute(OceanFixtures fixture, TripType tripType) throws Exception {
+ serviceContext.getMsConfig().setUseWells(false);
+ testExecute(fixture.nbSafe(), fixture.nbUnsafe(), fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), tripType, false, false);
+// serviceContext.getMsConfig().setUseWells(true);
+// testExecute(fixture.nbSafe(), fixture.nbUnsafe(), fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), TripType.STANDARD, false, false);
}
public void testExecute(int nbSafe,
int nbUnsafe,
- int nbSafeWithoutwell,
+ int nbSafeWithoutWell,
int nbUnsafeWithoutWell) throws Exception {
testExecute(
nbSafe,
nbUnsafe,
- nbSafeWithoutwell,
+ nbSafeWithoutWell,
nbUnsafeWithoutWell,
TripType.STANDARD,
false,
@@ -168,13 +166,16 @@ public abstract class AnalyzeInputSourceActionITSupport {
Set<Trip> unsafeTrips = action.getResultAsSet(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, Trip.class);
Assert.assertNotNull(unsafeTrips);
outputWriter.write(String.format("found %d unsafe trip(s).\n", unsafeTrips.size()));
+
+ log.info(String.format("\n[%s](useWells?%b) safe : %d - unsafe : %d\n", msConfig.dbName, msConfig.isUseWells(), safeTrips.size(), unsafeTrips.size()));
+
List<String> messages;
- if (log.isWarnEnabled()) {
+ if (msConfig.isLogWarnings() && log.isWarnEnabled()) {
messages = action.getWarnMessages();
if (CollectionUtils.isNotEmpty(messages)) {
for (String message : messages) {
- log.warn(String.format("[WARNING] %s\n", message));
-// outputWriter.write(String.format("[WARNING] %s\n", message));
+// log.debug(String.format("[WARNING] %s", message));
+ outputWriter.write(String.format("[WARNING] %s\n", message));
}
}
}
@@ -187,9 +188,6 @@ public abstract class AnalyzeInputSourceActionITSupport {
}
}
- outputWriter.flush();
- log.info(String.format("\n[%s] safe : %d - unsafe : %d\n", msConfig.dbName, safeTrips.size(), unsafeTrips.size()));
- log.info(new String(Files.readAllBytes(outputFile.toPath())));
if (msConfig.isUseWells()) {
Assert.assertEquals(nbSafe, safeTrips.size());
Assert.assertEquals(nbUnsafe, unsafeTrips.size());
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeAvdthTestSupport.java
=====================================
--- /dev/null
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeAvdthTestSupport.java
@@ -0,0 +1,178 @@
+/*
+ * #%L
+ * T3 :: Actions
+ * %%
+ * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ird.t3.actions.io.input.test;
+
+import fr.ird.t3.actions.T3Action;
+import fr.ird.t3.actions.T3ActionContext;
+import fr.ird.t3.actions.io.input.AnalyzeInputSourceAction;
+import fr.ird.t3.actions.io.input.AnalyzeInputSourceConfiguration;
+import fr.ird.t3.entities.data.Trip;
+import fr.ird.t3.entities.data.TripType;
+import fr.ird.t3.io.input.T3InputProvider;
+import fr.ird.t3.services.T3InputService;
+import fr.ird.t3.services.T3ServiceFactory;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Tony Chemit - dev(a)tchemit.fr
+ * @since 1.0
+ */
+(a)RunWith(Parameterized.class)
+public abstract class AnalyzeAvdthTestSupport {
+
+ @ClassRule
+ public static final FakeT3AvdthServiceContext serviceContext = new FakeT3AvdthServiceContext(true, null);
+ private static final Log log = LogFactory.getLog(AnalyzeAvdthTestSupport.class);
+ @Parameterized.Parameter
+ public OceanFixtures fixtures;
+
+ private BufferedWriter outputWriter;
+ private File target;
+ private T3InputProvider inputProvider;
+ private MSAccessTestConfiguration msConfig;
+
+ @AfterClass
+ public static void afterClass() {
+ serviceContext.close();
+ }
+
+ protected abstract MSAccessTestConfiguration createConfiguration();
+
+ @Before
+ public void setUp() throws IOException {
+
+ msConfig = createConfiguration();
+ boolean initOk = serviceContext.isInitOk() && msConfig.setup(fixtures);
+ Assume.assumeTrue("Could not init db", initOk);
+
+ String dbName = msConfig.dbName;
+ log.debug(String.format("Do test for db %s", dbName));
+ File outputFile = new File(serviceContext.getTestDir().getParentFile().getParentFile(), dbName.replace(".mdb", (msConfig.isUseWells() ? "-useWells" : "") + "-result.txt"));
+ log.info(String.format("Will save result in file : %s", outputFile));
+ outputWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile)));
+ File workingDirectory = serviceContext.getApplicationConfiguration().getTreatmentWorkingDirectory("yo", true);
+ // push in treatment directory the base to import
+ target = new File(workingDirectory, dbName);
+ log.debug(String.format("Will copy msAccess from %s to %s", msConfig.accessFile, target));
+ FileUtils.copyFile(msConfig.accessFile, target);
+ T3InputService inputService = serviceContext.newService(T3InputService.class);
+ inputProvider = inputService.getProvider(msConfig.getProviderId());
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (outputWriter != null) {
+ outputWriter.flush();
+ outputWriter.close();
+ }
+ }
+
+ @Test
+ public void testExecute() throws Exception {
+
+ boolean useWells = msConfig.isUseWells();
+ int nbSafe = fixtures.nbSafe(useWells);
+ int nbUnsafe = fixtures.nbUnsafe(useWells);
+ TripType tripType = msConfig.getTripType();
+ if (tripType == null) {
+ tripType = TripType.STANDARD;
+ }
+ FakeT3AvdthServiceContext serviceContext = getServiceContext();
+
+ T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
+ AnalyzeInputSourceConfiguration actionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
+ getInputProvider(), getTarget(), useWells, tripType, false, false);
+
+ T3ActionContext<AnalyzeInputSourceConfiguration> context = serviceFactory.newT3ActionContext(actionConfiguration, serviceContext);
+
+ BufferedWriter outputWriter = getOutputWriter();
+ outputWriter.write("----------------------------------------------------\n");
+ outputWriter.write(msConfig.getAccessFile() + "\n");
+ T3Action<AnalyzeInputSourceConfiguration> action;
+
+ action = serviceFactory.newT3Action(AnalyzeInputSourceAction.class, context);
+ Assert.assertNotNull(action);
+ action.run();
+
+ Set<Trip> safeTrips = action.getResultAsSet(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, Trip.class);
+ Assert.assertNotNull(safeTrips);
+ outputWriter.write(String.format("found %d safe trip(s).\n", safeTrips.size()));
+ Set<Trip> unsafeTrips = action.getResultAsSet(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, Trip.class);
+ Assert.assertNotNull(unsafeTrips);
+ outputWriter.write(String.format("found %d unsafe trip(s).\n", unsafeTrips.size()));
+ List<String> messages;
+ if (msConfig.isLogWarnings() && log.isWarnEnabled()) {
+ messages = action.getWarnMessages();
+ if (CollectionUtils.isNotEmpty(messages)) {
+ for (String message : messages) {
+ outputWriter.write(String.format("[WARNING] %s\n", message));
+ }
+ }
+ }
+ if (log.isErrorEnabled()) {
+ messages = action.getErrorMessages();
+ if (CollectionUtils.isNotEmpty(messages)) {
+ for (String message : messages) {
+ outputWriter.write(String.format("[ERROR] %s\n", message));
+ }
+ }
+ }
+ log.info(String.format("\n[%s] (useWells?%b) safe : %d - unsafe : %d\n", msConfig.getDbName(), useWells, safeTrips.size(), unsafeTrips.size()));
+ Assert.assertEquals(nbSafe, safeTrips.size());
+ Assert.assertEquals(nbUnsafe, unsafeTrips.size());
+ }
+
+ public FakeT3AvdthServiceContext getServiceContext() {
+ return serviceContext;
+ }
+
+ public BufferedWriter getOutputWriter() {
+ return outputWriter;
+ }
+
+ public File getTarget() {
+ return target;
+ }
+
+ public T3InputProvider getInputProvider() {
+ return inputProvider;
+ }
+}
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeInputSourceActionTestSupport.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeInputSourceActionTestSupport.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/AnalyzeInputSourceActionTestSupport.java
@@ -183,4 +183,56 @@ public abstract class AnalyzeInputSourceActionTestSupport {
}
}
}
+
+ protected void testExecute2(OceanFixtures fixture, TripType tripType) throws Exception {
+
+ MSAccessTestConfiguration msConfig = getMsConfig();
+ boolean useWells = msConfig.isUseWells();
+ int nbSafe = fixture.nbSafe(useWells);
+ int nbUnsafe = fixture.nbUnsafe(useWells);
+
+ FakeT3AvdthServiceContext serviceContext = getServiceContext();
+
+ T3ServiceFactory serviceFactory = serviceContext.getServiceFactory();
+ AnalyzeInputSourceConfiguration actionConfiguration = AnalyzeInputSourceConfiguration.newConfiguration(
+ getInputProvider(), getTarget(), useWells, tripType, false, false);
+
+ T3ActionContext<AnalyzeInputSourceConfiguration> context = serviceFactory.newT3ActionContext(actionConfiguration, serviceContext);
+
+ BufferedWriter outputWriter = getOutputWriter();
+ outputWriter.write("----------------------------------------------------\n");
+ outputWriter.write(msConfig.getAccessFile() + "\n");
+ T3Action<AnalyzeInputSourceConfiguration> action;
+
+ action = serviceFactory.newT3Action(AnalyzeInputSourceAction.class, context);
+ Assert.assertNotNull(action);
+ action.run();
+
+ Set<Trip> safeTrips = action.getResultAsSet(AnalyzeInputSourceAction.RESULT_SAFE_TRIPS, Trip.class);
+ Assert.assertNotNull(safeTrips);
+ outputWriter.write(String.format("found %d safe trip(s).\n", safeTrips.size()));
+ Set<Trip> unsafeTrips = action.getResultAsSet(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, Trip.class);
+ Assert.assertNotNull(unsafeTrips);
+ outputWriter.write(String.format("found %d unsafe trip(s).\n", unsafeTrips.size()));
+ List<String> messages;
+ if (msConfig.isLogWarnings() && log.isWarnEnabled()) {
+ messages = action.getWarnMessages();
+ if (CollectionUtils.isNotEmpty(messages)) {
+ for (String message : messages) {
+ outputWriter.write(String.format("[WARNING] %s\n", message));
+ }
+ }
+ }
+ if (log.isErrorEnabled()) {
+ messages = action.getErrorMessages();
+ if (CollectionUtils.isNotEmpty(messages)) {
+ for (String message : messages) {
+ outputWriter.write(String.format("[ERROR] %s\n", message));
+ }
+ }
+ }
+ log.info(String.format("\n[%s] (useWells?%b) safe : %d - unsafe : %d\n", msConfig.getDbName(), useWells, safeTrips.size(), unsafeTrips.size()));
+ Assert.assertEquals(nbSafe, safeTrips.size());
+ Assert.assertEquals(nbUnsafe, unsafeTrips.size());
+ }
}
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/MSAccessTestConfiguration.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/MSAccessTestConfiguration.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/MSAccessTestConfiguration.java
@@ -20,6 +20,7 @@
*/
package fr.ird.t3.actions.io.input.test;
+import fr.ird.t3.entities.data.TripType;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -51,6 +52,8 @@ public class MSAccessTestConfiguration {
private Boolean executeAll;
private File dbBasedir;
private boolean useWells;
+ private boolean logWarnings;
+ private TripType tripType;
public MSAccessTestConfiguration(String testNamePattern, String dbPattern, String providerId) {
this.testNamePattern = Pattern.compile(testNamePattern);
@@ -185,7 +188,55 @@ public class MSAccessTestConfiguration {
return useWells;
}
+ public void setUseWells(boolean useWells) {
+ this.useWells = useWells;
+ }
+
public String getProviderId() {
return providerId;
}
+
+ public boolean isLogWarnings() {
+ return logWarnings;
+ }
+
+ public void setLogWarnings(boolean logWarnings) {
+ this.logWarnings = logWarnings;
+ }
+
+ public boolean setup(OceanFixtures fixtures) {
+ String[] split = DB_PATH.split(":");
+ dbBasedir = getBasedir();
+ for (String s1 : split) {
+ dbBasedir = new File(dbBasedir, s1);
+ }
+ if (!dbBasedir.exists()) {
+ log.warn(String.format("Db directory [%s] does not exist, will skip test.", dbBasedir));
+ return false;
+ }
+ log.info(String.format("Db directory [%s] detected, will do tests.", dbBasedir));
+
+ String[] fixtureName = fixtures.toString().split("_");
+ String ocean = fixtureName[0];
+ String group = fixtureName[1];
+ dbName = String.format(dbPattern, ocean, group);
+ accessFile = new File(new File(dbBasedir, ocean), dbName);
+ boolean exists = accessFile.exists();
+ if (!exists) {
+ log.warn(String.format("Could not find access file %s", accessFile));
+ return false;
+ }
+ log.debug(String.format("DbName = %s", dbName));
+
+ execute = true;
+ return true;
+ }
+
+ public void setTripType(TripType tripType) {
+ this.tripType = tripType;
+ }
+
+ public TripType getTripType() {
+ return tripType;
+ }
}
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/OceanFixtures.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/OceanFixtures.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/OceanFixtures.java
@@ -10,12 +10,12 @@ package fr.ird.t3.actions.io.input.test;
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -28,11 +28,19 @@ package fr.ird.t3.actions.io.input.test;
*/
public interface OceanFixtures {
- int nbSafe() ;
+ default int nbSafe(boolean useWells) {
+ return useWells ? nbSafe() : nbSafeWithoutWell();
+ }
+
+ default int nbUnsafe(boolean useWells) {
+ return useWells ? nbUnsafe() : nbUnsafeWithoutWell();
+ }
+
+ int nbSafe();
- int nbUnsafe() ;
+ int nbUnsafe();
int nbSafeWithoutWell();
- int nbUnsafeWithoutWell() ;
+ int nbUnsafeWithoutWell();
}
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeAvdthTestV35Atlantic.java
=====================================
--- /dev/null
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeAvdthTestV35Atlantic.java
@@ -0,0 +1,54 @@
+package fr.ird.t3.actions.io.input;
+
+/*-
+ * #%L
+ * T3 :: Input AVDTH v 35
+ * %%
+ * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import fr.ird.t3.actions.io.input.test.AnalyzeAvdthTestSupport;
+import fr.ird.t3.actions.io.input.test.MSAccessTestConfiguration;
+import fr.ird.t3.entities.data.TripType;
+import fr.ird.t3.io.input.avdth.v35.T3InputProviderAvdth35;
+import org.junit.Ignore;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Created by tchemit on 08/03/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ */
+@Ignore
+public class AnalyzeAvdthTestV35Atlantic extends AnalyzeAvdthTestSupport {
+
+ @Parameterized.Parameters
+ public static List<AtlanticOceanFixtures> data() {
+ return Arrays.asList(AtlanticOceanFixtures.values());
+ }
+
+ @Override
+ protected MSAccessTestConfiguration createConfiguration() {
+ MSAccessTestConfiguration configuration = new MSAccessTestConfiguration("testExecute_([^_]*)_(\\d+)(_.+)*", "%s_%s_V35.mdb", T3InputProviderAvdth35.ID);
+ configuration.setUseWells(false);
+ configuration.setTripType(TripType.LOGBOOKMISSING);
+ return configuration;
+ }
+}
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeAvdthTestV35Indian.java
=====================================
--- /dev/null
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeAvdthTestV35Indian.java
@@ -0,0 +1,54 @@
+package fr.ird.t3.actions.io.input;
+
+/*-
+ * #%L
+ * T3 :: Input AVDTH v 35
+ * %%
+ * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import fr.ird.t3.actions.io.input.test.AnalyzeAvdthTestSupport;
+import fr.ird.t3.actions.io.input.test.MSAccessTestConfiguration;
+import fr.ird.t3.entities.data.TripType;
+import fr.ird.t3.io.input.avdth.v35.T3InputProviderAvdth35;
+import org.junit.Ignore;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Created by tchemit on 08/03/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ */
+@Ignore
+public class AnalyzeAvdthTestV35Indian extends AnalyzeAvdthTestSupport {
+
+ @Parameterized.Parameters
+ public static List<IndianOceanFixtures> data() {
+ return Arrays.asList(IndianOceanFixtures.values());
+ }
+
+ @Override
+ protected MSAccessTestConfiguration createConfiguration() {
+ MSAccessTestConfiguration configuration = new MSAccessTestConfiguration("testExecute_([^_]*)_(\\d+)(_.+)*", "%s_%s_V35.mdb", T3InputProviderAvdth35.ID);
+ configuration.setUseWells(false);
+ configuration.setTripType(TripType.LOGBOOKMISSING);
+ return configuration;
+ }
+}
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
@@ -46,6 +46,11 @@ public class AnalyzeInputSourceActionTest extends AnalyzeInputSourceActionTestSu
}
@Test
+ public void testExecute_OA_1980() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_1980, TripType.LOGBOOKMISSING);
+ }
+
+ @Test
public void testExecute_OI_2000() throws Exception {
testExecute(IndianOceanFixtures.OI_2000);
}
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AtlanticOceanFixtures.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AtlanticOceanFixtures.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AtlanticOceanFixtures.java
@@ -30,73 +30,74 @@ import fr.ird.t3.actions.io.input.test.OceanFixtures;
*/
public enum AtlanticOceanFixtures implements OceanFixtures {
- OA_1960(318, 36, 352, 2),
- OA_1961(298, 63, 361, 0),
- OA_1962(184, 133, 317, 0),
- OA_1963(218, 157, 375, 0),
- OA_1964(121, 61, 182, 0),
- OA_1965(93, 31, 124, 0),
- OA_1966(70, 27, 97, 0),
- OA_1967(53, 27, 80, 0),
- OA_1968(46, 14, 60, 0),
- OA_1969(64, 21, 86, 0),
-
- OA_1970(318, 36, 352, 2),
- OA_1971(298, 63, 361, 0),
- OA_1972(184, 133, 317, 0),
- OA_1973(218, 157, 375, 0),
- OA_1974(121, 61, 182, 0),
- OA_1975(93, 31, 124, 0),
- OA_1976(70, 27, 97, 0),
- OA_1977(53, 27, 80, 0),
- OA_1978(46, 14, 60, 0),
- OA_1979(64, 21, 86, 0),
-
- OA_1980(318, 36, 352, 2),
- OA_1981(298, 63, 361, 0),
- OA_1982(184, 133, 317, 0),
- OA_1983(218, 157, 375, 0),
- OA_1984(121, 61, 182, 0),
- OA_1985(93, 31, 124, 0),
- OA_1986(70, 27, 97, 0),
- OA_1987(53, 27, 80, 0),
- OA_1988(46, 14, 60, 0),
- OA_1989(64, 21, 86, 0),
-
- OA_1990(318, 36, 352, 2),
- OA_1991(298, 63, 361, 0),
- OA_1992(184, 133, 317, 0),
- OA_1993(218, 157, 375, 0),
- OA_1994(121, 61, 182, 0),
- OA_1995(93, 31, 124, 0),
- OA_1996(70, 27, 97, 0),
- OA_1997(53, 27, 80, 0),
- OA_1998(46, 14, 60, 0),
- OA_1999(64, 21, 86, 0),
+ OA_1960(151, 0),
+ OA_1961(159, 0),
+ OA_1962(203, 0),
+ OA_1963(807, 0),
+ OA_1964(709, 0),
+ OA_1965(911, 0),
+ OA_1966(942, 0),
+ OA_1967(993, 0),
+ OA_1968(1339, 0),
+ OA_1969(453, 1179),
+ OA_1970(289, 970),
+ OA_1971(146, 1047),
+ OA_1972(143, 1069),
+ OA_1973(235, 890),
+ OA_1974(254, 948),
+ OA_1975(248, 709),
+ OA_1976(149, 692),
+ OA_1977(40, 761),
+ OA_1978(56, 766),
+ OA_1979(76, 618),
+ OA_1980(324, 299),
+ OA_1981(365, 280),
+ OA_1982(416, 247),
+ OA_1983(343, 257),
+ OA_1984(297, 111),
+ OA_1985(325, 115),
+ OA_1986(214, 121),
+ OA_1987(186, 165),
+ OA_1988(212, 156),
+ OA_1989(192, 154),
+ OA_1990(141, 192),
+ OA_1991(268, 0),
+ OA_1992(250, 0),
+ OA_1993(281, 2),
+ OA_1994(278, 0),
+ OA_1995(243, 3),
+ OA_1996(90, 142),
+ OA_1997(36, 178),
+ OA_1998(206, 1),
+ OA_1999(326, 2),
OA_2000(318, 36, 352, 2),
- OA_2001(298, 63, 361, 0),
- OA_2002(184, 133, 317, 0),
- OA_2003(218, 157, 375, 0),
- OA_2004(121, 61, 182, 0),
+ OA_2001(298, 63, 358, 3),
+ OA_2002(184, 133, 316, 1),
+ OA_2003(218, 157, 369, 6),
+ OA_2004(121, 61, 181, 1),
OA_2005(93, 31, 124, 0),
OA_2006(70, 27, 97, 0),
- OA_2007(53, 27, 80, 0),
+ OA_2007(53, 27, 77, 3),
OA_2008(46, 14, 60, 0),
OA_2009(64, 21, 86, 0),
-
OA_2010(75, 13, 87, 0),
OA_2011(75, 13, 91, 1),
OA_2012(75, 13, 97, 0),
OA_2013(75, 13, 103, 0),
- OA_2014(75, 13, 91, 0),
- OA_2015(75, 13, 80, 8);
+ OA_2014(75, 13, 90, 0),
+ OA_2015(75, 13, 103, 0),
+ OA_2016(75, 13, 52, 55);
private final int nbSafe;
private final int nbUnsafe;
private final int nbSafeWithoutWell;
private final int nbUnsafeWithoutWell;
+ AtlanticOceanFixtures(int nbSafeWithoutWell, int nbUnsafeWithoutWell) {
+ this(nbSafeWithoutWell, nbUnsafeWithoutWell, nbSafeWithoutWell, nbUnsafeWithoutWell);
+ }
+
AtlanticOceanFixtures(int nbSafe, int nbUnsafe, int nbSafeWithoutWell, int nbUnsafeWithoutWell) {
this.nbSafe = nbSafe;
this.nbUnsafe = nbUnsafe;
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/IndianOceanFixtures.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/IndianOceanFixtures.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/IndianOceanFixtures.java
@@ -10,12 +10,12 @@ package fr.ird.t3.actions.io.input;
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
@@ -30,33 +30,41 @@ import fr.ird.t3.actions.io.input.test.OceanFixtures;
*/
public enum IndianOceanFixtures implements OceanFixtures {
+ OI_1998(183, 1, 183, 1),
+ OI_1999(55, 65, 195, 2),
OI_2000(55, 65, 220, 0),
OI_2001(70, 118, 188, 0),
- OI_2002(103, 125, 228, 0),
- OI_2003(83, 136, 219, 0),
+ OI_2002(103, 125, 227, 1),
+ OI_2003(83, 136, 217, 2),
OI_2004(78, 118, 196, 0),
- OI_2005(78, 110, 188, 0),
+ OI_2005(78, 110, 187, 1),
OI_2006(181, 12, 193, 0),
OI_2007(155, 12, 167, 0),
OI_2008(146, 34, 180, 0),
- OI_2009(122, 19, 141, 0),
+ OI_2009(122, 19, 138, 3),
OI_2010(112, 0, 112, 0),
OI_2011(141, 0, 126, 0),
OI_2012(145, 0, 119, 0),
OI_2013(124, 0, 124, 0),
- OI_2014(149, 0, 150, 0),
- OI_2015(111, 1, 110, 1);
+ OI_2014(149, 0, 149, 1),
+ OI_2015(111, 1, 147, 0),
+ OI_2016(111, 1, 169, 0),
+ OI_2017(111, 1, 168, 4);
private final int nbSafe;
private final int nbUnsafe;
private final int nbSafeWithoutWell;
- private final int nbUnsafeWithoutwell;
+ private final int nbUnsafeWithoutWell;
+
+ IndianOceanFixtures(int nbSafe, int nbUnsafe) {
+ this(nbSafe, nbUnsafe, nbSafe, nbUnsafe);
+ }
- IndianOceanFixtures(int nbSafe, int nbUnsafe, int nbSafeWithoutWell, int nbUnsafeWithoutwell) {
+ IndianOceanFixtures(int nbSafe, int nbUnsafe, int nbSafeWithoutWell, int nbUnsafeWithoutWell) {
this.nbSafe = nbSafe;
this.nbUnsafe = nbUnsafe;
this.nbSafeWithoutWell = nbSafeWithoutWell;
- this.nbUnsafeWithoutwell = nbUnsafeWithoutwell;
+ this.nbUnsafeWithoutWell = nbUnsafeWithoutWell;
}
public int nbSafe() {
@@ -72,7 +80,7 @@ public enum IndianOceanFixtures implements OceanFixtures {
}
public int nbUnsafeWithoutWell() {
- return nbUnsafeWithoutwell;
+ return nbUnsafeWithoutWell;
}
}
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanIT.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanIT.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanIT.java
@@ -23,6 +23,8 @@ package fr.ird.t3.actions.io.input.it;
import fr.ird.t3.actions.io.input.AnalyzeInputSourceAction;
import fr.ird.t3.actions.io.input.AtlanticOceanFixtures;
import fr.ird.t3.actions.io.input.test.MSAccessTestConfiguration;
+import fr.ird.t3.actions.io.input.test.OceanFixtures;
+import fr.ird.t3.entities.data.TripType;
import fr.ird.t3.io.input.avdth.v35.T3InputProviderAvdth35;
import org.junit.Ignore;
import org.junit.Test;
@@ -33,9 +35,13 @@ import org.junit.Test;
* @author Tony Chemit - dev(a)tchemit.fr
* @since 1.0
*/
-@Ignore
public class AnalyzeInputSourceActionAtlanticOceanIT extends AnalyzeInputSourceActionITSupport implements T3AVDTHV35TestAtlanticOcean {
+ @Override
+ void testExecute(OceanFixtures fixture) throws Exception {
+ super.testExecute(fixture, TripType.LOGBOOKMISSING);
+ }
+
@Test
@Override
public void testExecute_OA_1960() throws Exception {
@@ -370,6 +376,11 @@ public class AnalyzeInputSourceActionAtlanticOceanIT extends AnalyzeInputSourceA
public void testExecute_OA_2015() throws Exception {
testExecute(AtlanticOceanFixtures.OA_2015);
}
+ @Test
+ @Override
+ public void testExecute_OA_2016() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2016);
+ }
@Override
protected MSAccessTestConfiguration createConfiguration() {
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanRecentIT.java
=====================================
--- /dev/null
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanRecentIT.java
@@ -0,0 +1,160 @@
+/*
+ * #%L
+ * T3 :: Input AVDTH v 35
+ * %%
+ * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ird.t3.actions.io.input.it;
+
+import fr.ird.t3.actions.io.input.AnalyzeInputSourceAction;
+import fr.ird.t3.actions.io.input.AtlanticOceanFixtures;
+import fr.ird.t3.actions.io.input.test.MSAccessTestConfiguration;
+import fr.ird.t3.io.input.avdth.v35.T3InputProviderAvdth35;
+import org.junit.Test;
+
+/**
+ * Tests the action {@link AnalyzeInputSourceAction}.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ * @since 1.0
+ */
+public class AnalyzeInputSourceActionAtlanticOceanRecentIT extends AnalyzeInputSourceActionITSupport implements T3AVDTHV35TestAtlanticOceanRecent {
+
+// @Override
+// void testExecute(OceanFixtures fixture) throws Exception {
+// super.testExecute(fixture, TripType.LOGBOOKMISSING);
+// }
+
+ @Test
+ @Override
+ public void testExecute_OA_1998() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_1998);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_1999() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_1999);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2000() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2000);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2001() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2001);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2002() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2002);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2003() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2003);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2004() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2004);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2005() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2005);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2006() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2006);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2007() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2007);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2008() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2008);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2009() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2009);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2010() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2010);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2011() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2011);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2012() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2012);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2013() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2013);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2014() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2014);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2015() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2015);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2016() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2016);
+ }
+
+ @Override
+ protected MSAccessTestConfiguration createConfiguration() {
+ return new MSAccessTestConfiguration("testExecute_([^_]*)_(.*)", "%s_%s_V35.mdb", T3InputProviderAvdth35.ID);
+ }
+}
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionAtlanticOceanIT.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionAtlanticOceanIT.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionAtlanticOceanIT.java
@@ -379,5 +379,11 @@ public class ImportInputSourceActionAtlanticOceanIT extends ImportInputSourceAct
testExecute(AtlanticOceanFixtures.OA_2015);
}
+ @Override
+ @Test
+ public void testExecute_OA_2016() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2016);
+ }
+
}
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV35TestAtlanticOcean.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV35TestAtlanticOcean.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV35TestAtlanticOcean.java
@@ -26,7 +26,7 @@ package fr.ird.t3.actions.io.input.it;
* @author Tony Chemit - dev(a)tchemit.fr
* @since 1.0
*/
-public interface T3AVDTHV35TestAtlanticOcean {
+public interface T3AVDTHV35TestAtlanticOcean extends T3AVDTHV35TestAtlanticOceanRecent {
void testExecute_OA_1960() throws Exception;
@@ -104,40 +104,4 @@ public interface T3AVDTHV35TestAtlanticOcean {
void testExecute_OA_1997() throws Exception;
- void testExecute_OA_1998() throws Exception;
-
- void testExecute_OA_1999() throws Exception;
-
- void testExecute_OA_2000() throws Exception;
-
- void testExecute_OA_2001() throws Exception;
-
- void testExecute_OA_2002() throws Exception;
-
- void testExecute_OA_2003() throws Exception;
-
- void testExecute_OA_2004() throws Exception;
-
- void testExecute_OA_2005() throws Exception;
-
- void testExecute_OA_2006() throws Exception;
-
- void testExecute_OA_2007() throws Exception;
-
- void testExecute_OA_2008() throws Exception;
-
- void testExecute_OA_2009() throws Exception;
-
- void testExecute_OA_2010() throws Exception;
-
- void testExecute_OA_2011() throws Exception;
-
- void testExecute_OA_2012() throws Exception;
-
- void testExecute_OA_2013() throws Exception;
-
- void testExecute_OA_2014() throws Exception;
-
- void testExecute_OA_2015() throws Exception;
-
}
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV35TestAtlanticOceanRecent.java
=====================================
--- /dev/null
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV35TestAtlanticOceanRecent.java
@@ -0,0 +1,69 @@
+/*
+ * #%L
+ * T3 :: Input AVDTH v 35
+ * %%
+ * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ird.t3.actions.io.input.it;
+
+/**
+ * Contract to use for all tests on avdth database
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ * @since 1.0
+ */
+public interface T3AVDTHV35TestAtlanticOceanRecent {
+
+ void testExecute_OA_1998() throws Exception;
+
+ void testExecute_OA_1999() throws Exception;
+
+ void testExecute_OA_2000() throws Exception;
+
+ void testExecute_OA_2001() throws Exception;
+
+ void testExecute_OA_2002() throws Exception;
+
+ void testExecute_OA_2003() throws Exception;
+
+ void testExecute_OA_2004() throws Exception;
+
+ void testExecute_OA_2005() throws Exception;
+
+ void testExecute_OA_2006() throws Exception;
+
+ void testExecute_OA_2007() throws Exception;
+
+ void testExecute_OA_2008() throws Exception;
+
+ void testExecute_OA_2009() throws Exception;
+
+ void testExecute_OA_2010() throws Exception;
+
+ void testExecute_OA_2011() throws Exception;
+
+ void testExecute_OA_2012() throws Exception;
+
+ void testExecute_OA_2013() throws Exception;
+
+ void testExecute_OA_2014() throws Exception;
+
+ void testExecute_OA_2015() throws Exception;
+
+ void testExecute_OA_2016() throws Exception;
+
+}
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/36231216ca3c310b355506044f36d036…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/36231216ca3c310b355506044f36d036…
You're receiving this email because of your account on gitlab.com.
1
0
08 Mar '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
3f7ce999 by Tony CHEMIT at 2018-03-08T19:04:58Z
update test fixtures for ATL [skip ci]
- - - - -
9 changed files:
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/MSAccessTestConfiguration.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AtlanticOceanFixtures.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanIT.java
- + t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanRecentIT.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionAtlanticOceanIT.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV35TestAtlanticOcean.java
- + t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV35TestAtlanticOceanRecent.java
Changes:
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
@@ -94,7 +94,7 @@ public abstract class AnalyzeInputSourceActionITSupport {
if (doIt) {
String dbName = msConfig.dbName;
log.debug("Do test for db " + dbName);
- outputFile = new File(serviceContext.getTestDir(), "result.txt");
+ outputFile = new File(serviceContext.getTestDir().getParentFile().getParentFile(), dbName.replace(".mdb","-result.txt"));
log.info("Will save result in file : " + outputFile);
outputWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile)));
File workingDirectory = serviceContext.getApplicationConfiguration().getTreatmentWorkingDirectory("yo", true);
@@ -113,30 +113,28 @@ public abstract class AnalyzeInputSourceActionITSupport {
if (outputWriter != null) {
outputWriter.flush();
outputWriter.close();
+ log.info(new String(Files.readAllBytes(outputFile.toPath())));
}
}
-
void testExecute(OceanFixtures fixture) throws Exception {
- testExecute(
- fixture.nbSafe(),
- fixture.nbUnsafe(),
- fixture.nbSafeWithoutWell(),
- fixture.nbUnsafeWithoutWell(),
- TripType.STANDARD,
- false,
- false
- );
+ testExecute(fixture, TripType.STANDARD);
+ }
+ void testExecute(OceanFixtures fixture, TripType tripType) throws Exception {
+ serviceContext.getMsConfig().setUseWells(false);
+ testExecute(fixture.nbSafe(), fixture.nbUnsafe(), fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), tripType, false, false);
+// serviceContext.getMsConfig().setUseWells(true);
+// testExecute(fixture.nbSafe(), fixture.nbUnsafe(), fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), TripType.STANDARD, false, false);
}
public void testExecute(int nbSafe,
int nbUnsafe,
- int nbSafeWithoutwell,
+ int nbSafeWithoutWell,
int nbUnsafeWithoutWell) throws Exception {
testExecute(
nbSafe,
nbUnsafe,
- nbSafeWithoutwell,
+ nbSafeWithoutWell,
nbUnsafeWithoutWell,
TripType.STANDARD,
false,
@@ -168,13 +166,16 @@ public abstract class AnalyzeInputSourceActionITSupport {
Set<Trip> unsafeTrips = action.getResultAsSet(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, Trip.class);
Assert.assertNotNull(unsafeTrips);
outputWriter.write(String.format("found %d unsafe trip(s).\n", unsafeTrips.size()));
+
+ log.info(String.format("\n[%s](useWells?%b) safe : %d - unsafe : %d\n", msConfig.dbName, msConfig.isUseWells(), safeTrips.size(), unsafeTrips.size()));
+
List<String> messages;
if (log.isWarnEnabled()) {
messages = action.getWarnMessages();
if (CollectionUtils.isNotEmpty(messages)) {
for (String message : messages) {
- log.warn(String.format("[WARNING] %s\n", message));
-// outputWriter.write(String.format("[WARNING] %s\n", message));
+// log.debug(String.format("[WARNING] %s", message));
+ outputWriter.write(String.format("[WARNING] %s\n", message));
}
}
}
@@ -187,9 +188,6 @@ public abstract class AnalyzeInputSourceActionITSupport {
}
}
- outputWriter.flush();
- log.info(String.format("\n[%s] safe : %d - unsafe : %d\n", msConfig.dbName, safeTrips.size(), unsafeTrips.size()));
- log.info(new String(Files.readAllBytes(outputFile.toPath())));
if (msConfig.isUseWells()) {
Assert.assertEquals(nbSafe, safeTrips.size());
Assert.assertEquals(nbUnsafe, unsafeTrips.size());
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/MSAccessTestConfiguration.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/MSAccessTestConfiguration.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/MSAccessTestConfiguration.java
@@ -188,4 +188,8 @@ public class MSAccessTestConfiguration {
public String getProviderId() {
return providerId;
}
+
+ public void setUseWells(boolean useWells) {
+ this.useWells = useWells;
+ }
}
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AnalyzeInputSourceActionTest.java
@@ -46,6 +46,11 @@ public class AnalyzeInputSourceActionTest extends AnalyzeInputSourceActionTestSu
}
@Test
+ public void testExecute_OA_1980() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_1980, TripType.LOGBOOKMISSING);
+ }
+
+ @Test
public void testExecute_OI_2000() throws Exception {
testExecute(IndianOceanFixtures.OI_2000);
}
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AtlanticOceanFixtures.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AtlanticOceanFixtures.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AtlanticOceanFixtures.java
@@ -30,73 +30,74 @@ import fr.ird.t3.actions.io.input.test.OceanFixtures;
*/
public enum AtlanticOceanFixtures implements OceanFixtures {
- OA_1960(318, 36, 352, 2),
- OA_1961(298, 63, 361, 0),
- OA_1962(184, 133, 317, 0),
- OA_1963(218, 157, 375, 0),
- OA_1964(121, 61, 182, 0),
- OA_1965(93, 31, 124, 0),
- OA_1966(70, 27, 97, 0),
- OA_1967(53, 27, 80, 0),
- OA_1968(46, 14, 60, 0),
- OA_1969(64, 21, 86, 0),
-
- OA_1970(318, 36, 352, 2),
- OA_1971(298, 63, 361, 0),
- OA_1972(184, 133, 317, 0),
- OA_1973(218, 157, 375, 0),
- OA_1974(121, 61, 182, 0),
- OA_1975(93, 31, 124, 0),
- OA_1976(70, 27, 97, 0),
- OA_1977(53, 27, 80, 0),
- OA_1978(46, 14, 60, 0),
- OA_1979(64, 21, 86, 0),
-
- OA_1980(318, 36, 352, 2),
- OA_1981(298, 63, 361, 0),
- OA_1982(184, 133, 317, 0),
- OA_1983(218, 157, 375, 0),
- OA_1984(121, 61, 182, 0),
- OA_1985(93, 31, 124, 0),
- OA_1986(70, 27, 97, 0),
- OA_1987(53, 27, 80, 0),
- OA_1988(46, 14, 60, 0),
- OA_1989(64, 21, 86, 0),
-
- OA_1990(318, 36, 352, 2),
- OA_1991(298, 63, 361, 0),
- OA_1992(184, 133, 317, 0),
- OA_1993(218, 157, 375, 0),
- OA_1994(121, 61, 182, 0),
- OA_1995(93, 31, 124, 0),
- OA_1996(70, 27, 97, 0),
- OA_1997(53, 27, 80, 0),
- OA_1998(46, 14, 60, 0),
- OA_1999(64, 21, 86, 0),
+ OA_1960(151, 0),
+ OA_1961(159, 0),
+ OA_1962(203, 0),
+ OA_1963(807, 0),
+ OA_1964(709, 0),
+ OA_1965(911, 0),
+ OA_1966(942, 0),
+ OA_1967(993, 0),
+ OA_1968(1339, 0),
+ OA_1969(453, 1179),
+ OA_1970(289, 970),
+ OA_1971(146, 1047),
+ OA_1972(143, 1069),
+ OA_1973(235, 890),
+ OA_1974(254, 948),
+ OA_1975(248, 709),
+ OA_1976(149, 692),
+ OA_1977(40, 761),
+ OA_1978(56, 766),
+ OA_1979(76, 618),
+ OA_1980(324, 299),
+ OA_1981(365, 280),
+ OA_1982(416, 247),
+ OA_1983(343, 257),
+ OA_1984(297, 111),
+ OA_1985(325, 115),
+ OA_1986(214, 121),
+ OA_1987(186, 165),
+ OA_1988(212, 156),
+ OA_1989(192, 154),
+ OA_1990(141, 192),
+ OA_1991(268, 0),
+ OA_1992(250, 0),
+ OA_1993(281, 2),
+ OA_1994(278, 0),
+ OA_1995(243, 3),
+ OA_1996(90, 142),
+ OA_1997(36, 178),
+ OA_1998(205, 2),
+ OA_1999(323, 5),
OA_2000(318, 36, 352, 2),
- OA_2001(298, 63, 361, 0),
- OA_2002(184, 133, 317, 0),
- OA_2003(218, 157, 375, 0),
- OA_2004(121, 61, 182, 0),
+ OA_2001(298, 63, 358, 3),
+ OA_2002(184, 133, 316, 1),
+ OA_2003(218, 157, 369, 6),
+ OA_2004(121, 61, 181, 1),
OA_2005(93, 31, 124, 0),
OA_2006(70, 27, 97, 0),
- OA_2007(53, 27, 80, 0),
+ OA_2007(53, 27, 77, 3),
OA_2008(46, 14, 60, 0),
OA_2009(64, 21, 86, 0),
-
OA_2010(75, 13, 87, 0),
OA_2011(75, 13, 91, 1),
OA_2012(75, 13, 97, 0),
OA_2013(75, 13, 103, 0),
- OA_2014(75, 13, 91, 0),
- OA_2015(75, 13, 80, 8);
+ OA_2014(75, 13, 90, 0),
+ OA_2015(75, 13, 103, 0),
+ OA_2016(75, 13, 52, 55);
private final int nbSafe;
private final int nbUnsafe;
private final int nbSafeWithoutWell;
private final int nbUnsafeWithoutWell;
+ AtlanticOceanFixtures(int nbSafeWithoutWell, int nbUnsafeWithoutWell) {
+ this(nbSafeWithoutWell, nbUnsafeWithoutWell, nbSafeWithoutWell, nbUnsafeWithoutWell);
+ }
+
AtlanticOceanFixtures(int nbSafe, int nbUnsafe, int nbSafeWithoutWell, int nbUnsafeWithoutWell) {
this.nbSafe = nbSafe;
this.nbUnsafe = nbUnsafe;
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanIT.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanIT.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanIT.java
@@ -23,6 +23,8 @@ package fr.ird.t3.actions.io.input.it;
import fr.ird.t3.actions.io.input.AnalyzeInputSourceAction;
import fr.ird.t3.actions.io.input.AtlanticOceanFixtures;
import fr.ird.t3.actions.io.input.test.MSAccessTestConfiguration;
+import fr.ird.t3.actions.io.input.test.OceanFixtures;
+import fr.ird.t3.entities.data.TripType;
import fr.ird.t3.io.input.avdth.v35.T3InputProviderAvdth35;
import org.junit.Ignore;
import org.junit.Test;
@@ -33,9 +35,13 @@ import org.junit.Test;
* @author Tony Chemit - dev(a)tchemit.fr
* @since 1.0
*/
-@Ignore
public class AnalyzeInputSourceActionAtlanticOceanIT extends AnalyzeInputSourceActionITSupport implements T3AVDTHV35TestAtlanticOcean {
+ @Override
+ void testExecute(OceanFixtures fixture) throws Exception {
+ super.testExecute(fixture, TripType.LOGBOOKMISSING);
+ }
+
@Test
@Override
public void testExecute_OA_1960() throws Exception {
@@ -370,6 +376,11 @@ public class AnalyzeInputSourceActionAtlanticOceanIT extends AnalyzeInputSourceA
public void testExecute_OA_2015() throws Exception {
testExecute(AtlanticOceanFixtures.OA_2015);
}
+ @Test
+ @Override
+ public void testExecute_OA_2016() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2016);
+ }
@Override
protected MSAccessTestConfiguration createConfiguration() {
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanRecentIT.java
=====================================
--- /dev/null
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanRecentIT.java
@@ -0,0 +1,160 @@
+/*
+ * #%L
+ * T3 :: Input AVDTH v 35
+ * %%
+ * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ird.t3.actions.io.input.it;
+
+import fr.ird.t3.actions.io.input.AnalyzeInputSourceAction;
+import fr.ird.t3.actions.io.input.AtlanticOceanFixtures;
+import fr.ird.t3.actions.io.input.test.MSAccessTestConfiguration;
+import fr.ird.t3.io.input.avdth.v35.T3InputProviderAvdth35;
+import org.junit.Test;
+
+/**
+ * Tests the action {@link AnalyzeInputSourceAction}.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ * @since 1.0
+ */
+public class AnalyzeInputSourceActionAtlanticOceanRecentIT extends AnalyzeInputSourceActionITSupport implements T3AVDTHV35TestAtlanticOceanRecent {
+
+// @Override
+// void testExecute(OceanFixtures fixture) throws Exception {
+// super.testExecute(fixture, TripType.LOGBOOKMISSING);
+// }
+
+ @Test
+ @Override
+ public void testExecute_OA_1998() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_1998);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_1999() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_1999);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2000() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2000);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2001() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2001);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2002() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2002);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2003() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2003);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2004() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2004);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2005() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2005);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2006() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2006);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2007() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2007);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2008() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2008);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2009() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2009);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2010() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2010);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2011() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2011);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2012() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2012);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2013() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2013);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2014() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2014);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2015() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2015);
+ }
+
+ @Test
+ @Override
+ public void testExecute_OA_2016() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2016);
+ }
+
+ @Override
+ protected MSAccessTestConfiguration createConfiguration() {
+ return new MSAccessTestConfiguration("testExecute_([^_]*)_(.*)", "%s_%s_V35.mdb", T3InputProviderAvdth35.ID);
+ }
+}
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionAtlanticOceanIT.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionAtlanticOceanIT.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/ImportInputSourceActionAtlanticOceanIT.java
@@ -379,5 +379,11 @@ public class ImportInputSourceActionAtlanticOceanIT extends ImportInputSourceAct
testExecute(AtlanticOceanFixtures.OA_2015);
}
+ @Override
+ @Test
+ public void testExecute_OA_2016() throws Exception {
+ testExecute(AtlanticOceanFixtures.OA_2016);
+ }
+
}
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV35TestAtlanticOcean.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV35TestAtlanticOcean.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV35TestAtlanticOcean.java
@@ -26,7 +26,7 @@ package fr.ird.t3.actions.io.input.it;
* @author Tony Chemit - dev(a)tchemit.fr
* @since 1.0
*/
-public interface T3AVDTHV35TestAtlanticOcean {
+public interface T3AVDTHV35TestAtlanticOcean extends T3AVDTHV35TestAtlanticOceanRecent {
void testExecute_OA_1960() throws Exception;
@@ -104,40 +104,4 @@ public interface T3AVDTHV35TestAtlanticOcean {
void testExecute_OA_1997() throws Exception;
- void testExecute_OA_1998() throws Exception;
-
- void testExecute_OA_1999() throws Exception;
-
- void testExecute_OA_2000() throws Exception;
-
- void testExecute_OA_2001() throws Exception;
-
- void testExecute_OA_2002() throws Exception;
-
- void testExecute_OA_2003() throws Exception;
-
- void testExecute_OA_2004() throws Exception;
-
- void testExecute_OA_2005() throws Exception;
-
- void testExecute_OA_2006() throws Exception;
-
- void testExecute_OA_2007() throws Exception;
-
- void testExecute_OA_2008() throws Exception;
-
- void testExecute_OA_2009() throws Exception;
-
- void testExecute_OA_2010() throws Exception;
-
- void testExecute_OA_2011() throws Exception;
-
- void testExecute_OA_2012() throws Exception;
-
- void testExecute_OA_2013() throws Exception;
-
- void testExecute_OA_2014() throws Exception;
-
- void testExecute_OA_2015() throws Exception;
-
}
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV35TestAtlanticOceanRecent.java
=====================================
--- /dev/null
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/T3AVDTHV35TestAtlanticOceanRecent.java
@@ -0,0 +1,69 @@
+/*
+ * #%L
+ * T3 :: Input AVDTH v 35
+ * %%
+ * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ird.t3.actions.io.input.it;
+
+/**
+ * Contract to use for all tests on avdth database
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ * @since 1.0
+ */
+public interface T3AVDTHV35TestAtlanticOceanRecent {
+
+ void testExecute_OA_1998() throws Exception;
+
+ void testExecute_OA_1999() throws Exception;
+
+ void testExecute_OA_2000() throws Exception;
+
+ void testExecute_OA_2001() throws Exception;
+
+ void testExecute_OA_2002() throws Exception;
+
+ void testExecute_OA_2003() throws Exception;
+
+ void testExecute_OA_2004() throws Exception;
+
+ void testExecute_OA_2005() throws Exception;
+
+ void testExecute_OA_2006() throws Exception;
+
+ void testExecute_OA_2007() throws Exception;
+
+ void testExecute_OA_2008() throws Exception;
+
+ void testExecute_OA_2009() throws Exception;
+
+ void testExecute_OA_2010() throws Exception;
+
+ void testExecute_OA_2011() throws Exception;
+
+ void testExecute_OA_2012() throws Exception;
+
+ void testExecute_OA_2013() throws Exception;
+
+ void testExecute_OA_2014() throws Exception;
+
+ void testExecute_OA_2015() throws Exception;
+
+ void testExecute_OA_2016() throws Exception;
+
+}
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/3f7ce999a74f5b0c8df498dda0ab0fd8…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/3f7ce999a74f5b0c8df498dda0ab0fd8…
You're receiving this email because of your account on gitlab.com.
1
0
08 Mar '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
4defd6ba by Tony CHEMIT at 2018-03-08T18:07:37Z
update test fixtures for ATL [skip ci]
- - - - -
4 changed files:
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
- t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/MSAccessTestConfiguration.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AtlanticOceanFixtures.java
- t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanIT.java
Changes:
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionITSupport.java
@@ -113,30 +113,26 @@ public abstract class AnalyzeInputSourceActionITSupport {
if (outputWriter != null) {
outputWriter.flush();
outputWriter.close();
+ log.info(new String(Files.readAllBytes(outputFile.toPath())));
}
}
void testExecute(OceanFixtures fixture) throws Exception {
- testExecute(
- fixture.nbSafe(),
- fixture.nbUnsafe(),
- fixture.nbSafeWithoutWell(),
- fixture.nbUnsafeWithoutWell(),
- TripType.STANDARD,
- false,
- false
- );
+ serviceContext.getMsConfig().setUseWells(false);
+ testExecute(fixture.nbSafe(), fixture.nbUnsafe(), fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), TripType.STANDARD, false, false);
+// serviceContext.getMsConfig().setUseWells(true);
+// testExecute(fixture.nbSafe(), fixture.nbUnsafe(), fixture.nbSafeWithoutWell(), fixture.nbUnsafeWithoutWell(), TripType.STANDARD, false, false);
}
public void testExecute(int nbSafe,
int nbUnsafe,
- int nbSafeWithoutwell,
+ int nbSafeWithoutWell,
int nbUnsafeWithoutWell) throws Exception {
testExecute(
nbSafe,
nbUnsafe,
- nbSafeWithoutwell,
+ nbSafeWithoutWell,
nbUnsafeWithoutWell,
TripType.STANDARD,
false,
@@ -168,13 +164,15 @@ public abstract class AnalyzeInputSourceActionITSupport {
Set<Trip> unsafeTrips = action.getResultAsSet(AnalyzeInputSourceAction.RESULT_UNSAFE_TRIPS, Trip.class);
Assert.assertNotNull(unsafeTrips);
outputWriter.write(String.format("found %d unsafe trip(s).\n", unsafeTrips.size()));
+
+ log.info(String.format("\n[%s](useWells?%b) safe : %d - unsafe : %d\n", msConfig.dbName, msConfig.isUseWells(), safeTrips.size(), unsafeTrips.size()));
+
List<String> messages;
if (log.isWarnEnabled()) {
messages = action.getWarnMessages();
if (CollectionUtils.isNotEmpty(messages)) {
for (String message : messages) {
- log.warn(String.format("[WARNING] %s\n", message));
-// outputWriter.write(String.format("[WARNING] %s\n", message));
+ outputWriter.write(String.format("[WARNING] %s\n", message));
}
}
}
@@ -187,9 +185,6 @@ public abstract class AnalyzeInputSourceActionITSupport {
}
}
- outputWriter.flush();
- log.info(String.format("\n[%s] safe : %d - unsafe : %d\n", msConfig.dbName, safeTrips.size(), unsafeTrips.size()));
- log.info(new String(Files.readAllBytes(outputFile.toPath())));
if (msConfig.isUseWells()) {
Assert.assertEquals(nbSafe, safeTrips.size());
Assert.assertEquals(nbUnsafe, unsafeTrips.size());
=====================================
t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/MSAccessTestConfiguration.java
=====================================
--- a/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/MSAccessTestConfiguration.java
+++ b/t3-actions/src/main/java/fr/ird/t3/actions/io/input/test/MSAccessTestConfiguration.java
@@ -188,4 +188,8 @@ public class MSAccessTestConfiguration {
public String getProviderId() {
return providerId;
}
+
+ public void setUseWells(boolean useWells) {
+ this.useWells = useWells;
+ }
}
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AtlanticOceanFixtures.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AtlanticOceanFixtures.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/AtlanticOceanFixtures.java
@@ -30,73 +30,73 @@ import fr.ird.t3.actions.io.input.test.OceanFixtures;
*/
public enum AtlanticOceanFixtures implements OceanFixtures {
- OA_1960(318, 36, 352, 2),
- OA_1961(298, 63, 361, 0),
- OA_1962(184, 133, 317, 0),
- OA_1963(218, 157, 375, 0),
- OA_1964(121, 61, 182, 0),
- OA_1965(93, 31, 124, 0),
- OA_1966(70, 27, 97, 0),
- OA_1967(53, 27, 80, 0),
- OA_1968(46, 14, 60, 0),
- OA_1969(64, 21, 86, 0),
-
- OA_1970(318, 36, 352, 2),
- OA_1971(298, 63, 361, 0),
- OA_1972(184, 133, 317, 0),
- OA_1973(218, 157, 375, 0),
- OA_1974(121, 61, 182, 0),
- OA_1975(93, 31, 124, 0),
- OA_1976(70, 27, 97, 0),
- OA_1977(53, 27, 80, 0),
- OA_1978(46, 14, 60, 0),
- OA_1979(64, 21, 86, 0),
-
- OA_1980(318, 36, 352, 2),
- OA_1981(298, 63, 361, 0),
- OA_1982(184, 133, 317, 0),
- OA_1983(218, 157, 375, 0),
- OA_1984(121, 61, 182, 0),
- OA_1985(93, 31, 124, 0),
- OA_1986(70, 27, 97, 0),
- OA_1987(53, 27, 80, 0),
- OA_1988(46, 14, 60, 0),
- OA_1989(64, 21, 86, 0),
-
- OA_1990(318, 36, 352, 2),
- OA_1991(298, 63, 361, 0),
- OA_1992(184, 133, 317, 0),
- OA_1993(218, 157, 375, 0),
- OA_1994(121, 61, 182, 0),
- OA_1995(93, 31, 124, 0),
- OA_1996(70, 27, 97, 0),
- OA_1997(53, 27, 80, 0),
- OA_1998(46, 14, 60, 0),
- OA_1999(64, 21, 86, 0),
+ OA_1960(151, 0),
+ OA_1961(159, 0),
+ OA_1962(203, 0),
+ OA_1963(807, 0),
+ OA_1964(709, 0),
+ OA_1965(911, 0),
+ OA_1966(942, 0),
+ OA_1967(993, 0),
+ OA_1968(1339, 0),
+ OA_1969(453, 1179),
+ OA_1970(289, 970),
+ OA_1971(146, 1047),
+ OA_1972(143, 1069),
+ OA_1973(235, 890),
+ OA_1974(254, 948),
+ OA_1975(248, 709),
+ OA_1976(149, 692),
+ OA_1977(40, 761),
+ OA_1978(56, 766),
+ OA_1979(76, 618),
+ OA_1980(324, 299),
+ OA_1981(365, 280),
+ OA_1982(416, 247),
+ OA_1983(343, 257),
+ OA_1984(297, 111),
+ OA_1985(325, 115),
+ OA_1986(214, 121),
+ OA_1987(186, 165),
+ OA_1988(212, 156),
+ OA_1989(192, 154),
+ OA_1990(141, 192),
+ OA_1991(268, 0),
+ OA_1992(250, 0),
+ OA_1993(281, 2),
+ OA_1994(278, 0),
+ OA_1995(243, 3),
+ OA_1996(90, 142),
+ OA_1997(36, 178),
+ OA_1998(205, 2),
+ OA_1999(323, 5),
OA_2000(318, 36, 352, 2),
- OA_2001(298, 63, 361, 0),
- OA_2002(184, 133, 317, 0),
- OA_2003(218, 157, 375, 0),
- OA_2004(121, 61, 182, 0),
+ OA_2001(298, 63, 358, 3),
+ OA_2002(184, 133, 316, 1),
+ OA_2003(218, 157, 369, 6),
+ OA_2004(121, 61, 181, 1),
OA_2005(93, 31, 124, 0),
OA_2006(70, 27, 97, 0),
- OA_2007(53, 27, 80, 0),
+ OA_2007(53, 27, 77, 3),
OA_2008(46, 14, 60, 0),
OA_2009(64, 21, 86, 0),
-
OA_2010(75, 13, 87, 0),
OA_2011(75, 13, 91, 1),
OA_2012(75, 13, 97, 0),
OA_2013(75, 13, 103, 0),
- OA_2014(75, 13, 91, 0),
- OA_2015(75, 13, 80, 8);
+ OA_2014(75, 13, 90, 0),
+ OA_2015(75, 13, 103, 0);
private final int nbSafe;
private final int nbUnsafe;
private final int nbSafeWithoutWell;
private final int nbUnsafeWithoutWell;
+ AtlanticOceanFixtures(int nbSafeWithoutWell, int nbUnsafeWithoutWell) {
+ this(nbSafeWithoutWell, nbUnsafeWithoutWell, nbSafeWithoutWell, nbUnsafeWithoutWell);
+ }
+
AtlanticOceanFixtures(int nbSafe, int nbUnsafe, int nbSafeWithoutWell, int nbUnsafeWithoutWell) {
this.nbSafe = nbSafe;
this.nbUnsafe = nbUnsafe;
=====================================
t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanIT.java
=====================================
--- a/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanIT.java
+++ b/t3-input-avdthv35/src/test/java/fr/ird/t3/actions/io/input/it/AnalyzeInputSourceActionAtlanticOceanIT.java
@@ -33,7 +33,6 @@ import org.junit.Test;
* @author Tony Chemit - dev(a)tchemit.fr
* @since 1.0
*/
-@Ignore
public class AnalyzeInputSourceActionAtlanticOceanIT extends AnalyzeInputSourceActionITSupport implements T3AVDTHV35TestAtlanticOcean {
@Test
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/4defd6bae8eaa40ada6f5ca5a56c517e…
---
View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/4defd6bae8eaa40ada6f5ca5a56c517e…
You're receiving this email because of your account on gitlab.com.
1
0