Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Fixes some issues #199

Merged
merged 61 commits into from
Jan 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
bcd872a
Send token with upload request
bpross-52n Sep 1, 2015
c6b3ae9
Show upload buttons only for respective repositories
bpross-52n Sep 1, 2015
4089392
Enable adding/removing of loggers
bpross-52n Sep 2, 2015
b72a905
Added csrf token for sensible requests
bpross-52n Sep 2, 2015
9ed44cc
Merge branch 'wps-4.0' of https://github.com/52North/WPS into wps-4.0…
bpross-52n Sep 2, 2015
ece29b7
Use sync method
bpross-52n Sep 3, 2015
d8b6173
Enable process id editing via admin console
bpross-52n Sep 3, 2015
205f264
Deprecated constructor, class should be injected
bpross-52n Sep 3, 2015
2b9310d
Layouting, added license header
bpross-52n Sep 3, 2015
675589d
Enabled format editing for parsers
bpross-52n Sep 3, 2015
65e25eb
Removed unused file
bpross-52n Sep 3, 2015
ec275d0
Merge branch 'wps-4.0' of https://github.com/52North/WPS into wps-4.0…
bpross-52n Sep 4, 2015
b44c830
Merge branch 'wps-4.0' of https://github.com/52North/WPS into wps-4.0…
bpross-52n Sep 4, 2015
f3b70d9
Removed 52n security dependencies (now spring-security)
bpross-52n Sep 4, 2015
821d827
Changed color of links
bpross-52n Sep 4, 2015
e60faa2
Prevent JavaScript error when index page is requested
bpross-52n Sep 4, 2015
ef1996b
Fixed issue with property that was not replaced
bpross-52n Sep 4, 2015
8634503
Cleaned up
bpross-52n Sep 4, 2015
4399392
Fixed OMGenerator test
bpross-52n Sep 21, 2015
6bd802a
add little abstraction tier decoupling repository-manager from single…
ridoo Sep 22, 2015
c483578
Merge branch 'feature/making-repository-manager-ioc-managable' of htt…
ridoo Sep 22, 2015
c055234
remove not needed method
ridoo Sep 22, 2015
ebac48a
Merge branch 'origin_feature/making-repository-manager-ioc-managable'…
ridoo Sep 22, 2015
db04d7d
intialize repository manager
ridoo Sep 22, 2015
492e6d6
initiating WPS4R repository
ridoo Sep 22, 2015
342abd6
add missing title annotation
ridoo Sep 23, 2015
be63405
add scripts to register
ridoo Sep 23, 2015
bd7049b
add comment description why repository's COMPONENT_NAME actually is t…
ridoo Sep 23, 2015
7a81e49
fixes #197
ridoo Sep 23, 2015
2c4acc8
add SpringIntegrationHandler to wire non-ioc-managed dependencies wit…
ridoo Sep 24, 2015
5d141dc
increase readability
ridoo Sep 24, 2015
d253e2e
add SpringIntegrationHandler to wire non-ioc-managed dependencies wit…
ridoo Sep 24, 2015
cf8abf5
set verbose logging to trace
ridoo Sep 24, 2015
31da8bb
add parser/generator formats which can be handled by WPS4R
ridoo Sep 25, 2015
1a5c12a
Fixed issue with null as default value
bpross-52n Sep 28, 2015
403ff03
Merge branch 'wps-4.0' of https://github.com/52North/WPS into wps-4.0…
bpross-52n Sep 28, 2015
34302bf
Fixed if statement
bpross-52n Sep 28, 2015
03ee22d
Manually update license header
bpross-52n Sep 28, 2015
ce8bb70
update licenses
ridoo Sep 29, 2015
d654633
fix loading util resources form jar
ridoo Sep 29, 2015
8de1c00
add interface to add algorithms via RepositoryManager
ridoo Sep 29, 2015
aa613e2
cleanup spring config. share test profile across
ridoo Sep 29, 2015
b513a3f
let algoritms be added via RespositoryManager, fix some issues
ridoo Sep 30, 2015
2c67147
remove 'Local' from R-Repository
ridoo Sep 30, 2015
f91a8eb
tests weren't run actually, this fixes some of them, some have to be …
ridoo Oct 1, 2015
e7d685f
update header
ridoo Oct 1, 2015
b2bf87d
refine test configuration, do some fixes in R module
ridoo Oct 14, 2015
89fb83f
Merge branch 'setup/delete-bom-from-license-header' of https://github…
ridoo Oct 14, 2015
8def979
update license header
ridoo Oct 14, 2015
92425f3
Added csrf token for sensible requests
bpross-52n Sep 2, 2015
ffeda7d
Enable process id editing via admin console
bpross-52n Sep 3, 2015
8e0d963
Add token to requests
bpross-52n Sep 1, 2015
991f744
Merge branch 'wps-4.0-standard-2.0' of https://github.com/bpross-52n/…
ridoo Oct 14, 2015
ea34b24
allow also to remove algorithms via repositorymanager
ridoo Oct 14, 2015
604bf54
remove R algorithms
ridoo Oct 14, 2015
77a3113
fix controller tests
ridoo Oct 30, 2015
fa57a2a
update notice
ridoo Oct 30, 2015
3c7070d
renaming file ...Test -> ...IT
ridoo Nov 2, 2015
60344cf
fix injection during tests
ridoo Nov 2, 2015
7737356
fix inheritance setup
ridoo Nov 2, 2015
dfa27db
rename id
ridoo Nov 2, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ public static void tearDownClass() {

@Before
public void setUp() {
MockMvcBuilders.webAppContextSetup(this.wac).build();
WPSConfig.getInstance().setConfigurationManager(this.wac.getBean(ConfigurationManager.class));
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ public class ServiceLoaderAlgorithmRepository implements IAlgorithmRepository {
public ServiceLoaderAlgorithmRepository() {
this.currentAlgorithms = loadAlgorithms();
}

private Map<String, Class<? extends IAlgorithm>> loadAlgorithms() {
Map<String, Class<? extends IAlgorithm>> result = new HashMap<String, Class<? extends IAlgorithm>>();
ServiceLoader<IAlgorithm> loader = ServiceLoader.load(IAlgorithm.class);

for (IAlgorithm ia : loader) {
logger.debug("Adding algorithm with identifier {} and class {}",
ia.getWellKnownName(), ia.getClass().getCanonicalName());
result.put(ia.getWellKnownName(), ia.getClass());
}

return result;
}

@Override
public Collection<String> getAlgorithmNames() {
return this.currentAlgorithms.keySet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
Expand All @@ -37,9 +38,9 @@

/**
* A static repository to retrieve the available algorithms.
*
*
* @author foerster, Bastian Schaeffer, University of Muenster
*
*
*/
public class UploadedAlgorithmRepository implements
ITransactionalAlgorithmRepository {
Expand All @@ -52,13 +53,13 @@ public class UploadedAlgorithmRepository implements
public UploadedAlgorithmRepository() {
algorithmMap = new HashMap<String, String>();
processDescriptionMap = new HashMap<String, ProcessDescription>();

ConfigurationModule uploadedAlgorithmRepoConfigModule = WPSConfig.getInstance().getConfigurationModuleForClass(this.getClass().getName(), ConfigurationCategory.REPOSITORY);

// check if the repository is active
if(uploadedAlgorithmRepoConfigModule.isActive()){
List<AlgorithmEntry> algorithmEntries = uploadedAlgorithmRepoConfigModule.getAlgorithmEntries();
List<AlgorithmEntry> algorithmEntries = uploadedAlgorithmRepoConfigModule.getAlgorithmEntries();

for (AlgorithmEntry algorithmEntry : algorithmEntries) {
if(algorithmEntry.isActive()){
addAlgorithm(algorithmEntry.getAlgorithm());
Expand Down Expand Up @@ -111,7 +112,7 @@ public boolean containsAlgorithm(String className) {

private IAlgorithm loadAlgorithm(String algorithmClassName)
throws Exception {

Class<?> algorithmClass = new CustomClassLoader("/uploaded").loadClass(algorithmClassName);
IAlgorithm algorithm = null;
if (IAlgorithm.class.isAssignableFrom(algorithmClass)) {
Expand All @@ -126,10 +127,10 @@ private IAlgorithm loadAlgorithm(String algorithmClassName)
+ algorithmClassName
+ " does not implement IAlgorithm or have a Algorithm annotation.");
}


for (String supportedVersion : WPSConfig.SUPPORTED_VERSIONS) {

if(!algorithm.processDescriptionIsValid(supportedVersion)) {
LOGGER.warn("Algorithm description is not valid: " + algorithmClassName);//TODO add version to exception/log
throw new Exception("Could not load algorithm " +algorithmClassName +". ProcessDescription Not Valid.");
Expand All @@ -138,11 +139,19 @@ private IAlgorithm loadAlgorithm(String algorithmClassName)
return algorithm;
}

public boolean addAlgorithm(Object processID) {
if (!(processID instanceof String)) {
@Override
public boolean addAlgorithm(Object item) {
if ( !(item instanceof String || item instanceof Class<?>)) {
return false;
}
String algorithmClassName = (String) processID;
String algorithmClassName;
if (item instanceof String) {
algorithmClassName = (String) item;
} else {
// TODO to be tested as custom class loader is being used
// which scans in /uploaded folder only
algorithmClassName = ((Class<?>) item).getName();
}

algorithmMap.put(algorithmClassName, algorithmClassName);
LOGGER.info("Algorithm class registered: " + algorithmClassName);
Expand Down Expand Up @@ -173,5 +182,5 @@ public ProcessDescription getProcessDescription(String processID) {

@Override
public void shutdown() {}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@
* @author tkunicki
*/
public class AbstractSelfDescribingAlgorithmTest extends AbstractITClass {

public AbstractSelfDescribingAlgorithmTest() {
}

@Before
public void setUp() throws Exception {
MockMvcBuilders.webAppContextSetup(this.wac).build();
WPSConfig.getInstance().setConfigurationManager(this.wac.getBean(ConfigurationManager.class));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,26 @@

public class ExecuteRequestBuilderTest extends AbstractITClass{

private ProcessDescription processDescription;
private ProcessDescriptionType processDescriptionType;
private ProcessDescription processDescription;
private ProcessDescriptionType processDescriptionType;
private String inputID;
private String outputID;
private String url = "http://xyz.test.data";
private String complexDataString = "testString";

@Before
public void setUp(){
MockMvcBuilders.webAppContextSetup(this.wac).build();
WPSConfig.getInstance().setConfigurationManager(this.wac.getBean(ConfigurationManager.class));
processDescription = new MultiReferenceBinaryInputAlgorithm().getDescription();
processDescriptionType = ((ProcessDescriptionType)processDescription.getProcessDescriptionType(WPSConfig.VERSION_100));
processDescriptionType = ((ProcessDescriptionType)processDescription.getProcessDescriptionType(WPSConfig.VERSION_100));
inputID = processDescriptionType.getDataInputs().getInputArray(0).getIdentifier().getStringValue();
outputID = processDescriptionType.getProcessOutputs().getOutputArray(0).getIdentifier().getStringValue();
}

@Test
public void addComplexDataInputByReference() {

ExecuteRequestBuilder executeRequestBuilder = new ExecuteRequestBuilder(processDescriptionType);

addTestDataByReference(executeRequestBuilder);

ExecuteDocument request = executeRequestBuilder.getExecute();
Expand All @@ -90,151 +88,151 @@ public void addComplexDataInputByReference() {
Assert.assertThat("generated doc contains input url", request.toString(), containsString(url));
Assert.assertThat("document is valid", request.validate(), is(true));
}

@Test
public void addComplexDataInputString() {

ExecuteRequestBuilder executeRequestBuilder = new ExecuteRequestBuilder(processDescriptionType);

addTestDataString(executeRequestBuilder);

ExecuteDocument request = executeRequestBuilder.getExecute();

Assert.assertThat("generated doc contains input id", request.toString(), containsString(inputID));
Assert.assertThat("generated doc contains input string", request.toString(), containsString(complexDataString));
Assert.assertThat("document is valid", request.validate(), is(true));
}

@Test
public void setSupportedMimeTypeForOutput(){
ExecuteRequestBuilder executeRequestBuilder = new ExecuteRequestBuilder(processDescriptionType);

addTestDataByReference(executeRequestBuilder);

String mimeType = getMimeType(processDescriptionType, false);

executeRequestBuilder.setMimeTypeForOutput(mimeType, outputID);

ExecuteDocument request = executeRequestBuilder.getExecute();

checkOutputIdentifier(request.getExecute(), outputID);
checkOutputMimeType(request.getExecute(), mimeType);
Assert.assertThat("document is valid", request.validate(), is(true));

}

@Test
public void setDefaultMimeTypeForOutput(){
ExecuteRequestBuilder executeRequestBuilder = new ExecuteRequestBuilder(processDescriptionType);

addTestDataByReference(executeRequestBuilder);

String mimeType = getMimeType(processDescriptionType, true);

ExecuteDocument request = executeRequestBuilder.getExecute();

executeRequestBuilder.setMimeTypeForOutput(mimeType, outputID);

checkOutputIdentifier(request.getExecute(), outputID);
checkOutputMimeType(request.getExecute(), mimeType);
Assert.assertThat("document is valid", request.validate(), is(true));

}

private void addTestDataByReference(ExecuteRequestBuilder executeRequestBuilder){

InputType inputType = InputType.Factory.newInstance();

inputType.addNewIdentifier().setStringValue(inputID);
inputType.addNewReference().setHref(url);

executeRequestBuilder.addComplexData(inputType);

}

private void addTestDataString(ExecuteRequestBuilder executeRequestBuilder){

try {
executeRequestBuilder.addComplexData(inputID, complexDataString, "", "", "text/plain");
} catch (WPSClientException e) {
e.printStackTrace();
}

}

private String getMimeType(ProcessDescriptionType processDescriptionType, boolean isGetDefaultMimeType){

String result = "";

ProcessOutputs processOutputs = processDescriptionType.getProcessOutputs();

assertNotNull(processOutputs);

OutputDescriptionType outputDescriptionType = processOutputs.getOutputArray(0);

assertNotNull(outputDescriptionType);

SupportedComplexDataType complexDataType = outputDescriptionType.getComplexOutput();

assertNotNull(complexDataType);

if(isGetDefaultMimeType){
ComplexDataCombinationType defaultFormat = complexDataType.getDefault();

assertNotNull(defaultFormat);

ComplexDataDescriptionType format = defaultFormat.getFormat();

assertNotNull(format);
result = format.getMimeType();

result = format.getMimeType();
}else{
ComplexDataCombinationsType supportedFormats = complexDataType.getSupported();

assertNotNull(supportedFormats);

ComplexDataDescriptionType format = supportedFormats.getFormatArray(0);

assertNotNull(format);
result = format.getMimeType();

result = format.getMimeType();
}

return result;
}

private void checkOutputMimeType(Execute execute, String mimeType){

DocumentOutputDefinitionType outputDefinitionType = getOutputDefinitionType(execute);
assertTrue(outputDefinitionType.getMimeType() != null && outputDefinitionType.getMimeType().equals(mimeType));

assertTrue(outputDefinitionType.getMimeType() != null && outputDefinitionType.getMimeType().equals(mimeType));

}

private void checkOutputIdentifier(Execute execute, String identifier){

DocumentOutputDefinitionType outputDefinitionType = getOutputDefinitionType(execute);
assertTrue(outputDefinitionType.getIdentifier() != null && outputDefinitionType.getIdentifier().getStringValue().equals(identifier));

assertTrue(outputDefinitionType.getIdentifier() != null && outputDefinitionType.getIdentifier().getStringValue().equals(identifier));

}

private DocumentOutputDefinitionType getOutputDefinitionType(Execute execute){

ResponseFormType responseFormType = execute.getResponseForm();

assertNotNull(responseFormType);

ResponseDocumentType responseDocumentType = responseFormType.getResponseDocument();

assertNotNull(responseDocumentType);

DocumentOutputDefinitionType outputDefinitionType = responseDocumentType.getOutputArray(0);
assertNotNull(outputDefinitionType);

assertNotNull(outputDefinitionType);

return outputDefinitionType;

}

}
Loading