Skip to content
Snippets Groups Projects
Commit 6bfb3c73 authored by pkupczyk's avatar pkupczyk
Browse files

SSDM-689 : Add Javascript facade method for API extension for BLAST searchs

SVN: 32156
parent 26855d33
No related branches found
No related tags found
No related merge requests found
/*
* 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.dss.generic.server.api.v2.sequencedatabases;
import java.io.File;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import com.fasterxml.jackson.databind.ObjectMapper;
import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel;
import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SequenceSearchResult;
/**
* A test database that returns a search result that was stored in the parameters map under a key equal to the searched sequence snippet.
*
* @author pkupczyk
*/
public class EchoDatabase extends AbstractSequenceDatabase
{
public EchoDatabase(Properties properties, File storeRoot)
{
super(properties, storeRoot);
}
@Override
public boolean isAvailable()
{
return true;
}
@Override
public List<SequenceSearchResult> search(String sequenceSnippet, Map<String, String> optionalParametersOrNull)
{
String resultStr = optionalParametersOrNull.get(sequenceSnippet);
if (resultStr != null)
{
try
{
ObjectMapper mapper = new ObjectMapper();
SequenceSearchResult result = mapper.readValue(resultStr, SequenceSearchResult.class);
return Collections.singletonList(result);
} catch (Exception e)
{
throw CheckedExceptionTunnel.wrapIfNecessary(e);
}
} else
{
return Collections.emptyList();
}
}
}
......@@ -56,7 +56,7 @@ test {
useTestNG()
options.suites('source/java/tests.xml')
jvmArgs '-Xmx2048m', '-XX:MaxPermSize=256m', '-Duser.timezone=Europe/Zurich'
jvmArgs '-Xmx2048m', '-XX:MaxPermSize=256m', '-Duser.timezone=Europe/Zurich', '-Xdebug', '-Xrunjdwp:transport=dt_socket,address=20010,server=y,suspend=n'
testLogging.showStandardStreams = true
ignoreFailures = true
......
sequence-databases = echo-database
echo-database.label = Echo database
echo-database.class = ch.systemsx.cisd.openbis.dss.generic.server.api.v2.sequencedatabases.EchoDatabase
......@@ -97,7 +97,7 @@ public class JsTestCommonSelenium extends SeleniumTest
runTests("runOpenbisScreeningJsTests", new OpenbisScreeningJsWebappLocation());
}
private void runTests(String method, Location<OpenbisJsCommonWebapp> location)
protected void runTests(String method, Location<OpenbisJsCommonWebapp> location)
{
try
{
......
/*
* 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.jstest.suite.dev;
import ch.systemsx.cisd.openbis.jstest.page.OpenbisJsCommonWebapp;
import ch.systemsx.cisd.openbis.jstest.suite.common.JsTestCommonSelenium;
import ch.systemsx.cisd.openbis.uitest.layout.Location;
/**
* @author pkupczyk
*/
public class JsTestDevSelenium extends JsTestCommonSelenium
{
@Override
protected void runTests(String method, Location<OpenbisJsCommonWebapp> location)
{
try
{
Thread.sleep(1000 * 60 * 60 * 24);
} catch (Exception e)
{
new RuntimeException(e);
}
}
}
<suite name="All" verbose="2" >
<test name="Main" annotations="JDK">
<classes>
<class name="ch.systemsx.cisd.openbis.jstest.suite.dev.JsTestDevSelenium" />
</classes>
</test>
</suite>
......@@ -860,6 +860,21 @@ openbis.prototype.searchForDataSetsOnBehalfOfUser = function(searchCriteria, use
});
}
/**
* @see IGeneralInformationService.searchForDataSetsWithSequences(String, String, String, Map<String, String>)
* @method
*/
openbis.prototype.searchForDataSetsWithSequences = function(preferredSequenceDatabaseOrNull, sequenceSnippet, optionalParametersOrNull, action) {
this._internal.ajaxRequest({
url: this._internal.generalInfoServiceUrl,
data: { "method" : "searchForDataSetsWithSequences",
"params" : [ this.getSession(),
preferredSequenceDatabaseOrNull,
sequenceSnippet, optionalParametersOrNull ] },
success: action
});
}
/**
* @see IGeneralInformationService.filterDataSetsVisibleToUser(String, List<DataSet>, String)
* @method
......
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