diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchMaterialTypeTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchMaterialTypeTest.java index 2da05866204ab42389ba266ef56e8db4164e6f3a..32da83b0c1a7c3227362c06150c066aa5e6e988d 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchMaterialTypeTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchMaterialTypeTest.java @@ -37,12 +37,12 @@ import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.sort.CodeComparator; public class SearchMaterialTypeTest extends AbstractTest { @Test - public void testSearchAllWithVocabularies() + public void testSearchAll() { String sessionToken = v3api.login(TEST_USER, PASSWORD); EntityTypeSearchCriteria searchCriteria = new EntityTypeSearchCriteria(); MaterialTypeFetchOptions fetchOptions = new MaterialTypeFetchOptions(); - fetchOptions.withPropertyAssignments().withVocabulary(); + fetchOptions.withPropertyAssignments(); SearchResult<MaterialType> searchResult = v3api.searchMaterialTypes(sessionToken, searchCriteria, fetchOptions); List<MaterialType> types = searchResult.getObjects(); @@ -51,33 +51,33 @@ public class SearchMaterialTypeTest extends AbstractTest assertEquals(codes.toString(), "[BACTERIUM, CELL_LINE, COMPOUND, CONTROL, DELETION_TEST, GENE, OTHER_REF, SELF_REF, SIRNA, SLOW_GENE, VIRUS]"); assertEquals(types.get(0).getFetchOptions().hasPropertyAssignments(), true); - - List<String> vocabularyCodes = new ArrayList<String>(); - for (MaterialType type : types) - { - vocabularyCodes.addAll(extractVocabularyCodes(type.getPropertyAssignments())); - } - Collections.sort(vocabularyCodes); - assertEquals(vocabularyCodes.toString(), "[ORGANISM, ORGANISM]"); - v3api.logout(sessionToken); } @Test - public void testSearchExactCode() + public void testSearchExactCodeWithVocabularies() { String sessionToken = v3api.login(TEST_USER, PASSWORD); EntityTypeSearchCriteria searchCriteria = new EntityTypeSearchCriteria(); - searchCriteria.withCode().thatEquals("SIRNA"); + searchCriteria.withCode().thatEquals("BACTERIUM"); MaterialTypeFetchOptions fetchOptions = new MaterialTypeFetchOptions(); - fetchOptions.withPropertyAssignments(); + fetchOptions.withPropertyAssignments().withVocabulary(); SearchResult<MaterialType> searchResult = v3api.searchMaterialTypes(sessionToken, searchCriteria, fetchOptions); List<MaterialType> types = searchResult.getObjects(); List<String> codes = extractCodes(types); Collections.sort(codes); - assertEquals(codes.toString(), "[SIRNA]"); + assertEquals(codes.toString(), "[BACTERIUM]"); assertEquals(types.get(0).getFetchOptions().hasPropertyAssignments(), true); + + List<String> vocabularyCodes = new ArrayList<String>(); + for (MaterialType type : types) + { + vocabularyCodes.add(type.getCode() + ":" + extractVocabularyCodes(type.getPropertyAssignments())); + } + Collections.sort(vocabularyCodes); + assertEquals(vocabularyCodes.toString(), "[BACTERIUM:[ORGANISM]]"); + v3api.logout(sessionToken); }