diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java index 716dc908a496f472a63f3439276430005f398a4f..743befe3899775a2d2ea1063c23ceec7fa2dfbb1 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java @@ -29,6 +29,7 @@ import java.util.Set; import org.apache.commons.lang.builder.EqualsBuilder; import org.hamcrest.core.IsEqual; +import org.hibernate.SessionFactory; import org.jmock.Expectations; import org.springframework.dao.DataIntegrityViolationException; import org.testng.annotations.BeforeMethod; @@ -160,6 +161,10 @@ public final class CommonServerTest extends AbstractServerTestCase private IDataStoreService dataStoreService; + private SessionFactory hibernateSessionFactory; + + private org.hibernate.Session hibernateSession; + private final CommonServer createServer() { CommonServer server = @@ -208,6 +213,8 @@ public final class CommonServerTest extends AbstractServerTestCase entityValidatorFactory = context.mock(IEntityValidatorFactory.class); entityValidatorHotDeployPlugin = context.mock(IEntityValidatorHotDeployPlugin.class); hotDeploymentController = context.mock(IHotDeploymentController.class); + hibernateSessionFactory = context.mock(SessionFactory.class); + hibernateSession = context.mock(org.hibernate.Session.class); } @Test @@ -243,7 +250,8 @@ public final class CommonServerTest extends AbstractServerTestCase assertEquals( "# Besides the full identifier of format '/SPACE_CODE/PROJECT_CODE/EXPERIMENT_CODE', two short formats 'EXPERIMENT_CODE' and 'PROJECT_CODE/EXPERIMENT_CODE' are accepted given that the default project (former short format) or default space (latter short format) are configured. If the proper default value is not configured when using a short format, experiment import will fail.\nidentifier\tNON-MANAGED-PROP\tMANAGED-PROP-NO-SUBCOLUMNS\t" - + "MANAGED-PROP-SUBCOLUMNS:A\tMANAGED-PROP-SUBCOLUMNS:B", template); + + "MANAGED-PROP-SUBCOLUMNS:A\tMANAGED-PROP-SUBCOLUMNS:B", + template); context.assertIsSatisfied(); } @@ -1194,7 +1202,7 @@ public final class CommonServerTest extends AbstractServerTestCase List<Script> scripts = createServer(entityValidatorFactory, dynamicPropertyCalculatorFactory, managedPropertyEvaluatorFactory).listScripts(SESSION_TOKEN, - ScriptType.ENTITY_VALIDATION, EntityKind.SAMPLE); + ScriptType.ENTITY_VALIDATION, EntityKind.SAMPLE); assertEquals("s2", scripts.get(0).getName()); assertEquals(ScriptType.ENTITY_VALIDATION, scripts.get(0).getScriptType()); @@ -1247,7 +1255,7 @@ public final class CommonServerTest extends AbstractServerTestCase createServer(entityValidatorFactory, dynamicPropertyCalculatorFactory, managedPropertyEvaluatorFactory).deleteScripts(SESSION_TOKEN, - Arrays.asList(id1, id2)); + Arrays.asList(id1, id2)); context.assertIsSatisfied(); } @@ -1895,6 +1903,7 @@ public final class CommonServerTest extends AbstractServerTestCase public void testSaveDisplaySettings() { final PersonPE person = new PersonPE(); + person.setId(123L); EntityVisit v0 = visit(EntityKind.MATERIAL, 0); EntityVisit v1 = visit(EntityKind.SAMPLE, 2); DisplaySettings currentDisplaySettings = displaySettingsWithVisits(v0, v1); @@ -1902,6 +1911,15 @@ public final class CommonServerTest extends AbstractServerTestCase context.checking(new Expectations() { { + one(daoFactory).getSessionFactory(); + will(returnValue(hibernateSessionFactory)); + + one(hibernateSessionFactory).getCurrentSession(); + will(returnValue(hibernateSession)); + + one(hibernateSession).get(PersonPE.class, person.getId()); + will(returnValue(person)); + allowing(sessionManager).getSession(SESSION_TOKEN); Session mySession = createSession(CommonTestUtils.USER_ID); mySession.setPerson(person); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServerTest.java index ca756e158fbaae50089a554ba97161282af0ce69..757384decc6524ff16c9ad94a401c3e9af253024 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServerTest.java @@ -1386,6 +1386,7 @@ public class ServiceForDataStoreServerTest extends SystemTestCase SampleUpdatesDTO updates = new SampleUpdatesDTO(new TechId(sampleId), null, null, null, null, 0, SampleIdentifierFactory.parse(sampleIdentifier), null, null); updates.setProperties(Arrays.asList(createEntityProperty(propertyCode, propertyValue))); + updates.setUpdateExperimentLink(false); return updates; } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerDatabaseTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerDatabaseTest.java index ba605f30ba921390963710dbe76de39032fa7852..6e09172c5f8f312aa0048d65f3942db92b8daf6b 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerDatabaseTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerDatabaseTest.java @@ -740,6 +740,7 @@ public class GenericServerDatabaseTest extends AbstractDAOTest new SampleUpdatesDTO(new TechId(sampleId), null, null, null, Collections.emptyList(), 0, SampleIdentifierFactory.parse(sampleIdentifier), null, null); updates.setProperties(Arrays.asList(createEntityProperty(propertyCode, propertyValue))); + updates.setUpdateExperimentLink(false); return updates; } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/CommonServerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/CommonServerTest.java index c23cfe2347332ff72a1ea1bb45b0523db84be016..7b5e16a3bf7a6c2ee36417a3130cebe08c90b73c 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/CommonServerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/CommonServerTest.java @@ -1735,6 +1735,7 @@ public class CommonServerTest extends SystemTestCase SampleUpdatesDTO updates = new SampleUpdatesDTO(new TechId(1055L), Arrays.asList(new IEntityProperty[] { property }), null, null, new ArrayList<NewAttachment>(), 0, null, null, null); // /TEST-SPACE/EV-TEST + updates.setUpdateExperimentLink(false); if (user.isInstanceUserOrTestSpaceUserOrEnabledTestProjectUser()) {