ref 8819: Extend The Algorithms Importer to Manage Many Processes as Black Boxes
https://support.d4science.org/issues/8819 Updated the support for Processes as Black Boxes git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@150373 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7d94425542
commit
09758721d6
1
pom.xml
1
pom.xml
|
@ -468,7 +468,6 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
|
||||
|
|
|
@ -105,7 +105,7 @@ public class MainGenerator {
|
|||
serviceCredentials.getUserName(),
|
||||
Files.newInputStream(producedScript, StandardOpenOption.READ),
|
||||
|
||||
producedScript.getFileName().toString(), R_DESCRIPTION+project.getProjectConfig().getLanguage(),
|
||||
"Main.R", R_DESCRIPTION+project.getProjectConfig().getLanguage(),
|
||||
R_MIMETYPE, project.getProjectFolder().getFolder().getId());
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
|
|
|
@ -122,6 +122,7 @@ public class ProjectBuilder {
|
|||
public Project buildRepackage() throws StatAlgoImporterServiceException {
|
||||
checkInfoForRepackage();
|
||||
createBackupOfPackageProject();
|
||||
createMainCodeIfRequest();
|
||||
repackageProjectPackage();
|
||||
return project;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,9 @@ public class AvailableProjectConfigJAXB {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProjectConfigJAXB [language=" + language + ", support=" + support + "]";
|
||||
return "AvailableProjectConfigJAXB [language=" + language + ", support=" + support + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -27,11 +27,11 @@ public class BuildSAIDescriptor {
|
|||
ArrayList<ProjectSetup> availableProjectConfigurations = new ArrayList<>();
|
||||
ProjectSetup r = new ProjectSetup("R", ProjectSupportType.REdit);
|
||||
availableProjectConfigurations.add(r);
|
||||
ProjectSetup rBlackBox = new ProjectSetup("R-black box", ProjectSupportType.BlackBox);
|
||||
ProjectSetup rBlackBox = new ProjectSetup("R-blackbox", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(rBlackBox);
|
||||
ProjectSetup java = new ProjectSetup("Java", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(java);
|
||||
ProjectSetup knimeWorkflow = new ProjectSetup("Knime Workflow", ProjectSupportType.BlackBox);
|
||||
ProjectSetup knimeWorkflow = new ProjectSetup("Knime-Workflow", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(knimeWorkflow);
|
||||
ProjectSetup linuxCompiled = new ProjectSetup("Linux-compiled", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(linuxCompiled);
|
||||
|
@ -54,13 +54,13 @@ public class BuildSAIDescriptor {
|
|||
ArrayList<ProjectSetup> availableProjectConfigurations = new ArrayList<>();
|
||||
|
||||
logger.debug("SAIDescriptorJAXB: " + saiDescriptorJAXB);
|
||||
if (saiDescriptorJAXB != null && saiDescriptorJAXB.getAvailableprojectconfigurations() != null
|
||||
&& !saiDescriptorJAXB.getAvailableprojectconfigurations().isEmpty()) {
|
||||
if (saiDescriptorJAXB != null && saiDescriptorJAXB.getAvailableprojectconfiguration() != null
|
||||
&& !saiDescriptorJAXB.getAvailableprojectconfiguration().isEmpty()) {
|
||||
|
||||
ProjectSupportType type;
|
||||
|
||||
for (AvailableProjectConfigJAXB availableProjectConfigJAXB : saiDescriptorJAXB
|
||||
.getAvailableprojectconfigurations()) {
|
||||
.getAvailableprojectconfiguration()) {
|
||||
type = ProjectSupportType.valueOf(availableProjectConfigJAXB.getSupport());
|
||||
if (type != null) {
|
||||
availableProjectConfigurations
|
||||
|
@ -73,11 +73,11 @@ public class BuildSAIDescriptor {
|
|||
|
||||
ProjectSetup r = new ProjectSetup("R", ProjectSupportType.REdit);
|
||||
availableProjectConfigurations.add(r);
|
||||
ProjectSetup rBlackBox = new ProjectSetup("R-black box", ProjectSupportType.BlackBox);
|
||||
ProjectSetup rBlackBox = new ProjectSetup("R-blackbox", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(rBlackBox);
|
||||
ProjectSetup java = new ProjectSetup("Java", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(java);
|
||||
ProjectSetup knimeWorkflow = new ProjectSetup("Knime Workflow", ProjectSupportType.BlackBox);
|
||||
ProjectSetup knimeWorkflow = new ProjectSetup("Knime-Workflow", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(knimeWorkflow);
|
||||
ProjectSetup linuxCompiled = new ProjectSetup("Linux-compiled", ProjectSupportType.BlackBox);
|
||||
availableProjectConfigurations.add(linuxCompiled);
|
||||
|
|
|
@ -43,7 +43,7 @@ public class InformationSystemUtils {
|
|||
List<GenericResource> accountingResources = client.submit(query);
|
||||
logger.debug("Resources: " + accountingResources);
|
||||
|
||||
SAIDescriptorJAXB enableTabs = null;
|
||||
SAIDescriptorJAXB saiDescriptorJaxB = null;
|
||||
|
||||
for (GenericResource genericResource : accountingResources) {
|
||||
if (genericResource.scopes() != null) {
|
||||
|
@ -62,8 +62,8 @@ public class InformationSystemUtils {
|
|||
JAXBParser<SAIDescriptorJAXB> parser = new JAXBParser<SAIDescriptorJAXB>(
|
||||
SAIDescriptorJAXB.class);
|
||||
logger.debug("Body: " + genericResource.profile().bodyAsString());
|
||||
enableTabs = (SAIDescriptorJAXB) parser.parse(genericResource.profile().bodyAsString());
|
||||
logger.debug("Enable: " + enableTabs);
|
||||
saiDescriptorJaxB = (SAIDescriptorJAXB) parser.parse(genericResource.profile().bodyAsString());
|
||||
logger.debug("Enable: " + saiDescriptorJaxB);
|
||||
} catch (Throwable e) {
|
||||
String error = "Error in discovery SAI profile generic resource on IS in scope " + scope + ". "
|
||||
+ "Resource parsing failed!";
|
||||
|
@ -80,7 +80,7 @@ public class InformationSystemUtils {
|
|||
}
|
||||
}
|
||||
|
||||
return enableTabs;
|
||||
return saiDescriptorJaxB;
|
||||
|
||||
} catch (StatAlgoImporterServiceException e) {
|
||||
throw e;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.server.is;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@ -18,20 +19,20 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class SAIDescriptorJAXB {
|
||||
|
||||
@XmlElement(name = "availableprojectconfigurations")
|
||||
private List<AvailableProjectConfigJAXB> availableprojectconfigurations = null;
|
||||
@XmlElement(name = "availableprojectconfiguration")
|
||||
private List<AvailableProjectConfigJAXB> availableprojectconfiguration = new ArrayList<>();
|
||||
|
||||
public List<AvailableProjectConfigJAXB> getAvailableprojectconfigurations() {
|
||||
return availableprojectconfigurations;
|
||||
public List<AvailableProjectConfigJAXB> getAvailableprojectconfiguration() {
|
||||
return availableprojectconfiguration;
|
||||
}
|
||||
|
||||
public void setAvailableprojectconfigurations(List<AvailableProjectConfigJAXB> availableprojectconfigurations) {
|
||||
this.availableprojectconfigurations = availableprojectconfigurations;
|
||||
public void setAvailableprojectconfiguration(List<AvailableProjectConfigJAXB> availableprojectconfiguration) {
|
||||
this.availableprojectconfiguration = availableprojectconfiguration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SAIDescriptorJAXB [availableprojectconfigurations=" + availableprojectconfigurations + "]";
|
||||
return "SAIDescriptorJAXB [availableprojectconfiguration=" + availableprojectconfiguration + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.is.AvailableProjectConfigJAXB;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.is.SAIDescriptorJAXB;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.Constants;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ISResourceTest extends TestCase {
|
||||
private static Logger logger = LoggerFactory.getLogger(ISResourceTest.class);
|
||||
|
||||
public void test() {
|
||||
if (Constants.TEST_ENABLE) {
|
||||
|
||||
try {
|
||||
JAXBContext jaxbContext = JAXBContext.newInstance(SAIDescriptorJAXB.class);
|
||||
StringWriter sw = new StringWriter();
|
||||
|
||||
SAIDescriptorJAXB saiDescriptor = new SAIDescriptorJAXB();
|
||||
List<AvailableProjectConfigJAXB> list = new ArrayList<>();
|
||||
AvailableProjectConfigJAXB a1 = new AvailableProjectConfigJAXB();
|
||||
a1.setLanguage("R");
|
||||
a1.setSupport("REditor");
|
||||
list.add(a1);
|
||||
a1 = new AvailableProjectConfigJAXB();
|
||||
a1.setLanguage("Linux");
|
||||
a1.setSupport("BlackBox");
|
||||
list.add(a1);
|
||||
a1 = new AvailableProjectConfigJAXB();
|
||||
a1.setLanguage("Octave");
|
||||
a1.setSupport("BlackBox");
|
||||
list.add(a1);
|
||||
saiDescriptor.setAvailableprojectconfiguration(list);
|
||||
jaxbContext.createMarshaller().marshal(saiDescriptor, sw);
|
||||
logger.debug(sw.toString());
|
||||
SAIDescriptorJAXB descr = (SAIDescriptorJAXB) jaxbContext.createUnmarshaller()
|
||||
.unmarshal(new StringReader(sw.toString()));
|
||||
logger.debug("SAIDescriptor: " + descr);
|
||||
assertTrue("Success", true);
|
||||
} catch (Throwable e) {
|
||||
logger.error(e.getLocalizedMessage(), e);
|
||||
fail("Error:" + e.getLocalizedMessage());
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
assertTrue("Success", true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -11,13 +11,8 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter;
|
|||
*
|
||||
*
|
||||
*/
|
||||
public class TestStatAlgoImporter {
|
||||
public class StatAlgoImporterTest {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
# A default log4j configuration for log4j users.
|
||||
#
|
||||
# To use this configuration, deploy it into your application's WEB-INF/classes
|
||||
# directory. You are also encouraged to edit it as you like.
|
||||
|
||||
log4j.rootLogger=DEBUG, stdout, rollingFile
|
||||
|
||||
# Redirect log messages to console
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
|
||||
|
||||
|
||||
log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.rollingFile.File=test.log
|
||||
log4j.appender.rollingFile.MaxFileSize=20MB
|
||||
log4j.appender.rollingFile.MaxBackupIndex=2
|
||||
log4j.appender.rollingFile.layout = org.apache.log4j.PatternLayout
|
||||
log4j.appender.rollingFile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
|
|
@ -0,0 +1,33 @@
|
|||
2017-06-14 14:35:14 DEBUG ISResourceTest:50 - <?xml version="1.0" encoding="UTF-8" standalone="yes"?><saidescriptor><availableprojectconfigurations><language>R</language><support>REditor</support></availableprojectconfigurations><availableprojectconfigurations><language>Linux</language><support>BlackBox</support></availableprojectconfigurations><availableprojectconfigurations><language>Octave</language><support>BlackBox</support></availableprojectconfigurations></saidescriptor>
|
||||
2017-06-14 14:36:11 DEBUG ISResourceTest:49 - <?xml version="1.0" encoding="UTF-8" standalone="yes"?><saidescriptor><availableprojectconfigurations><language>R</language><support>REditor</support></availableprojectconfigurations><availableprojectconfigurations><language>Linux</language><support>BlackBox</support></availableprojectconfigurations><availableprojectconfigurations><language>Octave</language><support>BlackBox</support></availableprojectconfigurations></saidescriptor>
|
||||
2017-06-14 14:36:11 ERROR ISResourceTest:55 - org.gcube.portlets.user.statisticalalgorithmsimporter.server.is.SAIDescriptorJAXB cannot be cast to org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.SAIDescriptor
|
||||
java.lang.ClassCastException: org.gcube.portlets.user.statisticalalgorithmsimporter.server.is.SAIDescriptorJAXB cannot be cast to org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.SAIDescriptor
|
||||
at org.gcube.portlets.user.statisticalalgorithmsimporter.ISResourceTest.test(ISResourceTest.java:50)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.lang.reflect.Method.invoke(Method.java:498)
|
||||
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
|
||||
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
|
||||
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
|
||||
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
|
||||
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
|
||||
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
|
||||
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
|
||||
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
|
||||
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
|
||||
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
|
||||
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
|
||||
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
|
||||
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
|
||||
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
|
||||
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
|
||||
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
|
||||
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
|
||||
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
|
||||
2017-06-14 14:36:58 DEBUG ISResourceTest:49 - <?xml version="1.0" encoding="UTF-8" standalone="yes"?><saidescriptor><availableprojectconfigurations><language>R</language><support>REditor</support></availableprojectconfigurations><availableprojectconfigurations><language>Linux</language><support>BlackBox</support></availableprojectconfigurations><availableprojectconfigurations><language>Octave</language><support>BlackBox</support></availableprojectconfigurations></saidescriptor>
|
||||
2017-06-14 14:36:58 DEBUG ISResourceTest:52 - SAIDescriptor: SAIDescriptorJAXB [availableprojectconfigurations=[AvailableProjectConfigJAXB [language=R, support=REditor], AvailableProjectConfigJAXB [language=Linux, support=BlackBox], AvailableProjectConfigJAXB [language=Octave, support=BlackBox]]]
|
||||
2017-06-14 14:42:05 DEBUG ISResourceTest:48 - <?xml version="1.0" encoding="UTF-8" standalone="yes"?><saidescriptor><availableprojectconfiguration><language>R</language><support>REditor</support></availableprojectconfiguration><availableprojectconfiguration><language>Linux</language><support>BlackBox</support></availableprojectconfiguration><availableprojectconfiguration><language>Octave</language><support>BlackBox</support></availableprojectconfiguration></saidescriptor>
|
||||
2017-06-14 14:42:05 DEBUG ISResourceTest:51 - SAIDescriptor: SAIDescriptorJAXB [availableprojectconfiguration=[AvailableProjectConfigJAXB [language=R, support=REditor], AvailableProjectConfigJAXB [language=Linux, support=BlackBox], AvailableProjectConfigJAXB [language=Octave, support=BlackBox]]]
|
||||
2017-06-14 14:47:07 DEBUG ISResourceTest:48 - <?xml version="1.0" encoding="UTF-8" standalone="yes"?><saidescriptor><availableprojectconfiguration><language>R</language><support>REditor</support></availableprojectconfiguration><availableprojectconfiguration><language>Linux</language><support>BlackBox</support></availableprojectconfiguration><availableprojectconfiguration><language>Octave</language><support>BlackBox</support></availableprojectconfiguration></saidescriptor>
|
||||
2017-06-14 14:47:07 DEBUG ISResourceTest:51 - SAIDescriptor: SAIDescriptorJAXB [availableprojectconfiguration=[AvailableProjectConfigJAXB [language=R, support=REditor], AvailableProjectConfigJAXB [language=Linux, support=BlackBox], AvailableProjectConfigJAXB [language=Octave, support=BlackBox]]]
|
Loading…
Reference in New Issue