Skip to content
Snippets Groups Projects
Commit 710f96df authored by felmer's avatar felmer
Browse files

SSDM-1858: Adapt to the style of EntityDeletionTest where error messages are...

SSDM-1858: Adapt to the style of EntityDeletionTest where error messages are created by methods which can be overwritten in order to handle the "Context" part of the message in case of V3 API.

SVN: 34067
parent 7918f1c2
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,8 @@ import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetUpdat ...@@ -26,6 +26,8 @@ import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetUpdat
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.DataSetPermId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.DataSetPermId;
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.ExperimentIdentifier; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.ExperimentIdentifier;
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.SamplePermId; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.SamplePermId;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AbstractExternalData;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample;
import ch.systemsx.cisd.openbis.systemtest.AbstractDataSetAssignmentTestCase; import ch.systemsx.cisd.openbis.systemtest.AbstractDataSetAssignmentTestCase;
/** /**
...@@ -36,6 +38,8 @@ import ch.systemsx.cisd.openbis.systemtest.AbstractDataSetAssignmentTestCase; ...@@ -36,6 +38,8 @@ import ch.systemsx.cisd.openbis.systemtest.AbstractDataSetAssignmentTestCase;
@Test(groups = { "system-cleandb" }) @Test(groups = { "system-cleandb" })
public class AssignDataSetToExperimentAndSampleTest extends AbstractDataSetAssignmentTestCase public class AssignDataSetToExperimentAndSampleTest extends AbstractDataSetAssignmentTestCase
{ {
private static final String CONTEXT_DESCRIPTION = " (Context: [])";
@Autowired @Autowired
protected IApplicationServerApi v3api; protected IApplicationServerApi v3api;
...@@ -63,4 +67,11 @@ public class AssignDataSetToExperimentAndSampleTest extends AbstractDataSetAssig ...@@ -63,4 +67,11 @@ public class AssignDataSetToExperimentAndSampleTest extends AbstractDataSetAssig
} }
v3api.updateDataSets(userSessionToken, Arrays.asList(dataSetUpdate)); v3api.updateDataSets(userSessionToken, Arrays.asList(dataSetUpdate));
} }
@Override
protected String createErrorMessage(AbstractExternalData dataset, Sample sample, String postfix)
{
return super.createErrorMessage(dataset, sample, postfix) + CONTEXT_DESCRIPTION;
}
} }
...@@ -27,7 +27,6 @@ import org.testng.annotations.Test; ...@@ -27,7 +27,6 @@ import org.testng.annotations.Test;
import ch.systemsx.cisd.common.exceptions.AuthorizationFailureException; import ch.systemsx.cisd.common.exceptions.AuthorizationFailureException;
import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.common.exceptions.UserFailureException;
import ch.systemsx.cisd.common.test.AssertionUtil;
import ch.systemsx.cisd.openbis.generic.server.business.bo.entitygraph.DataSetNode; import ch.systemsx.cisd.openbis.generic.server.business.bo.entitygraph.DataSetNode;
import ch.systemsx.cisd.openbis.generic.server.business.bo.entitygraph.EntityGraphGenerator; import ch.systemsx.cisd.openbis.generic.server.business.bo.entitygraph.EntityGraphGenerator;
import ch.systemsx.cisd.openbis.generic.server.business.bo.entitygraph.ExperimentNode; import ch.systemsx.cisd.openbis.generic.server.business.bo.entitygraph.ExperimentNode;
...@@ -812,9 +811,13 @@ public abstract class AbstractDataSetAssignmentTestCase extends BaseTest ...@@ -812,9 +811,13 @@ public abstract class AbstractDataSetAssignmentTestCase extends BaseTest
"not connected to any experiment and the data set type (" "not connected to any experiment and the data set type ("
+ dataset.getDataSetType().getCode() + dataset.getDataSetType().getCode()
+ ") doesn't match one of the following regular expressions: NO-EXP-.* , NE.* ."; + ") doesn't match one of the following regular expressions: NO-EXP-.* , NE.* .";
AssertionUtil.assertStarts("The dataset '" + dataset.getCode() assertEquals(createErrorMessage(dataset, sample, postfix), ex.getMessage());
+ "' cannot be connected to the sample '" + sample.getIdentifier() }
+ "' because the new sample is " + postfix, ex.getMessage());
protected String createErrorMessage(AbstractExternalData dataset, Sample sample, String postfix)
{
return "The dataset '" + dataset.getCode() + "' cannot be connected to the sample '"
+ sample.getIdentifier() + "' because the new sample is " + postfix;
} }
private void checkAssignmentToExperiment(RoleWithHierarchy sourceSpaceRole, private void checkAssignmentToExperiment(RoleWithHierarchy sourceSpaceRole,
......
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