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

SSDM-2718: system tests for the new type of service

SVN: 35365
parent 779d4ac2
No related branches found
No related tags found
No related merge requests found
enabled-modules = test-.*
class = ch.ethz.sis.openbis.generic.server.api.v3.helper.service.JythonBasedServiceExecutor
script-path = script.py
from ch.ethz.sis.openbis.generic.as.api.v3.dto.space.fetchoptions import SpaceFetchOptions
from ch.ethz.sis.openbis.generic.as.api.v3.dto.space.search import SpaceSearchCriteria
def process(parameters):
name = parameters.get("name");
searchCriteria = SpaceSearchCriteria();
searchCriteria.withCode().thatEquals("CISD");
result = applicationService.searchSpaces(sessionToken, searchCriteria, SpaceFetchOptions());
return "hello %s. Services: %s" % (name, result.objects)
/*
* Copyright 2015 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.ethz.sis.openbis.systemtest.api.v3;
import static org.testng.Assert.assertEquals;
import java.io.Serializable;
import org.testng.annotations.Test;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.ExecutionOptions;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.ServiceCode;
/**
*
*
* @author Franz-Josef Elmer
*/
public class ExecuteServiceTest extends AbstractTest
{
@Test
public void testSearchServices()
{
String sessionToken = v3api.login(TEST_USER, PASSWORD);
ExecutionOptions options = new ExecutionOptions();
options.withParameter("name", Math.PI);
Serializable result = v3api.executeService(sessionToken, new ServiceCode("simple-service"), options);
assertEquals(result, "hello 3.14159265359. Services: [Space CISD]");
}
}
/*
* Copyright 2015 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.ethz.sis.openbis.systemtest.api.v3;
import static org.testng.Assert.assertEquals;
import org.testng.annotations.Test;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.common.search.SearchResult;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions.ServiceFetchOptions;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.search.ServiceSearchCriteria;
/**
*
*
* @author Franz-Josef Elmer
*/
public class SearchServiceTest extends AbstractTest
{
@Test
public void testSearchServices()
{
String sessionToken = v3api.login(TEST_USER, PASSWORD);
SearchResult<Service> result = v3api.searchServices(sessionToken, new ServiceSearchCriteria(), new ServiceFetchOptions());
assertEquals(result.getTotalCount(), 1);
}
}
......@@ -64,6 +64,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy.RoleC
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRowWithObject;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.builders.PropertyBuilder;
import ch.systemsx.cisd.openbis.generic.shared.coreplugin.CorePluginsUtils;
import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SpaceIdentifier;
import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientService;
import ch.systemsx.cisd.openbis.plugin.generic.shared.IGenericServer;
......@@ -79,6 +80,8 @@ import ch.systemsx.cisd.openbis.plugin.generic.shared.IGenericServer;
@TransactionConfiguration(transactionManager = "transaction-manager")
public abstract class SystemTestCase extends AbstractTransactionalTestNGSpringContextTests
{
private static final String SOURCE_TEST_CORE_PLUGINS = "sourceTest/core-plugins";
protected static final String SESSION_KEY = "session-key";
protected ICommonServerForInternalUse commonServer;
......@@ -98,6 +101,7 @@ public abstract class SystemTestCase extends AbstractTransactionalTestNGSpringCo
@BeforeSuite
public void beforeSuite()
{
System.setProperty(CorePluginsUtils.CORE_PLUGINS_FOLDER_KEY, SOURCE_TEST_CORE_PLUGINS);
TestInitializer.init();
}
......
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