diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractAssignmentSampleToExperimentTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractAssignmentSampleToExperimentTestCase.java index 2f3d43161f364286deeea2300f9bb225f8071474..5bcdcb88973951b8221ed7d67c657138f8e8601e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractAssignmentSampleToExperimentTestCase.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractAssignmentSampleToExperimentTestCase.java @@ -377,7 +377,7 @@ public abstract class AbstractAssignmentSampleToExperimentTestCase extends BaseT @Rollback(true) public void registerExperimentWithSampleInDifferentSpace() { - EntityGraphGenerator g = parseAndCreateGraph("/S1/S1\n"); + EntityGraphGenerator g = parseAndCreateGraph("/S1/S1\n", false); try { @@ -395,7 +395,7 @@ public abstract class AbstractAssignmentSampleToExperimentTestCase extends BaseT public void removeSamplesWithDataSetsFromExperimentFailsBecauseOneDataSetNeedsAnExperiment() { EntityGraphGenerator g = parseAndCreateGraph("E1, samples: S1, data sets: DS1[NET] DS2\n" - + "S1, data sets: DS1[NET] DS2\n"); + + "S1, data sets: DS1[NET] DS2\n", false); try { @@ -422,7 +422,7 @@ public abstract class AbstractAssignmentSampleToExperimentTestCase extends BaseT public void addSampleToAnExperimentFailingBecauseSampleHasAlreadyAnExperiment() { EntityGraphGenerator g = parseAndCreateGraph("E1, samples: S1\n" - + "E2\n"); + + "E2\n", false); try { @@ -486,7 +486,7 @@ public abstract class AbstractAssignmentSampleToExperimentTestCase extends BaseT public void spaceSampleCanNotBeAddedToExperimentFromAnotherSpace() { EntityGraphGenerator g = parseAndCreateGraph("/S2/P1/E1\n" - + "/S1/S1\n"); + + "/S1/S1\n", false); try { @@ -605,7 +605,7 @@ public abstract class AbstractAssignmentSampleToExperimentTestCase extends BaseT public void sampleWithExperimentCanNotBeAssignedToAnotherExperimentThroughExperimentUpdate() { EntityGraphGenerator g = parseAndCreateGraph("/S1/P1/E1, samples: /S1/S1\n" - + "/S1/P2/E2\n"); + + "/S1/P2/E2\n", false); try { @@ -624,7 +624,7 @@ public abstract class AbstractAssignmentSampleToExperimentTestCase extends BaseT public void sharedSampleCanNotBeAssignedToExperimentThroughExperimentUpdate() { EntityGraphGenerator g = parseAndCreateGraph("/S1/P1/E1\n" - + "/S1\n"); + + "/S1\n", false); try { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractDataSetAssignmentTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractDataSetAssignmentTestCase.java index 295b4d34c7fc338bf196863c35bc6205ed271f1a..d20b983fa63285bb67e0cee0a798b05079aefe1e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractDataSetAssignmentTestCase.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractDataSetAssignmentTestCase.java @@ -125,7 +125,6 @@ public abstract class AbstractDataSetAssignmentTestCase extends BaseTest */ protected abstract void reassignToSample(String dataSetCode, String samplePermIdOrNull, String userSessionToken); - /* @DataProvider public Object[][] rolesAllowedToAssignDataSetToExperiment() { @@ -150,7 +149,7 @@ public abstract class AbstractDataSetAssignmentTestCase extends BaseTest { return RolePermutator.getAcceptedPermutations(not(assignDataSetToSampleRule), source, destination, instance); } -*/ + @Test public void reassignTheTwoOriginalDataSetsOfPublishedDataSetsToDifferentOriginalSampleAndExperiment() { @@ -553,7 +552,7 @@ public abstract class AbstractDataSetAssignmentTestCase extends BaseTest { EntityGraphGenerator g = parseAndCreateGraph("E1, data sets: DS1[NECT] DS2\n" + "S2, data sets: DS5[NET]\n" - + "DS1[NECT], components: DS2\n"); + + "DS1[NECT], components: DS2\n", false); try { @@ -571,7 +570,7 @@ public abstract class AbstractDataSetAssignmentTestCase extends BaseTest @Rollback(true) public void dataSetCannotBeAssignedToSpaceSample() { - EntityGraphGenerator g = parseAndCreateGraph("E1, data sets: DS1\nS2\n"); + EntityGraphGenerator g = parseAndCreateGraph("E1, data sets: DS1\nS2\n", false); try { @@ -589,7 +588,7 @@ public abstract class AbstractDataSetAssignmentTestCase extends BaseTest @Rollback(true) public void dataSetCannotBeAssignedToSharedSample() { - EntityGraphGenerator g = parseAndCreateGraph("S1, data sets: DS1[NET]\n/S2\n"); + EntityGraphGenerator g = parseAndCreateGraph("S1, data sets: DS1[NET]\n/S2\n", false); try { @@ -808,6 +807,7 @@ public abstract class AbstractDataSetAssignmentTestCase extends BaseTest "not connected to any experiment and the data set type (" + dataset.getDataSetType().getCode() + ") doesn't match one of the following regular expressions: NO-EXP-.* , NE.* ."; + ex.printStackTrace(); assertEquals("The dataset '" + dataset.getCode() + "' cannot be connected to the sample '" + sample.getIdentifier() + "' because the new sample is " + postfix, getErrorMessage(ex)); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractEntityDeletionTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractEntityDeletionTestCase.java index 1979ed90fd70018d4df47226662fb3a75f4a2654..f97bda93c2fb17fd9251d5ff90260f56c03d5180 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractEntityDeletionTestCase.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractEntityDeletionTestCase.java @@ -118,7 +118,7 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest public final void testTrashExperimentWithSampleAndDataSet() { EntityGraphGenerator g = parseAndCreateGraph("E1, samples: S1, data sets: DS1\n" - + "S1, data sets: DS1\n"); + + "S1, data sets: DS1\n", false); deleteExperiments(g.e(1)); @@ -170,7 +170,7 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest EntityGraphGenerator g = parseAndCreateGraph("E1, samples: S1, data sets: DS1\n" + "E2, data sets: DS2\n" + "S1, data sets: DS1\n" - + "DS1, components: DS2\n"); + + "DS1, components: DS2\n", false); failTrashExperiment(g.e(2), createExpectedErrorMessage(g.ds(2), g.ds(1), g.s(1))); @@ -229,8 +229,7 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest + "E2, data sets: DS1\n" + "S1, data sets: DS2 DS3\n" + "DS1, components: DS2\n" - + "DS2, components: DS3\n" - ); + + "DS2, components: DS3\n", false); failTrashExperiment(g.e(1), createExpectedErrorMessage(g.ds(2), g.ds(1), g.e(2))); @@ -409,7 +408,7 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest EntityGraphGenerator g = parseAndCreateGraph("S1, components: S2\n" + "S2, data sets: DS2[NET]\n" + "S3, data sets: DS1[NECT]\n" - + "DS1[NECT], components: DS2[NET]\n"); + + "DS1[NECT], components: DS2[NET]\n", false); failTrashSample(g.s(1), createExpectedErrorMessage(g.ds(2), g.ds(1), g.s(3))); @@ -427,7 +426,7 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest EntityGraphGenerator g = parseAndCreateGraph("E1, data sets: DS1\n" + "S1, components: S2\n" + "S2, data sets: DS2[NET]\n" - + "DS1, components: DS2[NET]\n"); + + "DS1, components: DS2[NET]\n", false); failTrashSample(g.s(1), createExpectedErrorMessage(g.ds(2), g.ds(1), g.e(1))); @@ -446,7 +445,7 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest + "S2, data sets: DS2[NECT]\n" + "DS1[NECT], components: DS3[NET] DS4[NECT] DS5[NET]\n" + "DS2[NECT], components: DS4[NECT]\n" - + "DS4[NECT], components: DS5[NET] DS6[NET]\n"); + + "DS4[NECT], components: DS5[NET] DS6[NET]\n", false); failTrashSample(g.s(1), createExpectedErrorMessage(g.ds(4), g.ds(2), g.s(2))); @@ -462,7 +461,7 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest @Rollback(true) public void testTrashSampleWithComponentsFromAnInvisibleSpace() { - EntityGraphGenerator g = parseAndCreateGraph("/S1/S1, components: /S2/S2\n"); + EntityGraphGenerator g = parseAndCreateGraph("/S1/S1, components: /S2/S2\n", false); SessionBuilder sessionBuilder = aSession().withSpaceRole(RoleWithHierarchy.SPACE_ADMIN, entityGraphManager.getSample(g.s(1)).getSpace()); String userSessionToken = create(sessionBuilder); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/BaseTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/BaseTest.java index 182a8da1e9b8f2e7ebde27be7073807137d3255d..60d27e7006a0b05eb0874be8a3ad3f9baaebce46 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/BaseTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/BaseTest.java @@ -507,8 +507,18 @@ public abstract class BaseTest extends AbstractTransactionalTestNGSpringContextT } protected EntityGraphGenerator parseAndCreateGraph(String graphDefinition) + { + return parseAndCreateGraph(graphDefinition, true); + } + + protected EntityGraphGenerator parseAndCreateGraph(String graphDefinition, boolean startNewTransaction) { EntityGraphGenerator graphGenerator = entityGraphManager.parseAndCreateGraph(graphDefinition); + if (startNewTransaction) + { + TestTransaction.end(); + TestTransaction.start(); + } return graphGenerator; } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/entitygraph/EntityGraphManager.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/entitygraph/EntityGraphManager.java index 02bca8996c45fd531b2d783a2d818ed2d9b66608..aa784dd92f0445c8f248f0ca99706b88cd8f2f14 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/entitygraph/EntityGraphManager.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/entitygraph/EntityGraphManager.java @@ -1031,10 +1031,9 @@ public class EntityGraphManager { assertEquals(node.getCode() + " has unexpectedly still the old modifier: " + current.modifier, false, current.modifier.equals(previous.modifier)); - // Modification timestamp is for the whole transaction the same -// assertEquals(node.getCode() + " has unexpectedly still the old modification date: " -// + current.modificationDate + " > " + previous.modificationDate, -// true, current.modificationDate.getTime() > previous.modificationDate.getTime()); + assertEquals(node.getCode() + " has unexpectedly still the old modification date: " + + current.modificationDate + " > " + previous.modificationDate, + true, current.modificationDate.getTime() > previous.modificationDate.getTime()); } else { assertEquals(node.getCode() + " has unexpectedly a new modifier: ",