Skip to content
Snippets Groups Projects
Commit 17d1f420 authored by felmer's avatar felmer
Browse files

SP-753, BIS-480: Bug fixed in MaterialBO, system test added to CommonServerTest.

SVN: 29526
parent 30985c23
No related branches found
No related tags found
No related merge requests found
...@@ -90,6 +90,7 @@ public final class MaterialBO extends AbstractMaterialBusinessObject implements ...@@ -90,6 +90,7 @@ public final class MaterialBO extends AbstractMaterialBusinessObject implements
{ {
material = getMaterialById(materialId); material = getMaterialById(materialId);
dataChanged = false; dataChanged = false;
HibernateUtils.initialize(material.getMaterialType().getMaterialTypePropertyTypes());
} }
@Override @Override
......
...@@ -33,9 +33,11 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Attachment; ...@@ -33,9 +33,11 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Attachment;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AuthorizationGroup; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AuthorizationGroup;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ContainerDataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ContainerDataSet;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityTypePropertyType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityTypePropertyType;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAuthorizationGroup; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAuthorizationGroup;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample;
...@@ -158,6 +160,23 @@ public class CommonServerTest extends SystemTestCase ...@@ -158,6 +160,23 @@ public class CommonServerTest extends SystemTestCase
assertEquals("/CISD/CP-TEST-1", dataSet.getSampleIdentifier()); assertEquals("/CISD/CP-TEST-1", dataSet.getSampleIdentifier());
} }
@Test
public void testGetMaterialInfo()
{
Material materialInfo = commonServer.getMaterialInfo(systemSessionToken, new TechId(1));
assertEquals("AD3", materialInfo.getCode());
assertEquals(EntityKind.MATERIAL, materialInfo.getEntityKind());
EntityType entityType = materialInfo.getEntityType();
assertEquals("VIRUS", entityType.getCode());
List<? extends EntityTypePropertyType<?>> assignedPropertyTypes = entityType.getAssignedPropertyTypes();
assertEquals("VIRUS", assignedPropertyTypes.get(0).getEntityType().getCode());
assertEquals("DESCRIPTION", assignedPropertyTypes.get(0).getPropertyType().getCode());
assertEquals("VARCHAR", assignedPropertyTypes.get(0).getPropertyType().getDataType().getCode().toString());
assertEquals(1, assignedPropertyTypes.size());
assertEquals("[DESCRIPTION: Adenovirus 3]", materialInfo.getProperties().toString());
}
private void assertAssignedPropertyTypes(String expected, EntityType entityType) private void assertAssignedPropertyTypes(String expected, EntityType entityType)
{ {
List<? extends EntityTypePropertyType<?>> propTypes = entityType.getAssignedPropertyTypes(); List<? extends EntityTypePropertyType<?>> propTypes = entityType.getAssignedPropertyTypes();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment