[Git][ultreiaio/ird-t3][develop] update test fixtures for ATL and IND
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@tchemit.fr + * @since 1.0 + */ +@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@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@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@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@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@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@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/36231216ca3c310b355506044f36d0365... --- View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/36231216ca3c310b355506044f36d0365... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT