Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: a1b81a63 by Tony CHEMIT at 2017-10-25T15:11:58+02:00 clean servicxe client tests - - - - - 10 changed files: - services-client/pom.xml - services-client/src/test/java/fr/ird/observe/services/client/service/DataSourceServiceClientTest.java - services-client/src/test/java/fr/ird/observe/services/client/service/PingServiceClientTest.java - − services-client/src/test/java/fr/ird/observe/services/client/service/ServiceClientTestSupport.java - − services-client/src/test/java/fr/ird/observe/services/client/service/actions/consolidate/ConsolidateDataServiceClientTest.java - − services-client/src/test/java/fr/ird/observe/services/client/service/actions/consolidate/dcp/SimplifiedObjectTypeManagerTest.java - − services-client/src/test/java/fr/ird/observe/services/client/service/actions/report/AbstractReportServiceClientTest.java - − services-client/src/test/java/fr/ird/observe/services/client/service/actions/report/ReportAccessoryCatchClientTest.java - − services-client/src/test/java/fr/ird/observe/services/client/service/actions/validate/ValidateServiceClientTest.java - − services-client/src/test/java/fr/ird/observe/services/client/service/seine/TripSeineServiceClientTest.java Changes: ===================================== services-client/pom.xml ===================================== --- a/services-client/pom.xml +++ b/services-client/pom.xml @@ -118,10 +118,6 @@ <groupId>org.nuiton</groupId> <artifactId>nuiton-utils</artifactId> </dependency> - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-validator</artifactId> - </dependency> <dependency> <groupId>org.nuiton.topia</groupId> @@ -195,15 +191,6 @@ <test>fr.ird.observe.services.client.ServiceClientTestSuite</test> </configuration> </execution> - <execution> - <id>default-test</id> - <goals> - <goal>test</goal> - </goals> - <configuration> - <skip>true</skip> - </configuration> - </execution> </executions> </plugin> ===================================== services-client/src/test/java/fr/ird/observe/services/client/service/DataSourceServiceClientTest.java ===================================== --- a/services-client/src/test/java/fr/ird/observe/services/client/service/DataSourceServiceClientTest.java +++ b/services-client/src/test/java/fr/ird/observe/services/client/service/DataSourceServiceClientTest.java @@ -31,6 +31,9 @@ import fr.ird.observe.services.service.BabModelVersionException; import fr.ird.observe.services.service.DataSourceService; import fr.ird.observe.services.service.DatabaseConnexionNotAuthorizedException; import fr.ird.observe.services.service.DatabaseNotFoundException; +import fr.ird.observe.services.test.ServiceClientTestClassResource; +import fr.ird.observe.services.test.ServiceClientTestMethodResource; +import fr.ird.observe.services.test.ServiceTestSupport; import java.io.IOException; import org.junit.Assert; import org.junit.Ignore; @@ -41,7 +44,17 @@ import org.junit.Test; * * @author Tony Chemit - dev@tchemit.fr */ -public class DataSourceServiceClientTest extends ServiceClientTestSupport { +public class DataSourceServiceClientTest extends ServiceTestSupport { + + @Override + public ServiceClientTestMethodResource getTestMethodResource() { + return (ServiceClientTestMethodResource) super.getTestMethodResource(); + } + + @Override + public ServiceClientTestClassResource getTestClassResource() { + return (ServiceClientTestClassResource) super.getTestClassResource(); + } //FIXME @Ignore ===================================== services-client/src/test/java/fr/ird/observe/services/client/service/PingServiceClientTest.java ===================================== --- a/services-client/src/test/java/fr/ird/observe/services/client/service/PingServiceClientTest.java +++ b/services-client/src/test/java/fr/ird/observe/services/client/service/PingServiceClientTest.java @@ -24,6 +24,8 @@ package fr.ird.observe.services.client.service; import fr.ird.observe.services.configuration.rest.ObserveDataSourceConfigurationRest; import fr.ird.observe.services.service.PingService; +import fr.ird.observe.services.test.ServiceClientTestMethodResource; +import fr.ird.observe.services.test.ServiceTestSupport; import io.ultreia.java4all.http.HResponseNotAvailableException; import java.net.MalformedURLException; import java.net.URL; @@ -34,7 +36,12 @@ import org.junit.Test; * * @author Tony Chemit - dev@tchemit.fr */ -public class PingServiceClientTest extends ServiceClientTestSupport { +public class PingServiceClientTest extends ServiceTestSupport { + + @Override + public ServiceClientTestMethodResource getTestMethodResource() { + return (ServiceClientTestMethodResource) super.getTestMethodResource(); + } @Test(expected = HResponseNotAvailableException.class) public void testPingWithBadServerUrl() throws MalformedURLException, CloneNotSupportedException { ===================================== services-client/src/test/java/fr/ird/observe/services/client/service/ServiceClientTestSupport.java deleted ===================================== --- a/services-client/src/test/java/fr/ird/observe/services/client/service/ServiceClientTestSupport.java +++ /dev/null @@ -1,129 +0,0 @@ -package fr.ird.observe.services.client.service; - -/* - * #%L - * ObServe :: Services client implementation - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.dto.IdDto; -import fr.ird.observe.dto.form.Form; -import fr.ird.observe.services.configuration.ObserveDataSourceConnection; -import fr.ird.observe.services.configuration.rest.ObserveDataSourceConfigurationRest; -import fr.ird.observe.services.service.DataSourceService; -import fr.ird.observe.services.service.ObserveService; -import fr.ird.observe.services.test.ObserveTestConfiguration; -import fr.ird.observe.services.test.ServiceClientTestClassResource; -import fr.ird.observe.services.test.ServiceClientTestMethodResource; -import fr.ird.observe.services.test.ServiceTestSupport; -import fr.ird.observe.services.test.spi.DatabaseLoginConfiguration; -import fr.ird.observe.services.test.spi.DatabasePasswordConfiguration; -import fr.ird.observe.services.test.spi.DatabaseServerNameConfiguration; -import fr.ird.observe.services.test.spi.DatabaseUrlConfiguration; -import org.junit.After; -import org.junit.Before; - -/** - * @author Tony Chemit - dev@tchemit.fr - */ -@DatabaseLoginConfiguration(ObserveTestConfiguration.WEB_LOGIN) -@DatabasePasswordConfiguration(ObserveTestConfiguration.WEB_PASSWORD) -@DatabaseUrlConfiguration -@DatabaseServerNameConfiguration -public abstract class ServiceClientTestSupport extends ServiceTestSupport { - - private ObserveDataSourceConnection dataSourceConnection; - - private DataSourceService dataSourceService; - - @Override - public ServiceClientTestClassResource getTestClassResource() { - return (ServiceClientTestClassResource) super.getTestClassResource(); - } - - @Override - public ServiceClientTestMethodResource getTestMethodResource() { - return (ServiceClientTestMethodResource) super.getTestMethodResource(); - } - - @Before - public void setUp() throws Exception { - - ObserveDataSourceConfigurationRest dataSourceConfiguration = getTestMethodResource().getDataSourceConfiguration(); - - dataSourceService = getTestClassResource().newService(dataSourceConfiguration, DataSourceService.class); - dataSourceConnection = dataSourceService.open(dataSourceConfiguration); - } - - @After - public void tearDown() { - - if (dataSourceConnection != null) { - dataSourceService.close(); - } - - } - - public <S extends ObserveService> S newService(Class<S> serviceType) { - return getTestClassResource().newService(dataSourceConnection, serviceType); - } - - protected <T extends IdDto> void assertEditLabels(Form<T> form, int expectedLabels, Class<?>... expectedTypes) { - - //FIXME Rest test -// Assert.assertNotNull(formDto.getLabels()); -// -// Set<Class<?>> types = ReferenceSetDtos.getTypes(formDto.getLabels()); -// -// Assert.assertEquals(expectedTypes.length, types.size()); -// -// for (Class<?> expectedType : expectedTypes) { -// Assert.assertTrue(types.contains(expectedType)); -// } -// Assert.assertEquals(expectedLabels, formDto.sizeLabels()); -// -// for (ReferenceSetDto referenceSetDto : formDto.getLabels()) { -// -// Assert.assertTrue(referenceSetDto.size() > 0); -// -// } - } - - protected <T extends IdDto> void assertReadLabels(Form<T> form, int expectedLabels, Class<?>... expectedTypes) { - - //FIXME Rest test -// Assert.assertNotNull(formDto.getLabels()); -// -// Set<Class<?>> types = ReferenceSetDtos.getTypes(formDto.getLabels()); -// -// Assert.assertEquals(expectedTypes.length, types.size()); -// -// for (Class<?> expectedType : expectedTypes) { -// Assert.assertTrue(types.contains(expectedType)); -// } -// Assert.assertEquals(expectedLabels, formDto.sizeLabels()); -// -// for (ReferenceSetDto referenceSetDto : formDto.getLabels()) { -// -// Assert.assertTrue(referenceSetDto.isReferenceEmpty()); -// -// } - } - -} ===================================== services-client/src/test/java/fr/ird/observe/services/client/service/actions/consolidate/ConsolidateDataServiceClientTest.java deleted ===================================== --- a/services-client/src/test/java/fr/ird/observe/services/client/service/actions/consolidate/ConsolidateDataServiceClientTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package fr.ird.observe.services.client.service.actions.consolidate; - -/* - * #%L - * ObServe :: Services client implementation - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.services.service.actions.consolidate.ConsolidateDataServiceTest; - -/** - * Created on 29/08/15. - * - * @author Tony Chemit - dev@tchemit.fr - */ -public class ConsolidateDataServiceClientTest extends ConsolidateDataServiceTest { - -} ===================================== services-client/src/test/java/fr/ird/observe/services/client/service/actions/consolidate/dcp/SimplifiedObjectTypeManagerTest.java deleted ===================================== --- a/services-client/src/test/java/fr/ird/observe/services/client/service/actions/consolidate/dcp/SimplifiedObjectTypeManagerTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package fr.ird.observe.services.client.service.actions.consolidate.dcp; - -/*- - * #%L - * ObServe :: Services client implementation - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -/** - * Created by tchemit on 02/08/17. - * - * @author Tony Chemit - dev@tchemit.fr - */ -public class SimplifiedObjectTypeManagerTest extends fr.ird.observe.services.service.actions.consolidate.dcp.SimplifiedObjectTypeManagerTest { - -} ===================================== services-client/src/test/java/fr/ird/observe/services/client/service/actions/report/AbstractReportServiceClientTest.java deleted ===================================== --- a/services-client/src/test/java/fr/ird/observe/services/client/service/actions/report/AbstractReportServiceClientTest.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * #%L - * ObServe :: Services client implementation - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -package fr.ird.observe.services.client.service.actions.report; - - -import fr.ird.observe.dto.reference.DtoReference; -import fr.ird.observe.services.client.service.ServiceClientTestSupport; -import fr.ird.observe.services.service.actions.report.DataMatrix; -import fr.ird.observe.services.service.actions.report.Report; -import fr.ird.observe.services.service.actions.report.ReportBuilder; -import fr.ird.observe.services.service.actions.report.ReportRequest; -import fr.ird.observe.services.service.actions.report.ReportService; -import fr.ird.observe.services.service.actions.report.ReportVariable; -import fr.ird.observe.test.ObserveFixtures; -import java.io.IOException; -import java.net.URL; -import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -/** - * Classe abstraite de test d'un report. - * <p> - * On définit ici le mécanisme pour tester unitairement un report et son - * résultat. - * - * @author Tony Chemit - dev@tchemit.fr - * @since 1.9 - */ -public abstract class AbstractReportServiceClientTest extends ServiceClientTestSupport { - - /** Logger */ - private static final Log log = LogFactory.getLog(AbstractReportServiceClientTest.class); - - protected ReportService service; - - /** La liste de tous les reports connus. */ - protected static List<Report> reports; - - /** Le report à tester. */ - private Report report; - - protected abstract String getReportId(); - - @Before - public final void setUp() throws Exception { - - super.setUp(); - - service = newService(ReportService.class); - - // recuperation du report à tester - report = getReport(log, getReportId()); - - if (log.isInfoEnabled()) { - log.info("Will use report '" + report + "'"); - } - - } - - - /** - * L'unique test à lancer. - * <p> - * On vérifie : - * <ul> - * <li>la syntaxe du report via {@link #testReportSyntax(Report)}</li> - * <li>le résultat du report via {@link #testReportResult(DataMatrix)}</li> - * </ul> - * - * @throws Exception pour toute erreur lors de l'execution du report - */ - @Test - public final void testReport() throws Exception { - - // test de la syntaxe du report - testReportSyntax(report); - - // creation de l'executeur de report - report = service.populateVariables(report, ObserveFixtures.TRIP_SEINE_ID_1); - - // preparation des variables - prepareVariables(); - - - // on execute le report - DataMatrix result = service.executeReport(report, ObserveFixtures.TRIP_SEINE_ID_1); - - if (log.isInfoEnabled()) { - log.info("Result :\n" + result.getClipboardContent(true, true, false, '\t')); - } - - // on verifie le resultat - testReportResult(result); - } - - protected void prepareVariables() { - - } - - protected void setVariableValue(String variableName, String id) { - - for (ReportVariable variable : report.getVariables()) { - - if (variableName.equals(variable.getName())) { - - Object value = variable.getValues().stream() - .filter(DtoReference.newIdPredicate(id)) - .findFirst() - .orElse(null); - - variable.setSelectedValue(value); - - } - - } - - } - - protected abstract void testReportSyntax(Report report); - - protected abstract void testReportResult(DataMatrix result); - - protected static Report getReport(Log log, String reportId) throws IOException { - if (reports == null) { - - URL reportLocation = - AbstractReportServiceClientTest.class.getResource("/observe-reports.properties"); - - if (log.isInfoEnabled()) { - log.info("Loading reports from " + reportLocation); - } - - ReportBuilder builder = new ReportBuilder(); - - reports = builder.load(reportLocation); - - builder.clear(); - - Assert.assertNotNull(reports); - Assert.assertFalse(reports.isEmpty()); - } - - Report result = null; - // recuperation du report à tester - for (Report report : reports) { - if (reportId.equals(report.getId())) { - result = report; - break; - } - } - - Assert.assertNotNull("Could not find report with id " + reportId, reports); - return result; - } - - protected void assertReportName(Report report, - String name, - String description) { - Assert.assertEquals(getReportId(), report.getId()); - Assert.assertEquals(name, report.getName()); - Assert.assertEquals(description, report.getDescription()); - } - - protected void assertReportDimension(Report report, - int rows, - int columns, - String[] columnsHeader, - String[] rowsHeader) { - Assert.assertEquals(rows, report.getRows()); - Assert.assertEquals(columns, report.getColumns()); - Assert.assertArrayEquals(columnsHeader, report.getColumnHeaders()); - Assert.assertArrayEquals(rowsHeader, report.getRowHeaders()); - } - - protected void assertReportNbRequests(Report report, int nbRequests) { - ReportRequest[] requests = report.getRequests(); - Assert.assertNotNull(requests); - Assert.assertEquals(nbRequests, requests.length); - } - - protected void assertReportRequestDimension(ReportRequest request, - ReportRequest.RequestLayout layout, - int x, - int y) { - Assert.assertEquals(layout, request.getLayout()); -// Assert.assertEquals(new Point(width, height), request.getLocation()); - Assert.assertEquals(x, request.getX()); - Assert.assertEquals(y, request.getY()); - } - - protected void assertResultDimension(DataMatrix result, - int width, - int height, - int x, - int y) { - Assert.assertEquals(width, result.getWidth()); - Assert.assertEquals(height, result.getHeight()); - Assert.assertEquals(x, result.getX()); - Assert.assertEquals(y, result.getY()); - } - - protected void assertResultRow(DataMatrix result, int rowId, Object... row) { - Object[] actualRow = result.getData()[rowId]; - Assert.assertArrayEquals(row, actualRow); - } -} ===================================== services-client/src/test/java/fr/ird/observe/services/client/service/actions/report/ReportAccessoryCatchClientTest.java deleted ===================================== --- a/services-client/src/test/java/fr/ird/observe/services/client/service/actions/report/ReportAccessoryCatchClientTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * #%L - * ObServe :: Services client implementation - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -package fr.ird.observe.services.client.service.actions.report; - - -import fr.ird.observe.services.service.actions.report.DataMatrix; -import fr.ird.observe.services.service.actions.report.Report; -import fr.ird.observe.services.service.actions.report.ReportRequest; -import fr.ird.observe.test.ObserveFixtures; -import org.junit.Assert; - -/** - * Test du report {@code accessoryCatch}. - * - * @author Tony Chemit - dev@tchemit.fr - * @since 1.9 - */ -public class ReportAccessoryCatchClientTest extends AbstractReportServiceClientTest { - - @Override - protected void testReportSyntax(Report report) { - Assert.assertNotNull(report); - assertReportName( - report, - "Liste des captures accessoires selon le type de banc, filtrées par groupe", - "Afficher les captures accessoires par groupe d'espèce\n" + - "Les poids sont exprimés en tonnes." - ); - - assertReportDimension( - report, - -1, - 3, - new String[]{"Espèce", - "Banc libre", - "Banc objet", - }, - null - ); - - assertReportNbRequests(report, 3); - - ReportRequest[] requests = report.getRequests(); - - assertReportRequestDimension( - requests[0], - ReportRequest.RequestLayout.row, - 0, - 0 - ); - assertReportRequestDimension( - requests[1], - ReportRequest.RequestLayout.row, - 1, - 0 - ); - assertReportRequestDimension( - requests[2], - ReportRequest.RequestLayout.row, - 2, - 0 - ); - } - - @Override - protected String getReportId() { - return "accessoryCatch"; - } - - @Override - protected void prepareVariables() { - setVariableValue("speciesGroup", ObserveFixtures.SPECIES_GROUP_ID); - } - - @Override - protected void testReportResult(DataMatrix result) { - assertResultDimension(result, 3, 54, 0, 0); - - int row = 0; - assertResultRow(result, row++, "[FAO]MAE [sc]Aetobatus narinari [fr]Aigle de mer léopard", "-", "-"); - assertResultRow(result, row++, "[FAO]PTH [sc]Alopias pelagicus [fr]Renard pélagique", "-", "-"); - assertResultRow(result, row++, "[FAO]BTH [sc]Alopias superciliosus [fr]Renard à gros yeux", "-", "-"); - assertResultRow(result, row++, "[FAO]ALV [sc]Alopias vulpinus [fr]Renard", "-", "-"); - assertResultRow(result, row++, "[FAO]WSH [sc]Carcharodon carcharias [fr]Grand requin blanc", "-", "-"); - assertResultRow(result, row++, "[FAO]CCE [sc]Carcharhinus leucas [fr]Requin-bouledogue", "-", "-"); - assertResultRow(result, row++, "[FAO]FAL [sc]Carcharhinus falciformis [fr]Requin soyeux", "-", "+ Effectif : 17 Poids total (t) : 0.1753"); - assertResultRow(result, row++, "[FAO]OCS [sc]Carcharhinus longimanus [fr]Requin océanique", "+ Effectif : 1 Poids total (t) : 0.0447", "-"); - assertResultRow(result, row++, "[FAO]DUS [sc]Carcharhinus obscurus [fr]Requin sombre", "-", "-"); - assertResultRow(result, row++, "[FAO]PLS [sc]Dasyatys (Pteroplatytrygon) violacea [fr]Pastenague violette", "-", "-"); - assertResultRow(result, row++, "[FAO]SHL [sc]Etmopterus spp [fr]Genre Etmopterus", "-", "-"); - assertResultRow(result, row++, "[FAO]THR [sc]Alopias spp [fr]Renards de mer nca ", "-", "-"); - assertResultRow(result, row++, "[FAO]RSK [sc]Carcharhinidae spp [fr]Famille Carcharhinidae", "-", "+ Effectif : 11 Poids total (t) : 0.55"); - assertResultRow(result, row++, "[FAO]STT [sc]Dasyatidae [fr]Famille Dasyatidae", "+ Effectif : 7 Poids total (t) : 0.015", "-"); - assertResultRow(result, row++, "[FAO]MSK [sc]Lamnidae [fr]Famille Lamnidae", "-", "-"); - assertResultRow(result, row++, "[FAO]2FOD [sc]Odontaspididae [fr]Odontaspididae", "-", "-"); - assertResultRow(result, row++, "[FAO]- [sc]Rhincodontidae [fr]Famille Rhincodontidae", "-", "-"); - assertResultRow(result, row++, "[FAO]SPY [sc]Sphyrnidae [fr]Famille Sphyrnidae", "-", "+ Effectif : 1"); - assertResultRow(result, row++, "[FAO]TIG [sc]Galeocerdo cuvier [fr]Requin tigre commun", "-", "-"); - assertResultRow(result, row++, "[FAO]ISB [sc]Isistius brasiliensis [fr]Squalelet féroce", "-", "-"); - assertResultRow(result, row++, "[FAO]SMA [sc]Isurus oxyrinchus [fr]Taupe bleu", "-", "-"); - assertResultRow(result, row++, "[FAO]MAK [sc]Isurus spp [fr]Taupes", "-", "-"); - assertResultRow(result, row++, "[FAO]MAN [sc]Mobulidae [fr]Mantes, diables de mer nca ", "-", "-"); - assertResultRow(result, row++, "[FAO]MYL [sc]Myliobatis aquila [fr]Aigle commun", "-", "-"); - assertResultRow(result, row++, "[FAO]RMB [sc]Manta birostris [fr]Mante atlantique", "+ Effectif : 9 Poids total (t) : 1.1824", "-"); - assertResultRow(result, row++, "[FAO]RMT [sc]Mobula tarapacana [fr]Diable géant de Guinée", "-", "-"); - assertResultRow(result, row++, "[FAO]MNT [sc]Manta spp [fr]Raies manta", "-", "-"); - assertResultRow(result, row++, "[FAO]RMM [sc]Mobula mobular [fr]Mante mobula", "-", "-"); - assertResultRow(result, row++, "[FAO]LMP [sc]Megachasma pelagios [fr]Requin grande gueule", "-", "-"); - assertResultRow(result, row++, "[FAO]RMJ [sc]Mobula japanica [fr]Mante aiguillat", "-", "-"); - assertResultRow(result, row++, "[FAO]CVX [sc]Carcharhiniformes [fr]Ordre Carcharhiniformes", "-", "-"); - assertResultRow(result, row++, "[FAO]HDQ [sc]Heterodontiformes [fr]Ordre Heterodontiformes", "-", "-"); - assertResultRow(result, row++, "[FAO]HXW [sc]Hexanchiformes [fr]Ordre Hexanchiformes", "-", "-"); - assertResultRow(result, row++, "[FAO]LMZ [sc]Lamniformes [fr]Ordre Lamniformes", "-", "-"); - assertResultRow(result, row++, "[FAO]OCX [sc]Orectolobiformes [fr]Ordre Orectolobiformes", "-", "-"); - assertResultRow(result, row++, "[FAO]PWS [sc]Pristiophorus spp [fr]Requins-scies nca ", "-", "-"); - assertResultRow(result, row++, "[FAO]SHX [sc]Squaliformes [fr]Ordre Squaliformes", "-", "-"); - assertResultRow(result, row++, "[FAO]ASK [sc]Squatinidae [fr]Anges de mer nca ", "-", "-"); - assertResultRow(result, row++, "[FAO]BSH [sc]Prionace glauca [fr]Peau bleue", "-", "-"); - assertResultRow(result, row++, "[FAO]POR [sc]Lamna nasus [fr]Requin taupe commun", "-", "-"); - assertResultRow(result, row++, "[FAO]SRX [sc]Raie non identifiée [fr]Raie non identifiée", "-", "-"); - assertResultRow(result, row++, "[FAO]2REX [sc]Requin non identifié [fr]Requin non identifié", "-", "-"); - assertResultRow(result, row++, "[FAO]- [sc]Rhinopteridae [fr]Famille Rhinopteridae", "-", "-"); - assertResultRow(result, row++, "[FAO]NZX [sc]Rhinoptera spp [fr]Mourines", "-", "-"); - assertResultRow(result, row++, "[FAO]RMA [sc]Manta alfredi [fr]Manta Alfredi", "-", "-"); - assertResultRow(result, row++, "[FAO]RMC [sc]Mobula coilloti [fr]Mobula coilloti ", "-", "-"); - assertResultRow(result, row++, "[FAO]RMO [sc]Mobula thurstoni [fr]Mobula", "-", "-"); - assertResultRow(result, row++, "[FAO]RMV [sc]Mobula spp [fr]Mobula nca", "-", "-"); - assertResultRow(result, row++, "[FAO]BSK [sc]Cetorhinus maximus [fr]Requin pèlerin", "-", "-"); - assertResultRow(result, row++, "[FAO]RHN [sc]Rhincodon typus [fr]Requin baleine", "-", "-"); - assertResultRow(result, row++, "[FAO]SPL [sc]Sphyrna lewini [fr]Requin marteau halicorne", "-", "-"); - assertResultRow(result, row++, "[FAO]SPK [sc]Sphyrna mokarran [fr]Grand requin marteau", "-", "-"); - assertResultRow(result, row++, "[FAO]SPZ [sc]Sphyrna zygaena [fr]Requin marteau commun", "-", "-"); - assertResultRow(result, row, "[FAO]TOD [sc]Torpedinidae [fr]Torpilles, raies électriq. nca ", "-", "-"); - - - } -} ===================================== services-client/src/test/java/fr/ird/observe/services/client/service/actions/validate/ValidateServiceClientTest.java deleted ===================================== --- a/services-client/src/test/java/fr/ird/observe/services/client/service/actions/validate/ValidateServiceClientTest.java +++ /dev/null @@ -1,250 +0,0 @@ -package fr.ird.observe.services.client.service.actions.validate; - -/* - * #%L - * ObServe :: Services client implementation - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.common.collect.ImmutableSet; -import fr.ird.observe.dto.referential.CountryDto; -import fr.ird.observe.dto.referential.FpaZoneDto; -import fr.ird.observe.dto.referential.GearCaracteristicDto; -import fr.ird.observe.dto.referential.GearCaracteristicTypeDto; -import fr.ird.observe.dto.referential.GearDto; -import fr.ird.observe.dto.referential.HarbourDto; -import fr.ird.observe.dto.referential.LengthWeightParameterDto; -import fr.ird.observe.dto.referential.OceanDto; -import fr.ird.observe.dto.referential.OrganismDto; -import fr.ird.observe.dto.referential.PersonDto; -import fr.ird.observe.dto.referential.ProgramDto; -import fr.ird.observe.dto.referential.ReferentialDto; -import fr.ird.observe.dto.referential.SexDto; -import fr.ird.observe.dto.referential.SpeciesDto; -import fr.ird.observe.dto.referential.SpeciesGroupDto; -import fr.ird.observe.dto.referential.SpeciesListDto; -import fr.ird.observe.dto.referential.VesselDto; -import fr.ird.observe.dto.referential.VesselSizeCategoryDto; -import fr.ird.observe.dto.referential.VesselTypeDto; -import fr.ird.observe.services.client.service.ServiceClientTestSupport; -import fr.ird.observe.services.service.actions.validate.DataValidationRequest; -import fr.ird.observe.services.service.actions.validate.ReferentialValidationRequest; -import fr.ird.observe.services.service.actions.validate.ValidateService; -import fr.ird.observe.services.service.actions.validate.ValidationResult; -import fr.ird.observe.test.ObserveFixtures; -import org.junit.Assert; -import org.junit.Test; -import org.nuiton.validator.NuitonValidatorScope; - -/** - * @author Tony Chemit - dev@tchemit.fr - */ -public class ValidateServiceClientTest extends ServiceClientTestSupport { - - protected static final ImmutableSet<Class<? extends ReferentialDto>> REFERENTIAL_DTO_TYPES = ImmutableSet.of( - CountryDto.class, - FpaZoneDto.class, - GearCaracteristicDto.class, - GearCaracteristicTypeDto.class, - GearDto.class, - HarbourDto.class, - LengthWeightParameterDto.class, - OceanDto.class, - OrganismDto.class, - PersonDto.class, - ProgramDto.class, - SexDto.class, - SpeciesDto.class, - SpeciesGroupDto.class, - SpeciesListDto.class, - VesselDto.class, - VesselSizeCategoryDto.class, - VesselTypeDto.class - ); - - protected ValidateService service; - - @Override - public void setUp() throws Exception { - super.setUp(); - service = newService(ValidateService.class); - - } - - @Test - public void testValidateReferantials() throws Exception { - - ReferentialValidationRequest request = new ReferentialValidationRequest(); - - request.setValidationContext(ValidateService.UPDATE_VALIDATION_CONTEXT); - request.setScopes(ImmutableSet.copyOf(NuitonValidatorScope.values())); - - request.setReferentialTypes(REFERENTIAL_DTO_TYPES); - - ValidationResult<ReferentialValidationRequest> result = service.validateReferential(request); - Assert.assertNotNull(result); - //FIXME - -// ImmutableMap<Class<? extends ReferentialDto>, ValidateResultForDtoType<? extends IdDto>> resultByType = result.getResultByType(); -// Assert.assertNotNull(resultByType); -// Assert.assertEquals(59, resultByType.size()); -// -// assertValidateResultForReferentialDtoType(resultByType, CountryDto.class, 53); -// assertValidateResultForReferentialDtoType(resultByType, FpaZoneDto.class, 41); -// assertValidateResultForReferentialDtoType(resultByType, GearCaracteristicDto.class, 22); -// assertValidateResultForReferentialDtoType(resultByType, GearCaracteristicTypeDto.class, 6); -// assertValidateResultForReferentialDtoType(resultByType, GearDto.class, 26); -// assertValidateResultForReferentialDtoType(resultByType, HarbourDto.class, 74); -// assertValidateResultForReferentialDtoType(resultByType, LengthWeightParameterDto.class, 352); -// assertValidateResultForReferentialDtoType(resultByType, OceanDto.class, 3); -// assertValidateResultForReferentialDtoType(resultByType, OrganismDto.class, 8); -// assertValidateResultForReferentialDtoType(resultByType, PersonDto.class, 390); -// assertValidateResultForReferentialDtoType(resultByType, ProgramDto.class, 27); -// assertValidateResultForReferentialDtoType(resultByType, SexDto.class, 5); -// assertValidateResultForReferentialDtoType(resultByType, SpeciesDto.class, 275); -// assertValidateResultForReferentialDtoType(resultByType, SpeciesGroupDto.class, 8); -// assertValidateResultForReferentialDtoType(resultByType, SpeciesListDto.class, 5); -// assertValidateResultForReferentialDtoType(resultByType, VesselDto.class, 977); -// assertValidateResultForReferentialDtoType(resultByType, VesselSizeCategoryDto.class, 13); -// assertValidateResultForReferentialDtoType(resultByType, VesselTypeDto.class, 14); -// -// assertValidateResultForReferentialDtoType(resultByType, BaitHaulingStatusDto.class, 5); -// assertValidateResultForReferentialDtoType(resultByType, BaitSettingStatusDto.class, 5); -// assertValidateResultForReferentialDtoType(resultByType, BaitTypeDto.class, 16); -// assertValidateResultForReferentialDtoType(resultByType, CatchFateLonglineDto.class, 5); -// assertValidateResultForReferentialDtoType(resultByType, EncounterTypeDto.class, 12); -// assertValidateResultForReferentialDtoType(resultByType, HealthnessDto.class, 6); -// assertValidateResultForReferentialDtoType(resultByType, HookPositionDto.class, 13); -// assertValidateResultForReferentialDtoType(resultByType, HookSizeDto.class, 22); -// assertValidateResultForReferentialDtoType(resultByType, HookTypeDto.class, 13); -// assertValidateResultForReferentialDtoType(resultByType, ItemHorizontalPositionDto.class, 3); -// assertValidateResultForReferentialDtoType(resultByType, ItemVerticalPositionDto.class, 3); -// assertValidateResultForReferentialDtoType(resultByType, LightsticksColorDto.class, 7); -// assertValidateResultForReferentialDtoType(resultByType, LightsticksTypeDto.class, 2); -// assertValidateResultForReferentialDtoType(resultByType, LineTypeDto.class, 8); -// assertValidateResultForReferentialDtoType(resultByType, MaturityStatusDto.class, 12); -// assertValidateResultForReferentialDtoType(resultByType, MitigationTypeDto.class, 15); -// assertValidateResultForReferentialDtoType(resultByType, SensorBrandDto.class, 4); -// assertValidateResultForReferentialDtoType(resultByType, SensorDataFormatDto.class, 2); -// assertValidateResultForReferentialDtoType(resultByType, SensorTypeDto.class, 4); -// assertValidateResultForReferentialDtoType(resultByType, SettingShapeDto.class, 6); -// assertValidateResultForReferentialDtoType(resultByType, SizeMeasureTypeDto.class, 17); -// assertValidateResultForReferentialDtoType(resultByType, StomacFullnessDto.class, 7); -// assertValidateResultForReferentialDtoType(resultByType, TripTypeDto.class, 3); -// assertValidateResultForReferentialDtoType(resultByType, VesselActivityLonglineDto.class, 5); -// assertValidateResultForReferentialDtoType(resultByType, WeightMeasureTypeDto.class, 3); -// -// assertValidateResultForReferentialDtoType(resultByType, DetectionModeDto.class, 10); -// assertValidateResultForReferentialDtoType(resultByType, ObjectOperationDto.class, 4); -// assertValidateResultForReferentialDtoType(resultByType, ObservedSystemDto.class, 21); -// assertValidateResultForReferentialDtoType(resultByType, ReasonForDiscardDto.class, 5); -// assertValidateResultForReferentialDtoType(resultByType, ReasonForNoFishingDto.class, 13); -// assertValidateResultForReferentialDtoType(resultByType, ReasonForNullSetDto.class, 10); -// assertValidateResultForReferentialDtoType(resultByType, SpeciesFateDto.class, 9); -// assertValidateResultForReferentialDtoType(resultByType, SpeciesStatusDto.class, 3); -// assertValidateResultForReferentialDtoType(resultByType, SurroundingActivityDto.class, 8); -// assertValidateResultForReferentialDtoType(resultByType, TransmittingBuoyOperationDto.class, 3); -// assertValidateResultForReferentialDtoType(resultByType, TransmittingBuoyTypeDto.class, 12); -// assertValidateResultForReferentialDtoType(resultByType, VesselActivitySeineDto.class, 23); -// assertValidateResultForReferentialDtoType(resultByType, WeightCategoryDto.class, 101); -// assertValidateResultForReferentialDtoType(resultByType, WindDto.class, 13); - - } - - @Test - public void testValidateTripSeinesCreate() throws Exception { - - DataValidationRequest request = new DataValidationRequest(); - - request.setValidationContext(ValidateService.UPDATE_VALIDATION_CONTEXT); - request.setScopes(ImmutableSet.copyOf(NuitonValidatorScope.values())); - request.setDataIds(ImmutableSet.of(ObserveFixtures.TRIP_SEINE_ID_1, ObserveFixtures.TRIP_SEINE_ID_2)); - - ValidationResult<DataValidationRequest> result = service.validateData(request); - Assert.assertNotNull(result); - //FIXME -// ImmutableMap<Class<? extends IdDto>, ValidateResultForDtoType<? extends IdDto>> resultByType = result.getResultByType(); -// Assert.assertNotNull(resultByType); -// Assert.assertEquals(5, resultByType.size()); -// -// assertValidateResultForDtoType(resultByType, TripSeineDto.class, 2); -// assertValidateResultForDtoType(resultByType, RouteDto.class, 80); -// assertValidateResultForDtoType(resultByType, ActivitySeineDto.class, 1519); -// assertValidateResultForDtoType(resultByType, FloatingObjectDto.class, 99); -// assertValidateResultForDtoType(resultByType, SetSeineDto.class, 77); - - } - - @Test - public void testValidateTripSeinesUdpate() throws Exception { - - DataValidationRequest request = new DataValidationRequest(); - - request.setValidationContext(ValidateService.UPDATE_VALIDATION_CONTEXT); - request.setScopes(ImmutableSet.copyOf(NuitonValidatorScope.values())); - request.setDataIds(ImmutableSet.of(ObserveFixtures.TRIP_SEINE_ID_1, ObserveFixtures.TRIP_SEINE_ID_2)); - - ValidationResult<DataValidationRequest> result = service.validateData(request); - Assert.assertNotNull(result); - //FIXME - -// ImmutableMap<Class<? extends IdDto>, ValidateResultForDtoType<? extends IdDto>> resultByType = result.getResultByType(); -// Assert.assertNotNull(resultByType); -// Assert.assertEquals(8, resultByType.size()); -// -// assertValidateResultForDtoType(resultByType, TripSeineDto.class, 2); -// assertValidateResultForDtoType(resultByType, RouteDto.class, 80); -// assertValidateResultForDtoType(resultByType, ActivitySeineDto.class, 1519); -// assertValidateResultForDtoType(resultByType, FloatingObjectDto.class, 99); -// assertValidateResultForDtoType(resultByType, TransmittingBuoyDto.class, 42); -// assertValidateResultForDtoType(resultByType, SetSeineDto.class, 77); -// assertValidateResultForDtoType(resultByType, NonTargetCatchDto.class, 3); -// assertValidateResultForDtoType(resultByType, SchoolEstimateDto.class, 27); - - } - -// protected <D extends ReferentialDto> void assertValidateResultForReferentialDtoType(ImmutableMap<Class<? extends ReferentialDto>, ValidateResultForDtoType<? extends IdDto>> resultByType, Class<D> dtoType, int expectedCount) { -// -// ValidateResultForDtoType<D> validateResultForDtoType = (ValidateResultForDtoType) resultByType.get(dtoType); -// Assert.assertNotNull(validateResultForDtoType); -// ImmutableSet<ValidateResultForDto<D>> validateResultForDtos = validateResultForDtoType.getValidateResultForDto(); -// Assert.assertNotNull(validateResultForDtos); -// Assert.assertEquals(expectedCount, validateResultForDtos.size()); -// for (ValidateResultForDto<D> validateResultForDto : validateResultForDtos) { -// Assert.assertNotNull(validateResultForDto.getMessages()); -// Assert.assertFalse(validateResultForDto.getMessages().isEmpty()); -// } -// -// } - -// protected <D extends IdDto> void assertValidateResultForDtoType(ImmutableMap<Class<? extends IdDto>, ValidateResultForDtoType<? extends IdDto>> resultByType, Class<D> dtoType, int expectedCount) { -// -// ValidateResultForDtoType<D> validateResultForDtoType = (ValidateResultForDtoType) resultByType.get(dtoType); -// Assert.assertNotNull(validateResultForDtoType); -// ImmutableSet<ValidateResultForDto<D>> validateResultForDtos = validateResultForDtoType.getValidateResultForDto(); -// Assert.assertNotNull(validateResultForDtos); -// Assert.assertEquals(expectedCount, validateResultForDtos.size()); -// for (ValidateResultForDto<D> validateResultForDto : validateResultForDtos) { -// Assert.assertNotNull(validateResultForDto.getMessages()); -// Assert.assertFalse(validateResultForDto.getMessages().isEmpty()); -// } -// -// } - -} ===================================== services-client/src/test/java/fr/ird/observe/services/client/service/seine/TripSeineServiceClientTest.java deleted ===================================== --- a/services-client/src/test/java/fr/ird/observe/services/client/service/seine/TripSeineServiceClientTest.java +++ /dev/null @@ -1,198 +0,0 @@ -package fr.ird.observe.services.client.service.seine; - -/* - * #%L - * ObServe :: Services client implementation - * %% - * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.common.collect.Iterables; -import fr.ird.observe.dto.data.seine.TripSeineDto; -import fr.ird.observe.dto.data.seine.TripSeineReference; -import fr.ird.observe.dto.form.Form; -import fr.ird.observe.dto.reference.DataDtoReference; -import fr.ird.observe.dto.reference.DataDtoReferenceSet; -import fr.ird.observe.dto.referential.HarbourDto; -import fr.ird.observe.dto.referential.OceanDto; -import fr.ird.observe.dto.referential.PersonDto; -import fr.ird.observe.dto.referential.ProgramDto; -import fr.ird.observe.dto.referential.VesselDto; -import fr.ird.observe.services.action.DeleteRequestDto; -import fr.ird.observe.services.action.LoadFormRequestDto; -import fr.ird.observe.services.action.PreCreateFormRequestDto; -import fr.ird.observe.services.action.SaveRequestDto; -import fr.ird.observe.services.client.service.ServiceClientTestSupport; -import fr.ird.observe.services.service.data.seine.TripSeineService; -import fr.ird.observe.test.ObserveFixtures; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.nuiton.util.DateUtil; - -/** - * @author Tony Chemit - dev@tchemit.fr - */ - -public class TripSeineServiceClientTest extends ServiceClientTestSupport { - - protected TripSeineService service; - - @Override - public void setUp() throws Exception { - super.setUp(); - - service = newService(TripSeineService.class); - } - - @Test - public void loadFormTest() throws Exception { - - Form<TripSeineDto> form = service.loadForm(LoadFormRequestDto.of(ObserveFixtures.TRIP_SEINE_ID_1)); - - Assert.assertNotNull(form); - TripSeineDto tripSeineDto = form.getObject(); - - Assert.assertNull(tripSeineDto.getCaptain()); - - Assert.assertEquals("fr.ird.observe.entities.referentiel.Person#1355399844272#0.32586441962131485", tripSeineDto.getObserver().getId()); - Assert.assertEquals("Fanchon", tripSeineDto.getObserver().getFirstName()); - Assert.assertEquals("Varenne", tripSeineDto.getObserver().getLastName()); - Assert.assertNull(tripSeineDto.getDataEntryOperator()); - Assert.assertEquals("fr.ird.observe.entities.referentiel.Vessel#1306847717532#0.7435948873477364", tripSeineDto.getVessel().getId()); - Assert.assertEquals("835", tripSeineDto.getVessel().getCode()); - Assert.assertEquals("BERNICA", tripSeineDto.getVessel().getLabel()); - Assert.assertEquals("fr.ird.observe.entities.referentiel.Ocean#1239832686152#0.8325731048817705", tripSeineDto.getOcean().getId()); - Assert.assertEquals("2", tripSeineDto.getOcean().getCode()); - Assert.assertEquals("Indien", tripSeineDto.getOcean().getLabel()); - Assert.assertNull(tripSeineDto.getDepartureHarbour()); - Assert.assertNull(tripSeineDto.getLandingHarbour()); - Assert.assertNull(tripSeineDto.getErsId()); - Assert.assertEquals(DateUtil.createDate(25, 1, 2013), tripSeineDto.getStartDate()); - Assert.assertEquals(DateUtil.createDate(27, 2, 2013), tripSeineDto.getEndDate()); - Assert.assertNull(tripSeineDto.getFormsUrl()); - Assert.assertNull(tripSeineDto.getReportsUrl()); - Assert.assertTrue(tripSeineDto.getComment().startsWith("Caractéristiques de la senne")); - - assertEditLabels(form, 8, - ProgramDto.class, - PersonDto.class, - VesselDto.class, - OceanDto.class, - HarbourDto.class); - - } - - @Test - public void preCreateTest() { - Form<TripSeineDto> form = service.preCreate(PreCreateFormRequestDto.of(ObserveFixtures.PROGRAM_ID)); - - Assert.assertNotNull(form); - TripSeineDto tripSeineDto = form.getObject(); - - Assert.assertNull(tripSeineDto.getCaptain()); - Assert.assertNull(tripSeineDto.getObserver()); - Assert.assertNull(tripSeineDto.getDataEntryOperator()); - Assert.assertNull(tripSeineDto.getVessel()); - Assert.assertNull(tripSeineDto.getOcean()); - Assert.assertNull(tripSeineDto.getDepartureHarbour()); - Assert.assertNull(tripSeineDto.getLandingHarbour()); - Assert.assertNull(tripSeineDto.getErsId()); - //Assert.assertEquals(DateUtil.getDay(ObserveServiceContextTopiaTaiste.DATE), tripSeineDto.getStartDate()); - //Assert.assertEquals(DateUtil.getDay(ObserveServiceContextTopiaTaiste.DATE), tripSeineDto.getEndDate()); - Assert.assertNull(tripSeineDto.getFormsUrl()); - Assert.assertNull(tripSeineDto.getReportsUrl()); - Assert.assertNull(tripSeineDto.getComment()); - - assertEditLabels(form, 8, - ProgramDto.class, - PersonDto.class, - VesselDto.class, - OceanDto.class, - HarbourDto.class); - - } - - //FIXME Ce test modifie la base, il faut trouver un moyen d'utiliser une autre base - @Ignore - @Test - public void saveUpdateTest() { - - Form<TripSeineDto> form = service.loadForm(LoadFormRequestDto.of(ObserveFixtures.TRIP_SEINE_ID_1)); - - TripSeineDto tripSeineDto = form.getObject(); - -// ReferenceSetDto<PersonDto> personRefs = formDto.getReferenceSetDto(PersonDto.class); -// ReferenceSetDto<OceanDto> oceanRefs = formDto.getReferenceSetDto(OceanDto.class); -// ReferenceSetDto<HarbourDto> harbourRefs = formDto.getReferenceSetDto(HarbourDto.class); -// -// tripSeineDto.setCaptain((PersonReference) personRefs.toSet(0)); -// tripSeineDto.setDataEntryOperator((PersonReference) personRefs.toSet(2)); -// -// tripSeineDto.setOcean((OceanReference) oceanRefs.toSet(0)); -// -// tripSeineDto.setDepartureHarbour((HarbourReference) harbourRefs.toSet(0)); -// tripSeineDto.setLandingHarbour((HarbourReference) harbourRefs.toSet(1)); - - tripSeineDto.setErsId("ersid"); - - tripSeineDto.setStartDate(DateUtil.createDate(24, 8, 2015)); - tripSeineDto.setEndDate(DateUtil.createDate(24, 9, 2015)); - - tripSeineDto.setFormsUrl("http://une.url.com/formulaire"); - tripSeineDto.setReportsUrl("http://une.url.com/rapport"); - - tripSeineDto.setComment("Un commentaire"); - - service.save(SaveRequestDto.of(form.getObject())); - - Form<TripSeineDto> formReload = service.loadForm(LoadFormRequestDto.of(ObserveFixtures.TRIP_SEINE_ID_1)); - TripSeineDto tripSeineDtoReload = formReload.getObject(); - - Assert.assertEquals(tripSeineDto.getCaptain().getId(), tripSeineDtoReload.getCaptain().getId()); - Assert.assertEquals(tripSeineDto.getObserver().getId(), tripSeineDtoReload.getObserver().getId()); - Assert.assertEquals(tripSeineDto.getDataEntryOperator().getId(), tripSeineDtoReload.getDataEntryOperator().getId()); - Assert.assertEquals(tripSeineDto.getVessel().getId(), tripSeineDtoReload.getVessel().getId()); - Assert.assertEquals(tripSeineDto.getOcean().getId(), tripSeineDtoReload.getOcean().getId()); - Assert.assertEquals(tripSeineDto.getDepartureHarbour().getId(), tripSeineDtoReload.getDepartureHarbour().getId()); - Assert.assertEquals(tripSeineDto.getLandingHarbour().getId(), tripSeineDtoReload.getLandingHarbour().getId()); - Assert.assertEquals(tripSeineDto.getErsId(), tripSeineDtoReload.getErsId()); - Assert.assertEquals(tripSeineDto.getStartDate(), tripSeineDtoReload.getStartDate()); - Assert.assertEquals(tripSeineDto.getEndDate(), tripSeineDtoReload.getEndDate()); - Assert.assertEquals(tripSeineDto.getFormsUrl(), tripSeineDtoReload.getFormsUrl()); - Assert.assertEquals(tripSeineDto.getReportsUrl(), tripSeineDtoReload.getReportsUrl()); - Assert.assertEquals(tripSeineDto.getComment(), tripSeineDtoReload.getComment()); - - } - - @Ignore - @Test - public void deleteTest() { - - service.delete(DeleteRequestDto.of(ObserveFixtures.TRIP_SEINE_ID_1)); - - DataDtoReferenceSet<TripSeineReference> tripSeineByProgram = service.getAllTripSeine(); - - Assert.assertEquals(2, tripSeineByProgram.size()); - - Assert.assertTrue(Iterables.isEmpty(DataDtoReference.filterById(tripSeineByProgram.toSet(), ObserveFixtures.TRIP_SEINE_ID_1))); - - } - - -} View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/a1b81a639a636d5e8f656aa8f78f... --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/a1b81a639a636d5e8f656aa8f78f... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT