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

SSDM-802: SimpleImageDrobboxTest fixed and refactored.

SVN: 32396
parent 21a6de70
No related branches found
No related tags found
No related merge requests found
...@@ -6,10 +6,10 @@ from ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto import Geometry ...@@ -6,10 +6,10 @@ from ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto import Geometry
SPACE_CODE = "TEST" SPACE_CODE = "TEST"
PROJECT_CODE = "TEST-PROJECT" PROJECT_CODE = "TEST-PROJECT"
PROJECT_ID = "/%(SPACE_CODE)s/%(PROJECT_CODE)s" % vars() PROJECT_ID = "/%(SPACE_CODE)s/%(PROJECT_CODE)s" % vars()
EXPERIMENT_CODE = "DEMO-EXP-HCS" EXPERIMENT_CODE = "SIMPLE_IMAGE_DROPBOX_TEST"
EXPERIMENT_ID = "/%(SPACE_CODE)s/%(PROJECT_CODE)s/%(EXPERIMENT_CODE)s" % vars() EXPERIMENT_ID = "/%(SPACE_CODE)s/%(PROJECT_CODE)s/%(EXPERIMENT_CODE)s" % vars()
PLATE_CODE = "PLATE1" PLATE_CODE = "SIMPLE_IMAGE_DROPBOX_TEST"
PLATE_ID = "/%(SPACE_CODE)s/%(PLATE_CODE)s" % vars() PLATE_ID = "/%(SPACE_CODE)s/%(PLATE_CODE)s" % vars()
PLATE_GEOMETRY_PROPERTY_CODE = "$PLATE_GEOMETRY" PLATE_GEOMETRY_PROPERTY_CODE = "$PLATE_GEOMETRY"
PLATE_GEOMETRY = "384_WELLS_16X24" PLATE_GEOMETRY = "384_WELLS_16X24"
......
/*
* Copyright 2014 ETH Zuerich, SIS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.systemsx.cisd.openbis.screening.systemtests;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.testng.annotations.BeforeTest;
/**
*
* @author Franz-Josef Elmer
*/
public abstract class AbstractImageDropboxTestCase extends AbstractScreeningSystemTestCase
{
@BeforeTest
public void dropAnExampleDataSet() throws Exception
{
File exampleDataSet = createTestDataContents();
moveFileToIncoming(exampleDataSet);
waitUntilDataSetImported(FINISHED_POST_REGISTRATION_CONDITION);
}
private File createTestDataContents() throws IOException
{
File destination = new File(workingDirectory, "test-data");
destination.mkdirs();
FileUtils.copyDirectory(new File(getTestDataFolder(), getDataFolderToDrop()), destination);
return destination;
}
protected abstract String getDataFolderToDrop();
protected String getTestDataFolder()
{
return "../screening/resource/test-data/" + getClass().getSimpleName();
}
@Override
protected int dataSetImportWaitDurationInSeconds()
{
return 60;
}
}
...@@ -17,11 +17,8 @@ ...@@ -17,11 +17,8 @@
package ch.systemsx.cisd.openbis.screening.systemtests; package ch.systemsx.cisd.openbis.screening.systemtests;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.List; import java.util.List;
import org.apache.commons.io.FileUtils;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
...@@ -38,45 +35,24 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifi ...@@ -38,45 +35,24 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifi
* *
* @author Franz-Josef Elmer * @author Franz-Josef Elmer
*/ */
public class SimpleImageDropboxTest extends AbstractScreeningSystemTestCase public class SimpleImageDropboxTest extends AbstractImageDropboxTestCase
{ {
@BeforeTest
public void dropAnExampleDataSet() throws Exception
{
File exampleDataSet = createTestDataContents();
moveFileToIncoming(exampleDataSet);
waitUntilDataSetImported(FINISHED_POST_REGISTRATION_CONDITION);
}
private File createTestDataContents() throws IOException
{
File destination = new File(workingDirectory, "test-data");
destination.mkdirs();
FileUtils.copyDirectory(new File(getTestDataFolder(), "PLATE1"), destination);
return destination;
}
private String getTestDataFolder()
{
return "../screening/resource/test-data/" + getClass().getSimpleName();
}
@Override @Override
protected int dataSetImportWaitDurationInSeconds() protected String getDataFolderToDrop()
{ {
return 60; return "PLATE1";
} }
@Test @Test
public void test() throws Exception public void test() throws Exception
{ {
ExperimentIdentifier identifier = ExperimentIdentifierFactory.parse("/TEST/TEST-PROJECT/DEMO-EXP-HCS"); ExperimentIdentifier identifier = ExperimentIdentifierFactory.parse("/TEST/TEST-PROJECT/SIMPLE_IMAGE_DROPBOX_TEST");
Experiment experiment = commonServer.getExperimentInfo(sessionToken, identifier); Experiment experiment = commonServer.getExperimentInfo(sessionToken, identifier);
ListSampleCriteria sampleCriteria = ListSampleCriteria.createForExperiment(TechId.create(experiment)); ListSampleCriteria sampleCriteria = ListSampleCriteria.createForExperiment(TechId.create(experiment));
List<Sample> samples = commonServer.listSamples(sessionToken, sampleCriteria); List<Sample> samples = commonServer.listSamples(sessionToken, sampleCriteria);
Sample plate = samples.get(0); Sample plate = samples.get(0);
assertEquals("/TEST/PLATE1", plate.getIdentifier()); assertEquals("/TEST/SIMPLE_IMAGE_DROPBOX_TEST", plate.getIdentifier());
assertEquals(1, samples.size()); assertEquals(1, samples.size());
List<AbstractExternalData> dataSets2 List<AbstractExternalData> dataSets2
= commonServer.listRelatedDataSets(sessionToken, new DataSetRelatedEntities(samples), false); = commonServer.listRelatedDataSets(sessionToken, new DataSetRelatedEntities(samples), false);
......
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