Echobase-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- 1820 discussions
r670 - in trunk/echobase-services/src: main/java/fr/ifremer/echobase/services/removedata/strategy test/java/fr/ifremer/echobase/ui/actions/removedata
by tchemit@users.forge.codelutin.com 17 Sep '12
by tchemit@users.forge.codelutin.com 17 Sep '12
17 Sep '12
Author: tchemit
Date: 2012-09-17 10:58:15 +0200 (Mon, 17 Sep 2012)
New Revision: 670
Url: http://forge.codelutin.com/repositories/revision/echobase/670
Log:
refs #1437: Suppression des imports (works fine but still need some clarifications)
Modified:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AbstractRemoveDataStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AcousticRemoveDataStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonAllRemoveDataStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonTransectRemoveDataStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/LegacyVoyageRemoveDataStrategy.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceTest.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AcousticRemoveDataServiceTest.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceTest.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultRegionRemoveDataServiceTest.java
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AbstractRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AbstractRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AbstractRemoveDataStrategy.java 2012-09-17 08:58:15 UTC (rev 670)
@@ -31,6 +31,8 @@
import fr.ifremer.echobase.entities.data.CategoryDAO;
import fr.ifremer.echobase.entities.data.Cell;
import fr.ifremer.echobase.entities.data.CellDAO;
+import fr.ifremer.echobase.entities.data.DataProcessing;
+import fr.ifremer.echobase.entities.data.DataProcessingDAO;
import fr.ifremer.echobase.entities.data.Echotype;
import fr.ifremer.echobase.entities.data.EchotypeDAO;
import fr.ifremer.echobase.entities.data.LengthAgeKey;
@@ -76,6 +78,8 @@
protected VoyageDAO voyageDao;
+ protected DataProcessingDAO dataProcessingDAO;
+
protected CellDAO cellDAO;
protected CategoryDAO categoryDAO;
@@ -92,6 +96,7 @@
public void setServiceContext(EchoBaseServiceContext serviceContext) {
super.setServiceContext(serviceContext);
+ dataProcessingDAO = getDAO(DataProcessing.class, DataProcessingDAO.class);
cellDAO = getDAO(Cell.class, CellDAO.class);
echotypeDAO = getDAO(Echotype.class, EchotypeDAO.class);
voyageDao = getDAO(Voyage.class, VoyageDAO.class);
@@ -138,12 +143,10 @@
}
protected void removePreDataInVoyage(Voyage voyage) throws TopiaException {
-
// by default nothing to remove
}
protected void removePostDataInVoyage(Voyage voyage) throws TopiaException {
-
// by default nothing to remove
}
@@ -191,16 +194,10 @@
protected void removeEchotype(Voyage entity,
Echotype echotype) throws TopiaException {
- // delete all category
+ // delete all categories using this echotype
List<Category> allByEchotype = categoryDAO.findAllByEchotype(echotype);
categoryDAO.deleteAll(allByEchotype);
-// if (entity != null) {
-//
-// // remove it from the voyage
-// entity.removeEchotype(echotype);
-// }
-
// delete echotype
echotypeDAO.delete(echotype);
@@ -298,4 +295,29 @@
}
}
}
+
+ protected void removeVoyageOrphanCells() throws TopiaException {
+ // Get all cells of the voyage
+ TopiaSQLQuery<String> query = new TopiaSQLQuery<String>() {
+ @Override
+ protected PreparedStatement prepareQuery(Connection connection) throws SQLException {
+ String hql = "SELECT c.topiaid FROM Cell c " +
+ "WHERE c.cell IS NULL AND c.dataprocessing IS NULL AND c.voyage IS NULL";
+ PreparedStatement result = connection.prepareStatement(hql);
+ return result;
+ }
+
+ @Override
+ protected String prepareResult(ResultSet set) throws SQLException {
+ return set.getString(1);
+ }
+ };
+
+ List<String> cellIds = query.findMultipleResult(
+ (TopiaContextImplementor) getTransaction());
+ for (String cellId : cellIds) {
+ Cell cell = cellDAO.findByTopiaId(cellId);
+ cellDAO.delete(cell);
+ }
+ }
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AcousticRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AcousticRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AcousticRemoveDataStrategy.java 2012-09-17 08:58:15 UTC (rev 670)
@@ -29,7 +29,6 @@
import fr.ifremer.echobase.entities.data.DataAcquisition;
import fr.ifremer.echobase.entities.data.DataAcquisitionDAO;
import fr.ifremer.echobase.entities.data.DataProcessing;
-import fr.ifremer.echobase.entities.data.DataProcessingDAO;
import fr.ifremer.echobase.entities.data.Transect;
import fr.ifremer.echobase.entities.data.TransectDAO;
import fr.ifremer.echobase.entities.data.Voyage;
@@ -54,7 +53,6 @@
private static final Log log =
LogFactory.getLog(AcousticRemoveDataStrategy.class);
- protected DataProcessingDAO dataProcessingDAO;
protected DataAcquisitionDAO dataAcquisitionDAO;
@@ -65,7 +63,6 @@
super.setServiceContext(serviceContext);
dataAcquisitionDAO = getDAO(DataAcquisition.class, DataAcquisitionDAO.class);
- dataProcessingDAO = getDAO(DataProcessing.class, DataProcessingDAO.class);
transectDAO = getDAO(Transect.class, TransectDAO.class);
}
@@ -77,6 +74,9 @@
// remove post cell from top voyage
removeVoyagePostCell(voyage);
+
+ // remove orphans cells
+ removeVoyageOrphanCells();
}
@Override
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonAllRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonAllRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonAllRemoveDataStrategy.java 2012-09-17 08:58:15 UTC (rev 670)
@@ -47,6 +47,13 @@
LogFactory.getLog(CommonAllRemoveDataStrategy.class);
@Override
+ protected void removePostDataInVoyage(Voyage voyage) throws TopiaException {
+
+ // remove orphans cells
+ removeVoyageOrphanCells();
+ }
+
+ @Override
protected void removeImportData(Voyage voyage, String id) throws TopiaException {
if (id.startsWith(Voyage.class.getName())) {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonTransectRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonTransectRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonTransectRemoveDataStrategy.java 2012-09-17 08:58:15 UTC (rev 670)
@@ -71,6 +71,13 @@
}
@Override
+ protected void removePostDataInVoyage(Voyage voyage) throws TopiaException {
+
+ // remove orphans cells
+ removeVoyageOrphanCells();
+ }
+
+ @Override
protected void removeImportData(Voyage voyage, String id) throws TopiaException {
if (id.startsWith(Transect.class.getName())) {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/LegacyVoyageRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/LegacyVoyageRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/LegacyVoyageRemoveDataStrategy.java 2012-09-17 08:58:15 UTC (rev 670)
@@ -47,6 +47,13 @@
LogFactory.getLog(LegacyVoyageRemoveDataStrategy.class);
@Override
+ protected void removePostDataInVoyage(Voyage voyage) throws TopiaException {
+
+ // remove orphans cells
+ removeVoyageOrphanCells();
+ }
+
+ @Override
protected void removeImportData(Voyage voyage, String id) throws TopiaException {
if (id.startsWith(Voyage.class.getName())) {
Modified: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceTest.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceTest.java 2012-09-16 13:56:31 UTC (rev 669)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceTest.java 2012-09-17 08:58:15 UTC (rev 670)
@@ -287,7 +287,12 @@
for (String entityId : entityIds) {
if (entityId == null) continue;
E entity = getEntity(entityId);
- Assert.assertNull("Entity with id " + entityId + " should have been deleted, but is still in db :(", entity);
+ if (entity instanceof ImportLog) {
+
+ Assert.assertNull("ImporTLog with id " + entityId + " (" + ((ImportLog) entity).getImportType() + ") should have been deleted, but is still in db :(", entity);
+ } else {
+ Assert.assertNull("Entity with id " + entityId + " should have been deleted, but is still in db :(", entity);
+ }
}
}
@@ -295,7 +300,8 @@
for (String entityId : entityIds) {
if (entityId == null) continue;
E entity = getEntity(entityId);
- Assert.assertNotNull("Entity with id " + entityId + " should have not been deleted, but is deleted in db :(", entity);
+ Assert.assertNotNull("Entity with id " + entityId + " should NOT have been deleted, but is deleted in db :(", entity);
+
}
}
Modified: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AcousticRemoveDataServiceTest.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AcousticRemoveDataServiceTest.java 2012-09-16 13:56:31 UTC (rev 669)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AcousticRemoveDataServiceTest.java 2012-09-17 08:58:15 UTC (rev 670)
@@ -48,7 +48,6 @@
// and all his imports
assertEntityDeleted(importAcoustic1Id,
- importResultVoyage1Id,
importResultEsdu1Id,
importResultRegion1Id,
importResultMap1Id);
@@ -61,6 +60,7 @@
assertEntityExists(importCommonAll1Id,
importCommonTransect1Id,
importOperation1Id,
- importCatches1Id);
+ importCatches1Id,
+ importResultVoyage1Id);
}
}
Modified: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceTest.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceTest.java 2012-09-16 13:56:31 UTC (rev 669)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceTest.java 2012-09-17 08:58:15 UTC (rev 670)
@@ -58,9 +58,7 @@
importCatches1Id,
importAcoustic1Id,
importResultVoyage1Id,
- importResultEsdu1Id,
- importResultRegion1Id,
- importResultMap1Id);
+ importResultEsdu1Id);
// voyage 2 still in db
Modified: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultRegionRemoveDataServiceTest.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultRegionRemoveDataServiceTest.java 2012-09-16 13:56:31 UTC (rev 669)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultRegionRemoveDataServiceTest.java 2012-09-17 08:58:15 UTC (rev 670)
@@ -45,7 +45,7 @@
assertEntityDeleted(cellRegion1Id, resultRegion1Id);
// and all his imports
- assertEntityDeleted(importResultEsdu1Id);
+ assertEntityDeleted(importResultRegion1Id);
// voyage 1 other imports stay
assertEntityExists(voyage1Id, transect1Id, operation1Id,
1
0
r669 - in trunk: echobase-domain/src/main/xmi echobase-services/src/main/java/fr/ifremer/echobase/services/importdata echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata
by tchemit@users.forge.codelutin.com 16 Sep '12
by tchemit@users.forge.codelutin.com 16 Sep '12
16 Sep '12
Author: tchemit
Date: 2012-09-16 15:56:31 +0200 (Sun, 16 Sep 2012)
New Revision: 669
Url: http://forge.codelutin.com/repositories/revision/echobase/669
Log:
refs #1437: Suppression des imports (continue testing and fixing stuff)
Added:
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceTest.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AcousticRemoveDataServiceTest.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CatchesRemoveDataServiceTest.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonAllRemoveDataServiceTest.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceTest.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/OperationRemoveDataServiceTest.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultEsduRemoveDataServiceTest.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultMapRemoveDataServiceTest.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultRegionRemoveDataServiceTest.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultVoyageRemoveDataServiceTest.java
Removed:
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceIT.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonAllRemoveDataServiceIT.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceIT.java
Modified:
trunk/echobase-domain/src/main/xmi/echobase.zargo
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportConfiguration.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CommonImportConfiguration.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsImportConfiguration.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AbstractRemoveDataStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AcousticRemoveDataStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CatchesRemoveDataStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonAllRemoveDataStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonTransectRemoveDataStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/LegacyVoyageRemoveDataStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/OperationRemoveDataStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultEsduRemoveDataStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultMapRemoveDataStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultRegionRemoveDataStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultVoyageRemoveDataStrategy.java
Modified: trunk/echobase-domain/src/main/xmi/echobase.zargo
===================================================================
(Binary files differ)
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportConfiguration.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportConfiguration.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportConfiguration.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -94,6 +94,10 @@
return importType;
}
+ public final void setImportType(ImportType importType) {
+ this.importType = importType;
+ }
+
public List<EchoBaseCsvFileImportResult> getImportResults() {
return importResults;
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CommonImportConfiguration.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CommonImportConfiguration.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CommonImportConfiguration.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -23,7 +23,6 @@
*/
package fr.ifremer.echobase.services.importdata;
-import fr.ifremer.echobase.entities.ImportType;
import fr.ifremer.echobase.io.InputFile;
import java.util.Locale;
@@ -82,10 +81,6 @@
l_(locale, "echobase.common.transectFile"));
}
- public void setImportType(ImportType importType) {
- this.importType = importType;
- }
-
public String getMissionId() {
return missionId;
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsImportConfiguration.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsImportConfiguration.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsImportConfiguration.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -23,7 +23,6 @@
*/
package fr.ifremer.echobase.services.importdata;
-import fr.ifremer.echobase.entities.ImportType;
import fr.ifremer.echobase.io.InputFile;
import java.util.Locale;
@@ -123,10 +122,6 @@
this.dataProcessingId = dataProcessingId;
}
- public void setImportType(ImportType importType) {
- this.importType = importType;
- }
-
public String getResultLabel() {
return resultLabel;
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AbstractRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AbstractRemoveDataStrategy.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AbstractRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -37,6 +37,8 @@
import fr.ifremer.echobase.entities.data.LengthAgeKeyDAO;
import fr.ifremer.echobase.entities.data.LengthWeightKey;
import fr.ifremer.echobase.entities.data.LengthWeightKeyDAO;
+import fr.ifremer.echobase.entities.data.Result;
+import fr.ifremer.echobase.entities.data.ResultDAO;
import fr.ifremer.echobase.entities.data.Voyage;
import fr.ifremer.echobase.entities.data.VoyageDAO;
import fr.ifremer.echobase.services.EchoBaseServiceContext;
@@ -44,9 +46,16 @@
import fr.ifremer.echobase.services.removedata.RemoveDataConfiguration;
import org.apache.commons.collections.CollectionUtils;
import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.framework.TopiaSQLQuery;
import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.topia.persistence.TopiaEntity;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -77,6 +86,8 @@
protected LengthWeightKeyDAO lengthWeightKeyDAO;
+ protected ResultDAO resultDAO;
+
@Override
public void setServiceContext(EchoBaseServiceContext serviceContext) {
super.setServiceContext(serviceContext);
@@ -87,6 +98,7 @@
lengthAgeKeyDAO = getDAO(LengthAgeKey.class, LengthAgeKeyDAO.class);
lengthWeightKeyDAO = getDAO(LengthWeightKey.class, LengthWeightKeyDAO.class);
categoryDAO = getDAO(Category.class, CategoryDAO.class);
+ resultDAO = getDAO(Result.class, ResultDAO.class);
}
protected abstract void removeImportData(Voyage voyage,
@@ -98,7 +110,7 @@
Voyage voyage = voyageDao.findByTopiaId(importLog.getVoyageId());
- removeDataInVoyage(voyage);
+ removePreDataInVoyage(voyage);
int currentIndex = 0;
for (String importId : importLog.getImportId()) {
@@ -117,11 +129,24 @@
}
}
-// flushTransaction("Could not flush transaction");
+ flushTransaction("Could not flush transaction");
+
+ removePostDataInVoyage(voyage);
+
+
+ flushTransaction("Could not flush transaction");
}
- protected abstract void removeDataInVoyage(Voyage voyage) throws TopiaException;
+ protected void removePreDataInVoyage(Voyage voyage) throws TopiaException {
+ // by default nothing to remove
+ }
+
+ protected void removePostDataInVoyage(Voyage voyage) throws TopiaException {
+
+ // by default nothing to remove
+ }
+
protected <E extends TopiaEntity> E removeEntity(TopiaDAO<E> dao,
String id) throws TopiaException {
@@ -170,27 +195,28 @@
List<Category> allByEchotype = categoryDAO.findAllByEchotype(echotype);
categoryDAO.deleteAll(allByEchotype);
+// if (entity != null) {
+//
+// // remove it from the voyage
+// entity.removeEchotype(echotype);
+// }
+
// delete echotype
echotypeDAO.delete(echotype);
- if (entity != null) {
-
- // remove it from the voyage
- entity.removeEchotype(echotype);
- }
}
protected void removePostCell(Voyage entity,
Cell cell) throws TopiaException {
- // delete postcell
- cellDAO.delete(cell);
-
if (entity != null) {
// remove it from the voyage
entity.removePostCell(cell);
}
+
+ // delete postcell
+ cellDAO.delete(cell);
}
protected void removeVoyage(Voyage entity) throws TopiaException {
@@ -227,4 +253,49 @@
"Could not flush transaction after removing postCells");
}
}
+
+ protected void removeVoyageCellResults(final Voyage voyage) throws TopiaException {
+
+ // Get all cells of the voyage
+ TopiaSQLQuery<String> query = new TopiaSQLQuery<String>() {
+ @Override
+ protected PreparedStatement prepareQuery(Connection connection) throws SQLException {
+ String hql = "SELECT c.topiaid FROM Transit ta, " +
+ " Transect te, " +
+ " DataAcquisition da, " +
+ " DataProcessing dp, " +
+ " Cell c " +
+ "WHERE ta.voyage = ? " +
+ "AND ta.topiaId = te.transit " +
+ "AND te.topiaId = da.transect " +
+ "AND da.topiaId = dp.dataacquisition " +
+ "AND dp.topiaId = c.dataprocessing";
+ PreparedStatement result = connection.prepareStatement(hql);
+ result.setString(1, voyage.getTopiaId());
+ return result;
+ }
+
+ @Override
+ protected String prepareResult(ResultSet set) throws SQLException {
+ return set.getString(1);
+ }
+ };
+
+ List<String> cellIds = query.findMultipleResult(
+ (TopiaContextImplementor) getTransaction());
+
+ // remove all result of cells
+
+ for (String cellId : cellIds) {
+ Cell cell = cellDAO.findByTopiaId(cellId);
+ if (cell != null && !cell.isResultEmpty()) {
+ Collection<Result> cellResult = cell.getResult();
+// for (Result result : cellResult) {
+// cell.removeResult(result);
+// }
+ resultDAO.deleteAll(cellResult);
+ cell.clearResult();
+ }
+ }
+ }
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AcousticRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AcousticRemoveDataStrategy.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AcousticRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -28,6 +28,10 @@
import fr.ifremer.echobase.entities.data.Cell;
import fr.ifremer.echobase.entities.data.DataAcquisition;
import fr.ifremer.echobase.entities.data.DataAcquisitionDAO;
+import fr.ifremer.echobase.entities.data.DataProcessing;
+import fr.ifremer.echobase.entities.data.DataProcessingDAO;
+import fr.ifremer.echobase.entities.data.Transect;
+import fr.ifremer.echobase.entities.data.TransectDAO;
import fr.ifremer.echobase.entities.data.Voyage;
import fr.ifremer.echobase.services.EchoBaseServiceContext;
import org.apache.commons.logging.Log;
@@ -50,18 +54,27 @@
private static final Log log =
LogFactory.getLog(AcousticRemoveDataStrategy.class);
+ protected DataProcessingDAO dataProcessingDAO;
+
protected DataAcquisitionDAO dataAcquisitionDAO;
+ protected TransectDAO transectDAO;
+
@Override
public void setServiceContext(EchoBaseServiceContext serviceContext) {
super.setServiceContext(serviceContext);
dataAcquisitionDAO = getDAO(DataAcquisition.class, DataAcquisitionDAO.class);
+ dataProcessingDAO = getDAO(DataProcessing.class, DataProcessingDAO.class);
+ transectDAO = getDAO(Transect.class, TransectDAO.class);
}
@Override
- protected void removeDataInVoyage(Voyage voyage) throws TopiaException {
+ protected void removePostDataInVoyage(Voyage voyage) throws TopiaException {
+ // remove all cell results
+ removeVoyageCellResults(voyage);
+
// remove post cell from top voyage
removeVoyagePostCell(voyage);
}
@@ -71,17 +84,31 @@
if (id.startsWith(DataAcquisition.class.getName())) {
+ // get dataAcquisition
+ DataAcquisition dataAcquisition = dataAcquisitionDAO.findByTopiaId(id);
+
+ // remove it from cell
+ Transect transect = transectDAO.findContainsDataAcquisition(dataAcquisition);
+ transect.removeDataAcquisition(dataAcquisition);
+
// remove dataAcquisition
- DataAcquisition entity = removeEntity(dataAcquisitionDAO, id);
+ delete(dataAcquisitionDAO, dataAcquisition);
if (log.isInfoEnabled()) {
- log.info("DataAcquisition " + entity.getTopiaId() + " was removed");
+ log.info("DataAcquisition " + dataAcquisition.getTopiaId() + " was removed");
}
} else if (id.startsWith(Cell.class.getName())) {
+ // get cell
+ Cell cell = cellDAO.findByTopiaId(id);
+
+ // remove it from the dataAcquisition
+ DataProcessing dataProcessing = dataProcessingDAO.findContainsCell(cell);
+ dataProcessing.removeCell(cell);
+
// remove cell
- Cell entity = removeEntity(cellDAO, id);
+ delete(cellDAO, cell);
if (log.isInfoEnabled()) {
- log.info("Cell " + entity.getTopiaId() + " was removed");
+ log.info("Cell " + cell.getTopiaId() + " was removed");
}
} else {
canNotDealWithId(id);
@@ -90,7 +117,8 @@
@Override
public Set<ImportType> getPossibleSubImportType() {
- Set<ImportType> result = Sets.newHashSet(ImportType.RESULT_ESDU,
+ Set<ImportType> result = Sets.newHashSet(ImportType.RESULT_VOYAGE,
+ ImportType.RESULT_ESDU,
ImportType.RESULT_MAP,
ImportType.RESULT_REGION);
return result;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CatchesRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CatchesRemoveDataStrategy.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CatchesRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -24,6 +24,8 @@
*/
import fr.ifremer.echobase.entities.ImportType;
+import fr.ifremer.echobase.entities.data.Operation;
+import fr.ifremer.echobase.entities.data.OperationDAO;
import fr.ifremer.echobase.entities.data.Sample;
import fr.ifremer.echobase.entities.data.SampleDAO;
import fr.ifremer.echobase.entities.data.Voyage;
@@ -51,26 +53,31 @@
protected SampleDAO sampleDAO;
+ protected OperationDAO operationDAO;
+
@Override
public void setServiceContext(EchoBaseServiceContext serviceContext) {
super.setServiceContext(serviceContext);
sampleDAO = getDAO(Sample.class, SampleDAO.class);
+ operationDAO = getDAO(Operation.class, OperationDAO.class);
}
@Override
- protected void removeDataInVoyage(Voyage voyage) throws TopiaException {
- // nothing to do on voyage level
- }
-
- @Override
protected void removeImportData(Voyage voyage, String id) throws TopiaException {
if (id.startsWith(Sample.class.getName())) {
+ // get sample
+ Sample sample = sampleDAO.findByTopiaId(id);
+
+ // remove it from operation
+ Operation operation = operationDAO.findContainsSample(sample);
+ operation.removeSample(sample);
+
// remove sample
- Sample entity = removeEntity(sampleDAO, id);
+ delete(sampleDAO, sample);
if (log.isInfoEnabled()) {
- log.info("Sample " + entity.getTopiaId() + " was removed");
+ log.info("Sample " + sample.getTopiaId() + " was removed");
}
} else {
canNotDealWithId(id);
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonAllRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonAllRemoveDataStrategy.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonAllRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -47,16 +47,10 @@
LogFactory.getLog(CommonAllRemoveDataStrategy.class);
@Override
- protected void removeDataInVoyage(Voyage voyage) throws TopiaException {
- // nothing to do on voyage level (done by voyage id)...
- }
-
- @Override
protected void removeImportData(Voyage voyage, String id) throws TopiaException {
if (id.startsWith(Voyage.class.getName())) {
- // remove voyage
// get entity to delete
Voyage entity = voyageDao.findByTopiaId(id);
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonTransectRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonTransectRemoveDataStrategy.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonTransectRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -64,7 +64,7 @@
}
@Override
- protected void removeDataInVoyage(Voyage voyage) throws TopiaException {
+ protected void removePreDataInVoyage(Voyage voyage) throws TopiaException {
// remove postCell from voyage
removeVoyagePostCell(voyage);
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/LegacyVoyageRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/LegacyVoyageRemoveDataStrategy.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/LegacyVoyageRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -47,11 +47,6 @@
LogFactory.getLog(LegacyVoyageRemoveDataStrategy.class);
@Override
- protected void removeDataInVoyage(Voyage voyage) throws TopiaException {
- // nothing to do on voyage level
- }
-
- @Override
protected void removeImportData(Voyage voyage, String id) throws TopiaException {
if (id.startsWith(Voyage.class.getName())) {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/OperationRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/OperationRemoveDataStrategy.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/OperationRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -27,6 +27,8 @@
import fr.ifremer.echobase.entities.ImportType;
import fr.ifremer.echobase.entities.data.Operation;
import fr.ifremer.echobase.entities.data.OperationDAO;
+import fr.ifremer.echobase.entities.data.Transect;
+import fr.ifremer.echobase.entities.data.TransectDAO;
import fr.ifremer.echobase.entities.data.Voyage;
import fr.ifremer.echobase.services.EchoBaseServiceContext;
import org.apache.commons.logging.Log;
@@ -51,28 +53,33 @@
protected OperationDAO operationDAO;
+ protected TransectDAO transectDAO;
+
@Override
public void setServiceContext(EchoBaseServiceContext serviceContext) {
super.setServiceContext(serviceContext);
operationDAO = getDAO(Operation.class, OperationDAO.class);
+ transectDAO = getDAO(Transect.class, TransectDAO.class);
}
@Override
- protected void removeDataInVoyage(Voyage voyage) throws TopiaException {
- // nothing to do on voyage level
- }
-
- @Override
protected void removeImportData(Voyage voyage, String id) throws TopiaException {
if (id.startsWith(Operation.class.getName())) {
- // remove operation
- Operation entity = removeEntity(operationDAO, id);
+ // get operation
+ Operation operation = operationDAO.findByTopiaId(id);
+
+ // remove it from transect
+ Transect transect = transectDAO.findContainsOperation(operation);
+ transect.removeOperation(operation);
+
+ // remove it
+ delete(operationDAO, operation);
if (log.isInfoEnabled()) {
- log.info("Operation " + entity.getTopiaId() + " was removed");
+ log.info("Operation " + operation.getTopiaId() + " was removed");
}
} else {
canNotDealWithId(id);
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultEsduRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultEsduRemoveDataStrategy.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultEsduRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -24,10 +24,9 @@
*/
import fr.ifremer.echobase.entities.ImportType;
+import fr.ifremer.echobase.entities.data.Cell;
import fr.ifremer.echobase.entities.data.Result;
-import fr.ifremer.echobase.entities.data.ResultDAO;
import fr.ifremer.echobase.entities.data.Voyage;
-import fr.ifremer.echobase.services.EchoBaseServiceContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.TopiaException;
@@ -49,29 +48,22 @@
private static final Log log =
LogFactory.getLog(ResultEsduRemoveDataStrategy.class);
- protected ResultDAO resultDAO;
-
@Override
- public void setServiceContext(EchoBaseServiceContext serviceContext) {
- super.setServiceContext(serviceContext);
-
- resultDAO = getDAO(Result.class, ResultDAO.class);
- }
-
- @Override
- protected void removeDataInVoyage(Voyage voyage) throws TopiaException {
- // nothing to do on voyage level
- }
-
- @Override
protected void removeImportData(Voyage voyage, String id) throws TopiaException {
if (id.startsWith(Result.class.getName())) {
+ // get result
+ Result result = resultDAO.findByTopiaId(id);
+
+ // remove it from cell
+ Cell cell = cellDAO.findContainsResult(result);
+ cell.removeResult(result);
+
// remove result
- Result entity = removeEntity(resultDAO, id);
+ delete(resultDAO, result);
if (log.isDebugEnabled()) {
- log.debug("Result " + entity.getTopiaId() + " was removed");
+ log.debug("Result " + result.getTopiaId() + " was removed");
}
} else {
canNotDealWithId(id);
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultMapRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultMapRemoveDataStrategy.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultMapRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -48,19 +48,23 @@
LogFactory.getLog(ResultMapRemoveDataStrategy.class);
@Override
- protected void removeDataInVoyage(Voyage voyage) throws TopiaException {
- // nothing to do on voyage level
- }
-
- @Override
protected void removeImportData(Voyage voyage, String id) throws TopiaException {
if (id.startsWith(Cell.class.getName())) {
+ // get cell
+ Cell cell = cellDAO.findByTopiaId(id);
+
+ // dettach cell childs, we do not want to delete them from here ?
+ cell.clearChilds();
+
+ // remove it from voyage
+ voyage.removePostCell(cell);
+
// remove cell
- Cell entity = removeEntity(cellDAO, id);
+ delete(cellDAO, cell);
if (log.isInfoEnabled()) {
- log.info("Cell " + entity.getTopiaId() + " was removed");
+ log.info("Map Cell " + cell.getTopiaId() + " was removed");
}
} else {
canNotDealWithId(id);
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultRegionRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultRegionRemoveDataStrategy.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultRegionRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -25,9 +25,7 @@
import fr.ifremer.echobase.entities.ImportType;
import fr.ifremer.echobase.entities.data.Cell;
-import fr.ifremer.echobase.entities.data.CellDAO;
import fr.ifremer.echobase.entities.data.Voyage;
-import fr.ifremer.echobase.services.EchoBaseServiceContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.TopiaException;
@@ -50,19 +48,23 @@
LogFactory.getLog(ResultRegionRemoveDataStrategy.class);
@Override
- protected void removeDataInVoyage(Voyage voyage) throws TopiaException {
- // nothing to do on voyage level
- }
-
- @Override
protected void removeImportData(Voyage voyage, String id) throws TopiaException {
if (id.startsWith(Cell.class.getName())) {
- // remove post cell
- Cell entity = removeEntity(cellDAO, id);
+ // get cell
+ Cell cell = cellDAO.findByTopiaId(id);
+
+ // dettach cell childs, we do not want to delete them from here ?
+ cell.clearChilds();
+
+ // remove it from voyage
+ voyage.removePostCell(cell);
+
+ // remove cell
+ delete(cellDAO, cell);
if (log.isInfoEnabled()) {
- log.info("Cell " + entity.getTopiaId() + " was removed");
+ log.info("Region Cell " + cell.getTopiaId() + " was removed");
}
} else {
canNotDealWithId(id);
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultVoyageRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultVoyageRemoveDataStrategy.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/ResultVoyageRemoveDataStrategy.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -25,26 +25,14 @@
import com.google.common.collect.Sets;
import fr.ifremer.echobase.entities.ImportType;
-import fr.ifremer.echobase.entities.data.Cell;
import fr.ifremer.echobase.entities.data.Echotype;
import fr.ifremer.echobase.entities.data.LengthAgeKey;
import fr.ifremer.echobase.entities.data.LengthWeightKey;
-import fr.ifremer.echobase.entities.data.Result;
-import fr.ifremer.echobase.entities.data.ResultDAO;
import fr.ifremer.echobase.entities.data.Voyage;
-import fr.ifremer.echobase.services.EchoBaseServiceContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaContextImplementor;
-import org.nuiton.topia.framework.TopiaSQLQuery;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.List;
import java.util.Set;
/**
@@ -62,60 +50,13 @@
private static final Log log =
LogFactory.getLog(ResultVoyageRemoveDataStrategy.class);
-
- protected ResultDAO resultDAO;
-
@Override
- public void setServiceContext(EchoBaseServiceContext serviceContext) {
- super.setServiceContext(serviceContext);
+ protected void removePreDataInVoyage(final Voyage voyage) throws TopiaException {
- resultDAO = getDAO(Result.class, ResultDAO.class);
- }
-
- @Override
- protected void removeDataInVoyage(final Voyage voyage) throws TopiaException {
-
removeVoyagePostCell(voyage);
- // Get all cells of the voyage
- TopiaSQLQuery<String> query = new TopiaSQLQuery<String>() {
- @Override
- protected PreparedStatement prepareQuery(Connection connection) throws SQLException {
- String hql = "SELECT c.topiaid FROM TransitImpl ta, " +
- " TransectImpl te, " +
- " DataAcquisitionImpl da, " +
- " DataProcessingImpl dp, " +
- " CellImpl c " +
- "WHERE ta.voyage = ? " +
- "AND ta.topiaId = te.transit " +
- "AND te.topiaId = da.transect " +
- "AND da.topiaId = dp.dataacquisition" +
- "AND dp.topiaId = c.dataprocessing";
- PreparedStatement result = connection.prepareStatement(hql);
- result.setString(1, voyage.getTopiaId());
- return result;
- }
+ removeVoyageCellResults(voyage);
- @Override
- protected String prepareResult(ResultSet set) throws SQLException {
- return set.getString(1);
- }
- };
-
- List<String> cellIds = query.findMultipleResult(
- (TopiaContextImplementor) getTransaction());
-
- // remove all result of cells
-
- for (String cellId : cellIds) {
- Cell cell = cellDAO.findByTopiaId(cellId);
- Collection<Result> cellResult = cell.getResult();
- for (Result result : cellResult) {
- cell.removeResult(result);
- }
- resultDAO.deleteAll(cellResult);
- }
-
flushTransaction(
"Could not flush transaction after deleting data from voyage");
}
Deleted: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceIT.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceIT.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceIT.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -1,398 +0,0 @@
-package fr.ifremer.echobase.ui.actions.removedata;
-
-/*
- * #%L
- * EchoBase :: Services
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 - 2012 Ifremer, Codelutin
- * %%
- * 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.ifremer.echobase.entities.EchoBaseUser;
-import fr.ifremer.echobase.entities.ImportLog;
-import fr.ifremer.echobase.entities.ImportType;
-import fr.ifremer.echobase.entities.data.Category;
-import fr.ifremer.echobase.entities.data.CategoryDAO;
-import fr.ifremer.echobase.entities.data.Cell;
-import fr.ifremer.echobase.entities.data.CellDAO;
-import fr.ifremer.echobase.entities.data.DataAcquisition;
-import fr.ifremer.echobase.entities.data.DataAcquisitionDAO;
-import fr.ifremer.echobase.entities.data.DataProcessing;
-import fr.ifremer.echobase.entities.data.DataProcessingDAO;
-import fr.ifremer.echobase.entities.data.Echotype;
-import fr.ifremer.echobase.entities.data.EchotypeDAO;
-import fr.ifremer.echobase.entities.data.LengthAgeKey;
-import fr.ifremer.echobase.entities.data.LengthAgeKeyDAO;
-import fr.ifremer.echobase.entities.data.LengthWeightKey;
-import fr.ifremer.echobase.entities.data.LengthWeightKeyDAO;
-import fr.ifremer.echobase.entities.data.Transect;
-import fr.ifremer.echobase.entities.data.TransectDAO;
-import fr.ifremer.echobase.entities.data.Transit;
-import fr.ifremer.echobase.entities.data.TransitDAO;
-import fr.ifremer.echobase.entities.data.Voyage;
-import fr.ifremer.echobase.entities.data.VoyageDAO;
-import fr.ifremer.echobase.entities.references.Mission;
-import fr.ifremer.echobase.entities.references.Vessel;
-import fr.ifremer.echobase.services.EchoBaseTestServiceSupport;
-import fr.ifremer.echobase.services.FakeEchoBaseServiceContext;
-import fr.ifremer.echobase.services.importdata.CommonAllImportService;
-import fr.ifremer.echobase.services.importdata.CommonImportConfiguration;
-import fr.ifremer.echobase.services.removedata.RemoveDataConfiguration;
-import fr.ifremer.echobase.services.removedata.RemoveDataService;
-import junit.framework.Assert;
-import org.apache.commons.collections.CollectionUtils;
-import org.junit.Before;
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.persistence.TopiaDAO;
-import org.nuiton.topia.persistence.TopiaEntity;
-
-import java.util.List;
-
-/**
- * Abstract it form remove data feature.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.2
- */
-public abstract class AbstractRemoveDataServiceIT extends EchoBaseTestServiceSupport {
-
- protected String importCommonAll1Id;
-
- protected String importCommonTransect1Id;
-
- protected static final String voyage1Id = "fr.ifremer.echobase.entities.data.Voyage#1#1";
-
- protected static final String transit1Id = "fr.ifremer.echobase.entities.data.Transit#1#1";
-
- protected static final String transect1Id = "fr.ifremer.echobase.entities.data.Transect#1#1";
-
- protected static final String transect1_2Id = "fr.ifremer.echobase.entities.data.Transect#1#2";
-
- protected String importCommonAll2Id;
-
- protected String importCommonTransect2Id;
-
- protected static final String voyage2Id = "fr.ifremer.echobase.entities.data.Voyage#2#1";
-
- protected static final String transit2Id = "fr.ifremer.echobase.entities.data.Transit#2#1";
-
- protected static final String transect2Id = "fr.ifremer.echobase.entities.data.Transect#2#1";
-
- protected static final String transect2_2Id = "fr.ifremer.echobase.entities.data.Transect#2#2";
-
- protected VoyageDAO voyageDao;
-
- protected TransectDAO transectDAO;
-
- protected TransitDAO transitDAO;
-
- protected DataAcquisitionDAO dataAcquisitionDAO;
-
- protected DataProcessingDAO dataProcessingDAO;
-
- protected CellDAO cellDAO;
-
- protected CategoryDAO categoryDAO;
-
- protected EchotypeDAO echotypeDAO;
-
- protected LengthAgeKeyDAO lengthAgeKeyDAO;
-
- protected LengthWeightKeyDAO lengthWeightKeyDAO;
-
- @Override
- protected FakeEchoBaseServiceContext initContext() {
- return new FakeEchoBaseServiceContext(fixtures.IMPORT_DATA_ECHOBASE_NO_DATA());
- }
-
- @Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
-
- voyageDao = getDAO(Voyage.class, VoyageDAO.class);
- transectDAO = getDAO(Transect.class, TransectDAO.class);
- transitDAO = getDAO(Transit.class, TransitDAO.class);
- dataAcquisitionDAO = getDAO(DataAcquisition.class, DataAcquisitionDAO.class);
- dataProcessingDAO = getDAO(DataProcessing.class, DataProcessingDAO.class);
-
- cellDAO = getDAO(Cell.class, CellDAO.class);
- echotypeDAO = getDAO(Echotype.class, EchotypeDAO.class);
- lengthAgeKeyDAO = getDAO(LengthAgeKey.class, LengthAgeKeyDAO.class);
- lengthWeightKeyDAO = getDAO(LengthWeightKey.class, LengthWeightKeyDAO.class);
- categoryDAO = getDAO(Category.class, CategoryDAO.class);
- }
-
- protected void removeImport(String importId) {
- RemoveDataConfiguration conf = new RemoveDataConfiguration();
- conf.setImportLogId(importId);
-
- RemoveDataService service = getService(RemoveDataService.class);
-
- EchoBaseUser fakeUser = createFakeUser();
-
- service.removeImport(conf, fakeUser);
- }
-
-
- protected <E extends TopiaEntity> void assertEntityDeleted(Class<E> entityType, String... entityIds) throws TopiaException {
- TopiaDAO<E> dao = getDAO(entityType);
- for (String entityId : entityIds) {
- E entity = dao.findByTopiaId(entityId);
- Assert.assertNull("Entity with id " + entityId + " should have been deleted, but is still in db :(", entity);
- }
- }
-
- protected <E extends TopiaEntity> void assertEntityExists(Class<E> entityType, String... entityIds) throws TopiaException {
- TopiaDAO<E> dao = getDAO(entityType);
- for (String entityId : entityIds) {
- E entity = dao.findByTopiaId(entityId);
- Assert.assertNotNull("Entity with id " + entityId + " should have not been deleted, but is deleted in db :(", entity);
- }
- }
-
- protected <E extends TopiaEntity> E getFirstEntity(Class<E> entityType) {
- List<E> entities = getEntities(entityType);
- Assert.assertTrue(CollectionUtils.isNotEmpty(entities));
- return entities.get(0);
- }
-
- protected void createCommonAllImportV1() {
-
- // create voyage
- Voyage voyage1 = create(voyageDao,
- TopiaEntity.TOPIA_ID, voyage1Id,
- Voyage.PROPERTY_MISSION, getFirstEntity(Mission.class),
- Voyage.PROPERTY_NAME, "voyage1",
- Voyage.PROPERTY_START_DATE, newDate(),
- Voyage.PROPERTY_END_DATE, newDate(),
- Voyage.PROPERTY_START_PORT, "voyage1StartPort",
- Voyage.PROPERTY_END_PORT, "voyage1EndPort",
- Voyage.PROPERTY_DESCRIPTION, "voyage1Description",
- Voyage.PROPERTY_DATUM, "voyage1Datum"
- );
-
- // create transit
- Transit transit1 = create(transitDAO,
- TopiaEntity.TOPIA_ID, transit1Id,
- Transit.PROPERTY_START_TIME, newDate(),
- Transit.PROPERTY_END_TIME, newDate(),
- Transit.PROPERTY_START_LOCALITY, "transit1tartLocality",
- Transit.PROPERTY_END_LOCALITY, "transit1EndLocality",
- Transit.PROPERTY_DESCRIPTION, "transit1Description",
- Transit.PROPERTY_RELATED_ACTIVITY, "transit1RelatedActivity"
- );
- voyage1.addTransit(transit1);
-
- // create transect
- Transect transect1 = create(transectDAO,
- TopiaEntity.TOPIA_ID, transect1Id,
- Transect.PROPERTY_TITLE, "transect1Title",
- Transect.PROPERTY_VESSEL, getFirstEntity(Vessel.class),
- Transect.PROPERTY_STRATUM, "transect1Stratum"
- );
- transit1.addTransect(transect1);
-
- commitTransaction("ImportError!");
-
- CommonImportConfiguration importConf =
- new CommonImportConfiguration(getLocale());
- importConf.setImportType(ImportType.COMMON_ALL);
- importConf.setImportNotes("Common/Voyage/Transit/Transect1");
- importConf.setVoyageId(voyage1.getTopiaId());
-
- CommonAllImportService importService =
- getService(CommonAllImportService.class);
-
- ImportLog importLog = importService.computeImportLogEntry(
- importConf, createFakeUser());
-
- importLog.addImportId(voyage1.getTopiaId());
-
- commitTransaction("ImportLogError!");
-
- importCommonAll1Id = importLog.getTopiaId();
- }
-
- protected void createCommonAllImportV2() {
-
- // create voyage
- Voyage voyage1 = create(voyageDao,
- TopiaEntity.TOPIA_ID, voyage2Id,
- Voyage.PROPERTY_MISSION, getFirstEntity(Mission.class),
- Voyage.PROPERTY_NAME, "voyage1",
- Voyage.PROPERTY_START_DATE, newDate(),
- Voyage.PROPERTY_END_DATE, newDate(),
- Voyage.PROPERTY_START_PORT, "voyage1StartPort",
- Voyage.PROPERTY_END_PORT, "voyage1EndPort",
- Voyage.PROPERTY_DESCRIPTION, "voyage1Description",
- Voyage.PROPERTY_DATUM, "voyage1Datum"
- );
-
- // create transit
- Transit transit1 = create(transitDAO,
- TopiaEntity.TOPIA_ID, transit2Id,
- Transit.PROPERTY_START_TIME, newDate(),
- Transit.PROPERTY_END_TIME, newDate(),
- Transit.PROPERTY_START_LOCALITY, "transit1tartLocality",
- Transit.PROPERTY_END_LOCALITY, "transit1EndLocality",
- Transit.PROPERTY_DESCRIPTION, "transit1Description",
- Transit.PROPERTY_RELATED_ACTIVITY, "transit1RelatedActivity"
- );
- voyage1.addTransit(transit1);
-
- // create transect
- Transect transect1 = create(transectDAO,
- TopiaEntity.TOPIA_ID, transect2Id,
- Transect.PROPERTY_TITLE, "transect1Title",
- Transect.PROPERTY_VESSEL, getFirstEntity(Vessel.class),
- Transect.PROPERTY_STRATUM, "transect1Stratum"
- );
- transit1.addTransect(transect1);
-
- commitTransaction("ImportError!");
-
- CommonImportConfiguration importConf =
- new CommonImportConfiguration(getLocale());
- importConf.setImportType(ImportType.COMMON_ALL);
- importConf.setImportNotes("Common/Voyage/Transit/Transect2");
- importConf.setVoyageId(voyage1.getTopiaId());
-
- CommonAllImportService importService =
- getService(CommonAllImportService.class);
-
- ImportLog importLog = importService.computeImportLogEntry(
- importConf, createFakeUser());
-
- importLog.addImportId(voyage1.getTopiaId());
-
- commitTransaction("ImportLogError!");
-
- importCommonAll2Id = importLog.getTopiaId();
- }
-
- protected void createCommonTransectImportV1() {
-
- Voyage voyage1 = getEntityById(Voyage.class, voyage1Id);
-
- // create transect
- Transect transect2 = create(transectDAO,
- TopiaEntity.TOPIA_ID, transect1_2Id,
- Transect.PROPERTY_TITLE, "transect2Title",
- Transect.PROPERTY_VESSEL, getFirstEntity(Vessel.class),
- Transect.PROPERTY_STRATUM, "transect2Stratum"
- );
- voyage1.getTransit().get(0).addTransect(transect2);
-
- commitTransaction("ImportError!");
-
- CommonImportConfiguration importConf =
- new CommonImportConfiguration(getLocale());
- importConf.setImportType(ImportType.COMMON_TRANSECT);
- importConf.setImportNotes("Common/Transect1");
- importConf.setVoyageId(voyage1Id);
-
- CommonAllImportService importService =
- getService(CommonAllImportService.class);
-
- ImportLog importLog = importService.computeImportLogEntry(
- importConf, createFakeUser());
-
- importLog.addImportId(transect2.getTopiaId());
-
- commitTransaction("ImportLogError!");
-
- importCommonTransect1Id = importLog.getTopiaId();
- }
-
- protected void createCommonTransectImportV2() {
-
- Voyage voyage1 = getEntityById(Voyage.class, voyage2Id);
-
- // create transect
- Transect transect2 = create(transectDAO,
- TopiaEntity.TOPIA_ID, transect2_2Id,
- Transect.PROPERTY_TITLE, "transect2Title",
- Transect.PROPERTY_VESSEL, getFirstEntity(Vessel.class),
- Transect.PROPERTY_STRATUM, "transect2Stratum"
- );
- voyage1.getTransit().get(0).addTransect(transect2);
-
- commitTransaction("ImportError!");
-
- CommonImportConfiguration importConf =
- new CommonImportConfiguration(getLocale());
- importConf.setImportType(ImportType.COMMON_TRANSECT);
- importConf.setImportNotes("Common/Transect2");
- importConf.setVoyageId(voyage2Id);
-
- CommonAllImportService importService =
- getService(CommonAllImportService.class);
-
- ImportLog importLog = importService.computeImportLogEntry(
- importConf, createFakeUser());
-
- importLog.addImportId(transect2.getTopiaId());
-
- commitTransaction("ImportLogError!");
-
- importCommonTransect2Id = importLog.getTopiaId();
- }
-
- protected void createOperationImport() {
-
- // create operation
- // create operationMetadata
- // create geartMetadata
- }
-
- protected void createCatchesImport() {
-
- // create totalSample
- // create subSample
- // create biometrySample
- }
-
- protected void createAcousticImport() {
-
- // create cell
- }
-
- protected void createResultVoyageImport() {
-
- // create echotype
- // create lengthAgeKey
- // create lengthWeightKey
- }
-
- protected void createResultEsduImport() {
-
- // create result (on ESDU)
- }
-
- protected void createResultRegionImport() {
-
- // create region
- // create result (on region)
- }
-
- protected void createResultMapImport() {
-
- // create map
- }
-}
Copied: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceTest.java (from rev 667, trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceIT.java)
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceTest.java (rev 0)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceTest.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -0,0 +1,772 @@
+package fr.ifremer.echobase.ui.actions.removedata;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * 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.ifremer.echobase.entities.EchoBaseUser;
+import fr.ifremer.echobase.entities.ImportLog;
+import fr.ifremer.echobase.entities.ImportType;
+import fr.ifremer.echobase.entities.data.Category;
+import fr.ifremer.echobase.entities.data.CategoryDAO;
+import fr.ifremer.echobase.entities.data.Cell;
+import fr.ifremer.echobase.entities.data.CellDAO;
+import fr.ifremer.echobase.entities.data.Data;
+import fr.ifremer.echobase.entities.data.DataAcquisition;
+import fr.ifremer.echobase.entities.data.DataAcquisitionDAO;
+import fr.ifremer.echobase.entities.data.DataDAO;
+import fr.ifremer.echobase.entities.data.DataProcessing;
+import fr.ifremer.echobase.entities.data.DataProcessingDAO;
+import fr.ifremer.echobase.entities.data.Echotype;
+import fr.ifremer.echobase.entities.data.EchotypeDAO;
+import fr.ifremer.echobase.entities.data.GearMetadataValue;
+import fr.ifremer.echobase.entities.data.GearMetadataValueDAO;
+import fr.ifremer.echobase.entities.data.LengthAgeKey;
+import fr.ifremer.echobase.entities.data.LengthAgeKeyDAO;
+import fr.ifremer.echobase.entities.data.LengthWeightKey;
+import fr.ifremer.echobase.entities.data.LengthWeightKeyDAO;
+import fr.ifremer.echobase.entities.data.Operation;
+import fr.ifremer.echobase.entities.data.OperationDAO;
+import fr.ifremer.echobase.entities.data.OperationMetadataValue;
+import fr.ifremer.echobase.entities.data.OperationMetadataValueDAO;
+import fr.ifremer.echobase.entities.data.Result;
+import fr.ifremer.echobase.entities.data.ResultDAO;
+import fr.ifremer.echobase.entities.data.Sample;
+import fr.ifremer.echobase.entities.data.SampleDAO;
+import fr.ifremer.echobase.entities.data.SampleData;
+import fr.ifremer.echobase.entities.data.SampleDataDAO;
+import fr.ifremer.echobase.entities.data.Transect;
+import fr.ifremer.echobase.entities.data.TransectDAO;
+import fr.ifremer.echobase.entities.data.Transit;
+import fr.ifremer.echobase.entities.data.TransitDAO;
+import fr.ifremer.echobase.entities.data.Voyage;
+import fr.ifremer.echobase.entities.data.VoyageDAO;
+import fr.ifremer.echobase.entities.references.AcousticInstrument;
+import fr.ifremer.echobase.entities.references.CellType;
+import fr.ifremer.echobase.entities.references.DataMetadata;
+import fr.ifremer.echobase.entities.references.Gear;
+import fr.ifremer.echobase.entities.references.GearMetadata;
+import fr.ifremer.echobase.entities.references.Mission;
+import fr.ifremer.echobase.entities.references.OperationMetadata;
+import fr.ifremer.echobase.entities.references.SampleDataType;
+import fr.ifremer.echobase.entities.references.SampleType;
+import fr.ifremer.echobase.entities.references.Species;
+import fr.ifremer.echobase.entities.references.SpeciesCategory;
+import fr.ifremer.echobase.entities.references.Strata;
+import fr.ifremer.echobase.entities.references.Vessel;
+import fr.ifremer.echobase.services.EchoBaseTestServiceSupport;
+import fr.ifremer.echobase.services.FakeEchoBaseServiceContext;
+import fr.ifremer.echobase.services.importdata.AbstractImportConfiguration;
+import fr.ifremer.echobase.services.importdata.AbstractImportDataService;
+import fr.ifremer.echobase.services.importdata.AcousticImportConfiguration;
+import fr.ifremer.echobase.services.importdata.AcousticImportService;
+import fr.ifremer.echobase.services.importdata.CatchesImportConfiguration;
+import fr.ifremer.echobase.services.importdata.CatchesImportService;
+import fr.ifremer.echobase.services.importdata.CommonAllImportService;
+import fr.ifremer.echobase.services.importdata.CommonImportConfiguration;
+import fr.ifremer.echobase.services.importdata.OperationImportConfiguration;
+import fr.ifremer.echobase.services.importdata.OperationImportService;
+import fr.ifremer.echobase.services.importdata.ResultsEsduCellImportService;
+import fr.ifremer.echobase.services.importdata.ResultsImportConfiguration;
+import fr.ifremer.echobase.services.importdata.ResultsMapCellImportService;
+import fr.ifremer.echobase.services.importdata.ResultsRegionCellImportService;
+import fr.ifremer.echobase.services.importdata.ResultsVoyageImportService;
+import fr.ifremer.echobase.services.removedata.RemoveDataConfiguration;
+import fr.ifremer.echobase.services.removedata.RemoveDataService;
+import junit.framework.Assert;
+import org.apache.commons.collections.CollectionUtils;
+import org.junit.Before;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.persistence.TopiaDAO;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.TopiaId;
+
+import java.util.List;
+
+/**
+ * Abstract test for remove data feature.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2
+ */
+public abstract class AbstractRemoveDataServiceTest extends EchoBaseTestServiceSupport {
+
+ protected String importCommonAll1Id;
+
+ protected String importCommonTransect1Id;
+
+ protected String importOperation1Id;
+
+ protected String importCatches1Id;
+
+ protected String importAcoustic1Id;
+
+ protected String importResultVoyage1Id;
+
+ protected String importResultEsdu1Id;
+
+ protected String importResultRegion1Id;
+
+ protected String importResultMap1Id;
+
+ protected static final String voyage1Id = "fr.ifremer.echobase.entities.data.Voyage#1#1";
+
+ protected static final String transit1Id = "fr.ifremer.echobase.entities.data.Transit#1#1";
+
+ protected static final String transect1Id = "fr.ifremer.echobase.entities.data.Transect#1#1";
+
+ protected static final String transect1_2Id = "fr.ifremer.echobase.entities.data.Transect#1#2";
+
+ protected static final String operation1Id = "fr.ifremer.echobase.entities.data.Operation#1#1";
+
+ protected static final String totalSample1Id = "fr.ifremer.echobase.entities.data.Sample#1#total1";
+
+ protected static final String subSample1Id = "fr.ifremer.echobase.entities.data.Sample#1#sub1";
+
+ protected static final String biometrySample1Id = "fr.ifremer.echobase.entities.data.Sample#1#biometry1";
+
+ protected static final String dataAcquisition1Id = "fr.ifremer.echobase.entities.data.DataAcquisition#1";
+
+ protected static final String cellEsdu1Id = "fr.ifremer.echobase.entities.data.Cell#1#esdu1";
+
+ protected static final String cellMap1Id = "fr.ifremer.echobase.entities.data.Cell#1#map1";
+
+ protected static final String cellRegion1Id = "fr.ifremer.echobase.entities.data.Cell#1#region1";
+
+ protected static final String cellElementary1Id = "fr.ifremer.echobase.entities.data.Cell#1#elementary1";
+
+ protected static final String cellElementary1_2Id = "fr.ifremer.echobase.entities.data.Cell#1#elementary2";
+
+ protected static final String cellEsdu1_2Id = "fr.ifremer.echobase.entities.data.Cell#1#esdu2";
+
+ protected static final String resultEsdu1Id = "fr.ifremer.echobase.entities.data.Result#1#esdu1";
+
+ protected static final String resultMap1Id = "fr.ifremer.echobase.entities.data.Result#1#map1";
+
+ protected static final String resultRegion1Id = "fr.ifremer.echobase.entities.data.Result#1#region1";
+
+ protected static final String resultEsdu1_2Id = "fr.ifremer.echobase.entities.data.Result#1#esdu2";
+
+ protected static final String echotype1Id = "fr.ifremer.echobase.entities.data.Echotype#1#1";
+
+ protected static final String lengthAgeKey1Id = "fr.ifremer.echobase.entities.data.LengthAgeKey#1#1";
+
+ protected static final String lengthWeightKey1Id = "fr.ifremer.echobase.entities.data.LengthWeightKey#1#1";
+
+ protected String importCommonAll2Id;
+
+ protected String importCommonTransect2Id;
+
+ protected static final String voyage2Id = "fr.ifremer.echobase.entities.data.Voyage#2#1";
+
+ protected static final String transit2Id = "fr.ifremer.echobase.entities.data.Transit#2#1";
+
+ protected static final String transect2Id = "fr.ifremer.echobase.entities.data.Transect#2#1";
+
+ protected static final String transect2_2Id = "fr.ifremer.echobase.entities.data.Transect#2#2";
+
+ protected VoyageDAO voyageDao;
+
+ protected TransectDAO transectDAO;
+
+ protected TransitDAO transitDAO;
+
+ protected DataAcquisitionDAO dataAcquisitionDAO;
+
+ protected DataProcessingDAO dataProcessingDAO;
+
+ protected CellDAO cellDAO;
+
+ protected DataDAO dataDAO;
+
+ protected OperationDAO operationDAO;
+
+ protected OperationMetadataValueDAO operationMetadataValueDAO;
+
+ protected GearMetadataValueDAO gearMetadataValueDAO;
+
+ protected SampleDAO sampleDAO;
+
+ protected SampleDataDAO sampleDataDAO;
+
+ protected CategoryDAO categoryDAO;
+
+ protected EchotypeDAO echotypeDAO;
+
+ protected LengthAgeKeyDAO lengthAgeKeyDAO;
+
+ protected LengthWeightKeyDAO lengthWeightKeyDAO;
+
+ protected ResultDAO resultDAO;
+
+ @Override
+ protected FakeEchoBaseServiceContext initContext() {
+ return new FakeEchoBaseServiceContext(fixtures.IMPORT_DATA_ECHOBASE_NO_DATA());
+ }
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+
+ voyageDao = getDAO(Voyage.class, VoyageDAO.class);
+ transectDAO = getDAO(Transect.class, TransectDAO.class);
+ transitDAO = getDAO(Transit.class, TransitDAO.class);
+ dataAcquisitionDAO = getDAO(DataAcquisition.class, DataAcquisitionDAO.class);
+ dataProcessingDAO = getDAO(DataProcessing.class, DataProcessingDAO.class);
+
+ cellDAO = getDAO(Cell.class, CellDAO.class);
+ dataDAO = getDAO(Data.class, DataDAO.class);
+ operationDAO = getDAO(Operation.class, OperationDAO.class);
+ operationMetadataValueDAO = getDAO(OperationMetadataValue.class, OperationMetadataValueDAO.class);
+ gearMetadataValueDAO = getDAO(GearMetadataValue.class, GearMetadataValueDAO.class);
+ sampleDAO = getDAO(Sample.class, SampleDAO.class);
+ sampleDataDAO = getDAO(SampleData.class, SampleDataDAO.class);
+
+ echotypeDAO = getDAO(Echotype.class, EchotypeDAO.class);
+ lengthAgeKeyDAO = getDAO(LengthAgeKey.class, LengthAgeKeyDAO.class);
+ lengthWeightKeyDAO = getDAO(LengthWeightKey.class, LengthWeightKeyDAO.class);
+ categoryDAO = getDAO(Category.class, CategoryDAO.class);
+ resultDAO = getDAO(Result.class, ResultDAO.class);
+
+ //create imports for voyage 1
+ createCommonAllImportV1();
+ createCommonTransectImportV1();
+ createOperationImportV1();
+ createCatchesImportV1();
+ createAcousticImportV1();
+ createResultVoyageImportV1();
+ createResultEsduImportV1();
+ createResultRegionImportV1();
+ createResultMapImportV1();
+
+ // create imports for voyage 2
+ createCommonAllImportV2();
+ createCommonTransectImportV2();
+// createOperationImportV2();
+// createCatchesImportV2();
+// createAcousticImportV2();
+// createResultVoyageImportV2();
+// createResultEsduImportV2();
+// createResultRegionImportV2();
+// createResultMapImportv2();
+ }
+
+ protected void removeImport(String importId) {
+ RemoveDataConfiguration conf = new RemoveDataConfiguration();
+ conf.setImportLogId(importId);
+
+ RemoveDataService service = getService(RemoveDataService.class);
+
+ EchoBaseUser fakeUser = createFakeUser();
+
+ service.removeImport(conf, fakeUser);
+ }
+
+
+ protected <E extends TopiaEntity> void assertEntityDeleted(String... entityIds) throws TopiaException {
+ for (String entityId : entityIds) {
+ if (entityId == null) continue;
+ E entity = getEntity(entityId);
+ Assert.assertNull("Entity with id " + entityId + " should have been deleted, but is still in db :(", entity);
+ }
+ }
+
+ protected <E extends TopiaEntity> void assertEntityExists(String... entityIds) throws TopiaException {
+ for (String entityId : entityIds) {
+ if (entityId == null) continue;
+ E entity = getEntity(entityId);
+ Assert.assertNotNull("Entity with id " + entityId + " should have not been deleted, but is deleted in db :(", entity);
+ }
+ }
+
+ private <E extends TopiaEntity> E getFirstEntity(Class<E> entityType) {
+ List<E> entities = getEntities(entityType);
+ Assert.assertTrue(CollectionUtils.isNotEmpty(entities));
+ return entities.get(0);
+ }
+
+ private <E extends TopiaEntity> E getEntity(String id) throws TopiaException {
+ Class entityType = TopiaId.getClassName(id);
+ TopiaDAO<E> dao = getDAO(entityType);
+ E entity = dao.findByTopiaId(id);
+ return entity;
+ }
+
+ private void createCommonAllImportV1() {
+
+ // create voyage
+ Voyage voyage = create(voyageDao,
+ TopiaEntity.TOPIA_ID, voyage1Id,
+ Voyage.PROPERTY_MISSION, getFirstEntity(Mission.class),
+ Voyage.PROPERTY_NAME, "voyage1",
+ Voyage.PROPERTY_START_DATE, newDate(),
+ Voyage.PROPERTY_END_DATE, newDate(),
+ Voyage.PROPERTY_START_PORT, "voyage1StartPort",
+ Voyage.PROPERTY_END_PORT, "voyage1EndPort",
+ Voyage.PROPERTY_DESCRIPTION, "voyage1Description",
+ Voyage.PROPERTY_DATUM, "voyage1Datum"
+ );
+
+ // create transit
+ Transit transit = create(transitDAO,
+ TopiaEntity.TOPIA_ID, transit1Id,
+ Transit.PROPERTY_START_TIME, newDate(),
+ Transit.PROPERTY_END_TIME, newDate(),
+ Transit.PROPERTY_START_LOCALITY, "transit1tartLocality",
+ Transit.PROPERTY_END_LOCALITY, "transit1EndLocality",
+ Transit.PROPERTY_DESCRIPTION, "transit1Description",
+ Transit.PROPERTY_RELATED_ACTIVITY, "transit1RelatedActivity"
+ );
+ voyage.addTransit(transit);
+
+ // create transect
+ Transect transect = create(transectDAO,
+ TopiaEntity.TOPIA_ID, transect1Id,
+ Transect.PROPERTY_TITLE, "transect1Title",
+ Transect.PROPERTY_VESSEL, getFirstEntity(Vessel.class),
+ Transect.PROPERTY_STRATUM, "transect1Stratum"
+ );
+ transit.addTransect(transect);
+
+ commitTransaction("ImportError!");
+
+ importCommonAll1Id = createImport(
+ CommonAllImportService.class,
+ new CommonImportConfiguration(getLocale()),
+ ImportType.COMMON_ALL,
+ "Common/Voyage/Transit/Transect1",
+ voyage1Id,
+ voyage);
+ }
+
+ private void createCommonAllImportV2() {
+
+ // create voyage
+ Voyage voyage = create(voyageDao,
+ TopiaEntity.TOPIA_ID, voyage2Id,
+ Voyage.PROPERTY_MISSION, getFirstEntity(Mission.class),
+ Voyage.PROPERTY_NAME, "voyage1",
+ Voyage.PROPERTY_START_DATE, newDate(),
+ Voyage.PROPERTY_END_DATE, newDate(),
+ Voyage.PROPERTY_START_PORT, "voyage1StartPort",
+ Voyage.PROPERTY_END_PORT, "voyage1EndPort",
+ Voyage.PROPERTY_DESCRIPTION, "voyage1Description",
+ Voyage.PROPERTY_DATUM, "voyage1Datum"
+ );
+
+ // create transit
+ Transit transit = create(transitDAO,
+ TopiaEntity.TOPIA_ID, transit2Id,
+ Transit.PROPERTY_START_TIME, newDate(),
+ Transit.PROPERTY_END_TIME, newDate(),
+ Transit.PROPERTY_START_LOCALITY, "transit1tartLocality",
+ Transit.PROPERTY_END_LOCALITY, "transit1EndLocality",
+ Transit.PROPERTY_DESCRIPTION, "transit1Description",
+ Transit.PROPERTY_RELATED_ACTIVITY, "transit1RelatedActivity"
+ );
+ voyage.addTransit(transit);
+
+ // create transect
+ Transect transect = create(transectDAO,
+ TopiaEntity.TOPIA_ID, transect2Id,
+ Transect.PROPERTY_TITLE, "transect1Title",
+ Transect.PROPERTY_VESSEL, getFirstEntity(Vessel.class),
+ Transect.PROPERTY_STRATUM, "transect1Stratum"
+ );
+ transit.addTransect(transect);
+
+ commitTransaction("ImportError!");
+
+ importCommonAll2Id = createImport(
+ CommonAllImportService.class,
+ new CommonImportConfiguration(getLocale()),
+ ImportType.COMMON_ALL,
+ "Common/Voyage/Transit/Transect2",
+ voyage2Id,
+ voyage);
+ }
+
+ private void createCommonTransectImportV1() throws TopiaException {
+
+ Voyage voyage = getEntity(voyage1Id);
+
+ // create transect
+ Transect transect = create(transectDAO,
+ TopiaEntity.TOPIA_ID, transect1_2Id,
+ Transect.PROPERTY_TITLE, "transect2Title",
+ Transect.PROPERTY_VESSEL, getFirstEntity(Vessel.class),
+ Transect.PROPERTY_STRATUM, "transect2Stratum"
+ );
+ voyage.getTransit().get(0).addTransect(transect);
+
+ commitTransaction("ImportError!");
+
+ importCommonTransect1Id = createImport(
+ CommonAllImportService.class,
+ new CommonImportConfiguration(getLocale()),
+ ImportType.COMMON_TRANSECT,
+ "Common/Transect1",
+ voyage1Id,
+ transect);
+ }
+
+ private void createCommonTransectImportV2() throws TopiaException {
+
+ Voyage voyage = getEntity(voyage2Id);
+
+ // create transect
+ Transect transect = create(transectDAO,
+ TopiaEntity.TOPIA_ID, transect2_2Id,
+ Transect.PROPERTY_TITLE, "transect2Title",
+ Transect.PROPERTY_VESSEL, getFirstEntity(Vessel.class),
+ Transect.PROPERTY_STRATUM, "transect2Stratum"
+ );
+ voyage.getTransit().get(0).addTransect(transect);
+
+ commitTransaction("ImportError!");
+
+ importCommonTransect2Id = createImport(
+ CommonAllImportService.class,
+ new CommonImportConfiguration(getLocale()),
+ ImportType.COMMON_TRANSECT,
+ "Common/Transect2",
+ voyage2Id,
+ transect);
+ }
+
+ private void createOperationImportV1() throws TopiaException {
+
+ Transect transect = getEntity(transect1Id);
+
+ // create operation
+ Operation operation = create(operationDAO,
+ TopiaEntity.TOPIA_ID, operation1Id,
+ Operation.PROPERTY_ID, "operationId",
+ Operation.PROPERTY_GEAR, getFirstEntity(Gear.class)
+ );
+
+ transect.addOperation(operation);
+
+ // create operationMetadata
+ OperationMetadataValue operationMetadataValue = create(
+ operationMetadataValueDAO,
+ OperationMetadataValue.PROPERTY_OPERATION_METADATA, getFirstEntity(OperationMetadata.class),
+ OperationMetadataValue.PROPERTY_DATA_VALUE, "dataValue"
+ );
+
+ operation.addOperationMetadataValue(operationMetadataValue);
+
+ // create geartMetadata
+ GearMetadataValue gearMetadataValue = create(
+ gearMetadataValueDAO,
+ GearMetadataValue.PROPERTY_GEAR, operation.getGear(),
+ GearMetadataValue.PROPERTY_GEAR_METADATA, getFirstEntity(GearMetadata.class),
+ GearMetadataValue.PROPERTY_DATA_VALUE, "gearDataValue"
+ );
+
+ operation.addGearMetadataValue(gearMetadataValue);
+
+ importOperation1Id = createImport(
+ OperationImportService.class,
+ new OperationImportConfiguration(getLocale()),
+ ImportType.OPERATION,
+ "Operation1",
+ voyage1Id,
+ operation);
+
+ }
+
+ private void createCatchesImportV1() throws TopiaException {
+
+ Operation operation = getEntity(operation1Id);
+
+ // create totalSample
+ Sample totalSample = create(sampleDAO,
+ TopiaEntity.TOPIA_ID, totalSample1Id,
+ Sample.PROPERTY_SAMPLE_TYPE, getFirstEntity(SampleType.class),
+ Sample.PROPERTY_SPECIES_CATEGORY, getFirstEntity(SpeciesCategory.class),
+ Sample.PROPERTY_NUMBER_SAMPLED, 10,
+ Sample.PROPERTY_SAMPLE_WEIGHT, 2.4f
+ );
+ operation.addSample(totalSample);
+
+ // add a data
+ SampleData totalSampleData = create(sampleDataDAO,
+ SampleData.PROPERTY_DATA_VALUE, 24.5f,
+ SampleData.PROPERTY_SAMPLE_DATA_TYPE, getFirstEntity(SampleDataType.class)
+ );
+ totalSample.addSampleData(totalSampleData);
+
+ // create subSample
+ Sample subSample = create(sampleDAO,
+ TopiaEntity.TOPIA_ID, subSample1Id,
+ Sample.PROPERTY_SAMPLE_TYPE, getFirstEntity(SampleType.class),
+ Sample.PROPERTY_SPECIES_CATEGORY, getFirstEntity(SpeciesCategory.class),
+ Sample.PROPERTY_NUMBER_SAMPLED, 10,
+ Sample.PROPERTY_SAMPLE_WEIGHT, 2.5f
+ );
+ operation.addSample(subSample);
+ // add a data
+ SampleData subSampleData = create(sampleDataDAO,
+ SampleData.PROPERTY_DATA_VALUE, 25.4f,
+ SampleData.PROPERTY_SAMPLE_DATA_TYPE, getFirstEntity(SampleDataType.class)
+ );
+ subSample.addSampleData(subSampleData);
+
+ // create biometrySample
+ Sample biometrySample = create(sampleDAO,
+ TopiaEntity.TOPIA_ID, biometrySample1Id,
+ Sample.PROPERTY_SAMPLE_TYPE, getFirstEntity(SampleType.class),
+ Sample.PROPERTY_SPECIES_CATEGORY, getFirstEntity(SpeciesCategory.class),
+ Sample.PROPERTY_NUMBER_SAMPLED, 10,
+ Sample.PROPERTY_SAMPLE_WEIGHT, 2.6f
+ );
+ operation.addSample(biometrySample);
+
+ // add a data
+ SampleData biometrySampleData = create(sampleDataDAO,
+ SampleData.PROPERTY_DATA_VALUE, 26.4f,
+ SampleData.PROPERTY_SAMPLE_DATA_TYPE, getFirstEntity(SampleDataType.class)
+ );
+ biometrySample.addSampleData(biometrySampleData);
+
+ importCatches1Id = createImport(
+ CatchesImportService.class,
+ new CatchesImportConfiguration(getLocale()),
+ ImportType.CATCHES,
+ "Catches1",
+ voyage1Id,
+ totalSample, subSample, biometrySample);
+ }
+
+ private void createAcousticImportV1() throws TopiaException {
+
+ Transect transect = getEntity(transect1Id);
+
+ // create data acquisition
+ DataAcquisition dataAcquisition = create(dataAcquisitionDAO,
+ TopiaEntity.TOPIA_ID, dataAcquisition1Id,
+ DataAcquisition.PROPERTY_ACOUSTIC_INSTRUMENT, getFirstEntity(AcousticInstrument.class));
+ transect.addDataAcquisition(dataAcquisition);
+
+ // create dataProcessing
+ DataProcessing dataProcessing = create(dataProcessingDAO,
+ DataProcessing.PROPERTY_ID, "id1",
+ DataProcessing.PROPERTY_PROCESSING_TEMPLATE, "processingTemplate");
+ dataAcquisition.addDataProcessing(dataProcessing);
+
+ // create esdu cell
+ Cell esduCell = create(cellDAO,
+ TopiaEntity.TOPIA_ID, cellEsdu1Id,
+ Cell.PROPERTY_CELL_TYPE, getFirstEntity(CellType.class),
+ Cell.PROPERTY_NAME, "cellEsdu1");
+ dataProcessing.addCell(esduCell);
+
+ // create cell data
+ Data esduData = create(dataDAO,
+ Data.PROPERTY_DATA_METADATA, getFirstEntity(DataMetadata.class),
+ Data.PROPERTY_DATA_VALUE, "esdu1Data");
+ esduCell.addData(esduData);
+
+ // create elementary cell
+ Cell elementaryCell = create(cellDAO,
+ TopiaEntity.TOPIA_ID, cellElementary1Id,
+ Cell.PROPERTY_CELL_TYPE, getFirstEntity(CellType.class),
+ Cell.PROPERTY_NAME, "cellElementary1");
+ esduCell.addChilds(elementaryCell);
+
+ // create cell data
+ Data elementaryData = create(dataDAO,
+ Data.PROPERTY_DATA_METADATA, getFirstEntity(DataMetadata.class),
+ Data.PROPERTY_DATA_VALUE, "elementary1Data");
+ elementaryCell.addData(elementaryData);
+
+ importAcoustic1Id = createImport(
+ AcousticImportService.class,
+ new AcousticImportConfiguration(getLocale()),
+ ImportType.ACOUSTIC,
+ "Acoustic1",
+ voyage1Id,
+ dataAcquisition);
+ }
+
+ private void createResultVoyageImportV1() throws TopiaException {
+
+ Voyage voyage = getEntity(voyage1Id);
+
+ // create echotype
+ Echotype echotype = create(echotypeDAO,
+ TopiaEntity.TOPIA_ID, echotype1Id,
+ Echotype.PROPERTY_NAME, "echotype1Name");
+ voyage.addEchotype(echotype);
+
+ // create lengthAgeKey
+ LengthAgeKey lengthAgeKey = create(lengthAgeKeyDAO,
+ TopiaEntity.TOPIA_ID, lengthAgeKey1Id,
+ LengthAgeKey.PROPERTY_AGE, 12,
+ LengthAgeKey.PROPERTY_LENGTH, 12.5f,
+ LengthAgeKey.PROPERTY_METADATA, "lengthAgeKeyMetadata1",
+ LengthAgeKey.PROPERTY_SPECIES, getFirstEntity(Species.class),
+ LengthAgeKey.PROPERTY_STRATA, getFirstEntity(Strata.class)
+ );
+ voyage.addLengthAgeKey(lengthAgeKey);
+
+ // create lengthWeightKey
+
+ LengthWeightKey lengthWeightKey = create(lengthWeightKeyDAO,
+ TopiaEntity.TOPIA_ID, lengthWeightKey1Id,
+ LengthWeightKey.PROPERTY_APARAMETER, 12.5f,
+ LengthWeightKey.PROPERTY_BPARAMETER, 0.2f,
+ LengthWeightKey.PROPERTY_METADATA, "lengthWeightMetadata1",
+ LengthWeightKey.PROPERTY_SPECIES_CATEGORY, getFirstEntity(SpeciesCategory.class),
+ LengthWeightKey.PROPERTY_STRATA, getFirstEntity(Strata.class)
+ );
+ voyage.addLengthWeightKey(lengthWeightKey);
+
+ importResultVoyage1Id = createImport(
+ ResultsVoyageImportService.class,
+ new ResultsImportConfiguration(getLocale()),
+ ImportType.RESULT_VOYAGE,
+ "ResultsVoyage1",
+ voyage1Id,
+ echotype, lengthAgeKey, lengthWeightKey);
+ }
+
+ private void createResultEsduImportV1() throws TopiaException {
+
+ // create result (on ESDU)
+
+ Category category = create(categoryDAO);
+
+ Result result = create(resultDAO,
+ TopiaEntity.TOPIA_ID, resultEsdu1Id,
+ Result.PROPERTY_CATEGORY, category,
+ Result.PROPERTY_DATA_METADATA, getFirstEntity(DataMetadata.class),
+ Result.PROPERTY_RESULT_VALUE, "resultValueEdsu1",
+ Result.PROPERTY_RESULT_LABEL, "resultLabelEdsu1"
+ );
+
+ Cell cell = getEntity(cellEsdu1Id);
+ cell.addResult(result);
+
+ importResultEsdu1Id = createImport(
+ ResultsEsduCellImportService.class,
+ new ResultsImportConfiguration(getLocale()),
+ ImportType.RESULT_ESDU,
+ "ResultsEsdu1",
+ voyage1Id,
+ result);
+ }
+
+ private void createResultRegionImportV1() throws TopiaException {
+
+ // create region
+ Cell region = create(cellDAO,
+ TopiaEntity.TOPIA_ID, cellRegion1Id,
+ Cell.PROPERTY_CELL_TYPE, getFirstEntity(CellType.class),
+ Cell.PROPERTY_NAME, "cellRegion1");
+
+ Voyage voyage = getEntity(voyage1Id);
+ voyage.addPostCell(region);
+
+ // add esdu cell on it
+ Cell esduCell = getEntity(cellEsdu1Id);
+ region.addChilds(esduCell);
+
+ // create result (on region)
+ Category category = create(categoryDAO);
+ Result result = create(resultDAO,
+ TopiaEntity.TOPIA_ID, resultRegion1Id,
+ Result.PROPERTY_CATEGORY, category,
+ Result.PROPERTY_DATA_METADATA, getFirstEntity(DataMetadata.class),
+ Result.PROPERTY_RESULT_VALUE, "resultValueRegion1",
+ Result.PROPERTY_RESULT_LABEL, "resultLabelRegion1"
+ );
+ region.addResult(result);
+
+ importResultRegion1Id = createImport(
+ ResultsRegionCellImportService.class,
+ new ResultsImportConfiguration(getLocale()),
+ ImportType.RESULT_REGION,
+ "ResultsRegion1",
+ voyage1Id,
+ region);
+ }
+
+ private void createResultMapImportV1() throws TopiaException {
+
+ // create map
+ Cell map = create(cellDAO,
+ TopiaEntity.TOPIA_ID, cellMap1Id,
+ Cell.PROPERTY_CELL_TYPE, getFirstEntity(CellType.class),
+ Cell.PROPERTY_NAME, "cellMap1");
+
+ Voyage voyage = getEntity(voyage1Id);
+ voyage.addPostCell(map);
+
+ // create result (on map)
+ Category category = create(categoryDAO);
+ Result result = create(resultDAO,
+ TopiaEntity.TOPIA_ID, resultMap1Id,
+ Result.PROPERTY_CATEGORY, category,
+ Result.PROPERTY_DATA_METADATA, getFirstEntity(DataMetadata.class),
+ Result.PROPERTY_RESULT_VALUE, "resultValueMap1",
+ Result.PROPERTY_RESULT_LABEL, "resultLabelMap1"
+ );
+ map.addResult(result);
+
+ importResultMap1Id = createImport(
+ ResultsMapCellImportService.class,
+ new ResultsImportConfiguration(getLocale()),
+ ImportType.RESULT_MAP,
+ "ResultsMap1",
+ voyage1Id,
+ map);
+ }
+
+ private <C extends AbstractImportConfiguration, S extends AbstractImportDataService<C>> String createImport(
+ Class<S> serviceType,
+ C importConf,
+ ImportType importType,
+ String importNote,
+ String voyageId,
+ TopiaEntity... importIds) {
+ importConf.setImportType(importType);
+ importConf.setImportNotes(importNote);
+ importConf.setVoyageId(voyageId);
+
+ S importService = getService(serviceType);
+
+ ImportLog importLog = importService.computeImportLogEntry(
+ importConf, createFakeUser());
+
+ for (TopiaEntity importId : importIds) {
+ importLog.addImportId(importId.getTopiaId());
+ }
+
+ commitTransaction("ImportLogError!");
+
+ String importId = importLog.getTopiaId();
+ return importId;
+ }
+}
Property changes on: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AcousticRemoveDataServiceTest.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AcousticRemoveDataServiceTest.java (rev 0)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AcousticRemoveDataServiceTest.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -0,0 +1,66 @@
+package fr.ifremer.echobase.ui.actions.removedata;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * 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.ifremer.echobase.services.removedata.RemoveDataService;
+import fr.ifremer.echobase.services.removedata.strategy.AcousticRemoveDataStrategy;
+import org.junit.Test;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Test{@link RemoveDataService} with {@link AcousticRemoveDataStrategy}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class AcousticRemoveDataServiceTest extends AbstractRemoveDataServiceTest {
+
+ @Test
+ public void removeImport() throws TopiaException {
+
+ removeImport(importAcoustic1Id);
+
+ // dataAquisition 1 is deleted
+ assertEntityDeleted(dataAcquisition1Id, cellEsdu1Id, cellElementary1Id,
+ cellRegion1Id, cellMap1Id,
+ resultEsdu1Id, resultRegion1Id, resultMap1Id);
+
+ // and all his imports
+ assertEntityDeleted(importAcoustic1Id,
+ importResultVoyage1Id,
+ importResultEsdu1Id,
+ importResultRegion1Id,
+ importResultMap1Id);
+
+ // voyage 1 other imports stay
+ assertEntityExists(voyage1Id, transect1Id, operation1Id,
+ totalSample1Id, subSample1Id, biometrySample1Id);
+
+ // and all his imports
+ assertEntityExists(importCommonAll1Id,
+ importCommonTransect1Id,
+ importOperation1Id,
+ importCatches1Id);
+ }
+}
Property changes on: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AcousticRemoveDataServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CatchesRemoveDataServiceTest.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CatchesRemoveDataServiceTest.java (rev 0)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CatchesRemoveDataServiceTest.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -0,0 +1,64 @@
+package fr.ifremer.echobase.ui.actions.removedata;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * 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.ifremer.echobase.services.removedata.RemoveDataService;
+import fr.ifremer.echobase.services.removedata.strategy.CatchesRemoveDataStrategy;
+import org.junit.Test;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Test{@link RemoveDataService} with {@link CatchesRemoveDataStrategy}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class CatchesRemoveDataServiceTest extends AbstractRemoveDataServiceTest {
+
+ @Test
+ public void removeImport() throws TopiaException {
+
+ removeImport(importCatches1Id);
+
+ // sample1 are deleted
+ assertEntityDeleted(totalSample1Id, subSample1Id, biometrySample1Id);
+
+ // and all his imports
+ assertEntityDeleted(importCatches1Id);
+
+ // voyage 1 other imports stay
+ assertEntityExists(voyage1Id, transect1Id, operation1Id,
+ cellEsdu1Id, cellElementary1Id);
+
+ // and all his imports
+ assertEntityExists(importCommonAll1Id,
+ importCommonTransect1Id,
+ importOperation1Id,
+ importAcoustic1Id,
+ importResultVoyage1Id,
+ importResultEsdu1Id,
+ importResultRegion1Id,
+ importResultMap1Id);
+ }
+}
Property changes on: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CatchesRemoveDataServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonAllRemoveDataServiceIT.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonAllRemoveDataServiceIT.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonAllRemoveDataServiceIT.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -1,100 +0,0 @@
-package fr.ifremer.echobase.ui.actions.removedata;
-
-/*
- * #%L
- * EchoBase :: Services
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 - 2012 Ifremer, Codelutin
- * %%
- * 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.ifremer.echobase.entities.ImportLog;
-import fr.ifremer.echobase.entities.data.Transect;
-import fr.ifremer.echobase.entities.data.Voyage;
-import fr.ifremer.echobase.services.removedata.RemoveDataService;
-import fr.ifremer.echobase.services.removedata.strategy.CommonAllRemoveDataStrategy;
-import org.junit.Test;
-import org.nuiton.topia.TopiaException;
-
-/**
- * Test{@link RemoveDataService} with {@link CommonAllRemoveDataStrategy}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.3
- */
-public class CommonAllRemoveDataServiceIT extends AbstractRemoveDataServiceIT {
-
- @Test
- public void removeImport1() throws TopiaException {
-
- createCommonAllImportV1();
- createCommonTransectImportV1();
-
- createCommonAllImportV2();
- createCommonTransectImportV2();
-
- removeImport(importCommonAll1Id);
-
- // voyage 1 is deleted
- assertEntityDeleted(Voyage.class, voyage1Id);
-
- // and all his imports
- assertEntityDeleted(ImportLog.class,
- importCommonAll1Id,
- importCommonTransect1Id);
-
- // voyage 2 still in db
- assertEntityExists(Voyage.class, voyage2Id);
- assertEntityExists(Transect.class, transect2Id);
-
- // and all his imports
- assertEntityExists(ImportLog.class,
- importCommonAll2Id,
- importCommonTransect2Id);
-
- }
-
- @Test
- public void removeImport2() throws TopiaException {
-
- createCommonAllImportV1();
- createCommonTransectImportV1();
-
- createCommonAllImportV2();
- createCommonTransectImportV2();
-
- removeImport(importCommonAll2Id);
-
- // voyage 2 is deleted
- assertEntityDeleted(Voyage.class, voyage2Id);
-
- // and all his imports
- assertEntityDeleted(ImportLog.class,
- importCommonAll2Id,
- importCommonTransect2Id);
-
- // voyage 1 still in db
- assertEntityExists(Voyage.class, voyage1Id);
- assertEntityExists(Transect.class, transect1Id);
-
- // and all his imports
- assertEntityExists(ImportLog.class,
- importCommonAll1Id,
- importCommonTransect1Id);
- }
-}
Copied: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonAllRemoveDataServiceTest.java (from rev 667, trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonAllRemoveDataServiceIT.java)
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonAllRemoveDataServiceTest.java (rev 0)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonAllRemoveDataServiceTest.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -0,0 +1,99 @@
+package fr.ifremer.echobase.ui.actions.removedata;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * 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.ifremer.echobase.services.removedata.RemoveDataService;
+import fr.ifremer.echobase.services.removedata.strategy.CommonAllRemoveDataStrategy;
+import org.junit.Test;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Test{@link RemoveDataService} with {@link CommonAllRemoveDataStrategy}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class CommonAllRemoveDataServiceTest extends AbstractRemoveDataServiceTest {
+
+ @Test
+ public void removeImport1() throws TopiaException {
+
+ removeImport(importCommonAll1Id);
+
+ // voyage 1 is deleted
+ assertEntityDeleted(voyage1Id, transect1Id, operation1Id,
+ totalSample1Id, subSample1Id, biometrySample1Id,
+ cellEsdu1Id, cellElementary1Id, resultEsdu1Id,
+ echotype1Id, lengthAgeKey1Id, lengthWeightKey1Id);
+
+ // and all his imports
+ assertEntityDeleted(importCommonAll1Id,
+ importCommonTransect1Id,
+ importOperation1Id,
+ importCatches1Id,
+ importAcoustic1Id,
+ importResultVoyage1Id,
+ importResultEsdu1Id,
+ importResultRegion1Id,
+ importResultMap1Id);
+
+ // voyage 2 still in db
+ assertEntityExists(voyage2Id, transect2Id);
+
+ // and all his imports
+ assertEntityExists(importCommonAll2Id,
+ importCommonTransect2Id);
+
+ }
+
+ @Test
+ public void removeImport2() throws TopiaException {
+
+ removeImport(importCommonAll2Id);
+
+ // voyage 2 is deleted
+ assertEntityDeleted(voyage2Id);
+
+ // and all his imports
+ assertEntityDeleted(importCommonAll2Id,
+ importCommonTransect2Id);
+
+ // voyage 1 still in db
+ assertEntityExists(voyage1Id, transect1Id, operation1Id,
+ totalSample1Id, subSample1Id, biometrySample1Id,
+ cellEsdu1Id, cellElementary1Id, resultEsdu1Id,
+ echotype1Id, lengthAgeKey1Id, lengthWeightKey1Id);
+
+ // and all his imports
+ assertEntityExists(importCommonAll1Id,
+ importCommonTransect1Id,
+ importOperation1Id,
+ importCatches1Id,
+ importAcoustic1Id,
+ importResultVoyage1Id,
+ importResultEsdu1Id,
+ importResultRegion1Id,
+ importResultMap1Id);
+ }
+}
Property changes on: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonAllRemoveDataServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceIT.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceIT.java 2012-09-16 09:39:45 UTC (rev 668)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceIT.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -1,117 +0,0 @@
-package fr.ifremer.echobase.ui.actions.removedata;
-
-/*
- * #%L
- * EchoBase :: Services
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 - 2012 Ifremer, Codelutin
- * %%
- * 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.ifremer.echobase.entities.ImportLog;
-import fr.ifremer.echobase.entities.data.Transect;
-import fr.ifremer.echobase.entities.data.Voyage;
-import fr.ifremer.echobase.services.removedata.RemoveDataService;
-import fr.ifremer.echobase.services.removedata.strategy.CommonTransectRemoveDataStrategy;
-import org.junit.Test;
-import org.nuiton.topia.TopiaException;
-
-/**
- * Test{@link RemoveDataService} with {@link CommonTransectRemoveDataStrategy}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.3
- */
-public class CommonTransectRemoveDataServiceIT extends AbstractRemoveDataServiceIT {
-
- @Test
- public void removeImport1() throws TopiaException {
-
- createCommonAllImportV1();
- createCommonTransectImportV1();
-
- createCommonAllImportV2();
- createCommonTransectImportV2();
-
- removeImport(importCommonTransect1Id);
-
- // transect 1 is deleted
- assertEntityDeleted(Transect.class, transect1_2Id);
-
- // and all his imports
- assertEntityDeleted(ImportLog.class,
- importCommonTransect1Id);
-
- // voyage 1 is still here
- assertEntityExists(Voyage.class, voyage1Id);
- assertEntityExists(Transect.class, transect1Id);
-
- // and all his imports
- assertEntityExists(ImportLog.class,
- importCommonAll1Id);
-
-
- // voyage 2 still in db
- assertEntityExists(Voyage.class, voyage2Id);
- assertEntityExists(Transect.class, transect2Id);
-
- // and all his imports
- assertEntityExists(ImportLog.class,
- importCommonAll2Id,
- importCommonTransect2Id);
- }
-
- @Test
- public void removeImport2() throws TopiaException {
-
-
- createCommonAllImportV1();
- createCommonTransectImportV1();
-
- createCommonAllImportV2();
- createCommonTransectImportV2();
-
- removeImport(importCommonTransect2Id);
-
- // transect 2 is deleted
- assertEntityDeleted(Transect.class, transect2_2Id);
-
- // and all his imports
- assertEntityDeleted(ImportLog.class,
- importCommonTransect2Id);
-
-
- // voyage 2 is still here
- assertEntityExists(Voyage.class, voyage2Id);
- assertEntityExists(Transect.class, transect2Id);
-
- // and all his imports
- assertEntityExists(ImportLog.class,
- importCommonAll2Id);
-
-
- // voyage 1 still in db
- assertEntityExists(Voyage.class, voyage1Id);
- assertEntityExists(Transect.class, transect1Id);
-
- // and all his imports
- assertEntityExists(ImportLog.class,
- importCommonAll1Id,
- importCommonTransect1Id);
- }
-}
Copied: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceTest.java (from rev 667, trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceIT.java)
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceTest.java (rev 0)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceTest.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -0,0 +1,110 @@
+package fr.ifremer.echobase.ui.actions.removedata;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * 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.ifremer.echobase.services.removedata.RemoveDataService;
+import fr.ifremer.echobase.services.removedata.strategy.CommonTransectRemoveDataStrategy;
+import org.junit.Test;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Test{@link RemoveDataService} with {@link CommonTransectRemoveDataStrategy}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class CommonTransectRemoveDataServiceTest extends AbstractRemoveDataServiceTest {
+
+ @Test
+ public void removeImport1() throws TopiaException {
+
+ removeImport(importCommonTransect1Id);
+
+ // transect 1 is deleted
+ assertEntityDeleted(transect1_2Id);
+
+ // and all his imports
+ assertEntityDeleted(importCommonTransect1Id);
+
+ // voyage 1 is still here
+ assertEntityExists(voyage1Id, transect1Id, operation1Id,
+ totalSample1Id, subSample1Id, biometrySample1Id,
+ cellEsdu1Id, cellElementary1Id, resultEsdu1Id);
+
+ // and all his imports (exception transect1 one)
+ assertEntityExists(importCommonAll1Id,
+ importOperation1Id,
+ importCatches1Id,
+ importAcoustic1Id,
+ importResultVoyage1Id,
+ importResultEsdu1Id,
+ importResultRegion1Id,
+ importResultMap1Id);
+
+
+ // voyage 2 still in db
+ assertEntityExists(voyage2Id, transect2Id);
+
+ // and all his imports
+ assertEntityExists(importCommonAll2Id,
+ importCommonTransect2Id);
+ }
+
+ @Test
+ public void removeImport2() throws TopiaException {
+
+ removeImport(importCommonTransect2Id);
+
+ // transect 2 is deleted
+ assertEntityDeleted(transect2_2Id);
+
+ // and all his imports
+ assertEntityDeleted(importCommonTransect2Id);
+
+
+ // voyage 2 is still here
+ assertEntityExists(voyage2Id, transect2Id);
+
+ // and all his imports
+ assertEntityExists(importCommonAll2Id);
+
+
+ // voyage 1 still in db
+ assertEntityExists(voyage1Id, transect1Id, operation1Id,
+ totalSample1Id, subSample1Id, biometrySample1Id,
+ cellEsdu1Id, cellElementary1Id, resultEsdu1Id,
+ echotype1Id, lengthAgeKey1Id,lengthWeightKey1Id);
+
+ // and all his imports
+ assertEntityExists(importCommonAll1Id,
+ importCommonTransect1Id,
+ importOperation1Id,
+ importCatches1Id,
+ importAcoustic1Id,
+ importResultVoyage1Id,
+ importResultEsdu1Id,
+ importResultRegion1Id,
+ importResultMap1Id);
+ }
+}
Property changes on: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/OperationRemoveDataServiceTest.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/OperationRemoveDataServiceTest.java (rev 0)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/OperationRemoveDataServiceTest.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -0,0 +1,64 @@
+package fr.ifremer.echobase.ui.actions.removedata;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * 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.ifremer.echobase.services.removedata.RemoveDataService;
+import fr.ifremer.echobase.services.removedata.strategy.OperationRemoveDataStrategy;
+import org.junit.Test;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Test{@link RemoveDataService} with {@link OperationRemoveDataStrategy}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class OperationRemoveDataServiceTest extends AbstractRemoveDataServiceTest {
+
+ @Test
+ public void removeImport() throws TopiaException {
+
+ removeImport(importOperation1Id);
+
+ // operation 1 is deleted
+ assertEntityDeleted(operation1Id);
+
+ // and all his imports
+ assertEntityDeleted(importOperation1Id);
+
+ // voyage 1 other imports stay
+ assertEntityExists(voyage1Id, transect1Id,
+ cellEsdu1Id, cellElementary1Id, resultEsdu1Id,
+ echotype1Id, lengthAgeKey1Id, lengthWeightKey1Id);
+
+ // and all his imports
+ assertEntityExists(importCommonAll1Id,
+ importCommonTransect1Id,
+ importAcoustic1Id,
+ importResultVoyage1Id,
+ importResultEsdu1Id,
+ importResultRegion1Id,
+ importResultMap1Id);
+ }
+}
Property changes on: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/OperationRemoveDataServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultEsduRemoveDataServiceTest.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultEsduRemoveDataServiceTest.java (rev 0)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultEsduRemoveDataServiceTest.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -0,0 +1,67 @@
+package fr.ifremer.echobase.ui.actions.removedata;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * 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.ifremer.echobase.services.removedata.RemoveDataService;
+import fr.ifremer.echobase.services.removedata.strategy.ResultEsduRemoveDataStrategy;
+import org.junit.Test;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Test{@link RemoveDataService} with {@link ResultEsduRemoveDataStrategy}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class ResultEsduRemoveDataServiceTest extends AbstractRemoveDataServiceTest {
+
+ @Test
+ public void removeImport() throws TopiaException {
+
+ removeImport(importResultEsdu1Id);
+
+ // esdu cell result are deleted
+ assertEntityDeleted(resultEsdu1Id);
+
+ // and all his imports
+ assertEntityDeleted(importResultEsdu1Id);
+
+ // voyage 1 other imports stay
+ assertEntityExists(voyage1Id, transect1Id, operation1Id,
+ totalSample1Id, subSample1Id, biometrySample1Id,
+ dataAcquisition1Id, cellEsdu1Id, cellElementary1Id,
+ echotype1Id, lengthAgeKey1Id, lengthWeightKey1Id);
+
+ // and all his imports
+ assertEntityExists(importCommonAll1Id,
+ importCommonTransect1Id,
+ importOperation1Id,
+ importCatches1Id,
+ importAcoustic1Id,
+ importResultVoyage1Id,
+ importResultRegion1Id,
+ importResultMap1Id);
+ }
+
+}
Property changes on: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultEsduRemoveDataServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultMapRemoveDataServiceTest.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultMapRemoveDataServiceTest.java (rev 0)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultMapRemoveDataServiceTest.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -0,0 +1,45 @@
+package fr.ifremer.echobase.ui.actions.removedata;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * 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.ifremer.echobase.services.removedata.RemoveDataService;
+import fr.ifremer.echobase.services.removedata.strategy.ResultMapRemoveDataStrategy;
+import org.junit.Test;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Test{@link RemoveDataService} with {@link ResultMapRemoveDataStrategy}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class ResultMapRemoveDataServiceTest extends AbstractRemoveDataServiceTest {
+
+ @Test
+ public void removeImport() throws TopiaException {
+
+ removeImport(importResultMap1Id);
+
+ }
+}
Property changes on: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultMapRemoveDataServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultRegionRemoveDataServiceTest.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultRegionRemoveDataServiceTest.java (rev 0)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultRegionRemoveDataServiceTest.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -0,0 +1,65 @@
+package fr.ifremer.echobase.ui.actions.removedata;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * 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.ifremer.echobase.services.removedata.RemoveDataService;
+import fr.ifremer.echobase.services.removedata.strategy.ResultRegionRemoveDataStrategy;
+import org.junit.Test;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Test{@link RemoveDataService} with {@link ResultRegionRemoveDataStrategy}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class ResultRegionRemoveDataServiceTest extends AbstractRemoveDataServiceTest {
+
+ @Test
+ public void removeImport() throws TopiaException {
+
+ removeImport(importResultRegion1Id);
+
+ // esdu cell result are deleted
+ assertEntityDeleted(cellRegion1Id, resultRegion1Id);
+
+ // and all his imports
+ assertEntityDeleted(importResultEsdu1Id);
+
+ // voyage 1 other imports stay
+ assertEntityExists(voyage1Id, transect1Id, operation1Id,
+ totalSample1Id, subSample1Id, biometrySample1Id,
+ dataAcquisition1Id, cellEsdu1Id, cellElementary1Id, resultEsdu1Id,
+ echotype1Id, lengthAgeKey1Id, lengthWeightKey1Id);
+
+ // and all his imports
+ assertEntityExists(importCommonAll1Id,
+ importCommonTransect1Id,
+ importOperation1Id,
+ importCatches1Id,
+ importAcoustic1Id,
+ importResultVoyage1Id,
+ importResultMap1Id);
+ }
+}
Property changes on: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultRegionRemoveDataServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultVoyageRemoveDataServiceTest.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultVoyageRemoveDataServiceTest.java (rev 0)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultVoyageRemoveDataServiceTest.java 2012-09-16 13:56:31 UTC (rev 669)
@@ -0,0 +1,67 @@
+package fr.ifremer.echobase.ui.actions.removedata;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * 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.ifremer.echobase.services.removedata.RemoveDataService;
+import fr.ifremer.echobase.services.removedata.strategy.ResultVoyageRemoveDataStrategy;
+import org.junit.Test;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Test{@link RemoveDataService} with {@link ResultVoyageRemoveDataStrategy}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class ResultVoyageRemoveDataServiceTest extends AbstractRemoveDataServiceTest {
+
+ @Test
+ public void removeImport() throws TopiaException {
+
+ removeImport(importResultVoyage1Id);
+
+ // voyage "results" are deleted
+ assertEntityDeleted(echotype1Id, lengthAgeKey1Id, lengthWeightKey1Id,
+ cellRegion1Id, cellMap1Id,
+ resultEsdu1Id, resultRegion1Id, resultMap1Id);
+
+ // and all his imports
+ assertEntityDeleted(importResultVoyage1Id,
+ importResultEsdu1Id,
+ importResultRegion1Id,
+ importResultMap1Id);
+
+ // voyage 1 other imports stay
+ assertEntityExists(voyage1Id, transect1Id, operation1Id,
+ totalSample1Id, subSample1Id, biometrySample1Id,
+ dataAcquisition1Id, cellEsdu1Id, cellElementary1Id);
+
+ // and all his imports
+ assertEntityExists(importCommonAll1Id,
+ importCommonTransect1Id,
+ importOperation1Id,
+ importCatches1Id,
+ importAcoustic1Id);
+ }
+}
Property changes on: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/ResultVoyageRemoveDataServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
16 Sep '12
Author: tchemit
Date: 2012-09-16 11:39:45 +0200 (Sun, 16 Sep 2012)
New Revision: 668
Url: http://forge.codelutin.com/repositories/revision/echobase/668
Log:
split natural id and not-null tag values
Modified:
trunk/echobase-domain/src/main/xmi/echobase.properties
Modified: trunk/echobase-domain/src/main/xmi/echobase.properties
===================================================================
--- trunk/echobase-domain/src/main/xmi/echobase.properties 2012-09-15 11:50:06 UTC (rev 667)
+++ trunk/echobase-domain/src/main/xmi/echobase.properties 2012-09-16 09:39:45 UTC (rev 668)
@@ -69,50 +69,35 @@
### Natural id for references ################################################
###############################################################################
-fr.ifremer.echobase.entities.EntityModificationLog.attribute.entityType.tagValue.notNull=true
-fr.ifremer.echobase.entities.EntityModificationLog.attribute.entityId.tagValue.notNull=true
-fr.ifremer.echobase.entities.EntityModificationLog.attribute.modificationText.tagValue.notNull=true
-fr.ifremer.echobase.entities.EntityModificationLog.attribute.modificationDate.tagValue.notNull=true
-fr.ifremer.echobase.entities.EntityModificationLog.attribute.modificationUser.tagValue.notNull=true
-
fr.ifremer.echobase.entities.references.AcousticInstrument.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.AcousticInstrument.attribute.id.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.AcousticInstrument.attribute.id.tagValue.notNull=true
fr.ifremer.echobase.entities.references.AgeCategory.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.AgeCategory.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.AgeCategory.attribute.name.tagValue.notNull=true
-fr.ifremer.echobase.entities.references.AgeCategory.attribute.meaning.tagValue.notNull=true
fr.ifremer.echobase.entities.references.AreaOfOperation.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.AreaOfOperation.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.AreaOfOperation.attribute.name.tagValue.notNull=true
#fr.ifremer.echobase.entities.references.Calibration.class.tagValue.naturalIdMutable=true
#fr.ifremer.echobase.entities.references.Calibration.attribute.code.tagValue.naturalId=true
fr.ifremer.echobase.entities.references.CategoryMeaning.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.CategoryMeaning.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.CategoryMeaning.attribute.name.tagValue.notNull=true
#fr.ifremer.echobase.entities.references.CategoryRef.class.tagValue.naturalIdMutable=true
#fr.ifremer.echobase.entities.references.CategoryRef.attribute.code.tagValue.naturalId=true
fr.ifremer.echobase.entities.references.CategoryType.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.CategoryType.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.CategoryType.attribute.name.tagValue.notNull=true
fr.ifremer.echobase.entities.references.CellMethod.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.CellMethod.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.CellMethod.attribute.name.tagValue.notNull=true
fr.ifremer.echobase.entities.references.CellType.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.CellType.attribute.id.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.CellType.attribute.id.tagValue.notNull=true
fr.ifremer.echobase.entities.references.DataMetadata.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.DataMetadata.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.DataMetadata.attribute.name.tagValue.notNull=true
#fr.ifremer.echobase.entities.references.DataProtocol.class.tagValue.naturalIdMutable=true
#fr.ifremer.echobase.entities.references.DataProtocol.attribute.code.tagValue.naturalId=true
@@ -122,111 +107,161 @@
fr.ifremer.echobase.entities.references.DataType.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.DataType.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.DataType.attribute.name.tagValue.notNull=true
fr.ifremer.echobase.entities.references.DepthStratum.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.DepthStratum.attribute.id.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.DepthStratum.attribute.id.tagValue.notNull=true
fr.ifremer.echobase.entities.references.EchotypeCategory.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.EchotypeCategory.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.EchotypeCategory.attribute.name.tagValue.notNull=true
fr.ifremer.echobase.entities.references.Gear.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.Gear.attribute.casinoGearName.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.Gear.attribute.casinoGearName.tagValue.notNull=true
fr.ifremer.echobase.entities.references.GearCharacteristic.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.GearCharacteristic.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.GearCharacteristic.attribute.name.tagValue.notNull=true
#fr.ifremer.echobase.entities.references.GearCharacteristicValue.class.tagValue.naturalIdMutable=true
#fr.ifremer.echobase.entities.references.GearCharacteristicValue.attribute.code.tagValue.naturalId=true
fr.ifremer.echobase.entities.references.GearMetadata.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.GearMetadata.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.GearMetadata.attribute.name.tagValue.notNull=true
#fr.ifremer.echobase.entities.references.Impacte.class.tagValue.naturalIdMutable=true
#fr.ifremer.echobase.entities.references.Impacte.attribute.code.tagValue.naturalId=true
fr.ifremer.echobase.entities.references.MeasurementMetadata.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.MeasurementMetadata.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.MeasurementMetadata.attribute.name.tagValue.notNull=true
fr.ifremer.echobase.entities.references.MeasureType.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.MeasureType.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.MeasureType.attribute.name.tagValue.notNull=true
fr.ifremer.echobase.entities.references.Mission.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.Mission.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.Mission.attribute.name.tagValue.notNull=true
fr.ifremer.echobase.entities.references.OperationEvent.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.OperationEvent.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.OperationEvent.attribute.name.tagValue.notNull=true
fr.ifremer.echobase.entities.references.OperationMetadata.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.OperationMetadata.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.OperationMetadata.attribute.name.tagValue.notNull=true
fr.ifremer.echobase.entities.references.ReferenceDatum.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.ReferenceDatum.attribute.id.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.ReferenceDatum.attribute.id.tagValue.notNull=true
fr.ifremer.echobase.entities.references.ReferenceDatumType.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.ReferenceDatumType.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.ReferenceDatumType.attribute.name.tagValue.notNull=true
fr.ifremer.echobase.entities.references.ReferencingMethod.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.ReferencingMethod.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.ReferencingMethod.attribute.name.tagValue.notNull=true
fr.ifremer.echobase.entities.references.SampleDataType.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.SampleDataType.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.SampleDataType.attribute.name.tagValue.notNull=true
fr.ifremer.echobase.entities.references.SampleType.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.SampleType.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.SampleType.attribute.name.tagValue.notNull=true
fr.ifremer.echobase.entities.references.SexCategory.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.SexCategory.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.SexCategory.attribute.name.tagValue.notNull=true
-fr.ifremer.echobase.entities.references.SexCategory.attribute.meaning.tagValue.notNull=true
fr.ifremer.echobase.entities.references.SizeCategory.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.SizeCategory.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.SizeCategory.attribute.name.tagValue.notNull=true
-fr.ifremer.echobase.entities.references.SizeCategory.attribute.meaning.tagValue.notNull=true
fr.ifremer.echobase.entities.references.Species.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.Species.attribute.baracoudaCode.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.Species.attribute.baracoudaCode.tagValue.notNull=true
fr.ifremer.echobase.entities.references.SpeciesCategory.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.SpeciesCategory.attribute.species.tagValue.naturalId=true
fr.ifremer.echobase.entities.references.SpeciesCategory.attribute.sizeCategory.tagValue.naturalId=true
fr.ifremer.echobase.entities.references.SpeciesCategory.attribute.ageCategory.tagValue.naturalId=true
fr.ifremer.echobase.entities.references.SpeciesCategory.attribute.sexCategory.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.SpeciesCategory.attribute.species.tagValue.notNull=true
-fr.ifremer.echobase.entities.references.SpeciesCategory.attribute.sizeCategory.tagValue.notNull=false
-fr.ifremer.echobase.entities.references.SpeciesCategory.attribute.ageCategory.tagValue.notNull=false
-fr.ifremer.echobase.entities.references.SpeciesCategory.attribute.sexCategory.tagValue.notNull=false
fr.ifremer.echobase.entities.references.Strata.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.Strata.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.Strata.attribute.name.tagValue.notNull=true
#fr.ifremer.echobase.entities.references.TSParameters.class.tagValue.naturalIdMutable=true
#fr.ifremer.echobase.entities.references.TSParameters.attribute.code.tagValue.naturalId=true
fr.ifremer.echobase.entities.references.Vessel.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.Vessel.attribute.name.tagValue.naturalId=true
-fr.ifremer.echobase.entities.references.Vessel.attribute.name.tagValue.notNull=true
fr.ifremer.echobase.entities.references.VesselType.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.references.VesselType.attribute.name.tagValue.naturalId=true
+
+###############################################################################
+### Not null for references ###################################################
+###############################################################################
+
+fr.ifremer.echobase.entities.EntityModificationLog.attribute.entityType.tagValue.notNull=true
+fr.ifremer.echobase.entities.EntityModificationLog.attribute.entityId.tagValue.notNull=true
+fr.ifremer.echobase.entities.EntityModificationLog.attribute.modificationText.tagValue.notNull=true
+fr.ifremer.echobase.entities.EntityModificationLog.attribute.modificationDate.tagValue.notNull=true
+fr.ifremer.echobase.entities.EntityModificationLog.attribute.modificationUser.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.AcousticInstrument.attribute.id.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.AgeCategory.attribute.name.tagValue.notNull=true
+fr.ifremer.echobase.entities.references.AgeCategory.attribute.meaning.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.AreaOfOperation.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.CategoryMeaning.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.CategoryType.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.CellMethod.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.CellType.attribute.id.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.DataMetadata.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.DataType.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.DepthStratum.attribute.id.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.EchotypeCategory.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.Gear.attribute.casinoGearName.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.GearCharacteristic.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.GearMetadata.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.MeasurementMetadata.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.MeasureType.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.Mission.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.OperationEvent.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.OperationMetadata.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.ReferenceDatum.attribute.id.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.ReferenceDatumType.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.ReferencingMethod.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.SampleDataType.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.SampleType.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.SexCategory.attribute.name.tagValue.notNull=true
+fr.ifremer.echobase.entities.references.SexCategory.attribute.meaning.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.SizeCategory.attribute.name.tagValue.notNull=true
+fr.ifremer.echobase.entities.references.SizeCategory.attribute.meaning.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.Species.attribute.baracoudaCode.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.SpeciesCategory.attribute.species.tagValue.notNull=true
+fr.ifremer.echobase.entities.references.SpeciesCategory.attribute.sizeCategory.tagValue.notNull=false
+fr.ifremer.echobase.entities.references.SpeciesCategory.attribute.ageCategory.tagValue.notNull=false
+fr.ifremer.echobase.entities.references.SpeciesCategory.attribute.sexCategory.tagValue.notNull=false
+
+fr.ifremer.echobase.entities.references.Strata.attribute.name.tagValue.notNull=true
+
+fr.ifremer.echobase.entities.references.Vessel.attribute.name.tagValue.notNull=true
+
fr.ifremer.echobase.entities.references.VesselType.attribute.name.tagValue.notNull=true
###############################################################################
@@ -237,6 +272,14 @@
fr.ifremer.echobase.entities.data.Category.attribute.depthStratum.tagValue.naturalId=true
fr.ifremer.echobase.entities.data.Category.attribute.echotype.tagValue.naturalId=true
fr.ifremer.echobase.entities.data.Category.attribute.speciesCategory.tagValue.naturalId=true
+
+fr.ifremer.echobase.entities.data.Voyage.class.tagValue.naturalIdMutable=true
+fr.ifremer.echobase.entities.data.Voyage.attribute.name.tagValue.naturalId=true
+
+###############################################################################
+### Not null for data #########################################################
+###############################################################################
+
fr.ifremer.echobase.entities.data.Category.attribute.depthStratum.tagValue.notNull=false
fr.ifremer.echobase.entities.data.Category.attribute.echotype.tagValue.notNull=false
fr.ifremer.echobase.entities.data.Category.attribute.speciesCategory.tagValue.notNull=false
@@ -302,8 +345,6 @@
fr.ifremer.echobase.entities.data.Transit.attribute.description.tagValue.notNull=true
fr.ifremer.echobase.entities.data.Transit.attribute.relatedActivity.tagValue.notNull=true
-fr.ifremer.echobase.entities.data.Voyage.class.tagValue.naturalIdMutable=true
-fr.ifremer.echobase.entities.data.Voyage.attribute.name.tagValue.naturalId=true
fr.ifremer.echobase.entities.data.Voyage.attribute.name.tagValue.notNull=true
fr.ifremer.echobase.entities.data.Voyage.attribute.startDate.tagValue.notNull=true
fr.ifremer.echobase.entities.data.Voyage.attribute.endDate.tagValue.notNull=true
@@ -311,4 +352,4 @@
fr.ifremer.echobase.entities.data.Voyage.attribute.endPort.tagValue.notNull=true
fr.ifremer.echobase.entities.data.Voyage.attribute.description.tagValue.notNull=true
fr.ifremer.echobase.entities.data.Voyage.attribute.mission.tagValue.notNull=true
-fr.ifremer.echobase.entities.data.Voyage.attribute.datum.tagValue.notNull=true
+fr.ifremer.echobase.entities.data.Voyage.attribute.datum.tagValue.notNull=true
\ No newline at end of file
1
0
r667 - in trunk/echobase-services/src: main/java/fr/ifremer/echobase/services/importdata main/java/fr/ifremer/echobase/services/removedata main/java/fr/ifremer/echobase/services/removedata/strategy test/java/fr/ifremer/echobase/services test/java/fr/ifremer/echobase/ui/actions test/java/fr/ifremer/echobase/ui/actions/removedata test/resources/import-data
by tchemit@users.forge.codelutin.com 15 Sep '12
by tchemit@users.forge.codelutin.com 15 Sep '12
15 Sep '12
Author: tchemit
Date: 2012-09-15 13:50:06 +0200 (Sat, 15 Sep 2012)
New Revision: 667
Url: http://forge.codelutin.com/repositories/revision/echobase/667
Log:
refs #1437: Suppression des imports (debut des tests)
Added:
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceIT.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonAllRemoveDataServiceIT.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceIT.java
Removed:
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removeData/
Modified:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportDataService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/RemoveDataService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AbstractRemoveDataStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonTransectRemoveDataStrategy.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/EchoBaseServiceFixtures.java
trunk/echobase-services/src/test/resources/import-data/echobase-1.2-nodata.h2.db.gz
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportDataService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportDataService.java 2012-09-14 20:16:18 UTC (rev 666)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportDataService.java 2012-09-15 11:50:06 UTC (rev 667)
@@ -130,20 +130,36 @@
return new EchoBaseCsvFileImportResult(inputFile.getFileName());
}
- protected String computeResultAndLogBookEntry(M configuration,
- EchoBaseUser user) {
-
+ public ImportLog computeImportLogEntry(M configuration,
+ EchoBaseUser user) {
Date importDate = newDate();
String importUser = user.getEmail();
-
ImportLog importLog = create(getDAO(ImportLog.class),
ImportLog.PROPERTY_VOYAGE_ID, configuration.getVoyageId(),
ImportLog.PROPERTY_IMPORT_TYPE, configuration.getImportType(),
ImportLog.PROPERTY_IMPORT_USER, importUser,
ImportLog.PROPERTY_IMPORT_DATE, importDate,
ImportLog.PROPERTY_IMPORT_TEXT, configuration.getImportNotes());
+ return importLog;
+ }
+ protected String computeResultAndLogBookEntry(M configuration,
+ EchoBaseUser user) {
+
+ Date importDate = newDate();
+ String importUser = user.getEmail();
+
+ ImportLog importLog = computeImportLogEntry(configuration, user);
+//
+// ImportLog importLog = create(getDAO(ImportLog.class),
+// ImportLog.PROPERTY_VOYAGE_ID, configuration.getVoyageId(),
+// ImportLog.PROPERTY_IMPORT_TYPE, configuration.getImportType(),
+// ImportLog.PROPERTY_IMPORT_USER, importUser,
+// ImportLog.PROPERTY_IMPORT_DATE, importDate,
+// ImportLog.PROPERTY_IMPORT_TEXT, configuration.getImportNotes());
+//
+
String importType = getImportLabel(configuration);
StringBuilder buffer = new StringBuilder();
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/RemoveDataService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/RemoveDataService.java 2012-09-14 20:16:18 UTC (rev 666)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/RemoveDataService.java 2012-09-15 11:50:06 UTC (rev 667)
@@ -158,11 +158,17 @@
continue;
}
+ if (!importLog.getVoyageId().equals(logEntry.getVoyageId())) {
+
+ // not on same voyage, this importLog can not be obsoleted
+ continue;
+ }
+
if (possibleSubImportType.contains(logEntry.getImportType())) {
// ok can try to remove this import log
// try to find out if first id is still exists
- String firstId = importLog.getImportId().iterator().next();
+ String firstId = logEntry.getImportId().iterator().next();
if (!isIdExists(firstId)) {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AbstractRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AbstractRemoveDataStrategy.java 2012-09-14 20:16:18 UTC (rev 666)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/AbstractRemoveDataStrategy.java 2012-09-15 11:50:06 UTC (rev 667)
@@ -42,10 +42,12 @@
import fr.ifremer.echobase.services.EchoBaseServiceContext;
import fr.ifremer.echobase.services.EchoBaseServiceSupport;
import fr.ifremer.echobase.services.removedata.RemoveDataConfiguration;
+import org.apache.commons.collections.CollectionUtils;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.topia.persistence.TopiaEntity;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -94,7 +96,7 @@
public void doRemove(RemoveDataConfiguration model, ImportLog importLog) throws TopiaException {
- Voyage voyage = voyageDao.findByTopiaId(importLog.getTopiaId());
+ Voyage voyage = voyageDao.findByTopiaId(importLog.getVoyageId());
removeDataInVoyage(voyage);
@@ -114,6 +116,8 @@
throw new EchoBaseTechnicalException(e);
}
}
+
+// flushTransaction("Could not flush transaction");
}
protected abstract void removeDataInVoyage(Voyage voyage) throws TopiaException;
@@ -191,7 +195,9 @@
protected void removeVoyage(Voyage entity) throws TopiaException {
- Set<Echotype> echotypes = Sets.newHashSet(entity.getEchotype());
+ Set<Echotype> echotypes = CollectionUtils.isEmpty(entity.getEchotype()) ?
+ Collections.<Echotype>emptySet() :
+ Sets.newHashSet(entity.getEchotype());
// clean this data
entity.clearEchotype();
@@ -209,13 +215,16 @@
protected void removeVoyagePostCell(Voyage entity) throws TopiaException {
- for (Cell postCell : entity.getPostCell()) {
- removePostCell(null, postCell);
- }
+ if (CollectionUtils.isNotEmpty(entity.getPostCell())) {
+ for (Cell postCell : entity.getPostCell()) {
+ removePostCell(null, postCell);
+ }
- // clean this data
- entity.clearPostCell();
+ // clean this data
+ entity.clearPostCell();
- flushTransaction("Could not flush transaction after removing postCells");
+ flushTransaction(
+ "Could not flush transaction after removing postCells");
+ }
}
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonTransectRemoveDataStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonTransectRemoveDataStrategy.java 2012-09-14 20:16:18 UTC (rev 666)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/removedata/strategy/CommonTransectRemoveDataStrategy.java 2012-09-15 11:50:06 UTC (rev 667)
@@ -27,6 +27,8 @@
import fr.ifremer.echobase.entities.ImportType;
import fr.ifremer.echobase.entities.data.Transect;
import fr.ifremer.echobase.entities.data.TransectDAO;
+import fr.ifremer.echobase.entities.data.Transit;
+import fr.ifremer.echobase.entities.data.TransitDAO;
import fr.ifremer.echobase.entities.data.Voyage;
import fr.ifremer.echobase.services.EchoBaseServiceContext;
import org.apache.commons.logging.Log;
@@ -51,11 +53,14 @@
protected TransectDAO transectDAO;
+ protected TransitDAO transitDAO;
+
@Override
public void setServiceContext(EchoBaseServiceContext serviceContext) {
super.setServiceContext(serviceContext);
transectDAO = getDAO(Transect.class, TransectDAO.class);
+ transitDAO = getDAO(Transit.class, TransitDAO.class);
}
@Override
@@ -71,19 +76,24 @@
if (id.startsWith(Transect.class.getName())) {
// remove transect
- removeTransect(id);
+ Transect transect = transectDAO.findByTopiaId(id);
+
+ // remove it from transit
+ Transit transit = transitDAO.findContainsTransect(transect);
+ transit.removeTransect(transect);
+
+ // delete it
+ delete(transectDAO, transect);
+
+ if (log.isInfoEnabled()) {
+ log.info("Transect " + transect.getTopiaId() + " was removed");
+ }
+
} else {
canNotDealWithId(id);
}
}
- protected void removeTransect(String id) throws TopiaException {
- Transect entity = removeEntity(transectDAO, id);
- if (log.isInfoEnabled()) {
- log.info("Transect " + entity.getTopiaId() + " was removed");
- }
- }
-
@Override
public Set<ImportType> getPossibleSubImportType() {
Set<ImportType> result = Sets.newHashSet(ImportType.OPERATION,
Modified: trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/EchoBaseServiceFixtures.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/EchoBaseServiceFixtures.java 2012-09-14 20:16:18 UTC (rev 666)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/EchoBaseServiceFixtures.java 2012-09-15 11:50:06 UTC (rev 667)
@@ -31,10 +31,6 @@
*/
public class EchoBaseServiceFixtures {
- public String completeDb2011() {
- return "/import-data/echobase-pelgas-2011.h2.db.gz";
- }
-
public String IMPORT_DATA_ECHOBASE_NO_DATA() {
return "/import-data/echobase-" + dbVersion() + "-nodata.h2.db.gz";
}
Copied: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceIT.java (from rev 666, trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removeData/AbstractRemoveDataServiceIT.java)
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceIT.java (rev 0)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceIT.java 2012-09-15 11:50:06 UTC (rev 667)
@@ -0,0 +1,398 @@
+package fr.ifremer.echobase.ui.actions.removedata;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * 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.ifremer.echobase.entities.EchoBaseUser;
+import fr.ifremer.echobase.entities.ImportLog;
+import fr.ifremer.echobase.entities.ImportType;
+import fr.ifremer.echobase.entities.data.Category;
+import fr.ifremer.echobase.entities.data.CategoryDAO;
+import fr.ifremer.echobase.entities.data.Cell;
+import fr.ifremer.echobase.entities.data.CellDAO;
+import fr.ifremer.echobase.entities.data.DataAcquisition;
+import fr.ifremer.echobase.entities.data.DataAcquisitionDAO;
+import fr.ifremer.echobase.entities.data.DataProcessing;
+import fr.ifremer.echobase.entities.data.DataProcessingDAO;
+import fr.ifremer.echobase.entities.data.Echotype;
+import fr.ifremer.echobase.entities.data.EchotypeDAO;
+import fr.ifremer.echobase.entities.data.LengthAgeKey;
+import fr.ifremer.echobase.entities.data.LengthAgeKeyDAO;
+import fr.ifremer.echobase.entities.data.LengthWeightKey;
+import fr.ifremer.echobase.entities.data.LengthWeightKeyDAO;
+import fr.ifremer.echobase.entities.data.Transect;
+import fr.ifremer.echobase.entities.data.TransectDAO;
+import fr.ifremer.echobase.entities.data.Transit;
+import fr.ifremer.echobase.entities.data.TransitDAO;
+import fr.ifremer.echobase.entities.data.Voyage;
+import fr.ifremer.echobase.entities.data.VoyageDAO;
+import fr.ifremer.echobase.entities.references.Mission;
+import fr.ifremer.echobase.entities.references.Vessel;
+import fr.ifremer.echobase.services.EchoBaseTestServiceSupport;
+import fr.ifremer.echobase.services.FakeEchoBaseServiceContext;
+import fr.ifremer.echobase.services.importdata.CommonAllImportService;
+import fr.ifremer.echobase.services.importdata.CommonImportConfiguration;
+import fr.ifremer.echobase.services.removedata.RemoveDataConfiguration;
+import fr.ifremer.echobase.services.removedata.RemoveDataService;
+import junit.framework.Assert;
+import org.apache.commons.collections.CollectionUtils;
+import org.junit.Before;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.persistence.TopiaDAO;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+import java.util.List;
+
+/**
+ * Abstract it form remove data feature.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2
+ */
+public abstract class AbstractRemoveDataServiceIT extends EchoBaseTestServiceSupport {
+
+ protected String importCommonAll1Id;
+
+ protected String importCommonTransect1Id;
+
+ protected static final String voyage1Id = "fr.ifremer.echobase.entities.data.Voyage#1#1";
+
+ protected static final String transit1Id = "fr.ifremer.echobase.entities.data.Transit#1#1";
+
+ protected static final String transect1Id = "fr.ifremer.echobase.entities.data.Transect#1#1";
+
+ protected static final String transect1_2Id = "fr.ifremer.echobase.entities.data.Transect#1#2";
+
+ protected String importCommonAll2Id;
+
+ protected String importCommonTransect2Id;
+
+ protected static final String voyage2Id = "fr.ifremer.echobase.entities.data.Voyage#2#1";
+
+ protected static final String transit2Id = "fr.ifremer.echobase.entities.data.Transit#2#1";
+
+ protected static final String transect2Id = "fr.ifremer.echobase.entities.data.Transect#2#1";
+
+ protected static final String transect2_2Id = "fr.ifremer.echobase.entities.data.Transect#2#2";
+
+ protected VoyageDAO voyageDao;
+
+ protected TransectDAO transectDAO;
+
+ protected TransitDAO transitDAO;
+
+ protected DataAcquisitionDAO dataAcquisitionDAO;
+
+ protected DataProcessingDAO dataProcessingDAO;
+
+ protected CellDAO cellDAO;
+
+ protected CategoryDAO categoryDAO;
+
+ protected EchotypeDAO echotypeDAO;
+
+ protected LengthAgeKeyDAO lengthAgeKeyDAO;
+
+ protected LengthWeightKeyDAO lengthWeightKeyDAO;
+
+ @Override
+ protected FakeEchoBaseServiceContext initContext() {
+ return new FakeEchoBaseServiceContext(fixtures.IMPORT_DATA_ECHOBASE_NO_DATA());
+ }
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+
+ voyageDao = getDAO(Voyage.class, VoyageDAO.class);
+ transectDAO = getDAO(Transect.class, TransectDAO.class);
+ transitDAO = getDAO(Transit.class, TransitDAO.class);
+ dataAcquisitionDAO = getDAO(DataAcquisition.class, DataAcquisitionDAO.class);
+ dataProcessingDAO = getDAO(DataProcessing.class, DataProcessingDAO.class);
+
+ cellDAO = getDAO(Cell.class, CellDAO.class);
+ echotypeDAO = getDAO(Echotype.class, EchotypeDAO.class);
+ lengthAgeKeyDAO = getDAO(LengthAgeKey.class, LengthAgeKeyDAO.class);
+ lengthWeightKeyDAO = getDAO(LengthWeightKey.class, LengthWeightKeyDAO.class);
+ categoryDAO = getDAO(Category.class, CategoryDAO.class);
+ }
+
+ protected void removeImport(String importId) {
+ RemoveDataConfiguration conf = new RemoveDataConfiguration();
+ conf.setImportLogId(importId);
+
+ RemoveDataService service = getService(RemoveDataService.class);
+
+ EchoBaseUser fakeUser = createFakeUser();
+
+ service.removeImport(conf, fakeUser);
+ }
+
+
+ protected <E extends TopiaEntity> void assertEntityDeleted(Class<E> entityType, String... entityIds) throws TopiaException {
+ TopiaDAO<E> dao = getDAO(entityType);
+ for (String entityId : entityIds) {
+ E entity = dao.findByTopiaId(entityId);
+ Assert.assertNull("Entity with id " + entityId + " should have been deleted, but is still in db :(", entity);
+ }
+ }
+
+ protected <E extends TopiaEntity> void assertEntityExists(Class<E> entityType, String... entityIds) throws TopiaException {
+ TopiaDAO<E> dao = getDAO(entityType);
+ for (String entityId : entityIds) {
+ E entity = dao.findByTopiaId(entityId);
+ Assert.assertNotNull("Entity with id " + entityId + " should have not been deleted, but is deleted in db :(", entity);
+ }
+ }
+
+ protected <E extends TopiaEntity> E getFirstEntity(Class<E> entityType) {
+ List<E> entities = getEntities(entityType);
+ Assert.assertTrue(CollectionUtils.isNotEmpty(entities));
+ return entities.get(0);
+ }
+
+ protected void createCommonAllImportV1() {
+
+ // create voyage
+ Voyage voyage1 = create(voyageDao,
+ TopiaEntity.TOPIA_ID, voyage1Id,
+ Voyage.PROPERTY_MISSION, getFirstEntity(Mission.class),
+ Voyage.PROPERTY_NAME, "voyage1",
+ Voyage.PROPERTY_START_DATE, newDate(),
+ Voyage.PROPERTY_END_DATE, newDate(),
+ Voyage.PROPERTY_START_PORT, "voyage1StartPort",
+ Voyage.PROPERTY_END_PORT, "voyage1EndPort",
+ Voyage.PROPERTY_DESCRIPTION, "voyage1Description",
+ Voyage.PROPERTY_DATUM, "voyage1Datum"
+ );
+
+ // create transit
+ Transit transit1 = create(transitDAO,
+ TopiaEntity.TOPIA_ID, transit1Id,
+ Transit.PROPERTY_START_TIME, newDate(),
+ Transit.PROPERTY_END_TIME, newDate(),
+ Transit.PROPERTY_START_LOCALITY, "transit1tartLocality",
+ Transit.PROPERTY_END_LOCALITY, "transit1EndLocality",
+ Transit.PROPERTY_DESCRIPTION, "transit1Description",
+ Transit.PROPERTY_RELATED_ACTIVITY, "transit1RelatedActivity"
+ );
+ voyage1.addTransit(transit1);
+
+ // create transect
+ Transect transect1 = create(transectDAO,
+ TopiaEntity.TOPIA_ID, transect1Id,
+ Transect.PROPERTY_TITLE, "transect1Title",
+ Transect.PROPERTY_VESSEL, getFirstEntity(Vessel.class),
+ Transect.PROPERTY_STRATUM, "transect1Stratum"
+ );
+ transit1.addTransect(transect1);
+
+ commitTransaction("ImportError!");
+
+ CommonImportConfiguration importConf =
+ new CommonImportConfiguration(getLocale());
+ importConf.setImportType(ImportType.COMMON_ALL);
+ importConf.setImportNotes("Common/Voyage/Transit/Transect1");
+ importConf.setVoyageId(voyage1.getTopiaId());
+
+ CommonAllImportService importService =
+ getService(CommonAllImportService.class);
+
+ ImportLog importLog = importService.computeImportLogEntry(
+ importConf, createFakeUser());
+
+ importLog.addImportId(voyage1.getTopiaId());
+
+ commitTransaction("ImportLogError!");
+
+ importCommonAll1Id = importLog.getTopiaId();
+ }
+
+ protected void createCommonAllImportV2() {
+
+ // create voyage
+ Voyage voyage1 = create(voyageDao,
+ TopiaEntity.TOPIA_ID, voyage2Id,
+ Voyage.PROPERTY_MISSION, getFirstEntity(Mission.class),
+ Voyage.PROPERTY_NAME, "voyage1",
+ Voyage.PROPERTY_START_DATE, newDate(),
+ Voyage.PROPERTY_END_DATE, newDate(),
+ Voyage.PROPERTY_START_PORT, "voyage1StartPort",
+ Voyage.PROPERTY_END_PORT, "voyage1EndPort",
+ Voyage.PROPERTY_DESCRIPTION, "voyage1Description",
+ Voyage.PROPERTY_DATUM, "voyage1Datum"
+ );
+
+ // create transit
+ Transit transit1 = create(transitDAO,
+ TopiaEntity.TOPIA_ID, transit2Id,
+ Transit.PROPERTY_START_TIME, newDate(),
+ Transit.PROPERTY_END_TIME, newDate(),
+ Transit.PROPERTY_START_LOCALITY, "transit1tartLocality",
+ Transit.PROPERTY_END_LOCALITY, "transit1EndLocality",
+ Transit.PROPERTY_DESCRIPTION, "transit1Description",
+ Transit.PROPERTY_RELATED_ACTIVITY, "transit1RelatedActivity"
+ );
+ voyage1.addTransit(transit1);
+
+ // create transect
+ Transect transect1 = create(transectDAO,
+ TopiaEntity.TOPIA_ID, transect2Id,
+ Transect.PROPERTY_TITLE, "transect1Title",
+ Transect.PROPERTY_VESSEL, getFirstEntity(Vessel.class),
+ Transect.PROPERTY_STRATUM, "transect1Stratum"
+ );
+ transit1.addTransect(transect1);
+
+ commitTransaction("ImportError!");
+
+ CommonImportConfiguration importConf =
+ new CommonImportConfiguration(getLocale());
+ importConf.setImportType(ImportType.COMMON_ALL);
+ importConf.setImportNotes("Common/Voyage/Transit/Transect2");
+ importConf.setVoyageId(voyage1.getTopiaId());
+
+ CommonAllImportService importService =
+ getService(CommonAllImportService.class);
+
+ ImportLog importLog = importService.computeImportLogEntry(
+ importConf, createFakeUser());
+
+ importLog.addImportId(voyage1.getTopiaId());
+
+ commitTransaction("ImportLogError!");
+
+ importCommonAll2Id = importLog.getTopiaId();
+ }
+
+ protected void createCommonTransectImportV1() {
+
+ Voyage voyage1 = getEntityById(Voyage.class, voyage1Id);
+
+ // create transect
+ Transect transect2 = create(transectDAO,
+ TopiaEntity.TOPIA_ID, transect1_2Id,
+ Transect.PROPERTY_TITLE, "transect2Title",
+ Transect.PROPERTY_VESSEL, getFirstEntity(Vessel.class),
+ Transect.PROPERTY_STRATUM, "transect2Stratum"
+ );
+ voyage1.getTransit().get(0).addTransect(transect2);
+
+ commitTransaction("ImportError!");
+
+ CommonImportConfiguration importConf =
+ new CommonImportConfiguration(getLocale());
+ importConf.setImportType(ImportType.COMMON_TRANSECT);
+ importConf.setImportNotes("Common/Transect1");
+ importConf.setVoyageId(voyage1Id);
+
+ CommonAllImportService importService =
+ getService(CommonAllImportService.class);
+
+ ImportLog importLog = importService.computeImportLogEntry(
+ importConf, createFakeUser());
+
+ importLog.addImportId(transect2.getTopiaId());
+
+ commitTransaction("ImportLogError!");
+
+ importCommonTransect1Id = importLog.getTopiaId();
+ }
+
+ protected void createCommonTransectImportV2() {
+
+ Voyage voyage1 = getEntityById(Voyage.class, voyage2Id);
+
+ // create transect
+ Transect transect2 = create(transectDAO,
+ TopiaEntity.TOPIA_ID, transect2_2Id,
+ Transect.PROPERTY_TITLE, "transect2Title",
+ Transect.PROPERTY_VESSEL, getFirstEntity(Vessel.class),
+ Transect.PROPERTY_STRATUM, "transect2Stratum"
+ );
+ voyage1.getTransit().get(0).addTransect(transect2);
+
+ commitTransaction("ImportError!");
+
+ CommonImportConfiguration importConf =
+ new CommonImportConfiguration(getLocale());
+ importConf.setImportType(ImportType.COMMON_TRANSECT);
+ importConf.setImportNotes("Common/Transect2");
+ importConf.setVoyageId(voyage2Id);
+
+ CommonAllImportService importService =
+ getService(CommonAllImportService.class);
+
+ ImportLog importLog = importService.computeImportLogEntry(
+ importConf, createFakeUser());
+
+ importLog.addImportId(transect2.getTopiaId());
+
+ commitTransaction("ImportLogError!");
+
+ importCommonTransect2Id = importLog.getTopiaId();
+ }
+
+ protected void createOperationImport() {
+
+ // create operation
+ // create operationMetadata
+ // create geartMetadata
+ }
+
+ protected void createCatchesImport() {
+
+ // create totalSample
+ // create subSample
+ // create biometrySample
+ }
+
+ protected void createAcousticImport() {
+
+ // create cell
+ }
+
+ protected void createResultVoyageImport() {
+
+ // create echotype
+ // create lengthAgeKey
+ // create lengthWeightKey
+ }
+
+ protected void createResultEsduImport() {
+
+ // create result (on ESDU)
+ }
+
+ protected void createResultRegionImport() {
+
+ // create region
+ // create result (on region)
+ }
+
+ protected void createResultMapImport() {
+
+ // create map
+ }
+}
Property changes on: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/AbstractRemoveDataServiceIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonAllRemoveDataServiceIT.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonAllRemoveDataServiceIT.java (rev 0)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonAllRemoveDataServiceIT.java 2012-09-15 11:50:06 UTC (rev 667)
@@ -0,0 +1,100 @@
+package fr.ifremer.echobase.ui.actions.removedata;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * 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.ifremer.echobase.entities.ImportLog;
+import fr.ifremer.echobase.entities.data.Transect;
+import fr.ifremer.echobase.entities.data.Voyage;
+import fr.ifremer.echobase.services.removedata.RemoveDataService;
+import fr.ifremer.echobase.services.removedata.strategy.CommonAllRemoveDataStrategy;
+import org.junit.Test;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Test{@link RemoveDataService} with {@link CommonAllRemoveDataStrategy}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class CommonAllRemoveDataServiceIT extends AbstractRemoveDataServiceIT {
+
+ @Test
+ public void removeImport1() throws TopiaException {
+
+ createCommonAllImportV1();
+ createCommonTransectImportV1();
+
+ createCommonAllImportV2();
+ createCommonTransectImportV2();
+
+ removeImport(importCommonAll1Id);
+
+ // voyage 1 is deleted
+ assertEntityDeleted(Voyage.class, voyage1Id);
+
+ // and all his imports
+ assertEntityDeleted(ImportLog.class,
+ importCommonAll1Id,
+ importCommonTransect1Id);
+
+ // voyage 2 still in db
+ assertEntityExists(Voyage.class, voyage2Id);
+ assertEntityExists(Transect.class, transect2Id);
+
+ // and all his imports
+ assertEntityExists(ImportLog.class,
+ importCommonAll2Id,
+ importCommonTransect2Id);
+
+ }
+
+ @Test
+ public void removeImport2() throws TopiaException {
+
+ createCommonAllImportV1();
+ createCommonTransectImportV1();
+
+ createCommonAllImportV2();
+ createCommonTransectImportV2();
+
+ removeImport(importCommonAll2Id);
+
+ // voyage 2 is deleted
+ assertEntityDeleted(Voyage.class, voyage2Id);
+
+ // and all his imports
+ assertEntityDeleted(ImportLog.class,
+ importCommonAll2Id,
+ importCommonTransect2Id);
+
+ // voyage 1 still in db
+ assertEntityExists(Voyage.class, voyage1Id);
+ assertEntityExists(Transect.class, transect1Id);
+
+ // and all his imports
+ assertEntityExists(ImportLog.class,
+ importCommonAll1Id,
+ importCommonTransect1Id);
+ }
+}
Property changes on: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonAllRemoveDataServiceIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceIT.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceIT.java (rev 0)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceIT.java 2012-09-15 11:50:06 UTC (rev 667)
@@ -0,0 +1,117 @@
+package fr.ifremer.echobase.ui.actions.removedata;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * 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.ifremer.echobase.entities.ImportLog;
+import fr.ifremer.echobase.entities.data.Transect;
+import fr.ifremer.echobase.entities.data.Voyage;
+import fr.ifremer.echobase.services.removedata.RemoveDataService;
+import fr.ifremer.echobase.services.removedata.strategy.CommonTransectRemoveDataStrategy;
+import org.junit.Test;
+import org.nuiton.topia.TopiaException;
+
+/**
+ * Test{@link RemoveDataService} with {@link CommonTransectRemoveDataStrategy}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class CommonTransectRemoveDataServiceIT extends AbstractRemoveDataServiceIT {
+
+ @Test
+ public void removeImport1() throws TopiaException {
+
+ createCommonAllImportV1();
+ createCommonTransectImportV1();
+
+ createCommonAllImportV2();
+ createCommonTransectImportV2();
+
+ removeImport(importCommonTransect1Id);
+
+ // transect 1 is deleted
+ assertEntityDeleted(Transect.class, transect1_2Id);
+
+ // and all his imports
+ assertEntityDeleted(ImportLog.class,
+ importCommonTransect1Id);
+
+ // voyage 1 is still here
+ assertEntityExists(Voyage.class, voyage1Id);
+ assertEntityExists(Transect.class, transect1Id);
+
+ // and all his imports
+ assertEntityExists(ImportLog.class,
+ importCommonAll1Id);
+
+
+ // voyage 2 still in db
+ assertEntityExists(Voyage.class, voyage2Id);
+ assertEntityExists(Transect.class, transect2Id);
+
+ // and all his imports
+ assertEntityExists(ImportLog.class,
+ importCommonAll2Id,
+ importCommonTransect2Id);
+ }
+
+ @Test
+ public void removeImport2() throws TopiaException {
+
+
+ createCommonAllImportV1();
+ createCommonTransectImportV1();
+
+ createCommonAllImportV2();
+ createCommonTransectImportV2();
+
+ removeImport(importCommonTransect2Id);
+
+ // transect 2 is deleted
+ assertEntityDeleted(Transect.class, transect2_2Id);
+
+ // and all his imports
+ assertEntityDeleted(ImportLog.class,
+ importCommonTransect2Id);
+
+
+ // voyage 2 is still here
+ assertEntityExists(Voyage.class, voyage2Id);
+ assertEntityExists(Transect.class, transect2Id);
+
+ // and all his imports
+ assertEntityExists(ImportLog.class,
+ importCommonAll2Id);
+
+
+ // voyage 1 still in db
+ assertEntityExists(Voyage.class, voyage1Id);
+ assertEntityExists(Transect.class, transect1Id);
+
+ // and all his imports
+ assertEntityExists(ImportLog.class,
+ importCommonAll1Id,
+ importCommonTransect1Id);
+ }
+}
Property changes on: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removedata/CommonTransectRemoveDataServiceIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-services/src/test/resources/import-data/echobase-1.2-nodata.h2.db.gz
===================================================================
(Binary files differ)
1
0
r666 - trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removeData
by tchemit@users.forge.codelutin.com 14 Sep '12
by tchemit@users.forge.codelutin.com 14 Sep '12
14 Sep '12
Author: tchemit
Date: 2012-09-14 22:16:18 +0200 (Fri, 14 Sep 2012)
New Revision: 666
Url: http://forge.codelutin.com/repositories/revision/echobase/666
Log:
add missing svn properties + license header
Modified:
trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removeData/AbstractRemoveDataServiceIT.java
Modified: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removeData/AbstractRemoveDataServiceIT.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removeData/AbstractRemoveDataServiceIT.java 2012-09-14 20:15:44 UTC (rev 665)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removeData/AbstractRemoveDataServiceIT.java 2012-09-14 20:16:18 UTC (rev 666)
@@ -1,5 +1,28 @@
package fr.ifremer.echobase.ui.actions.removeData;
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * 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.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.services.EchoBaseTestServiceSupport;
import fr.ifremer.echobase.services.FakeEchoBaseServiceContext;
Property changes on: trunk/echobase-services/src/test/java/fr/ifremer/echobase/ui/actions/removeData/AbstractRemoveDataServiceIT.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
1
0
r665 - trunk/echobase-ui/src/main/env/prod/resources
by tchemit@users.forge.codelutin.com 14 Sep '12
by tchemit@users.forge.codelutin.com 14 Sep '12
14 Sep '12
Author: tchemit
Date: 2012-09-14 22:15:44 +0200 (Fri, 14 Sep 2012)
New Revision: 665
Url: http://forge.codelutin.com/repositories/revision/echobase/665
Log:
fix log file name
Modified:
trunk/echobase-ui/src/main/env/prod/resources/log4j.properties
Modified: trunk/echobase-ui/src/main/env/prod/resources/log4j.properties
===================================================================
--- trunk/echobase-ui/src/main/env/prod/resources/log4j.properties 2012-09-14 16:37:54 UTC (rev 664)
+++ trunk/echobase-ui/src/main/env/prod/resources/log4j.properties 2012-09-14 20:15:44 UTC (rev 665)
@@ -31,7 +31,7 @@
# file output...
log4j.appender.file=org.apache.log4j.RollingFileAppender
-log4j.appender.file.File=${echobase.log.dir}/t3.log
+log4j.appender.file.File=${echobase.log.dir}/echobase.log
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=4
log4j.appender.file.layout=org.apache.log4j.PatternLayout
1
0
r664 - in trunk: . echobase-domain echobase-services echobase-tools echobase-ui
by maven-release@users.forge.codelutin.com 14 Sep '12
by maven-release@users.forge.codelutin.com 14 Sep '12
14 Sep '12
Author: maven-release
Date: 2012-09-14 18:37:54 +0200 (Fri, 14 Sep 2012)
New Revision: 664
Url: http://forge.codelutin.com/repositories/revision/echobase/664
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
trunk/echobase-domain/pom.xml
trunk/echobase-services/pom.xml
trunk/echobase-tools/pom.xml
trunk/echobase-ui/pom.xml
trunk/pom.xml
Modified: trunk/echobase-domain/pom.xml
===================================================================
--- trunk/echobase-domain/pom.xml 2012-09-14 16:37:47 UTC (rev 663)
+++ trunk/echobase-domain/pom.xml 2012-09-14 16:37:54 UTC (rev 664)
@@ -9,7 +9,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>1.2</version>
+ <version>1.3-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
Modified: trunk/echobase-services/pom.xml
===================================================================
--- trunk/echobase-services/pom.xml 2012-09-14 16:37:47 UTC (rev 663)
+++ trunk/echobase-services/pom.xml 2012-09-14 16:37:54 UTC (rev 664)
@@ -6,7 +6,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>1.2</version>
+ <version>1.3-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
Modified: trunk/echobase-tools/pom.xml
===================================================================
--- trunk/echobase-tools/pom.xml 2012-09-14 16:37:47 UTC (rev 663)
+++ trunk/echobase-tools/pom.xml 2012-09-14 16:37:54 UTC (rev 664)
@@ -11,7 +11,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>1.2</version>
+ <version>1.3-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
Modified: trunk/echobase-ui/pom.xml
===================================================================
--- trunk/echobase-ui/pom.xml 2012-09-14 16:37:47 UTC (rev 663)
+++ trunk/echobase-ui/pom.xml 2012-09-14 16:37:54 UTC (rev 664)
@@ -7,7 +7,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>1.2</version>
+ <version>1.3-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-09-14 16:37:47 UTC (rev 663)
+++ trunk/pom.xml 2012-09-14 16:37:54 UTC (rev 664)
@@ -11,7 +11,7 @@
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>1.2</version>
+ <version>1.3-SNAPSHOT</version>
<modules>
<module>echobase-domain</module>
@@ -78,12 +78,12 @@
</developers>
<scm>
- <url>http://svn.forge.codelutin.com/svn/echobase/tags/echobase-1.2</url>
+ <url>http://svn.forge.codelutin.com/svn/echobase/trunk</url>
<connection>
- scm:svn:http://svn.forge.codelutin.com/svn/echobase/tags/echobase-1.2
+ scm:svn:http://svn.forge.codelutin.com/svn/echobase/trunk
</connection>
<developerConnection>
- scm:svn:http://svn.forge.codelutin.com/svn/echobase/tags/echobase-1.2
+ scm:svn:http://svn.forge.codelutin.com/svn/echobase/trunk
</developerConnection>
</scm>
1
0
Author: maven-release
Date: 2012-09-14 18:37:47 +0200 (Fri, 14 Sep 2012)
New Revision: 663
Url: http://forge.codelutin.com/repositories/revision/echobase/663
Log:
[maven-release-plugin] copy for tag echobase-1.2
Added:
tags/echobase-1.2/
1
0
r662 - in trunk: . echobase-domain echobase-services echobase-tools echobase-ui
by maven-release@users.forge.codelutin.com 14 Sep '12
by maven-release@users.forge.codelutin.com 14 Sep '12
14 Sep '12
Author: maven-release
Date: 2012-09-14 18:37:39 +0200 (Fri, 14 Sep 2012)
New Revision: 662
Url: http://forge.codelutin.com/repositories/revision/echobase/662
Log:
[maven-release-plugin] prepare release echobase-1.2
Modified:
trunk/echobase-domain/pom.xml
trunk/echobase-services/pom.xml
trunk/echobase-tools/pom.xml
trunk/echobase-ui/pom.xml
trunk/pom.xml
Modified: trunk/echobase-domain/pom.xml
===================================================================
--- trunk/echobase-domain/pom.xml 2012-09-14 16:12:13 UTC (rev 661)
+++ trunk/echobase-domain/pom.xml 2012-09-14 16:37:39 UTC (rev 662)
@@ -9,7 +9,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
Modified: trunk/echobase-services/pom.xml
===================================================================
--- trunk/echobase-services/pom.xml 2012-09-14 16:12:13 UTC (rev 661)
+++ trunk/echobase-services/pom.xml 2012-09-14 16:37:39 UTC (rev 662)
@@ -6,7 +6,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
Modified: trunk/echobase-tools/pom.xml
===================================================================
--- trunk/echobase-tools/pom.xml 2012-09-14 16:12:13 UTC (rev 661)
+++ trunk/echobase-tools/pom.xml 2012-09-14 16:37:39 UTC (rev 662)
@@ -11,7 +11,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
Modified: trunk/echobase-ui/pom.xml
===================================================================
--- trunk/echobase-ui/pom.xml 2012-09-14 16:12:13 UTC (rev 661)
+++ trunk/echobase-ui/pom.xml 2012-09-14 16:37:39 UTC (rev 662)
@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
@@ -372,7 +370,7 @@
<phase>generate-resources</phase>
<configuration>
<target>
- <mkdir dir="${embeddedWarDir}/WEB-INF/classes"/>
+ <mkdir dir="${embeddedWarDir}/WEB-INF/classes" />
</target>
</configuration>
<goals>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-09-14 16:12:13 UTC (rev 661)
+++ trunk/pom.xml 2012-09-14 16:37:39 UTC (rev 662)
@@ -11,7 +11,7 @@
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.2</version>
<modules>
<module>echobase-domain</module>
@@ -78,12 +78,12 @@
</developers>
<scm>
- <url>http://svn.forge.codelutin.com/svn/echobase/trunk</url>
+ <url>http://svn.forge.codelutin.com/svn/echobase/tags/echobase-1.2</url>
<connection>
- scm:svn:http://svn.forge.codelutin.com/svn/echobase/trunk
+ scm:svn:http://svn.forge.codelutin.com/svn/echobase/tags/echobase-1.2
</connection>
<developerConnection>
- scm:svn:http://svn.forge.codelutin.com/svn/echobase/trunk
+ scm:svn:http://svn.forge.codelutin.com/svn/echobase/tags/echobase-1.2
</developerConnection>
</scm>
1
0
Author: tchemit
Date: 2012-09-14 18:12:13 +0200 (Fri, 14 Sep 2012)
New Revision: 661
Url: http://forge.codelutin.com/repositories/revision/echobase/661
Log:
update to last stable of nuiton-utils and topia
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-09-14 14:36:44 UTC (rev 660)
+++ trunk/pom.xml 2012-09-14 16:12:13 UTC (rev 661)
@@ -133,8 +133,8 @@
<!-- libraries version -->
<eugenePluginVersion>2.5</eugenePluginVersion>
- <topiaVersion>2.6.14-SNAPSHOT</topiaVersion>
- <nuitonUtilsVersion>2.6.2-SNAPSHOT</nuitonUtilsVersion>
+ <topiaVersion>2.7</topiaVersion>
+ <nuitonUtilsVersion>2.6.2</nuitonUtilsVersion>
<nuitonI18nVersion>2.5</nuitonI18nVersion>
<nuitonWebVersion>1.11</nuitonWebVersion>
<msaccessImporterVersion>1.4.1</msaccessImporterVersion>
1
0