Skip to content
Snippets Groups Projects
Commit 8d89108f authored by jakubs's avatar jakubs
Browse files

SP-389 BIS-190 simple metaproject dropbox api dropbox test

SVN: 27555
parent b8f1d799
No related branches found
No related tags found
No related merge requests found
SPACE_CODE = "META"
PROJECT_ID = "/META/META"
EXPERIMENT_ID = "/META/META/META"
def create_project_and_experiment(transaction):
space = transaction.createNewSpace(SPACE_CODE, None)
space.setDescription("A demo space")
project = transaction.createNewProject(PROJECT_ID)
project.setDescription("A demo project")
exp = transaction.createNewExperiment(EXPERIMENT_ID, 'SIRNA_HCS')
exp.setPropertyValue("DESCRIPTION", "A sample experiment")
return exp
def process(transaction):
create_project_and_experiment(transaction)
existing_metaproject = transaction.getMetaproject("TEST_METAPROJECTS", "test")
copy_metaproject = transaction.createNewMetaproject("COPY_TEST_METAPROJCTS", existing_metaproject.getDescription(), "test")
print existing_metaproject.getDescription()
# existing_attached_sample = transaction.getSample("TEST-SPACE/EV-TEST")
new_metaproject = transaction.createNewMetaproject("TEST_META", "description", "test")
sample = transaction.createNewSample("/META/METASAMPLE", "NORMAL")
new_metaproject.addEntity(sample)
incoming-dir = ${root-dir}/incoming-metaproject-api-test
incoming-dir-create = true
incoming-data-completeness-condition = auto-detection
top-level-data-set-handler = ch.systemsx.cisd.etlserver.registrator.api.v2.JythonTopLevelDataSetHandlerV2
script-path = metaproject-api.py
storage-processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
/*
* Copyright 2012 ETH Zuerich, CISD
*
* 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.datastoreserver.systemtests;
import java.io.File;
import java.io.IOException;
import org.testng.annotations.Test;
import ch.systemsx.cisd.common.filesystem.FileUtilities;
import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService;
import ch.systemsx.cisd.openbis.dss.generic.shared.ServiceProvider;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Metaproject;
/**
* @author Jakub Straszewski
*/
public class MetaprojectDropboxApiSystemTest extends SystemTestCase
{
// for jython script locate
// metaproject-api-data-set-handler.py
@Override
protected File getIncomingDirectory()
{
return new File(rootDir, "incoming-metaproject-api-test");
}
@Test
public void testCreateMetaproject() throws Exception
{
IEncapsulatedOpenBISService openBISService = ServiceProvider.getOpenBISService();
runDropbox();
assertMetaprojectCreated(openBISService);
}
private void assertMetaprojectCreated(IEncapsulatedOpenBISService openBISService)
{
Metaproject oldProject = openBISService.tryGetMetaproject("TEST_METAPROJECTS", "test");
Metaproject newProject = openBISService.tryGetMetaproject("COPY_TEST_METAPROJCTS", "test");
assertEquals(oldProject.getDescription(), newProject.getDescription());
}
private void runDropbox() throws IOException, Exception
{
File exampleDataSet = new File(workingDirectory, "my-data");
createExampleDataSet(exampleDataSet);
moveFileToIncoming(exampleDataSet);
waitUntilDataSetImported();
}
private void createExampleDataSet(File exampleDataSet)
{
exampleDataSet.mkdirs();
FileUtilities.writeToFile(new File(exampleDataSet, "file.txt"), "hello world");
}
}
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