diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateVocabularyTermTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateVocabularyTermTest.java index 243f8b3ee51e457696f4122befbd3925d2706903..9f367b3ebe7d112280057a3b37b275dd9359b619 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateVocabularyTermTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateVocabularyTermTest.java @@ -38,6 +38,7 @@ import ch.systemsx.cisd.common.test.AssertionUtil; /** * @author pkupczyk */ +@Test(groups = { "before remote api" }) public class CreateVocabularyTermTest extends AbstractTest { @@ -251,14 +252,13 @@ public class CreateVocabularyTermTest extends AbstractTest creation2.setCode("NEW2"); creation2.setPreviousTermId(new VocabularyTermPermId("NEW1", "ORGANISM")); - List<String> terms = extractCodes(listTerms(creation1.getVocabularyId())); + List<VocabularyTerm> termsBefore = listTerms(creation1.getVocabularyId()); + assertTerms(termsBefore, "RAT", "DOG", "HUMAN", "GORILLA", "FLY"); createTerms(TEST_USER, PASSWORD, creation1, creation2); List<VocabularyTerm> termsAfter = listTerms(creation1.getVocabularyId()); - terms.add(terms.indexOf("HUMAN") + 1, creation1.getCode()); - terms.add(terms.indexOf("NEW1") + 1, creation2.getCode()); - assertTerms(termsAfter, terms); + assertTerms(termsAfter, "RAT", "DOG", "HUMAN", "NEW1", "NEW2", "GORILLA", "FLY"); } @Test @@ -281,16 +281,13 @@ public class CreateVocabularyTermTest extends AbstractTest creation4.setCode("NEW4"); creation4.setPreviousTermId(null); - List<String> terms = extractCodes(listTerms(creation1.getVocabularyId())); + List<VocabularyTerm> termsBefore = listTerms(creation1.getVocabularyId()); + assertTerms(termsBefore, "RAT", "DOG", "HUMAN", "GORILLA", "FLY"); createTerms(TEST_USER, PASSWORD, creation1, creation2, creation3, creation4); List<VocabularyTerm> termsAfter = listTerms(creation1.getVocabularyId()); - terms.add(terms.indexOf("HUMAN") + 1, creation1.getCode()); - terms.add(terms.indexOf("GORILLA") + 1, creation2.getCode()); - terms.add(terms.indexOf("NEW2") + 1, creation3.getCode()); - terms.add(creation4.getCode()); - assertTerms(termsAfter, terms); + assertTerms(termsAfter, "RAT", "DOG", "HUMAN", "NEW1", "GORILLA", "NEW2", "NEW3", "FLY", "NEW4"); } private VocabularyTermCreation termCreation() @@ -370,26 +367,26 @@ public class CreateVocabularyTermTest extends AbstractTest private void createWithPreviousTermNull(VocabularyTermCreation creation) { - List<String> terms = extractCodes(listTerms(creation.getVocabularyId())); + List<VocabularyTerm> termsBefore = listTerms(creation.getVocabularyId()); + assertTerms(termsBefore, "RAT", "DOG", "HUMAN", "GORILLA", "FLY"); creation.setPreviousTermId(null); createTerms(TEST_USER, PASSWORD, creation); List<VocabularyTerm> termsAfter = listTerms(creation.getVocabularyId()); - terms.add(creation.getCode()); - assertTerms(termsAfter, terms); + assertTerms(termsAfter, "RAT", "DOG", "HUMAN", "GORILLA", "FLY", creation.getCode()); } private void createWithPreviousTermNotNull(VocabularyTermCreation creation) { - List<String> terms = extractCodes(listTerms(creation.getVocabularyId())); + List<VocabularyTerm> termsBefore = listTerms(creation.getVocabularyId()); + assertTerms(termsBefore, "RAT", "DOG", "HUMAN", "GORILLA", "FLY"); creation.setPreviousTermId(new VocabularyTermPermId("HUMAN", "ORGANISM")); createTerms(TEST_USER, PASSWORD, creation); List<VocabularyTerm> termsAfter = listTerms(creation.getVocabularyId()); - terms.add(terms.indexOf("HUMAN") + 1, creation.getCode()); - assertTerms(termsAfter, terms); + assertTerms(termsAfter, "RAT", "DOG", "HUMAN", creation.getCode(), "GORILLA", "FLY"); } private List<VocabularyTerm> listTerms(IVocabularyId vocabularyId) @@ -409,21 +406,17 @@ public class CreateVocabularyTermTest extends AbstractTest return results.getObjects(); } - private void assertTerms(List<VocabularyTerm> actualTerms, List<String> expectedCodes) - { - List<String> actualCodes = extractCodes(actualTerms); - assertEquals(actualCodes, expectedCodes, - "Actual codes: " + actualCodes + ", Expected codes: " + expectedCodes); - } - - private List<String> extractCodes(List<VocabularyTerm> actualTerms) + private void assertTerms(List<VocabularyTerm> actualTerms, String... expectedCodes) { List<String> actualCodes = new ArrayList<String>(); + for (VocabularyTerm actualTerm : actualTerms) { actualCodes.add(actualTerm.getCode()); } - return actualCodes; + + assertEquals(actualCodes, Arrays.asList(expectedCodes), + "Actual codes: " + actualCodes + ", Expected codes: " + Arrays.asList(expectedCodes)); } } diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/DeleteVocabularyTermTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/DeleteVocabularyTermTest.java index 9e1de2ed6cabe646f0d7dcca219df0878e52492e..b0d9531fa6e11176fb554db9ebd854ac17240021 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/DeleteVocabularyTermTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/DeleteVocabularyTermTest.java @@ -54,6 +54,7 @@ import ch.systemsx.cisd.common.exceptions.UserFailureException; /** * @author pkupczyk */ +@Test(groups = { "before remote api" }) public class DeleteVocabularyTermTest extends AbstractDeletionTest { diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchVocabularyTermTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchVocabularyTermTest.java index e80cfac8652c2c8e8d64dab335d971ab4e099704..1720c0a316a4eeedc341de0f2e5c54ffcab19a2b 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchVocabularyTermTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchVocabularyTermTest.java @@ -31,6 +31,7 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.vocabulary.search.VocabularyTerm /** * @author pkupczyk */ +@Test(groups = { "before remote api" }) public class SearchVocabularyTermTest extends AbstractTest { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/DateBasedSearchesThroughJsonApiTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/DateBasedSearchesThroughJsonApiTest.java index 93a0a516bc8e0f9de71a9f364db4f157717cbf2e..9d083fc2e99e9e7cba978e5e05cee7914018570b 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/DateBasedSearchesThroughJsonApiTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/DateBasedSearchesThroughJsonApiTest.java @@ -39,8 +39,7 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchCl import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClauseTimeAttribute; import ch.systemsx.cisd.openbis.remoteapitest.RemoteApiTestCase; -@Test(groups = -{ "remote api" }) +@Test(groups = { "remote api" }, dependsOnGroups = { "before remote api" }) public class DateBasedSearchesThroughJsonApiTest extends RemoteApiTestCase { @@ -154,8 +153,7 @@ public class DateBasedSearchesThroughJsonApiTest extends RemoteApiTestCase SearchCriteria criteria = criteriaWith( registrationDate(moreThanOrEqual("2009-02-01", "+1")), - registrationDate(lessThanOrEqual("2009-03-01", "+1")) - ); + registrationDate(lessThanOrEqual("2009-03-01", "+1"))); List<DataSet> result = generalInformationService.searchForDataSets(sessionToken, criteria); @@ -180,8 +178,7 @@ public class DateBasedSearchesThroughJsonApiTest extends RemoteApiTestCase SearchCriteria criteria = criteriaWith( registrationDate(lessThanOrEqual("2010-01-01", "+1")), - modificationDate(equals("2011-05-09", "+1")) - ); + modificationDate(equals("2011-05-09", "+1"))); List<DataSet> result = generalInformationService.searchForDataSets(sessionToken, criteria); @@ -205,8 +202,7 @@ public class DateBasedSearchesThroughJsonApiTest extends RemoteApiTestCase SearchCriteria criteria = criteriaWith( registrationDate(moreThanOrEqual("2010-01-01", "+1")), - modificationDate(equals("2011-05-09", "+1")) - ); + modificationDate(equals("2011-05-09", "+1"))); List<DataSet> result = generalInformationService.searchForDataSets(sessionToken, criteria); @@ -538,9 +534,9 @@ public class DateBasedSearchesThroughJsonApiTest extends RemoteApiTestCase /* * for hamcrest 1.3 - * @Override public void describeMismatchSafely(Collection<T> actualItems, Description mismatchDescription) { - * mismatchDescription.appendText("These elements were missing: "); for (Identifier<T> identifier : this.identifiers) { if - * (!identifier.foundIn(actualItems)) { mismatchDescription.appendText(identifier.toString() + " "); } } } + * @Override public void describeMismatchSafely(Collection<T> actualItems, Description mismatchDescription) { mismatchDescription.appendText( + * "These elements were missing: "); for (Identifier<T> identifier : this.identifiers) { if (!identifier.foundIn(actualItems)) { + * mismatchDescription.appendText(identifier.toString() + " "); } } } */ } @@ -579,15 +575,16 @@ public class DateBasedSearchesThroughJsonApiTest extends RemoteApiTestCase /* * for hamcrest 1.3 - * @Override public void describeMismatchSafely(Collection<T> actualItems, Description mismatchDescription) { - * mismatchDescription.appendText("These unwanted elements were found: "); for (Identifier<T> identifier : this.identifiers) { if - * (identifier.foundIn(actualItems)) { mismatchDescription.appendText(identifier.toString() + " "); } } } + * @Override public void describeMismatchSafely(Collection<T> actualItems, Description mismatchDescription) { mismatchDescription.appendText( + * "These unwanted elements were found: "); for (Identifier<T> identifier : this.identifiers) { if (identifier.foundIn(actualItems)) { + * mismatchDescription.appendText(identifier.toString() + " "); } } } */ } // This list contains all the datasets that are found in the database. // When this test is able to create it's own test data, these can and should be removed. private static List<DataSetInfo> allDataSets; + { allDataSets = new ArrayList<DataSetInfo>(); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationChangingServiceJsonApiTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationChangingServiceJsonApiTest.java index 470594099bfc2e5acb316b2359241a9323d5ec7f..feb2f0ffdb3c2b515181be1927b346391704d422 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationChangingServiceJsonApiTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationChangingServiceJsonApiTest.java @@ -31,13 +31,12 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Vocabulary; import ch.systemsx.cisd.openbis.remoteapitest.RemoteApiTestCase; /** - * Verifies that an instance of {@link IGeneralInformationService} is published via JSON-RPC and - * that it is correctly functioning with external clients. + * Verifies that an instance of {@link IGeneralInformationService} is published via JSON-RPC and that it is correctly functioning with external + * clients. * * @author Kaloyan Enimanev */ -@Test(groups = - { "remote api" }) +@Test(groups = { "remote api" }, dependsOnGroups = { "before remote api" }) public class GeneralInformationChangingServiceJsonApiTest extends RemoteApiTestCase { protected IGeneralInformationService generalInfoService; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationServiceHttpInvokerApiTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationServiceHttpInvokerApiTest.java index ea32d369d89f399588a1af97e262e6470d970918..8c77ed30a0e99cbb4f864a471c4b600569706814 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationServiceHttpInvokerApiTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationServiceHttpInvokerApiTest.java @@ -42,13 +42,12 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary; import ch.systemsx.cisd.openbis.generic.shared.util.TestInstanceHostUtils; /** - * Verifies that an instance of {@link IGeneralInformationService} is published via - * {@link HttpInvokerServiceExporter} and that it is correctly functioning with external clients. + * Verifies that an instance of {@link IGeneralInformationService} is published via {@link HttpInvokerServiceExporter} and that it is correctly + * functioning with external clients. * * @author Kaloyan Enimanev */ -@Test(groups = - { "remote api" }) +@Test(groups = { "remote api" }, dependsOnGroups = { "before remote api" }) public class GeneralInformationServiceHttpInvokerApiTest extends GeneralInformationServiceJsonApiTest { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationServiceJsonApiTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationServiceJsonApiTest.java index 4dc836088401ec9abde09efda22f819acc04a4f5..8c04a62fa9fc7aa12937148e9992f254704cc738 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationServiceJsonApiTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationServiceJsonApiTest.java @@ -78,7 +78,7 @@ import ch.systemsx.cisd.openbis.remoteapitest.RemoteApiTestCase; * * @author Kaloyan Enimanev */ -@Test(groups = { "remote api" }) +@Test(groups = { "remote api" }, dependsOnGroups = { "before remote api" }) public class GeneralInformationServiceJsonApiTest extends RemoteApiTestCase { protected IGeneralInformationService generalInformationService; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/QueryApiServerJsonTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/QueryApiServerJsonTest.java index d70240c461b594737f81029d842dcca88906ed23..0db7ea6157f90dd0ae6a428e454234f8b899c926 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/QueryApiServerJsonTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/QueryApiServerJsonTest.java @@ -37,13 +37,11 @@ import ch.systemsx.cisd.openbis.plugin.query.shared.api.v1.dto.QueryTableModel; import ch.systemsx.cisd.openbis.remoteapitest.RemoteApiTestCase; /** - * Verifies that an instance of {@link IQueryApiServer} is published via JSON-RPC and that it is - * correctly functioning with external clients. + * Verifies that an instance of {@link IQueryApiServer} is published via JSON-RPC and that it is correctly functioning with external clients. * * @author Chandrasekhar Ramakrishnan */ -@Test(groups = - { "remote api" }) +@Test(groups = { "remote api" }, dependsOnGroups = { "before remote api" }) public class QueryApiServerJsonTest extends RemoteApiTestCase { private static final String SERVICE_URL = TestInstanceHostUtils.getOpenBISUrl() + "/openbis/"