Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
99b151d1
by Tony CHEMIT at 2017-10-28T22:22:53+02:00
8 changed files:
- dto/src/main/java/fr/ird/observe/spi/DtoModelClasses.java
- services-local/src/test/java/fr/ird/observe/entity/ReplicateReferentialsTest.java → services-local/src/test/java/fr/ird/observe/entity/ReplicateReferentialTest.java
- services-local/src/test/java/fr/ird/observe/entity/ReplicateTestSupport.java
- services-local/src/test/java/fr/ird/observe/entity/ReplicateTripLonglineTest.java
- services-local/src/test/java/fr/ird/observe/entity/ReplicateTripSeineTest.java
- test/src/main/resources/db/6.904/dataForTestSeine-fixtures.json
- test/src/main/resources/db/6.904/empty_pg-fixtures.json
- test/src/main/resources/db/6.904/referentiel-fixtures.json
Changes:
| ... | ... | @@ -234,7 +234,7 @@ public class DtoModelClasses { |
| 234 | 234 |
.addAll(LONGLINE_REFERENTIAL_TYPES)
|
| 235 | 235 |
.build();
|
| 236 | 236 |
|
| 237 |
- private static final ImmutableSet<Class<? extends DataDto>> SEINE_ENTITY_DATA_TYPES = ImmutableSet.of(
|
|
| 237 |
+ public static final ImmutableSet<Class<? extends DataDto>> SEINE_ENTITY_DATA_TYPES = ImmutableSet.of(
|
|
| 238 | 238 |
ActivitySeineDto.class,
|
| 239 | 239 |
FloatingObjectDto.class,
|
| 240 | 240 |
FloatingObjectPartDto.class,
|
| ... | ... | @@ -265,7 +265,7 @@ public class DtoModelClasses { |
| 265 | 265 |
SetSeineTargetCatchDto.class,
|
| 266 | 266 |
TripSeineGearUseDto.class);
|
| 267 | 267 |
|
| 268 |
- private static final ImmutableSet<Class<? extends DataDto>> LONGLINE_ENTITY_DATA_TYPES = ImmutableSet.of(
|
|
| 268 |
+ public static final ImmutableSet<Class<? extends DataDto>> LONGLINE_ENTITY_DATA_TYPES = ImmutableSet.of(
|
|
| 269 | 269 |
ActivityLonglineObsDto.class,
|
| 270 | 270 |
BaitsCompositionObsDto.class,
|
| 271 | 271 |
BasketDto.class,
|
| ... | ... | @@ -22,10 +22,15 @@ package fr.ird.observe.entity; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.services.configuration.DataSourceCreateWithNoReferentialImportException;
|
|
| 26 |
+import fr.ird.observe.services.configuration.IncompatibleDataSourceCreateConfigurationException;
|
|
| 27 |
+import fr.ird.observe.services.service.BabModelVersionException;
|
|
| 28 |
+import fr.ird.observe.services.service.DatabaseConnexionNotAuthorizedException;
|
|
| 29 |
+import fr.ird.observe.services.service.DatabaseNotFoundException;
|
|
| 25 | 30 |
import fr.ird.observe.services.test.DatabaseName;
|
| 26 | 31 |
import fr.ird.observe.services.test.spi.DatabaseNameConfiguration;
|
| 27 |
-import fr.ird.observe.test.ObserveFixtures;
|
|
| 28 |
-import org.junit.Test;
|
|
| 32 |
+import fr.ird.observe.spi.DtoModelClasses;
|
|
| 33 |
+import java.io.IOException;
|
|
| 29 | 34 |
import org.nuiton.topia.service.sql.batch.actions.ReplicateTablesRequest;
|
| 30 | 35 |
import org.nuiton.topia.service.sql.batch.tables.TopiaSqlTables;
|
| 31 | 36 |
|
| ... | ... | @@ -35,20 +40,23 @@ import org.nuiton.topia.service.sql.batch.tables.TopiaSqlTables; |
| 35 | 40 |
* @author Tony Chemit - dev@tchemit.fr
|
| 36 | 41 |
*/
|
| 37 | 42 |
@DatabaseNameConfiguration(DatabaseName.referentiel)
|
| 38 |
-public class ReplicateReferentialsTest extends ReplicateTestSupport {
|
|
| 43 |
+public class ReplicateReferentialTest extends ReplicateTestSupport {
|
|
| 39 | 44 |
|
| 40 |
- @Test
|
|
| 41 |
- public void testReplicate() throws Exception {
|
|
| 45 |
+ public ReplicateReferentialTest() {
|
|
| 46 |
+ super(DtoModelClasses.REFERENTIAL_TYPES, null);
|
|
| 47 |
+ }
|
|
| 42 | 48 |
|
| 43 |
- TopiaSqlTables tables = getTestMethodResource().getTopiaApplicationContext().getReferentialTables();
|
|
| 49 |
+ @Override
|
|
| 50 |
+ TopiaSqlTables createTables() {
|
|
| 51 |
+ return getTestMethodResource().getTopiaApplicationContext().getReferentialTables();
|
|
| 52 |
+ }
|
|
| 44 | 53 |
|
| 45 |
- ReplicateTablesRequest request
|
|
| 46 |
- = createReplicateTablesRequest(DatabaseName.empty_h2)
|
|
| 54 |
+ @Override
|
|
| 55 |
+ ReplicateTablesRequest createRequest(TopiaSqlTables tables) throws DatabaseNotFoundException, DataSourceCreateWithNoReferentialImportException, IncompatibleDataSourceCreateConfigurationException, IOException, BabModelVersionException, DatabaseConnexionNotAuthorizedException {
|
|
| 56 |
+ return createReplicateTablesRequest(DatabaseName.empty_h2)
|
|
| 47 | 57 |
.setTables(tables)
|
| 48 | 58 |
.build();
|
| 49 | 59 |
|
| 50 |
- testReplicate0(request, ObserveFixtures.REFERENTIAL_TABLES_COUNT);
|
|
| 51 |
- |
|
| 52 | 60 |
}
|
| 53 | 61 |
|
| 54 | 62 |
}
|
| ... | ... | @@ -22,8 +22,12 @@ package fr.ird.observe.entity; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
-import com.google.common.collect.ImmutableMap;
|
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 26 | 26 |
import com.google.common.io.Files;
|
| 27 |
+import fr.ird.observe.dto.data.DataDto;
|
|
| 28 |
+import fr.ird.observe.dto.referential.ReferentialDto;
|
|
| 29 |
+import fr.ird.observe.entities.ObserveDataEntity;
|
|
| 30 |
+import fr.ird.observe.entities.referentiel.ObserveReferentialEntity;
|
|
| 27 | 31 |
import fr.ird.observe.persistence.ObserveTopiaApplicationContext;
|
| 28 | 32 |
import fr.ird.observe.persistence.ObserveTopiaPersistenceContext;
|
| 29 | 33 |
import fr.ird.observe.services.configuration.DataSourceCreateWithNoReferentialImportException;
|
| ... | ... | @@ -37,17 +41,16 @@ import fr.ird.observe.services.test.DatabaseName; |
| 37 | 41 |
import fr.ird.observe.services.test.ServiceLocalTestClassResource;
|
| 38 | 42 |
import fr.ird.observe.services.test.ServiceLocalTestMethodResource;
|
| 39 | 43 |
import fr.ird.observe.services.test.ServiceTestSupport;
|
| 44 |
+import fr.ird.observe.spi.PersistenceModelHelper;
|
|
| 40 | 45 |
import java.io.File;
|
| 41 | 46 |
import java.io.IOException;
|
| 42 | 47 |
import java.io.Writer;
|
| 43 | 48 |
import java.nio.charset.StandardCharsets;
|
| 44 |
-import java.util.Map;
|
|
| 45 | 49 |
import org.apache.commons.logging.Log;
|
| 46 | 50 |
import org.apache.commons.logging.LogFactory;
|
| 47 | 51 |
import org.junit.Assert;
|
| 52 |
+import org.junit.Test;
|
|
| 48 | 53 |
import org.nuiton.topia.service.sql.batch.actions.ReplicateTablesRequest;
|
| 49 |
-import org.nuiton.topia.service.sql.batch.actions.TopiaSqlTableSelectArgument;
|
|
| 50 |
-import org.nuiton.topia.service.sql.batch.tables.TopiaSqlTable;
|
|
| 51 | 54 |
import org.nuiton.topia.service.sql.batch.tables.TopiaSqlTables;
|
| 52 | 55 |
import org.nuiton.util.StringUtil;
|
| 53 | 56 |
|
| ... | ... | @@ -56,7 +59,7 @@ import org.nuiton.util.StringUtil; |
| 56 | 59 |
*
|
| 57 | 60 |
* @author Tony Chemit - dev@tchemit.fr
|
| 58 | 61 |
*/
|
| 59 |
-class ReplicateTestSupport extends ServiceTestSupport {
|
|
| 62 |
+public abstract class ReplicateTestSupport extends ServiceTestSupport {
|
|
| 60 | 63 |
|
| 61 | 64 |
/**
|
| 62 | 65 |
* Logger.
|
| ... | ... | @@ -64,7 +67,17 @@ class ReplicateTestSupport extends ServiceTestSupport { |
| 64 | 67 |
private static final Log log = LogFactory.getLog(ReplicateTestSupport.class);
|
| 65 | 68 |
|
| 66 | 69 |
private File scriptFile;
|
| 70 |
+ private final ImmutableSet<Class<? extends ReferentialDto>> referentialTypesToTest;
|
|
| 71 |
+ private final ImmutableSet<Class<? extends DataDto>> dataTypesToTest;
|
|
| 67 | 72 |
|
| 73 |
+ abstract TopiaSqlTables createTables();
|
|
| 74 |
+ |
|
| 75 |
+ abstract ReplicateTablesRequest createRequest(TopiaSqlTables tables) throws DatabaseNotFoundException, DataSourceCreateWithNoReferentialImportException, IncompatibleDataSourceCreateConfigurationException, IOException, BabModelVersionException, DatabaseConnexionNotAuthorizedException;
|
|
| 76 |
+ |
|
| 77 |
+ ReplicateTestSupport(ImmutableSet<Class<? extends ReferentialDto>> referentialTypesToTest, ImmutableSet<Class<? extends DataDto>> dataTypesToTest) {
|
|
| 78 |
+ this.referentialTypesToTest = referentialTypesToTest;
|
|
| 79 |
+ this.dataTypesToTest = dataTypesToTest;
|
|
| 80 |
+ }
|
|
| 68 | 81 |
|
| 69 | 82 |
@Override
|
| 70 | 83 |
public ServiceLocalTestClassResource getTestClassResource() {
|
| ... | ... | @@ -76,80 +89,60 @@ class ReplicateTestSupport extends ServiceTestSupport { |
| 76 | 89 |
return (ServiceLocalTestMethodResource) super.getTestMethodResource();
|
| 77 | 90 |
}
|
| 78 | 91 |
|
| 79 |
- ReplicateTablesRequest.Builder createReplicateTablesRequest(DatabaseName databaseName) throws DataSourceCreateWithNoReferentialImportException, IOException, IncompatibleDataSourceCreateConfigurationException, BabModelVersionException, DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException {
|
|
| 92 |
+ @Test
|
|
| 93 |
+ public final void testReplicate() throws DatabaseNotFoundException, DataSourceCreateWithNoReferentialImportException, IncompatibleDataSourceCreateConfigurationException, IOException, BabModelVersionException, DatabaseConnexionNotAuthorizedException {
|
|
| 80 | 94 |
|
| 81 |
- File targetDatabaseDirectory = new File(getTestMethodResource().getTestDirectory(), "targetReplication");
|
|
| 82 |
- ObserveDataSourceConfigurationTopiaH2 targetTopiaConfiguration = getTestClassResource().createDataSourceConfiguration(getTestMethodResource().getDbVersion(), databaseName.name(), targetDatabaseDirectory, getTestMethodResource().getLogin(), getTestMethodResource().getPassword());
|
|
| 83 |
- ObserveTopiaApplicationContext targetTopiaApplicationContext = ObserveTopiaApplicationContextFactory.getOrCreateTopiaApplicationContext(targetTopiaConfiguration);
|
|
| 95 |
+ TopiaSqlTables tables = createTables();
|
|
| 84 | 96 |
|
| 85 |
- scriptFile = new File(getTestMethodResource().getTestDirectory(), "script.sql");
|
|
| 97 |
+ ReplicateTablesRequest request = createRequest(tables);
|
|
| 86 | 98 |
|
| 87 |
- Writer writer = Files.newWriter(scriptFile, StandardCharsets.UTF_8);
|
|
| 99 |
+ log.info(String.format("Will replicate using %d tables.", tables.size()));
|
|
| 88 | 100 |
|
| 89 |
- return getTestMethodResource().getTopiaApplicationContext()
|
|
| 101 |
+ getTestMethodResource().getTopiaApplicationContext()
|
|
| 90 | 102 |
.getSqlBatchService()
|
| 91 |
- .replicateTablesRequestBuilder()
|
|
| 92 |
- .to(targetTopiaApplicationContext)
|
|
| 93 |
- .to(writer);
|
|
| 94 |
- }
|
|
| 95 |
- |
|
| 96 |
- private static void assertReplicateTripResults(ReplicateTablesRequest replicationRequest, ImmutableMap<String, Long> expectedResults) {
|
|
| 97 |
- |
|
| 98 |
- TopiaSqlTables tables = replicationRequest.getTables();
|
|
| 99 |
- try (ObserveTopiaPersistenceContext persistenceContext = (ObserveTopiaPersistenceContext) replicationRequest.getTargetTopiaApplicationContext().newPersistenceContext()) {
|
|
| 100 |
- |
|
| 101 |
- for (TopiaSqlTable table : tables) {
|
|
| 102 |
- |
|
| 103 |
- String fullyTableName = table.getFullyTableName();
|
|
| 103 |
+ .execute(request);
|
|
| 104 | 104 |
|
| 105 |
- if (!expectedResults.containsKey(fullyTableName.toLowerCase())) {
|
|
| 106 | 105 |
|
| 107 |
- Long count = persistenceContext.countTable(fullyTableName);
|
|
| 108 |
- System.out.println(fullyTableName + " , " + count);
|
|
| 106 |
+ try (ObserveTopiaPersistenceContext persistenceContext = (ObserveTopiaPersistenceContext) request.getTargetTopiaApplicationContext().newPersistenceContext()) {
|
|
| 109 | 107 |
|
| 108 |
+ if (referentialTypesToTest != null) {
|
|
| 109 |
+ for (Class<? extends ReferentialDto> aClass : referentialTypesToTest) {
|
|
| 110 |
+ Class<ObserveReferentialEntity> entityType = PersistenceModelHelper.fromReferentialDto(aClass).toEntityType();
|
|
| 111 |
+ int expectedCount = getTestMethodResource().getDatabaseFixtures().count(aClass);
|
|
| 112 |
+ long actualCount = persistenceContext.getDao(entityType).count();
|
|
| 113 |
+ Assert.assertEquals("Should have found " + expectedCount + " on " + aClass.getName() + ", but was " + actualCount, expectedCount, actualCount);
|
|
| 110 | 114 |
}
|
| 111 |
- |
|
| 112 | 115 |
}
|
| 113 |
- |
|
| 114 |
- for (Map.Entry<String, Long> entry : expectedResults.entrySet()) {
|
|
| 115 |
- String fullyTableName = entry.getKey();
|
|
| 116 |
- Long expectedCount = entry.getValue();
|
|
| 117 |
- Long count = persistenceContext.countTable(fullyTableName);
|
|
| 118 |
- |
|
| 119 |
- log.debug("Found: " + fullyTableName + " , " + count);
|
|
| 120 |
- Assert.assertEquals("Should have found " + expectedCount + " on " + fullyTableName + ", but was " + count, expectedCount, count);
|
|
| 121 |
- |
|
| 116 |
+ if (dataTypesToTest != null) {
|
|
| 117 |
+ for (Class<? extends DataDto> aClass : dataTypesToTest) {
|
|
| 118 |
+ Class<ObserveDataEntity> entityType = PersistenceModelHelper.fromDataDto(aClass).toEntityType();
|
|
| 119 |
+ int expectedCount = getTestMethodResource().getDatabaseFixtures().count(aClass);
|
|
| 120 |
+ long actualCount = persistenceContext.getDao(entityType).count();
|
|
| 121 |
+ Assert.assertEquals("Should have found " + expectedCount + " on " + aClass.getName() + ", but was " + actualCount, expectedCount, actualCount);
|
|
| 122 |
+ }
|
|
| 122 | 123 |
}
|
| 123 | 124 |
|
| 124 | 125 |
}
|
| 125 | 126 |
|
| 126 |
- }
|
|
| 127 |
- |
|
| 128 |
- void testReplicate0(ReplicateTablesRequest request, ImmutableMap<String, Long> expectedTablesCount) {
|
|
| 129 |
- |
|
| 130 |
- TopiaSqlTables tables = request.getTables();
|
|
| 131 |
- log.info(String.format("Will replicate using %d tables.", tables.size()));
|
|
| 132 |
- |
|
| 133 |
- getTestMethodResource().getTopiaApplicationContext()
|
|
| 134 |
- .getSqlBatchService()
|
|
| 135 |
- .execute(request);
|
|
| 136 |
- |
|
| 137 |
- |
|
| 138 |
- assertReplicateTripResults(request, expectedTablesCount);
|
|
| 139 |
- |
|
| 140 | 127 |
log.debug(String.format("Replicate to script (length: %s) :\n%s", StringUtil.convertMemory(scriptFile.length()), scriptFile));
|
| 141 | 128 |
|
| 142 | 129 |
}
|
| 143 | 130 |
|
| 144 |
- protected void testReplicate(TopiaSqlTables tables, ImmutableMap<String, Long> expectedTablesCount, Iterable<String> tripIds) throws DataSourceCreateWithNoReferentialImportException, IOException, IncompatibleDataSourceCreateConfigurationException, DatabaseNotFoundException, DatabaseConnexionNotAuthorizedException, BabModelVersionException {
|
|
| 131 |
+ ReplicateTablesRequest.Builder createReplicateTablesRequest(DatabaseName databaseName) throws DataSourceCreateWithNoReferentialImportException, IOException, IncompatibleDataSourceCreateConfigurationException, BabModelVersionException, DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException {
|
|
| 145 | 132 |
|
| 146 |
- ReplicateTablesRequest request
|
|
| 147 |
- = createReplicateTablesRequest(DatabaseName.referentiel)
|
|
| 148 |
- .setSelectArgument(TopiaSqlTableSelectArgument.of(tripIds))
|
|
| 149 |
- .setTables(tables)
|
|
| 150 |
- .build();
|
|
| 133 |
+ File targetDatabaseDirectory = new File(getTestMethodResource().getTestDirectory(), "targetReplication");
|
|
| 134 |
+ ObserveDataSourceConfigurationTopiaH2 targetTopiaConfiguration = getTestClassResource().createDataSourceConfiguration(getTestMethodResource().getDbVersion(), databaseName.name(), targetDatabaseDirectory, getTestMethodResource().getLogin(), getTestMethodResource().getPassword());
|
|
| 135 |
+ ObserveTopiaApplicationContext targetTopiaApplicationContext = ObserveTopiaApplicationContextFactory.getOrCreateTopiaApplicationContext(targetTopiaConfiguration);
|
|
| 151 | 136 |
|
| 152 |
- testReplicate0(request, expectedTablesCount);
|
|
| 137 |
+ scriptFile = new File(getTestMethodResource().getTestDirectory(), "script.sql");
|
|
| 138 |
+ |
|
| 139 |
+ Writer writer = Files.newWriter(scriptFile, StandardCharsets.UTF_8);
|
|
| 153 | 140 |
|
| 141 |
+ return getTestMethodResource().getTopiaApplicationContext()
|
|
| 142 |
+ .getSqlBatchService()
|
|
| 143 |
+ .replicateTablesRequestBuilder()
|
|
| 144 |
+ .to(targetTopiaApplicationContext)
|
|
| 145 |
+ .to(writer);
|
|
| 154 | 146 |
}
|
| 147 |
+ |
|
| 155 | 148 |
}
|
| ... | ... | @@ -23,13 +23,21 @@ package fr.ird.observe.entity; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.dto.data.longline.TripLonglineDto;
|
| 26 |
+import fr.ird.observe.dto.data.seine.TripSeineDto;
|
|
| 27 |
+import fr.ird.observe.services.configuration.DataSourceCreateWithNoReferentialImportException;
|
|
| 28 |
+import fr.ird.observe.services.configuration.IncompatibleDataSourceCreateConfigurationException;
|
|
| 29 |
+import fr.ird.observe.services.service.BabModelVersionException;
|
|
| 30 |
+import fr.ird.observe.services.service.DatabaseConnexionNotAuthorizedException;
|
|
| 31 |
+import fr.ird.observe.services.service.DatabaseNotFoundException;
|
|
| 26 | 32 |
import fr.ird.observe.services.test.DatabaseName;
|
| 27 | 33 |
import fr.ird.observe.services.test.spi.DatabaseNameConfiguration;
|
| 28 |
-import fr.ird.observe.test.ObserveFixtures;
|
|
| 34 |
+import fr.ird.observe.spi.DtoModelClasses;
|
|
| 35 |
+import java.io.IOException;
|
|
| 29 | 36 |
import java.util.Set;
|
| 30 | 37 |
import org.apache.commons.logging.Log;
|
| 31 | 38 |
import org.apache.commons.logging.LogFactory;
|
| 32 |
-import org.junit.Test;
|
|
| 39 |
+import org.nuiton.topia.service.sql.batch.actions.ReplicateTablesRequest;
|
|
| 40 |
+import org.nuiton.topia.service.sql.batch.actions.TopiaSqlTableSelectArgument;
|
|
| 33 | 41 |
import org.nuiton.topia.service.sql.batch.tables.TopiaSqlTables;
|
| 34 | 42 |
|
| 35 | 43 |
/**
|
| ... | ... | @@ -43,27 +51,25 @@ public class ReplicateTripLonglineTest extends ReplicateTestSupport { |
| 43 | 51 |
/** Logger. */
|
| 44 | 52 |
private static final Log log = LogFactory.getLog(ReplicateTripLonglineTest.class);
|
| 45 | 53 |
|
| 46 |
- @Test
|
|
| 47 |
- public void testReplicate() throws Exception {
|
|
| 54 |
+ public ReplicateTripLonglineTest() {
|
|
| 55 |
+ super(null, DtoModelClasses.LONGLINE_ENTITY_DATA_TYPES);
|
|
| 56 |
+ }
|
|
| 57 |
+ |
|
| 58 |
+ |
|
| 59 |
+ @Override
|
|
| 60 |
+ TopiaSqlTables createTables() {
|
|
| 61 |
+ return getTestMethodResource().getTopiaApplicationContext().getTripLonglineTables();
|
|
| 62 |
+ }
|
|
| 63 |
+ |
|
| 64 |
+ @Override
|
|
| 65 |
+ protected ReplicateTablesRequest createRequest(TopiaSqlTables tables) throws DatabaseNotFoundException, DataSourceCreateWithNoReferentialImportException, IncompatibleDataSourceCreateConfigurationException, IOException, BabModelVersionException, DatabaseConnexionNotAuthorizedException {
|
|
| 48 | 66 |
Set<String> ids = getTestMethodResource().getDatabaseFixtures().ids(TripLonglineDto.class);
|
| 49 | 67 |
log.info(String.format("will replicate %d trip(s).", ids.size()));
|
| 50 |
- TopiaSqlTables tables = getTestMethodResource().getTopiaApplicationContext().getTripLonglineTables();
|
|
| 51 |
- testReplicate(tables, ObserveFixtures.ALL_TRIP_LONGLINE_COUNT, ids);
|
|
| 52 |
- }
|
|
| 53 | 68 |
|
| 54 |
-// @Test
|
|
| 55 |
-// public void testReplicateTripLonline1() throws Exception {
|
|
| 56 |
-// testReplicate(ObserveFixtures.TRIP_LONGLINE_1_TABLES_COUNT, ObserveFixtures.TRIP_LONGLINE_ID_1);
|
|
| 57 |
-// }
|
|
| 58 |
-//
|
|
| 59 |
-// @Test
|
|
| 60 |
-// public void testReplicateTripLonline2() throws Exception {
|
|
| 61 |
-// testReplicate(ObserveFixtures.TRIP_LONGLINE_2_TABLES_COUNT, ObserveFixtures.TRIP_LONGLINE_ID_2);
|
|
| 62 |
-// }
|
|
| 63 |
-//
|
|
| 64 |
-// @Test
|
|
| 65 |
-// public void testReplicateTripLonline3() throws Exception {
|
|
| 66 |
-// testReplicate(ObserveFixtures.TRIP_LONGLINE_3_TABLES_COUNT, ObserveFixtures.TRIP_LONGLINE_ID_3);
|
|
| 67 |
-// }
|
|
| 69 |
+ return createReplicateTablesRequest(DatabaseName.referentiel)
|
|
| 70 |
+ .setSelectArgument(TopiaSqlTableSelectArgument.of(ids))
|
|
| 71 |
+ .setTables(tables)
|
|
| 72 |
+ .build();
|
|
| 73 |
+ }
|
|
| 68 | 74 |
|
| 69 | 75 |
}
|
| ... | ... | @@ -22,14 +22,22 @@ package fr.ird.observe.entity; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 25 | 26 |
import fr.ird.observe.dto.data.seine.TripSeineDto;
|
| 27 |
+import fr.ird.observe.services.configuration.DataSourceCreateWithNoReferentialImportException;
|
|
| 28 |
+import fr.ird.observe.services.configuration.IncompatibleDataSourceCreateConfigurationException;
|
|
| 29 |
+import fr.ird.observe.services.service.BabModelVersionException;
|
|
| 30 |
+import fr.ird.observe.services.service.DatabaseConnexionNotAuthorizedException;
|
|
| 31 |
+import fr.ird.observe.services.service.DatabaseNotFoundException;
|
|
| 26 | 32 |
import fr.ird.observe.services.test.DatabaseName;
|
| 27 | 33 |
import fr.ird.observe.services.test.spi.DatabaseNameConfiguration;
|
| 28 |
-import fr.ird.observe.test.ObserveFixtures;
|
|
| 34 |
+import fr.ird.observe.spi.DtoModelClasses;
|
|
| 35 |
+import java.io.IOException;
|
|
| 29 | 36 |
import java.util.Set;
|
| 30 | 37 |
import org.apache.commons.logging.Log;
|
| 31 | 38 |
import org.apache.commons.logging.LogFactory;
|
| 32 |
-import org.junit.Test;
|
|
| 39 |
+import org.nuiton.topia.service.sql.batch.actions.ReplicateTablesRequest;
|
|
| 40 |
+import org.nuiton.topia.service.sql.batch.actions.TopiaSqlTableSelectArgument;
|
|
| 33 | 41 |
import org.nuiton.topia.service.sql.batch.tables.TopiaSqlTables;
|
| 34 | 42 |
|
| 35 | 43 |
/**
|
| ... | ... | @@ -39,30 +47,28 @@ import org.nuiton.topia.service.sql.batch.tables.TopiaSqlTables; |
| 39 | 47 |
*/
|
| 40 | 48 |
@DatabaseNameConfiguration(DatabaseName.dataForTestSeine)
|
| 41 | 49 |
public class ReplicateTripSeineTest extends ReplicateTestSupport {
|
| 50 |
+ |
|
| 42 | 51 |
/** Logger. */
|
| 43 | 52 |
private static final Log log = LogFactory.getLog(ReplicateTripSeineTest.class);
|
| 44 | 53 |
|
| 45 |
- @Test
|
|
| 46 |
- public void testReplicate() throws Exception {
|
|
| 54 |
+ public ReplicateTripSeineTest() {
|
|
| 55 |
+ super(null, DtoModelClasses.SEINE_ENTITY_DATA_TYPES);
|
|
| 56 |
+ }
|
|
| 57 |
+ |
|
| 58 |
+ @Override
|
|
| 59 |
+ TopiaSqlTables createTables() {
|
|
| 60 |
+ return getTestMethodResource().getTopiaApplicationContext().getTripSeineTables();
|
|
| 61 |
+ }
|
|
| 62 |
+ |
|
| 63 |
+ @Override
|
|
| 64 |
+ protected ReplicateTablesRequest createRequest(TopiaSqlTables tables) throws DatabaseNotFoundException, DataSourceCreateWithNoReferentialImportException, IncompatibleDataSourceCreateConfigurationException, IOException, BabModelVersionException, DatabaseConnexionNotAuthorizedException {
|
|
| 47 | 65 |
Set<String> ids = getTestMethodResource().getDatabaseFixtures().ids(TripSeineDto.class);
|
| 48 | 66 |
log.info(String.format("will replicate %d trip(s).", ids.size()));
|
| 49 |
- TopiaSqlTables tables = getTestMethodResource().getTopiaApplicationContext().getTripSeineTables();
|
|
| 50 |
- testReplicate(tables, ObserveFixtures.ALL_TRIP_SEINE_COUNT, ids);
|
|
| 51 |
- }
|
|
| 52 | 67 |
|
| 53 |
-// @Test
|
|
| 54 |
-// public void testReplicateTripSeine1() throws Exception {
|
|
| 55 |
-// testReplicate(ObserveFixtures.TRIP_SEINE_1_TABLES_COUNT, ObserveFixtures.TRIP_SEINE_ID_1);
|
|
| 56 |
-// }
|
|
| 57 |
-//
|
|
| 58 |
-// @Test
|
|
| 59 |
-// public void testReplicateTripSeine2() throws Exception {
|
|
| 60 |
-// testReplicate(ObserveFixtures.TRIP_SEINE_2_TABLES_COUNT, ObserveFixtures.TRIP_SEINE_ID_2);
|
|
| 61 |
-// }
|
|
| 62 |
-//
|
|
| 63 |
-// @Test
|
|
| 64 |
-// public void testReplicateTripSeine3() throws Exception {
|
|
| 65 |
-// testReplicate(ObserveFixtures.TRIP_SEINE_3_TABLES_COUNT, ObserveFixtures.TRIP_SEINE_ID_3);
|
|
| 66 |
-// }
|
|
| 68 |
+ return createReplicateTablesRequest(DatabaseName.referentiel)
|
|
| 69 |
+ .setSelectArgument(TopiaSqlTableSelectArgument.of(ids))
|
|
| 70 |
+ .setTables(tables)
|
|
| 71 |
+ .build();
|
|
| 72 |
+ }
|
|
| 67 | 73 |
|
| 68 | 74 |
}
|
| ... | ... | @@ -10134,4 +10134,4 @@ |
| 10134 | 10134 |
},
|
| 10135 | 10135 |
"types": {}
|
| 10136 | 10136 |
}
|
| 10137 |
-}
|
|
| 10137 |
+}
|
|
| \ No newline at end of file |
| ... | ... | @@ -121,4 +121,4 @@ |
| 121 | 121 |
},
|
| 122 | 122 |
"types": {}
|
| 123 | 123 |
}
|
| 124 |
-}
|
|
| 124 |
+}
|
|
| \ No newline at end of file |
| ... | ... | @@ -1080,6 +1080,8 @@ |
| 1080 | 1080 |
"fr.ird.observe.entities.referentiel.Person#1428578953995#0.8402597879270977",
|
| 1081 | 1081 |
"fr.ird.observe.entities.referentiel.Person#1428578984404#0.1624818954985996",
|
| 1082 | 1082 |
"fr.ird.observe.entities.referentiel.Person#1428579047136#0.28582733330602794",
|
| 1083 |
+ "fr.ird.observe.entities.referentiel.Person#1429515754811#0.0860557500272989",
|
|
| 1084 |
+ "fr.ird.observe.entities.referentiel.Person#1429515754847#0.704271007329226",
|
|
| 1083 | 1085 |
"fr.ird.observe.entities.referentiel.Person#1432805038273#0.5664302448691187",
|
| 1084 | 1086 |
"fr.ird.observe.entities.referentiel.Person#1433499200854#0.615648015402257",
|
| 1085 | 1087 |
"fr.ird.observe.entities.referentiel.Person#1433499201263#0.745114278979599",
|
| ... | ... | @@ -1274,6 +1276,13 @@ |
| 1274 | 1276 |
"fr.ird.observe.entities.referentiel.ShipOwner#0#9"
|
| 1275 | 1277 |
],
|
| 1276 | 1278 |
"referential.SizeMeasureType": [
|
| 1279 |
+ "fr.ird.observe.entities.referentiel.SizeMeasureType#1429515949422#0.323839171556756",
|
|
| 1280 |
+ "fr.ird.observe.entities.referentiel.SizeMeasureType#1429515949444#0.180838016327471",
|
|
| 1281 |
+ "fr.ird.observe.entities.referentiel.SizeMeasureType#1429515949471#0.763535852311179",
|
|
| 1282 |
+ "fr.ird.observe.entities.referentiel.SizeMeasureType#1429515949556#0.658470877679065",
|
|
| 1283 |
+ "fr.ird.observe.entities.referentiel.SizeMeasureType#1429515949576#0.370653854450211",
|
|
| 1284 |
+ "fr.ird.observe.entities.referentiel.SizeMeasureType#1429515949617#0.259305257815868",
|
|
| 1285 |
+ "fr.ird.observe.entities.referentiel.SizeMeasureType#1429515949639#0.329839885467663",
|
|
| 1277 | 1286 |
"fr.ird.observe.entities.referentiel.SizeMeasureType#1433499465700#0.0902433863375336",
|
| 1278 | 1287 |
"fr.ird.observe.entities.referentiel.SizeMeasureType#1433499465999#0.707568018231541",
|
| 1279 | 1288 |
"fr.ird.observe.entities.referentiel.SizeMeasureType#1433499466255#0.444246932631359",
|
| ... | ... | @@ -1485,6 +1494,15 @@ |
| 1485 | 1494 |
"fr.ird.observe.entities.referentiel.Species#1365776436586#0.42584811850930293",
|
| 1486 | 1495 |
"fr.ird.observe.entities.referentiel.Species#1383399210341#0.7324960169421437",
|
| 1487 | 1496 |
"fr.ird.observe.entities.referentiel.Species#1383400882289#0.9275723384489454",
|
| 1497 |
+ "fr.ird.observe.entities.referentiel.Species#1429515782578#0.57668571616523",
|
|
| 1498 |
+ "fr.ird.observe.entities.referentiel.Species#1429515783191#0.301721239695325",
|
|
| 1499 |
+ "fr.ird.observe.entities.referentiel.Species#1429515783493#0.271485573379323",
|
|
| 1500 |
+ "fr.ird.observe.entities.referentiel.Species#1429515783680#0.0288836669642478",
|
|
| 1501 |
+ "fr.ird.observe.entities.referentiel.Species#1429515783742#0.596136273350567",
|
|
| 1502 |
+ "fr.ird.observe.entities.referentiel.Species#1429515783863#0.310130815720186",
|
|
| 1503 |
+ "fr.ird.observe.entities.referentiel.Species#1429515784177#0.217057247878984",
|
|
| 1504 |
+ "fr.ird.observe.entities.referentiel.Species#1429515784214#0.543130560778081",
|
|
| 1505 |
+ "fr.ird.observe.entities.referentiel.Species#1429515784335#0.773490378633141",
|
|
| 1488 | 1506 |
"fr.ird.observe.entities.referentiel.Species#1433499238727#0.452269877539948",
|
| 1489 | 1507 |
"fr.ird.observe.entities.referentiel.Species#1433499239128#0.665396141353995",
|
| 1490 | 1508 |
"fr.ird.observe.entities.referentiel.Species#1433499239536#0.330866874894127",
|
| ... | ... | @@ -2526,6 +2544,9 @@ |
| 2526 | 2544 |
"fr.ird.observe.entities.referentiel.Vessel#1418400134914#0.7508690402739512",
|
| 2527 | 2545 |
"fr.ird.observe.entities.referentiel.Vessel#1418400258815#0.12569862197124138",
|
| 2528 | 2546 |
"fr.ird.observe.entities.referentiel.Vessel#1418400345435#0.5664364147475593",
|
| 2547 |
+ "fr.ird.observe.entities.referentiel.Vessel#1429515780666#0.496382233686745",
|
|
| 2548 |
+ "fr.ird.observe.entities.referentiel.Vessel#1429515780701#0.825504872016609",
|
|
| 2549 |
+ "fr.ird.observe.entities.referentiel.Vessel#1429515781376#0.949138431344181",
|
|
| 2529 | 2550 |
"fr.ird.observe.entities.referentiel.Vessel#1433148953942#0.24272879354646504",
|
| 2530 | 2551 |
"fr.ird.observe.entities.referentiel.Vessel#1433499209711#0.316791892750189",
|
| 2531 | 2552 |
"fr.ird.observe.entities.referentiel.Vessel#1433499210648#0.808905522339046",
|
| ... | ... | @@ -2849,6 +2870,7 @@ |
| 2849 | 2870 |
"fr.ird.observe.entities.referentiel.longline.BaitSettingStatus#1239832686123#0.2",
|
| 2850 | 2871 |
"fr.ird.observe.entities.referentiel.longline.BaitSettingStatus#1239832686123#0.3",
|
| 2851 | 2872 |
"fr.ird.observe.entities.referentiel.longline.BaitSettingStatus#1239832686123#0.4",
|
| 2873 |
+ "fr.ird.observe.entities.referentiel.longline.BaitSettingStatus#1429515949203#0.00216103950515389",
|
|
| 2852 | 2874 |
"fr.ird.observe.entities.referentiel.longline.BaitSettingStatus#1433499460626#0.465611247578636"
|
| 2853 | 2875 |
],
|
| 2854 | 2876 |
"referential.longline.BaitType": [
|
| ... | ... | @@ -2862,6 +2884,7 @@ |
| 2862 | 2884 |
"fr.ird.observe.entities.referentiel.longline.BaitType#1239832686124#0.8",
|
| 2863 | 2885 |
"fr.ird.observe.entities.referentiel.longline.BaitType#1239832686124#0.9",
|
| 2864 | 2886 |
"fr.ird.observe.entities.referentiel.longline.BaitType#1239832686124#1.0",
|
| 2887 |
+ "fr.ird.observe.entities.referentiel.longline.BaitType#1429515949067#0.955311801983044",
|
|
| 2865 | 2888 |
"fr.ird.observe.entities.referentiel.longline.BaitType#1433499457783#0.290097113000229",
|
| 2866 | 2889 |
"fr.ird.observe.entities.referentiel.longline.BaitType#1433499458077#0.820353789720684",
|
| 2867 | 2890 |
"fr.ird.observe.entities.referentiel.longline.BaitType#1433499458372#0.785577602451667",
|
| ... | ... | @@ -2874,6 +2897,7 @@ |
| 2874 | 2897 |
"fr.ird.observe.entities.referentiel.longline.CatchFateLongline#1239832686125#0.2",
|
| 2875 | 2898 |
"fr.ird.observe.entities.referentiel.longline.CatchFateLongline#1239832686125#0.3",
|
| 2876 | 2899 |
"fr.ird.observe.entities.referentiel.longline.CatchFateLongline#1239832686125#0.4",
|
| 2900 |
+ "fr.ird.observe.entities.referentiel.longline.CatchFateLongline#1429515949274#0.952565349172801",
|
|
| 2877 | 2901 |
"fr.ird.observe.entities.referentiel.longline.CatchFateLongline#1433499462055#0.71151070506312"
|
| 2878 | 2902 |
],
|
| 2879 | 2903 |
"referential.longline.EncounterType": [
|
| ... | ... | @@ -2935,6 +2959,7 @@ |
| 2935 | 2959 |
"fr.ird.observe.entities.referentiel.longline.HookSize#1239832686151#0.7",
|
| 2936 | 2960 |
"fr.ird.observe.entities.referentiel.longline.HookSize#1239832686151#0.8",
|
| 2937 | 2961 |
"fr.ird.observe.entities.referentiel.longline.HookSize#1239832686151#0.9",
|
| 2962 |
+ "fr.ird.observe.entities.referentiel.longline.HookSize#1429515948468#0.511942049022764",
|
|
| 2938 | 2963 |
"fr.ird.observe.entities.referentiel.longline.HookSize#1433499436918#0.552373287733644"
|
| 2939 | 2964 |
],
|
| 2940 | 2965 |
"referential.longline.HookType": [
|
| ... | ... | @@ -3038,6 +3063,7 @@ |
| 3038 | 3063 |
"fr.ird.observe.entities.referentiel.longline.SettingShape#1239832686128#0.3",
|
| 3039 | 3064 |
"fr.ird.observe.entities.referentiel.longline.SettingShape#1239832686128#0.4",
|
| 3040 | 3065 |
"fr.ird.observe.entities.referentiel.longline.SettingShape#1239832686128#0.5",
|
| 3066 |
+ "fr.ird.observe.entities.referentiel.longline.SettingShape#1429515949392#0.162451097276062",
|
|
| 3041 | 3067 |
"fr.ird.observe.entities.referentiel.longline.SettingShape#1433499465088#0.892811479745433"
|
| 3042 | 3068 |
],
|
| 3043 | 3069 |
"referential.longline.StomacFullness": [
|
| ... | ... | @@ -3047,6 +3073,7 @@ |
| 3047 | 3073 |
"fr.ird.observe.entities.referentiel.longline.StomacFullness#1239832686135#0.4",
|
| 3048 | 3074 |
"fr.ird.observe.entities.referentiel.longline.StomacFullness#1239832686135#0.5",
|
| 3049 | 3075 |
"fr.ird.observe.entities.referentiel.longline.StomacFullness#1239832686135#0.6",
|
| 3076 |
+ "fr.ird.observe.entities.referentiel.longline.StomacFullness#1429515949368#0.204060212243348",
|
|
| 3050 | 3077 |
"fr.ird.observe.entities.referentiel.longline.StomacFullness#1433499464733#0.548250555759296"
|
| 3051 | 3078 |
],
|
| 3052 | 3079 |
"referential.longline.TripType": [
|