From: Mathieu Baudier Date: Tue, 17 Jul 2012 14:14:45 +0000 (+0000) Subject: Restructured SLC building X-Git-Tag: argeo-slc-2.1.7~654 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;ds=sidebyside;h=f1622f872934a0c45aa3dc4ebe34b808e1508239;hp=651d33e13bfa9a7b46464be412023ee747e612e8;p=gpl%2Fargeo-slc.git Restructured SLC building git-svn-id: https://svn.argeo.org/slc/trunk@5495 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/dep/org.argeo.slc.dep.backend/pom.xml b/dep/org.argeo.slc.dep.backend/pom.xml index bb76b3049..6ffb9aae6 100644 --- a/dep/org.argeo.slc.dep.backend/pom.xml +++ b/dep/org.argeo.slc.dep.backend/pom.xml @@ -50,16 +50,6 @@ org.argeo.slc.support.jcr 1.1.3-SNAPSHOT - - org.argeo.slc.runtime - org.argeo.slc.support.activemq - 1.1.3-SNAPSHOT - - - org.argeo.slc.runtime - org.argeo.slc.server - 1.1.3-SNAPSHOT - org.argeo.slc.runtime org.argeo.slc.support.equinox @@ -68,17 +58,17 @@ - org.argeo.slc.modules + org.argeo.slc org.argeo.slc.agent 1.1.3-SNAPSHOT - org.argeo.slc.modules + org.argeo.slc org.argeo.slc.agent.jcr 1.1.3-SNAPSHOT - org.argeo.slc.modules + org.argeo.slc org.argeo.slc.node.jackrabbit 1.1.3-SNAPSHOT @@ -90,12 +80,12 @@ 1.1.3-SNAPSHOT - org.argeo.slc.modules + org.argeo.slc org.argeo.slc.server.repo 1.1.3-SNAPSHOT - org.argeo.slc.modules + org.argeo.slc org.argeo.slc.server.repo.webapp 1.1.3-SNAPSHOT diff --git a/legacy/modules/org.argeo.slc.agent.ext.jdbc/pom.xml b/legacy/modules/org.argeo.slc.agent.ext.jdbc/pom.xml index 929dc59cd..1288c1d53 100644 --- a/legacy/modules/org.argeo.slc.agent.ext.jdbc/pom.xml +++ b/legacy/modules/org.argeo.slc.agent.ext.jdbc/pom.xml @@ -1,8 +1,8 @@ 4.0.0 - org.argeo.slc.modules - agent + org.argeo.slc + modules 1.1.3-SNAPSHOT .. diff --git a/legacy/modules/org.argeo.slc.agent.ext.xalan/pom.xml b/legacy/modules/org.argeo.slc.agent.ext.xalan/pom.xml index cb8bf1e8c..a74e35482 100644 --- a/legacy/modules/org.argeo.slc.agent.ext.xalan/pom.xml +++ b/legacy/modules/org.argeo.slc.agent.ext.xalan/pom.xml @@ -1,8 +1,8 @@ 4.0.0 - org.argeo.slc.modules - agent + org.argeo.slc + modules 1.1.3-SNAPSHOT .. diff --git a/legacy/modules/org.argeo.slc.agent.jms/pom.xml b/legacy/modules/org.argeo.slc.agent.jms/pom.xml index d6d154ff5..fb3fd85b7 100644 --- a/legacy/modules/org.argeo.slc.agent.jms/pom.xml +++ b/legacy/modules/org.argeo.slc.agent.jms/pom.xml @@ -1,8 +1,8 @@ 4.0.0 - org.argeo.slc.modules - agent + org.argeo.slc + modules 1.1.3-SNAPSHOT .. diff --git a/legacy/modules/org.argeo.slc.ext.activemq/pom.xml b/legacy/modules/org.argeo.slc.ext.activemq/pom.xml index b1241927b..185dba271 100644 --- a/legacy/modules/org.argeo.slc.ext.activemq/pom.xml +++ b/legacy/modules/org.argeo.slc.ext.activemq/pom.xml @@ -1,8 +1,8 @@ 4.0.0 - org.argeo.slc.modules - agent + org.argeo.slc + modules 1.1.3-SNAPSHOT .. diff --git a/legacy/runtime/org.argeo.slc.support.castor/.classpath b/legacy/runtime/org.argeo.slc.support.castor/.classpath deleted file mode 100644 index 238982686..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/legacy/runtime/org.argeo.slc.support.castor/.project b/legacy/runtime/org.argeo.slc.support.castor/.project deleted file mode 100644 index c0bc103dd..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.argeo.slc.support.castor - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.pde.PluginNature - - diff --git a/legacy/runtime/org.argeo.slc.support.castor/.settings/org.eclipse.jdt.core.prefs b/legacy/runtime/org.argeo.slc.support.castor/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 93d31747f..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Fri Aug 29 11:10:18 CEST 2008 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/legacy/runtime/org.argeo.slc.support.castor/build.properties b/legacy/runtime/org.argeo.slc.support.castor/build.properties deleted file mode 100644 index a3d626614..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/build.properties +++ /dev/null @@ -1,8 +0,0 @@ -additional.bundles = org.argeo.slc.unit,\ - junit,\ - org.apache.xml.serializer,\ - org.apache.xerces -source.. = src/main/java/,\ - src/main/resources/,\ - src/test/java/,\ - src/test/resources/ diff --git a/legacy/runtime/org.argeo.slc.support.castor/pom.xml b/legacy/runtime/org.argeo.slc.support.castor/pom.xml deleted file mode 100644 index 9ba9f6b90..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/pom.xml +++ /dev/null @@ -1,98 +0,0 @@ - - 4.0.0 - - org.argeo.slc - runtime - 1.1.3-SNAPSHOT - .. - - org.argeo.slc.runtime - org.argeo.slc.support.castor - SLC Support Castor - Implementations of SLC Specs using Castor - - - - org.apache.felix - maven-bundle-plugin - - - - - org.argeo.slc.* - - - org.argeo.slc.*;resolution:=optional, - org.argeo.slc.deploy;resolution:=optional, - org.argeo.slc.build;resolution:=optional, - org.argeo.slc.execution;resolution:=optional, - org.argeo.slc.core.attachment;resolution:=optional, - org.argeo.slc.core.structure;resolution:=optional, - org.argeo.slc.core.structure.tree;resolution:=optional, - org.argeo.slc.core.test;resolution:=optional, - org.argeo.slc.core.test.tree;resolution:=optional, - org.argeo.slc.runtime;resolution:=optional, - org.argeo.slc.core.execution;resolution:=optional, - org.argeo.slc.msg;resolution:=optional, - org.argeo.slc.msg.build;resolution:=optional, - org.argeo.slc.msg.process;resolution:=optional, - org.argeo.slc.msg.event;resolution:=optional, - org.argeo.slc.msg.test.tree;resolution:=optional, - org.argeo.slc.detached;resolution:=optional, - org.apache.xml.serialize;resolution:=optional, - org.apache.xerces.jaxp;resolution:=optional, - org.w3c.dom.*;version="0.0.0";resolution:=optional, - org.xml.sax.*;version="0.0.0";resolution:=optional, - javax.xml.transform.*;version="0.0.0";resolution:=optional, - javax.xml.parsers.*;version="0.0.0";resolution:=optional, - org.springframework.xml.validation;resolution:=optional, - org.apache.commons.io, - org.springframework.oxm, - org.springframework.core, - org.springframework.xml.transform, - org.springframework.core.io, - * - - org.castor - - - - - - - - - org.argeo.slc.runtime - org.argeo.slc.core - 1.1.3-SNAPSHOT - - - - org.argeo.tp - org.springframework.oxm - - - - org.argeo.tp - org.castor - - - - org.argeo.tp - org.apache.xerces - - - - org.argeo.tp - org.apache.xalan - - - - - org.argeo.slc.runtime - org.argeo.slc.unit - test - 1.1.3-SNAPSHOT - - - \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java b/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java deleted file mode 100644 index 4a250e4cf..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * 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 org.argeo.slc.castor.execution; - -import org.argeo.slc.core.execution.PrimitiveAccessor; -import org.argeo.slc.core.execution.PrimitiveUtils; -import org.exolab.castor.mapping.AbstractFieldHandler; - -public class PrimitiveFieldHandler extends AbstractFieldHandler { - - @Override - public Object getValue(Object object) throws IllegalStateException { - if (object == null) - return null; - - Object value = ((PrimitiveAccessor) object).getValue(); - return value != null ? value.toString() : null; - } - - @Override - public Object newInstance(Object parent, Object[] args) - throws IllegalStateException { - return null; - } - - @Override - public Object newInstance(Object parent) throws IllegalStateException { - return null; - } - - @Override - public void resetValue(Object object) throws IllegalStateException, - IllegalArgumentException { - } - - @Override - public void setValue(Object object, Object value) - throws IllegalStateException, IllegalArgumentException { - PrimitiveAccessor primitiveAccessor = (PrimitiveAccessor) object; - String type = primitiveAccessor.getType(); - String str = value.toString(); - primitiveAccessor.setValue(PrimitiveUtils.convert(type, str)); - } - -} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/structure/tree/TreeSPathFieldHandler.java b/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/structure/tree/TreeSPathFieldHandler.java deleted file mode 100644 index 5d56fb99f..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/structure/tree/TreeSPathFieldHandler.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * 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 org.argeo.slc.castor.structure.tree; - -import org.exolab.castor.mapping.AbstractFieldHandler; -import org.exolab.castor.mapping.MapItem; - -import org.argeo.slc.core.structure.tree.TreeSPath; - -public class TreeSPathFieldHandler extends AbstractFieldHandler { - - @Override - public Object getValue(Object object) throws IllegalStateException { - MapItem part = (MapItem) object; - return ((TreeSPath) part.getKey()).getAsUniqueString(); - } - - @Override - public Object newInstance(Object parent) throws IllegalStateException { - return null; - } - - @Override - public Object newInstance(Object parent, Object[] args) - throws IllegalStateException { - return null; - } - - @Override - public void resetValue(Object object) throws IllegalStateException, - IllegalArgumentException { - MapItem part = (MapItem) object; - part.setKey(null); - } - - @Override - public void setValue(Object object, Object value) - throws IllegalStateException, IllegalArgumentException { - MapItem part = (MapItem) object; - part.setKey(new TreeSPath(value.toString())); - } - -} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/test/tree/StatusFieldHandler.java b/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/test/tree/StatusFieldHandler.java deleted file mode 100644 index a69eb87da..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/test/tree/StatusFieldHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * 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 org.argeo.slc.castor.test.tree; - -import org.argeo.slc.core.test.SimpleResultPart; -import org.argeo.slc.core.test.SlcTestUtils; -import org.argeo.slc.test.TestStatus; -import org.exolab.castor.mapping.AbstractFieldHandler; - -public class StatusFieldHandler extends AbstractFieldHandler { - - @Override - public Object getValue(Object object) throws IllegalStateException { - SimpleResultPart part = (SimpleResultPart) object; - return SlcTestUtils.statusToString(part.getStatus()); - } - - @Override - public Object newInstance(Object parent) throws IllegalStateException { - return null; - } - - @Override - public Object newInstance(Object parent, Object[] args) - throws IllegalStateException { - return null; - } - - @Override - public void resetValue(Object object) throws IllegalStateException, - IllegalArgumentException { - SimpleResultPart part = (SimpleResultPart) object; - // ERROR by default since it should be explicitely set - part.setStatus(TestStatus.ERROR); - } - - @Override - public void setValue(Object object, Object value) - throws IllegalStateException, IllegalArgumentException { - SimpleResultPart part = (SimpleResultPart) object; - Integer status = SlcTestUtils.stringToStatus((String) value); - part.setStatus(status); - } - -} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java b/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java deleted file mode 100644 index ad6bcdc24..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * 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 org.argeo.slc.xml.process; - -import java.io.File; -import java.io.FileWriter; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.transform.stream.StreamResult; - -import org.apache.commons.io.IOUtils; -import org.argeo.slc.SlcException; -import org.argeo.slc.execution.ExecutionProcess; -import org.argeo.slc.process.SlcExecution; -import org.argeo.slc.process.SlcExecutionNotifier; -import org.argeo.slc.execution.ExecutionStep; -import org.argeo.slc.process.SlcExecutionStep; -import org.springframework.oxm.Marshaller; - -/** @deprecated Probably not even working anymore */ -public class FileSlcExecutionNotifier implements SlcExecutionNotifier { - // private final static SimpleDateFormat sdf = new SimpleDateFormat( - // "yyyyMMdd-HHmmss"); - // - // private String basePath; - private Marshaller marshaller; - - private Map uuidToDir = new HashMap(); - - public void addSteps(ExecutionProcess slcExecution, - List additionalSteps) { - writeSlcExecution(slcExecution); - } - - public void updateStatus(ExecutionProcess slcExecution, String oldStatus, - String newStatus) { - writeSlcExecution(slcExecution); - } - - protected void writeSlcExecution(ExecutionProcess process) { - if (!(process instanceof SlcExecution)) - throw new SlcException("Unsupported process type " - + process.getClass()); - SlcExecution slcExecution = (SlcExecution) process; - FileWriter out = null; - try { - out = new FileWriter(getFilePath(slcExecution)); - marshaller.marshal(slcExecution, new StreamResult(out)); - } catch (Exception e) { - throw new SlcException("Cannot marshall SlcExecution to " - + getFilePath(slcExecution), e); - } finally { - IOUtils.closeQuietly(out); - } - } - - protected String getFileName(SlcExecution slcExecution) { - return "SlcExecution-" + slcExecution.getUuid() + ".xml"; - } - - protected String getFilePath(SlcExecution slcExecution) { - String dirPath = uuidToDir.get(slcExecution.getUuid()); - return dirPath + File.separator + "SlcExecution-" - + slcExecution.getUuid() + ".xml"; - } - - public void setBasePath(String basePath) { - // this.basePath = basePath; - } - - public void setMarshaller(Marshaller marshaller) { - this.marshaller = marshaller; - } - -} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/test/tree/XsltReportGenerator.java b/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/test/tree/XsltReportGenerator.java deleted file mode 100644 index 0a99356df..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/test/tree/XsltReportGenerator.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * 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 org.argeo.slc.xml.test.tree; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.Templates; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - -import org.springframework.core.io.Resource; -import org.springframework.oxm.Marshaller; -import org.springframework.xml.transform.StringResult; -import org.w3c.dom.Document; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.argeo.slc.SlcException; -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.test.TestResultListener; -import org.argeo.slc.test.TestResultPart; - -/** Build a report based on a tree test result using an XSLT stylesheet. */ -public class XsltReportGenerator implements TestResultListener { - private final static Log log = LogFactory.getLog(XsltReportGenerator.class); - - private DocumentBuilder documentBuilder = null; - - private Resource xsltStyleSheet; - - private Templates templates; - - private Marshaller marshaller; - - private String outputDir; - private String outputFileExtension = "html"; - - private Boolean logXml = false; - - private Map xsltParameters = new HashMap(); - - public void init() { - if (templates != null) - return; - - if (xsltStyleSheet == null) - throw new SlcException("XSLT style sheet not specified."); - - InputStream in = null; - try { - TransformerFactory transformerFactory = TransformerFactory - .newInstance(); - in = xsltStyleSheet.getInputStream(); - StreamSource xsltSource = new StreamSource(in); - templates = transformerFactory.newTemplates(xsltSource); - } catch (Exception e) { - throw new SlcException("Could not initialize templates", e); - } finally { - IOUtils.closeQuietly(in); - } - } - - public void resultPartAdded(TreeTestResult testResult, - TestResultPart testResultPart) { - - } - - public void close(TreeTestResult testResult) { - if (templates == null) - throw new SlcException("XSLT template not initialized"); - - File file = getFile(testResult); - OutputStream out = null; - - try { - Transformer transformer = templates.newTransformer(); - for (String paramKey : xsltParameters.keySet()) { - transformer - .setParameter(paramKey, xsltParameters.get(paramKey)); - if (log.isTraceEnabled()) - log.trace("Set XSLT parameter " + paramKey + " to " - + xsltParameters.get(paramKey)); - } - - if (documentBuilder == null) - documentBuilder = DocumentBuilderFactory.newInstance() - .newDocumentBuilder(); - - Document document = documentBuilder.newDocument(); - DOMResult marshallResult = new DOMResult(document); - marshaller.marshal(testResult, marshallResult); - - if (logXml) { - Transformer identityTransformer = TransformerFactory - .newInstance().newTransformer(); - StringResult xmlResult = new StringResult(); - identityTransformer.transform(new DOMSource(marshallResult - .getNode()), xmlResult); - log.info("Marshalled XML:\n" + xmlResult); - } - - DOMSource transfoSource = new DOMSource(marshallResult.getNode()); - - if (outputDir != null) { - File dir = new File(outputDir); - dir.mkdirs(); - out = new FileOutputStream(file); - StreamResult outputResult = new StreamResult(out); - transformer.transform(transfoSource, outputResult); - } else { - // print on console if no output dir - StringResult result = new StringResult(); - transformer.transform(transfoSource, result); - log.info("Generated report:\n" + result); - } - } catch (Exception e) { - throw new SlcException( - "Could not transform test result to " + file, e); - } finally { - IOUtils.closeQuietly(out); - } - } - - public Resource getXsltStyleSheet() { - return xsltStyleSheet; - } - - public void setXsltStyleSheet(Resource xsltStyleSheet) { - this.xsltStyleSheet = xsltStyleSheet; - } - - public void setTemplates(Templates templates) { - this.templates = templates; - } - - public void setMarshaller(Marshaller marshaller) { - this.marshaller = marshaller; - } - - public void setOutputDir(String outputDir) { - this.outputDir = outputDir; - } - - public void setOutputFileExtension(String outputFileExtension) { - this.outputFileExtension = outputFileExtension; - } - - protected File getFile(TreeTestResult result) { - Long time = System.currentTimeMillis(); - return new File(outputDir + File.separator + time + "-" - + result.getUuid() + "." + outputFileExtension); - } - - public void setLogXml(Boolean logXml) { - this.logXml = logXml; - } - - public void setXsltParameters(Map xsltParameters) { - this.xsltParameters = xsltParameters; - } - -} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/attachment.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/attachment.xml deleted file mode 100644 index 774e1bf07..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/attachment.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - Attachment objects XML mapping - - - - - - - - - \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/common.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/common.xml deleted file mode 100644 index ae97e3465..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/common.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - Build objects XML mapping - - - - - - - - - - - \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml deleted file mode 100644 index 662cbe6af..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - Execution objects XML mapping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/msg.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/msg.xml deleted file mode 100644 index 269903113..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/msg.xml +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - - Message objects XML mapping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml deleted file mode 100644 index 67bba2743..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - Process objects XML mapping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/runtime.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/runtime.xml deleted file mode 100644 index 9b1a1c07b..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/runtime.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - Runtime objects XML mapping - - - - - - - - - - - - \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/spring.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/spring.xml deleted file mode 100644 index 0b73dee77..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/spring.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - classpath:org/argeo/slc/castor/common.xml - classpath:org/argeo/slc/castor/msg.xml - classpath:org/argeo/slc/castor/process.xml - classpath:org/argeo/slc/castor/runtime.xml - classpath:org/argeo/slc/castor/structure.xml - classpath:org/argeo/slc/castor/test.xml - classpath:org/argeo/slc/castor/execution.xml - classpath:org/argeo/slc/castor/attachment.xml - - - - - - - - - - - - - - - - - - - diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/structure.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/structure.xml deleted file mode 100644 index ad63a7a3f..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/structure.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - Structure related objects XML mapping - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/test.xml b/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/test.xml deleted file mode 100644 index 45b9bbe0a..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/test.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - Test objects XML mapping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/site/apt/index.apt b/legacy/runtime/org.argeo.slc.support.castor/src/site/apt/index.apt deleted file mode 100644 index f414460db..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/site/apt/index.apt +++ /dev/null @@ -1 +0,0 @@ -Argeo SLC Site \ No newline at end of file diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/AbstractCastorTestCase.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/AbstractCastorTestCase.java deleted file mode 100644 index f91ad0b6e..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/AbstractCastorTestCase.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * 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 org.argeo.slc.castor; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.unit.AbstractSpringTestCase; -import org.argeo.slc.unit.UnitXmlUtils; -import org.springframework.oxm.Marshaller; -import org.springframework.oxm.Unmarshaller; -import org.springframework.xml.transform.StringResult; -import org.springframework.xml.transform.StringSource; -import org.springframework.xml.validation.XmlValidator; - -public abstract class AbstractCastorTestCase extends AbstractSpringTestCase { - protected Log log = LogFactory.getLog(getClass()); - - private Marshaller marshaller; - private Unmarshaller unmarshaller; - - @Override - public void setUp() { - marshaller = getBean(Marshaller.class); - unmarshaller = getBean(Unmarshaller.class); - } - - protected StringResult marshal(Object obj) throws Exception { - return marshal(obj, false); - } - - protected StringResult marshalAndValidate(Object obj) throws Exception { - return marshal(obj, true); - } - - protected StringResult marshal(Object obj, boolean validate) - throws Exception { - StringResult xml = new StringResult(); - marshaller.marshal(obj, xml); - - log.info("Marshalled " + obj.getClass() + ": " + xml + "\n"); - - if (validate) - UnitXmlUtils.assertXmlValidation(getBean(XmlValidator.class), - new StringSource(xml.toString())); - return xml; - } - - @SuppressWarnings("unchecked") - protected T unmarshal(StringResult xml) throws Exception { - return (T) unmarshaller.unmarshal(new StringSource(xml.toString())); - } - - @SuppressWarnings("unchecked") - protected T marshUnmarsh(Object obj, boolean validate) throws Exception { - StringResult xml = marshal(obj, validate); - return (T) unmarshal(xml); - } - - @SuppressWarnings("unchecked") - protected T marshUnmarsh(Object obj) throws Exception { - return (T) marshUnmarsh(obj, true); - } -} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionAnswerCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionAnswerCastorTest.java deleted file mode 100644 index ea3b55012..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionAnswerCastorTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * 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 org.argeo.slc.castor; - -import org.argeo.slc.msg.ExecutionAnswer; - -public class ExecutionAnswerCastorTest extends AbstractCastorTestCase { - public void testMarshUnmarshOk() throws Exception { - ExecutionAnswer answer = new ExecutionAnswer(ExecutionAnswer.OK, - "No problem!"); - ExecutionAnswer answerUnm = marshUnmarsh(answer); - assertExecutionAnswer(answer, answerUnm); - } - - public void testMarshUnmarshError() throws Exception { - ExecutionAnswer answer = new ExecutionAnswer(ExecutionAnswer.ERROR, - "Oooops..."); - ExecutionAnswer answerUnm = marshUnmarsh(answer); - assertExecutionAnswer(answer, answerUnm); - } - - public static void assertExecutionAnswer(ExecutionAnswer expected, - ExecutionAnswer reached) { - assertEquals(expected.getStatus(), reached.getStatus()); - assertEquals(expected.getMessage(), reached.getMessage()); - } -} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java deleted file mode 100644 index b25f52b7b..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * 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 org.argeo.slc.castor; - -import java.util.ArrayList; -import java.util.List; - -import org.argeo.slc.execution.ExecutionFlowDescriptor; -import org.argeo.slc.execution.ExecutionModuleDescriptor; -import org.argeo.slc.execution.ExecutionSpec; -import org.argeo.slc.unit.execution.ExecutionFlowDescriptorTestUtils; - -public class ExecutionModuleDescriptorCastorTest extends AbstractCastorTestCase { - public void testMarshUnmarsh() throws Exception { - ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor(); - moduleDescriptor.setName("test.module"); - moduleDescriptor.setVersion("1.0.0"); - moduleDescriptor.setLabel("Test Module"); - moduleDescriptor.setDescription("module descriptor"); - - ExecutionFlowDescriptor flowDescriptor = ExecutionFlowDescriptorTestUtils - .createSimpleExecutionFlowDescriptor(); - - List flows = new ArrayList(); - flows.add(flowDescriptor); - moduleDescriptor.setExecutionFlows(flows); - - List specs = new ArrayList(); - specs.add(flowDescriptor.getExecutionSpec()); - moduleDescriptor.setExecutionSpecs(specs); - - marshUnmarsh(moduleDescriptor, false); - } - - public void testMarshUnmarshMini() throws Exception { - ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor(); - moduleDescriptor.setName("test.moodule"); - moduleDescriptor.setVersion("1.0.0"); - marshUnmarsh(moduleDescriptor, false); - } - -} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ModularDistributionCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ModularDistributionCastorTest.java deleted file mode 100644 index 317d01993..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ModularDistributionCastorTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * 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 org.argeo.slc.castor; - -import org.argeo.slc.msg.ObjectList; -import org.argeo.slc.msg.build.ModularDistributionDescriptor; - -public class ModularDistributionCastorTest extends AbstractCastorTestCase { - public void testModularDistributionDescriptor() throws Exception { - ModularDistributionDescriptor mdd = new ModularDistributionDescriptor(); - mdd.setName("name"); - mdd.setVersion("0.1.0"); - mdd.getModulesDescriptors().put("eclipse", - "http://localhost/updateSite"); - mdd.getModulesDescriptors().put("modularDistribution", - "http://localhost/modularDistribution"); - - marshUnmarsh(mdd, false); - } - - public void testModularDistributionDescriptorList() throws Exception { - ModularDistributionDescriptor mdd = new ModularDistributionDescriptor(); - mdd.setName("name"); - mdd.setVersion("0.1.0"); - mdd.getModulesDescriptors().put("eclipse", - "http://localhost/updateSite"); - mdd.getModulesDescriptors().put("modularDistribution", - "http://localhost/modularDistribution"); - - ModularDistributionDescriptor mdd2 = new ModularDistributionDescriptor(); - mdd2.setName("name2"); - mdd2.setVersion("0.1.1"); - mdd2.getModulesDescriptors().put("eclipse", - "http://localhost/updateSite2"); - mdd2.getModulesDescriptors().put("modularDistribution", - "http://localhost/modularDistribution2"); - - ObjectList ol = new ObjectList(); - ol.getObjects().add(mdd); - ol.getObjects().add(mdd2); - - marshUnmarsh(ol, false); - } - -} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ObjectListCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ObjectListCastorTest.java deleted file mode 100644 index b01d9a7de..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ObjectListCastorTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * 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 org.argeo.slc.castor; - -import org.argeo.slc.msg.ObjectList; -import org.argeo.slc.runtime.SlcAgentDescriptor; - -public class ObjectListCastorTest extends AbstractCastorTestCase { - - public void testAgentDescriptorList() throws Exception { - SlcAgentDescriptor agentDescriptor = SlcAgentDescriptorCastorTest - .createMiniAgentDescriptor(); - ObjectList lst = new ObjectList(); - lst.getObjects().add(agentDescriptor); - ObjectList lstUnm = (ObjectList) marshUnmarsh(lst, false); - assertEquals(1, lstUnm.getObjects().size()); - } -} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcAgentDescriptorCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcAgentDescriptorCastorTest.java deleted file mode 100644 index 0367da70f..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcAgentDescriptorCastorTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * 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 org.argeo.slc.castor; - -import java.util.ArrayList; -import java.util.List; - -import org.argeo.slc.execution.ExecutionModuleDescriptor; -import org.argeo.slc.runtime.SlcAgentDescriptor; - -public class SlcAgentDescriptorCastorTest extends AbstractCastorTestCase { - public void testMarshUnmarshMini() throws Exception { - SlcAgentDescriptor agentDescriptor = createMiniAgentDescriptor(); - SlcAgentDescriptor agentDescriptorUnm = marshUnmarsh(agentDescriptor, - false); - assertSlcAgentDescriptor(agentDescriptor, agentDescriptorUnm); - } - - public void testMarshUnmarshWithModuleDescriptor() throws Exception { - SlcAgentDescriptor agentDescriptor = createMiniAgentDescriptor(); - - List lst = new ArrayList(); - ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor(); - moduleDescriptor.setName("test.moodule"); - moduleDescriptor.setVersion("1.0.0"); - lst.add(moduleDescriptor); - agentDescriptor.setModuleDescriptors(lst); - - SlcAgentDescriptor agentDescriptorUnm = marshUnmarsh(agentDescriptor, - false); - assertSlcAgentDescriptor(agentDescriptor, agentDescriptorUnm); - } - - protected static SlcAgentDescriptor createMiniAgentDescriptor() { - SlcAgentDescriptor agentDescriptor = new SlcAgentDescriptor(); - agentDescriptor.setHost("localhost"); - agentDescriptor.setUuid("555"); - return agentDescriptor; - } - - protected static void assertSlcAgentDescriptor(SlcAgentDescriptor expected, - SlcAgentDescriptor reached) { - assertNotNull(reached); - assertEquals(expected.getHost(), reached.getHost()); - assertEquals(expected.getUuid(), expected.getUuid()); - assertEquals(expected.getModuleDescriptors().size(), reached - .getModuleDescriptors().size()); - } -} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java deleted file mode 100644 index 44794e163..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * 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 org.argeo.slc.castor; - -import java.text.SimpleDateFormat; -import java.util.UUID; - -import org.argeo.slc.msg.process.SlcExecutionRequest; -import org.argeo.slc.msg.process.SlcExecutionStepsRequest; -import org.argeo.slc.process.SlcExecution; -import org.argeo.slc.process.SlcExecutionStep; -import org.argeo.slc.unit.process.SlcExecutionTestUtils; -import org.springframework.xml.transform.StringResult; - -public class SlcExecutionCastorTest extends AbstractCastorTestCase { - public void testMarshalling() throws Exception { - SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution(); - - SlcExecutionRequest msgSave = new SlcExecutionRequest(); - msgSave.setSlcExecution(slcExec); - - StringResult msgSaveXml = marshalAndValidate(msgSave); - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - SlcExecutionStep step0 = new SlcExecutionStep(); - step0.setUuid(UUID.randomUUID().toString()); - step0.setTimestamp(sdf.parse("2008-04-17 18:21")); - step0.setType("LOG"); - step0.addLog("A log message\nand another line"); - - SlcExecutionStep step1 = new SlcExecutionStep(); - step1.setUuid(UUID.randomUUID().toString()); - step1.setTimestamp(sdf.parse("2008-04-17 18:25")); - step1.setType("LOG"); - step1.addLog("A nother log message"); - - SlcExecutionStepsRequest msgNotif = new SlcExecutionStepsRequest(); - msgNotif.addStep(step0); - msgNotif.addStep(step1); - msgNotif.setSlcExecutionUuid(slcExec.getUuid()); - - StringResult msgNotifXml = marshalAndValidate(msgNotif); - - SlcExecutionRequest msgSaveUnm = unmarshal(msgSaveXml); - assertNotNull(msgSaveUnm); - SlcExecutionTestUtils.assertSlcExecution(slcExec, msgSaveUnm - .getSlcExecution()); - - SlcExecutionStepsRequest msgNotifUnm = unmarshal(msgNotifXml); - assertNotNull(msgNotifUnm); - assertEquals(slcExec.getUuid(), msgNotifUnm.getSlcExecutionUuid()); - assertEquals(2, msgNotifUnm.getSteps().size()); - SlcExecutionTestUtils.assertSlcExecutionStep(step0, msgNotifUnm - .getSteps().get(0)); - SlcExecutionTestUtils.assertSlcExecutionStep(step1, msgNotifUnm - .getSteps().get(1)); - - SlcExecution slcExecUnm = msgSaveUnm.getSlcExecution(); - slcExecUnm.getSteps().addAll(msgNotifUnm.getSteps()); - - SlcExecutionRequest msgUpdate = new SlcExecutionRequest(); - msgUpdate.setSlcExecution(slcExecUnm); - StringResult msgUpdateXml = marshalAndValidate(msgUpdate); - - SlcExecutionRequest msgUpdateUnm = unmarshal(msgUpdateXml); - assertNotNull(msgUpdateUnm); - } - - public void testMarshUnmarsh() throws Exception { - SlcExecution slcExec = SlcExecutionTestUtils - .createSlcExecutionWithRealizedFlows(); - marshUnmarsh(slcExec, false); - } -} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCastorTest.java deleted file mode 100644 index 7d6d6e961..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCastorTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * 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 org.argeo.slc.castor; - -import static org.argeo.slc.unit.UnitUtils.assertDateSec; -import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createCompleteTreeTestResult; -import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createSimpleResultPartRequest; - -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest; -import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest; -import org.argeo.slc.msg.test.tree.ResultPartRequest; -import org.argeo.slc.unit.test.tree.UnitTestTreeUtil; -import org.springframework.xml.transform.StringResult; - -public class TreeTestResultCastorTest extends AbstractCastorTestCase { - public void testMarshUnmarsh() throws Exception { - TreeTestResult ttr = createCompleteTreeTestResult(); - - StringResult xml = marshalAndValidate(ttr); - - TreeTestResult ttrUnm = unmarshal(xml); - - UnitTestTreeUtil.assertTreeTestResult(ttr, ttrUnm); - } - - public void testCreateTreeTestResultRequest() throws Exception { - CreateTreeTestResultRequest req = new CreateTreeTestResultRequest(); - req.setTreeTestResult(createCompleteTreeTestResult()); - - StringResult xml = marshalAndValidate(req); - - CreateTreeTestResultRequest reqUnm = unmarshal(xml); - - UnitTestTreeUtil.assertTreeTestResult(req.getTreeTestResult(), reqUnm - .getTreeTestResult()); - } - - public void testResultPartRequest() throws Exception { - TreeTestResult ttr = createCompleteTreeTestResult(); - ResultPartRequest req = createSimpleResultPartRequest(ttr); - - StringResult xml = marshalAndValidate(req); - - ResultPartRequest reqUnm = unmarshal(xml); - - UnitTestTreeUtil - .assertPart(req.getResultPart(), reqUnm.getResultPart()); - } - - public void testCloseTreeTestResultRequest() throws Exception { - TreeTestResult ttr = createCompleteTreeTestResult(); - ttr.close(); - - CloseTreeTestResultRequest req = new CloseTreeTestResultRequest(ttr - .getUuid(), ttr.getCloseDate()); - - StringResult xml = marshalAndValidate(req); - - CloseTreeTestResultRequest reqUnm = unmarshal(xml); - - assertEquals(ttr.getUuid(), reqUnm.getResultUuid()); - assertDateSec(ttr.getCloseDate(), ttr.getCloseDate()); - } -} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCollectionCastorTest.java b/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCollectionCastorTest.java deleted file mode 100644 index 46fc836e1..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCollectionCastorTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * 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 org.argeo.slc.castor; - -import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createCompleteTreeTestResult; - -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.core.test.tree.TreeTestResultCollection; -import org.argeo.slc.unit.test.tree.UnitTestTreeUtil; -import org.springframework.xml.transform.StringResult; - -public class TreeTestResultCollectionCastorTest extends AbstractCastorTestCase { - public void testMarshUnmarsh() throws Exception { - TreeTestResult ttr = createCompleteTreeTestResult(); - TreeTestResult ttr2 = createCompleteTreeTestResult(); - - TreeTestResultCollection ttrc = new TreeTestResultCollection(); - ttrc.setId("testCollection"); - ttrc.getResults().add(ttr); - ttrc.getResults().add(ttr2); - - StringResult xml = marshalAndValidate(ttrc); - - TreeTestResultCollection ttrcUnm = unmarshal(xml); - - assertEquals(ttrc.getId(), ttrcUnm.getId()); - assertEquals(ttrc.getResults().size(), ttrcUnm.getResults().size()); - for (TreeTestResult ttrT : ttrc.getResults()) { - if (ttrT.getUuid().equals(ttr.getUuid())) - UnitTestTreeUtil.assertTreeTestResult(ttr, ttrT); - else - UnitTestTreeUtil.assertTreeTestResult(ttr2, ttrT); - } - } -} diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/resources/log4j.properties b/legacy/runtime/org.argeo.slc.support.castor/src/test/resources/log4j.properties deleted file mode 100644 index 0133bab88..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/test/resources/log4j.properties +++ /dev/null @@ -1,22 +0,0 @@ -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=WARN, console - -## Levels -# Slc -log4j.logger.org.argeo=DEBUG - -# Castor -log4j.logger.org.exolab.castor=WARN - -# Spring -log4j.logger.org.springframework=WARN - - -## Appenders -# A1 is set to be a ConsoleAppender. -log4j.appender.console=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c%n - diff --git a/legacy/runtime/org.argeo.slc.support.castor/src/test/resources/org/argeo/slc/castor/applicationContext.xml b/legacy/runtime/org.argeo.slc.support.castor/src/test/resources/org/argeo/slc/castor/applicationContext.xml deleted file mode 100644 index c479075b8..000000000 --- a/legacy/runtime/org.argeo.slc.support.castor/src/test/resources/org/argeo/slc/castor/applicationContext.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/modules/agent/pom.xml b/modules/agent/pom.xml index 84da38466..52f633ac9 100644 --- a/modules/agent/pom.xml +++ b/modules/agent/pom.xml @@ -6,8 +6,8 @@ 1.1.3-SNAPSHOT .. - org.argeo.slc.modules - agent + org.argeo.slc + modules pom SLC Modules Agent diff --git a/modules/org.argeo.slc.agent.jcr/pom.xml b/modules/org.argeo.slc.agent.jcr/pom.xml index a27eec627..a0b72ae5f 100644 --- a/modules/org.argeo.slc.agent.jcr/pom.xml +++ b/modules/org.argeo.slc.agent.jcr/pom.xml @@ -1,8 +1,8 @@ 4.0.0 - org.argeo.slc.modules - agent + org.argeo.slc + modules 1.1.3-SNAPSHOT .. diff --git a/modules/org.argeo.slc.agent/pom.xml b/modules/org.argeo.slc.agent/pom.xml index b1b056580..03fdcb0b3 100644 --- a/modules/org.argeo.slc.agent/pom.xml +++ b/modules/org.argeo.slc.agent/pom.xml @@ -1,8 +1,8 @@ 4.0.0 - org.argeo.slc.modules - agent + org.argeo.slc + modules 1.1.3-SNAPSHOT .. diff --git a/modules/org.argeo.slc.node.jackrabbit/pom.xml b/modules/org.argeo.slc.node.jackrabbit/pom.xml index 4363c321f..4bc021e24 100644 --- a/modules/org.argeo.slc.node.jackrabbit/pom.xml +++ b/modules/org.argeo.slc.node.jackrabbit/pom.xml @@ -1,8 +1,8 @@ 4.0.0 - org.argeo.slc.modules - server + org.argeo.slc + modules 1.1.3-SNAPSHOT .. diff --git a/modules/org.argeo.slc.server.repo.webapp/pom.xml b/modules/org.argeo.slc.server.repo.webapp/pom.xml index 3f388ea07..880feb097 100644 --- a/modules/org.argeo.slc.server.repo.webapp/pom.xml +++ b/modules/org.argeo.slc.server.repo.webapp/pom.xml @@ -1,8 +1,8 @@ 4.0.0 - org.argeo.slc.modules - server + org.argeo.slc + modules 1.1.3-SNAPSHOT .. diff --git a/modules/org.argeo.slc.server.repo/pom.xml b/modules/org.argeo.slc.server.repo/pom.xml index 85affbbbd..fb3abbd47 100644 --- a/modules/org.argeo.slc.server.repo/pom.xml +++ b/modules/org.argeo.slc.server.repo/pom.xml @@ -1,8 +1,8 @@ 4.0.0 - org.argeo.slc.modules - server + org.argeo.slc + modules 1.1.3-SNAPSHOT .. diff --git a/modules/server/pom.xml b/modules/server/pom.xml index 31e8d4d96..fdc177d8c 100644 --- a/modules/server/pom.xml +++ b/modules/server/pom.xml @@ -6,8 +6,8 @@ 1.1.3-SNAPSHOT .. - org.argeo.slc.modules - server + org.argeo.slc + modules pom SLC Modules Server diff --git a/plugins/org.argeo.slc.client.rcp/META-INF/MANIFEST.MF b/plugins/org.argeo.slc.client.rcp/META-INF/MANIFEST.MF index 201bff662..03c71a755 100644 --- a/plugins/org.argeo.slc.client.rcp/META-INF/MANIFEST.MF +++ b/plugins/org.argeo.slc.client.rcp/META-INF/MANIFEST.MF @@ -13,6 +13,4 @@ Import-Package: org.argeo.security.ui.rcp, org.argeo.slc.execution, org.argeo.slc.process, org.argeo.slc.runtime, - org.argeo.slc.services, - org.argeo.slc.services.impl Export-Package: org.argeo.slc.client.rcp diff --git a/plugins/org.argeo.slc.client.rcp/pom.xml b/plugins/org.argeo.slc.client.rcp/pom.xml index 62e86094e..bbe2e40ca 100644 --- a/plugins/org.argeo.slc.client.rcp/pom.xml +++ b/plugins/org.argeo.slc.client.rcp/pom.xml @@ -19,12 +19,12 @@ - org.argeo.slc.modules + org.argeo.slc org.argeo.slc.node.jackrabbit 1.1.3-SNAPSHOT - org.argeo.slc.modules + org.argeo.slc org.argeo.slc.agent 1.1.3-SNAPSHOT diff --git a/plugins/org.argeo.slc.client.ui.dist/pom.xml b/plugins/org.argeo.slc.client.ui.dist/pom.xml index 647520d94..5a234bfec 100644 --- a/plugins/org.argeo.slc.client.ui.dist/pom.xml +++ b/plugins/org.argeo.slc.client.ui.dist/pom.xml @@ -38,7 +38,7 @@ 1.1.3-SNAPSHOT - org.argeo.slc.modules + org.argeo.slc org.argeo.slc.server.repo 1.1.3-SNAPSHOT diff --git a/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF b/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF index f7ddb7998..07ac629c9 100644 --- a/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF +++ b/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF @@ -43,8 +43,6 @@ Import-Package: javax.jcr;version="2.0.0", org.argeo.slc.msg.test.tree, org.argeo.slc.process, org.argeo.slc.runtime, - org.argeo.slc.services, - org.argeo.slc.services.impl, org.argeo.slc.test, org.eclipse.core.expressions, org.eclipse.ui.forms, diff --git a/plugins/org.argeo.slc.client.ui/pom.xml b/plugins/org.argeo.slc.client.ui/pom.xml index 95c278784..b87c55870 100644 --- a/plugins/org.argeo.slc.client.ui/pom.xml +++ b/plugins/org.argeo.slc.client.ui/pom.xml @@ -36,11 +36,11 @@ 1.1.3-SNAPSHOT - - org.argeo.slc.runtime - org.argeo.slc.server - 1.1.3-SNAPSHOT - + + + + + diff --git a/runtime/org.argeo.slc.support.castor/.classpath b/runtime/org.argeo.slc.support.castor/.classpath new file mode 100644 index 000000000..238982686 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/runtime/org.argeo.slc.support.castor/.project b/runtime/org.argeo.slc.support.castor/.project new file mode 100644 index 000000000..c0bc103dd --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/.project @@ -0,0 +1,28 @@ + + + org.argeo.slc.support.castor + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/runtime/org.argeo.slc.support.castor/.settings/org.eclipse.jdt.core.prefs b/runtime/org.argeo.slc.support.castor/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..93d31747f --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Fri Aug 29 11:10:18 CEST 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/runtime/org.argeo.slc.support.castor/build.properties b/runtime/org.argeo.slc.support.castor/build.properties new file mode 100644 index 000000000..a3d626614 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/build.properties @@ -0,0 +1,8 @@ +additional.bundles = org.argeo.slc.unit,\ + junit,\ + org.apache.xml.serializer,\ + org.apache.xerces +source.. = src/main/java/,\ + src/main/resources/,\ + src/test/java/,\ + src/test/resources/ diff --git a/runtime/org.argeo.slc.support.castor/pom.xml b/runtime/org.argeo.slc.support.castor/pom.xml new file mode 100644 index 000000000..9ba9f6b90 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/pom.xml @@ -0,0 +1,98 @@ + + 4.0.0 + + org.argeo.slc + runtime + 1.1.3-SNAPSHOT + .. + + org.argeo.slc.runtime + org.argeo.slc.support.castor + SLC Support Castor + Implementations of SLC Specs using Castor + + + + org.apache.felix + maven-bundle-plugin + + + + + org.argeo.slc.* + + + org.argeo.slc.*;resolution:=optional, + org.argeo.slc.deploy;resolution:=optional, + org.argeo.slc.build;resolution:=optional, + org.argeo.slc.execution;resolution:=optional, + org.argeo.slc.core.attachment;resolution:=optional, + org.argeo.slc.core.structure;resolution:=optional, + org.argeo.slc.core.structure.tree;resolution:=optional, + org.argeo.slc.core.test;resolution:=optional, + org.argeo.slc.core.test.tree;resolution:=optional, + org.argeo.slc.runtime;resolution:=optional, + org.argeo.slc.core.execution;resolution:=optional, + org.argeo.slc.msg;resolution:=optional, + org.argeo.slc.msg.build;resolution:=optional, + org.argeo.slc.msg.process;resolution:=optional, + org.argeo.slc.msg.event;resolution:=optional, + org.argeo.slc.msg.test.tree;resolution:=optional, + org.argeo.slc.detached;resolution:=optional, + org.apache.xml.serialize;resolution:=optional, + org.apache.xerces.jaxp;resolution:=optional, + org.w3c.dom.*;version="0.0.0";resolution:=optional, + org.xml.sax.*;version="0.0.0";resolution:=optional, + javax.xml.transform.*;version="0.0.0";resolution:=optional, + javax.xml.parsers.*;version="0.0.0";resolution:=optional, + org.springframework.xml.validation;resolution:=optional, + org.apache.commons.io, + org.springframework.oxm, + org.springframework.core, + org.springframework.xml.transform, + org.springframework.core.io, + * + + org.castor + + + + + + + + + org.argeo.slc.runtime + org.argeo.slc.core + 1.1.3-SNAPSHOT + + + + org.argeo.tp + org.springframework.oxm + + + + org.argeo.tp + org.castor + + + + org.argeo.tp + org.apache.xerces + + + + org.argeo.tp + org.apache.xalan + + + + + org.argeo.slc.runtime + org.argeo.slc.unit + test + 1.1.3-SNAPSHOT + + + \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java new file mode 100644 index 000000000..4a250e4cf --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/execution/PrimitiveFieldHandler.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * 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 org.argeo.slc.castor.execution; + +import org.argeo.slc.core.execution.PrimitiveAccessor; +import org.argeo.slc.core.execution.PrimitiveUtils; +import org.exolab.castor.mapping.AbstractFieldHandler; + +public class PrimitiveFieldHandler extends AbstractFieldHandler { + + @Override + public Object getValue(Object object) throws IllegalStateException { + if (object == null) + return null; + + Object value = ((PrimitiveAccessor) object).getValue(); + return value != null ? value.toString() : null; + } + + @Override + public Object newInstance(Object parent, Object[] args) + throws IllegalStateException { + return null; + } + + @Override + public Object newInstance(Object parent) throws IllegalStateException { + return null; + } + + @Override + public void resetValue(Object object) throws IllegalStateException, + IllegalArgumentException { + } + + @Override + public void setValue(Object object, Object value) + throws IllegalStateException, IllegalArgumentException { + PrimitiveAccessor primitiveAccessor = (PrimitiveAccessor) object; + String type = primitiveAccessor.getType(); + String str = value.toString(); + primitiveAccessor.setValue(PrimitiveUtils.convert(type, str)); + } + +} diff --git a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/structure/tree/TreeSPathFieldHandler.java b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/structure/tree/TreeSPathFieldHandler.java new file mode 100644 index 000000000..5d56fb99f --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/structure/tree/TreeSPathFieldHandler.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * 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 org.argeo.slc.castor.structure.tree; + +import org.exolab.castor.mapping.AbstractFieldHandler; +import org.exolab.castor.mapping.MapItem; + +import org.argeo.slc.core.structure.tree.TreeSPath; + +public class TreeSPathFieldHandler extends AbstractFieldHandler { + + @Override + public Object getValue(Object object) throws IllegalStateException { + MapItem part = (MapItem) object; + return ((TreeSPath) part.getKey()).getAsUniqueString(); + } + + @Override + public Object newInstance(Object parent) throws IllegalStateException { + return null; + } + + @Override + public Object newInstance(Object parent, Object[] args) + throws IllegalStateException { + return null; + } + + @Override + public void resetValue(Object object) throws IllegalStateException, + IllegalArgumentException { + MapItem part = (MapItem) object; + part.setKey(null); + } + + @Override + public void setValue(Object object, Object value) + throws IllegalStateException, IllegalArgumentException { + MapItem part = (MapItem) object; + part.setKey(new TreeSPath(value.toString())); + } + +} diff --git a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/test/tree/StatusFieldHandler.java b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/test/tree/StatusFieldHandler.java new file mode 100644 index 000000000..a69eb87da --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/test/tree/StatusFieldHandler.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * 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 org.argeo.slc.castor.test.tree; + +import org.argeo.slc.core.test.SimpleResultPart; +import org.argeo.slc.core.test.SlcTestUtils; +import org.argeo.slc.test.TestStatus; +import org.exolab.castor.mapping.AbstractFieldHandler; + +public class StatusFieldHandler extends AbstractFieldHandler { + + @Override + public Object getValue(Object object) throws IllegalStateException { + SimpleResultPart part = (SimpleResultPart) object; + return SlcTestUtils.statusToString(part.getStatus()); + } + + @Override + public Object newInstance(Object parent) throws IllegalStateException { + return null; + } + + @Override + public Object newInstance(Object parent, Object[] args) + throws IllegalStateException { + return null; + } + + @Override + public void resetValue(Object object) throws IllegalStateException, + IllegalArgumentException { + SimpleResultPart part = (SimpleResultPart) object; + // ERROR by default since it should be explicitely set + part.setStatus(TestStatus.ERROR); + } + + @Override + public void setValue(Object object, Object value) + throws IllegalStateException, IllegalArgumentException { + SimpleResultPart part = (SimpleResultPart) object; + Integer status = SlcTestUtils.stringToStatus((String) value); + part.setStatus(status); + } + +} diff --git a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java new file mode 100644 index 000000000..ad6bcdc24 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * 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 org.argeo.slc.xml.process; + +import java.io.File; +import java.io.FileWriter; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.transform.stream.StreamResult; + +import org.apache.commons.io.IOUtils; +import org.argeo.slc.SlcException; +import org.argeo.slc.execution.ExecutionProcess; +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.process.SlcExecutionNotifier; +import org.argeo.slc.execution.ExecutionStep; +import org.argeo.slc.process.SlcExecutionStep; +import org.springframework.oxm.Marshaller; + +/** @deprecated Probably not even working anymore */ +public class FileSlcExecutionNotifier implements SlcExecutionNotifier { + // private final static SimpleDateFormat sdf = new SimpleDateFormat( + // "yyyyMMdd-HHmmss"); + // + // private String basePath; + private Marshaller marshaller; + + private Map uuidToDir = new HashMap(); + + public void addSteps(ExecutionProcess slcExecution, + List additionalSteps) { + writeSlcExecution(slcExecution); + } + + public void updateStatus(ExecutionProcess slcExecution, String oldStatus, + String newStatus) { + writeSlcExecution(slcExecution); + } + + protected void writeSlcExecution(ExecutionProcess process) { + if (!(process instanceof SlcExecution)) + throw new SlcException("Unsupported process type " + + process.getClass()); + SlcExecution slcExecution = (SlcExecution) process; + FileWriter out = null; + try { + out = new FileWriter(getFilePath(slcExecution)); + marshaller.marshal(slcExecution, new StreamResult(out)); + } catch (Exception e) { + throw new SlcException("Cannot marshall SlcExecution to " + + getFilePath(slcExecution), e); + } finally { + IOUtils.closeQuietly(out); + } + } + + protected String getFileName(SlcExecution slcExecution) { + return "SlcExecution-" + slcExecution.getUuid() + ".xml"; + } + + protected String getFilePath(SlcExecution slcExecution) { + String dirPath = uuidToDir.get(slcExecution.getUuid()); + return dirPath + File.separator + "SlcExecution-" + + slcExecution.getUuid() + ".xml"; + } + + public void setBasePath(String basePath) { + // this.basePath = basePath; + } + + public void setMarshaller(Marshaller marshaller) { + this.marshaller = marshaller; + } + +} diff --git a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/test/tree/XsltReportGenerator.java b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/test/tree/XsltReportGenerator.java new file mode 100644 index 000000000..0a99356df --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/test/tree/XsltReportGenerator.java @@ -0,0 +1,188 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * 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 org.argeo.slc.xml.test.tree; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import org.springframework.core.io.Resource; +import org.springframework.oxm.Marshaller; +import org.springframework.xml.transform.StringResult; +import org.w3c.dom.Document; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.argeo.slc.SlcException; +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.test.TestResultListener; +import org.argeo.slc.test.TestResultPart; + +/** Build a report based on a tree test result using an XSLT stylesheet. */ +public class XsltReportGenerator implements TestResultListener { + private final static Log log = LogFactory.getLog(XsltReportGenerator.class); + + private DocumentBuilder documentBuilder = null; + + private Resource xsltStyleSheet; + + private Templates templates; + + private Marshaller marshaller; + + private String outputDir; + private String outputFileExtension = "html"; + + private Boolean logXml = false; + + private Map xsltParameters = new HashMap(); + + public void init() { + if (templates != null) + return; + + if (xsltStyleSheet == null) + throw new SlcException("XSLT style sheet not specified."); + + InputStream in = null; + try { + TransformerFactory transformerFactory = TransformerFactory + .newInstance(); + in = xsltStyleSheet.getInputStream(); + StreamSource xsltSource = new StreamSource(in); + templates = transformerFactory.newTemplates(xsltSource); + } catch (Exception e) { + throw new SlcException("Could not initialize templates", e); + } finally { + IOUtils.closeQuietly(in); + } + } + + public void resultPartAdded(TreeTestResult testResult, + TestResultPart testResultPart) { + + } + + public void close(TreeTestResult testResult) { + if (templates == null) + throw new SlcException("XSLT template not initialized"); + + File file = getFile(testResult); + OutputStream out = null; + + try { + Transformer transformer = templates.newTransformer(); + for (String paramKey : xsltParameters.keySet()) { + transformer + .setParameter(paramKey, xsltParameters.get(paramKey)); + if (log.isTraceEnabled()) + log.trace("Set XSLT parameter " + paramKey + " to " + + xsltParameters.get(paramKey)); + } + + if (documentBuilder == null) + documentBuilder = DocumentBuilderFactory.newInstance() + .newDocumentBuilder(); + + Document document = documentBuilder.newDocument(); + DOMResult marshallResult = new DOMResult(document); + marshaller.marshal(testResult, marshallResult); + + if (logXml) { + Transformer identityTransformer = TransformerFactory + .newInstance().newTransformer(); + StringResult xmlResult = new StringResult(); + identityTransformer.transform(new DOMSource(marshallResult + .getNode()), xmlResult); + log.info("Marshalled XML:\n" + xmlResult); + } + + DOMSource transfoSource = new DOMSource(marshallResult.getNode()); + + if (outputDir != null) { + File dir = new File(outputDir); + dir.mkdirs(); + out = new FileOutputStream(file); + StreamResult outputResult = new StreamResult(out); + transformer.transform(transfoSource, outputResult); + } else { + // print on console if no output dir + StringResult result = new StringResult(); + transformer.transform(transfoSource, result); + log.info("Generated report:\n" + result); + } + } catch (Exception e) { + throw new SlcException( + "Could not transform test result to " + file, e); + } finally { + IOUtils.closeQuietly(out); + } + } + + public Resource getXsltStyleSheet() { + return xsltStyleSheet; + } + + public void setXsltStyleSheet(Resource xsltStyleSheet) { + this.xsltStyleSheet = xsltStyleSheet; + } + + public void setTemplates(Templates templates) { + this.templates = templates; + } + + public void setMarshaller(Marshaller marshaller) { + this.marshaller = marshaller; + } + + public void setOutputDir(String outputDir) { + this.outputDir = outputDir; + } + + public void setOutputFileExtension(String outputFileExtension) { + this.outputFileExtension = outputFileExtension; + } + + protected File getFile(TreeTestResult result) { + Long time = System.currentTimeMillis(); + return new File(outputDir + File.separator + time + "-" + + result.getUuid() + "." + outputFileExtension); + } + + public void setLogXml(Boolean logXml) { + this.logXml = logXml; + } + + public void setXsltParameters(Map xsltParameters) { + this.xsltParameters = xsltParameters; + } + +} diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/attachment.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/attachment.xml new file mode 100644 index 000000000..774e1bf07 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/attachment.xml @@ -0,0 +1,32 @@ + + + + + + Attachment objects XML mapping + + + + + + + + + \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/common.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/common.xml new file mode 100644 index 000000000..ae97e3465 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/common.xml @@ -0,0 +1,32 @@ + + + + Build objects XML mapping + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml new file mode 100644 index 000000000..662cbe6af --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/execution.xml @@ -0,0 +1,172 @@ + + + + + + Execution objects XML mapping + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/msg.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/msg.xml new file mode 100644 index 000000000..269903113 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/msg.xml @@ -0,0 +1,217 @@ + + + + + + + Message objects XML mapping + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml new file mode 100644 index 000000000..67bba2743 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/process.xml @@ -0,0 +1,82 @@ + + + + + + Process objects XML mapping + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/runtime.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/runtime.xml new file mode 100644 index 000000000..9b1a1c07b --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/runtime.xml @@ -0,0 +1,36 @@ + + + + + + Runtime objects XML mapping + + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/spring.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/spring.xml new file mode 100644 index 000000000..0b73dee77 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/spring.xml @@ -0,0 +1,64 @@ + + + + + + + + + + classpath:org/argeo/slc/castor/common.xml + classpath:org/argeo/slc/castor/msg.xml + classpath:org/argeo/slc/castor/process.xml + classpath:org/argeo/slc/castor/runtime.xml + classpath:org/argeo/slc/castor/structure.xml + classpath:org/argeo/slc/castor/test.xml + classpath:org/argeo/slc/castor/execution.xml + classpath:org/argeo/slc/castor/attachment.xml + + + + + + + + + + + + + + + + + + + diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/structure.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/structure.xml new file mode 100644 index 000000000..ad63a7a3f --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/structure.xml @@ -0,0 +1,51 @@ + + + + Structure related objects XML mapping + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/test.xml b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/test.xml new file mode 100644 index 000000000..45b9bbe0a --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/main/resources/org/argeo/slc/castor/test.xml @@ -0,0 +1,123 @@ + + + + Test objects XML mapping + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/site/apt/index.apt b/runtime/org.argeo.slc.support.castor/src/site/apt/index.apt new file mode 100644 index 000000000..f414460db --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/site/apt/index.apt @@ -0,0 +1 @@ +Argeo SLC Site \ No newline at end of file diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/AbstractCastorTestCase.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/AbstractCastorTestCase.java new file mode 100644 index 000000000..f91ad0b6e --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/AbstractCastorTestCase.java @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * 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 org.argeo.slc.castor; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.unit.AbstractSpringTestCase; +import org.argeo.slc.unit.UnitXmlUtils; +import org.springframework.oxm.Marshaller; +import org.springframework.oxm.Unmarshaller; +import org.springframework.xml.transform.StringResult; +import org.springframework.xml.transform.StringSource; +import org.springframework.xml.validation.XmlValidator; + +public abstract class AbstractCastorTestCase extends AbstractSpringTestCase { + protected Log log = LogFactory.getLog(getClass()); + + private Marshaller marshaller; + private Unmarshaller unmarshaller; + + @Override + public void setUp() { + marshaller = getBean(Marshaller.class); + unmarshaller = getBean(Unmarshaller.class); + } + + protected StringResult marshal(Object obj) throws Exception { + return marshal(obj, false); + } + + protected StringResult marshalAndValidate(Object obj) throws Exception { + return marshal(obj, true); + } + + protected StringResult marshal(Object obj, boolean validate) + throws Exception { + StringResult xml = new StringResult(); + marshaller.marshal(obj, xml); + + log.info("Marshalled " + obj.getClass() + ": " + xml + "\n"); + + if (validate) + UnitXmlUtils.assertXmlValidation(getBean(XmlValidator.class), + new StringSource(xml.toString())); + return xml; + } + + @SuppressWarnings("unchecked") + protected T unmarshal(StringResult xml) throws Exception { + return (T) unmarshaller.unmarshal(new StringSource(xml.toString())); + } + + @SuppressWarnings("unchecked") + protected T marshUnmarsh(Object obj, boolean validate) throws Exception { + StringResult xml = marshal(obj, validate); + return (T) unmarshal(xml); + } + + @SuppressWarnings("unchecked") + protected T marshUnmarsh(Object obj) throws Exception { + return (T) marshUnmarsh(obj, true); + } +} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionAnswerCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionAnswerCastorTest.java new file mode 100644 index 000000000..ea3b55012 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionAnswerCastorTest.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * 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 org.argeo.slc.castor; + +import org.argeo.slc.msg.ExecutionAnswer; + +public class ExecutionAnswerCastorTest extends AbstractCastorTestCase { + public void testMarshUnmarshOk() throws Exception { + ExecutionAnswer answer = new ExecutionAnswer(ExecutionAnswer.OK, + "No problem!"); + ExecutionAnswer answerUnm = marshUnmarsh(answer); + assertExecutionAnswer(answer, answerUnm); + } + + public void testMarshUnmarshError() throws Exception { + ExecutionAnswer answer = new ExecutionAnswer(ExecutionAnswer.ERROR, + "Oooops..."); + ExecutionAnswer answerUnm = marshUnmarsh(answer); + assertExecutionAnswer(answer, answerUnm); + } + + public static void assertExecutionAnswer(ExecutionAnswer expected, + ExecutionAnswer reached) { + assertEquals(expected.getStatus(), reached.getStatus()); + assertEquals(expected.getMessage(), reached.getMessage()); + } +} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java new file mode 100644 index 000000000..b25f52b7b --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ExecutionModuleDescriptorCastorTest.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * 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 org.argeo.slc.castor; + +import java.util.ArrayList; +import java.util.List; + +import org.argeo.slc.execution.ExecutionFlowDescriptor; +import org.argeo.slc.execution.ExecutionModuleDescriptor; +import org.argeo.slc.execution.ExecutionSpec; +import org.argeo.slc.unit.execution.ExecutionFlowDescriptorTestUtils; + +public class ExecutionModuleDescriptorCastorTest extends AbstractCastorTestCase { + public void testMarshUnmarsh() throws Exception { + ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor(); + moduleDescriptor.setName("test.module"); + moduleDescriptor.setVersion("1.0.0"); + moduleDescriptor.setLabel("Test Module"); + moduleDescriptor.setDescription("module descriptor"); + + ExecutionFlowDescriptor flowDescriptor = ExecutionFlowDescriptorTestUtils + .createSimpleExecutionFlowDescriptor(); + + List flows = new ArrayList(); + flows.add(flowDescriptor); + moduleDescriptor.setExecutionFlows(flows); + + List specs = new ArrayList(); + specs.add(flowDescriptor.getExecutionSpec()); + moduleDescriptor.setExecutionSpecs(specs); + + marshUnmarsh(moduleDescriptor, false); + } + + public void testMarshUnmarshMini() throws Exception { + ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor(); + moduleDescriptor.setName("test.moodule"); + moduleDescriptor.setVersion("1.0.0"); + marshUnmarsh(moduleDescriptor, false); + } + +} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ModularDistributionCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ModularDistributionCastorTest.java new file mode 100644 index 000000000..317d01993 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ModularDistributionCastorTest.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * 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 org.argeo.slc.castor; + +import org.argeo.slc.msg.ObjectList; +import org.argeo.slc.msg.build.ModularDistributionDescriptor; + +public class ModularDistributionCastorTest extends AbstractCastorTestCase { + public void testModularDistributionDescriptor() throws Exception { + ModularDistributionDescriptor mdd = new ModularDistributionDescriptor(); + mdd.setName("name"); + mdd.setVersion("0.1.0"); + mdd.getModulesDescriptors().put("eclipse", + "http://localhost/updateSite"); + mdd.getModulesDescriptors().put("modularDistribution", + "http://localhost/modularDistribution"); + + marshUnmarsh(mdd, false); + } + + public void testModularDistributionDescriptorList() throws Exception { + ModularDistributionDescriptor mdd = new ModularDistributionDescriptor(); + mdd.setName("name"); + mdd.setVersion("0.1.0"); + mdd.getModulesDescriptors().put("eclipse", + "http://localhost/updateSite"); + mdd.getModulesDescriptors().put("modularDistribution", + "http://localhost/modularDistribution"); + + ModularDistributionDescriptor mdd2 = new ModularDistributionDescriptor(); + mdd2.setName("name2"); + mdd2.setVersion("0.1.1"); + mdd2.getModulesDescriptors().put("eclipse", + "http://localhost/updateSite2"); + mdd2.getModulesDescriptors().put("modularDistribution", + "http://localhost/modularDistribution2"); + + ObjectList ol = new ObjectList(); + ol.getObjects().add(mdd); + ol.getObjects().add(mdd2); + + marshUnmarsh(ol, false); + } + +} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ObjectListCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ObjectListCastorTest.java new file mode 100644 index 000000000..b01d9a7de --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/ObjectListCastorTest.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * 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 org.argeo.slc.castor; + +import org.argeo.slc.msg.ObjectList; +import org.argeo.slc.runtime.SlcAgentDescriptor; + +public class ObjectListCastorTest extends AbstractCastorTestCase { + + public void testAgentDescriptorList() throws Exception { + SlcAgentDescriptor agentDescriptor = SlcAgentDescriptorCastorTest + .createMiniAgentDescriptor(); + ObjectList lst = new ObjectList(); + lst.getObjects().add(agentDescriptor); + ObjectList lstUnm = (ObjectList) marshUnmarsh(lst, false); + assertEquals(1, lstUnm.getObjects().size()); + } +} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcAgentDescriptorCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcAgentDescriptorCastorTest.java new file mode 100644 index 000000000..0367da70f --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcAgentDescriptorCastorTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * 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 org.argeo.slc.castor; + +import java.util.ArrayList; +import java.util.List; + +import org.argeo.slc.execution.ExecutionModuleDescriptor; +import org.argeo.slc.runtime.SlcAgentDescriptor; + +public class SlcAgentDescriptorCastorTest extends AbstractCastorTestCase { + public void testMarshUnmarshMini() throws Exception { + SlcAgentDescriptor agentDescriptor = createMiniAgentDescriptor(); + SlcAgentDescriptor agentDescriptorUnm = marshUnmarsh(agentDescriptor, + false); + assertSlcAgentDescriptor(agentDescriptor, agentDescriptorUnm); + } + + public void testMarshUnmarshWithModuleDescriptor() throws Exception { + SlcAgentDescriptor agentDescriptor = createMiniAgentDescriptor(); + + List lst = new ArrayList(); + ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor(); + moduleDescriptor.setName("test.moodule"); + moduleDescriptor.setVersion("1.0.0"); + lst.add(moduleDescriptor); + agentDescriptor.setModuleDescriptors(lst); + + SlcAgentDescriptor agentDescriptorUnm = marshUnmarsh(agentDescriptor, + false); + assertSlcAgentDescriptor(agentDescriptor, agentDescriptorUnm); + } + + protected static SlcAgentDescriptor createMiniAgentDescriptor() { + SlcAgentDescriptor agentDescriptor = new SlcAgentDescriptor(); + agentDescriptor.setHost("localhost"); + agentDescriptor.setUuid("555"); + return agentDescriptor; + } + + protected static void assertSlcAgentDescriptor(SlcAgentDescriptor expected, + SlcAgentDescriptor reached) { + assertNotNull(reached); + assertEquals(expected.getHost(), reached.getHost()); + assertEquals(expected.getUuid(), expected.getUuid()); + assertEquals(expected.getModuleDescriptors().size(), reached + .getModuleDescriptors().size()); + } +} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java new file mode 100644 index 000000000..44794e163 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/SlcExecutionCastorTest.java @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * 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 org.argeo.slc.castor; + +import java.text.SimpleDateFormat; +import java.util.UUID; + +import org.argeo.slc.msg.process.SlcExecutionRequest; +import org.argeo.slc.msg.process.SlcExecutionStepsRequest; +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.process.SlcExecutionStep; +import org.argeo.slc.unit.process.SlcExecutionTestUtils; +import org.springframework.xml.transform.StringResult; + +public class SlcExecutionCastorTest extends AbstractCastorTestCase { + public void testMarshalling() throws Exception { + SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution(); + + SlcExecutionRequest msgSave = new SlcExecutionRequest(); + msgSave.setSlcExecution(slcExec); + + StringResult msgSaveXml = marshalAndValidate(msgSave); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + SlcExecutionStep step0 = new SlcExecutionStep(); + step0.setUuid(UUID.randomUUID().toString()); + step0.setTimestamp(sdf.parse("2008-04-17 18:21")); + step0.setType("LOG"); + step0.addLog("A log message\nand another line"); + + SlcExecutionStep step1 = new SlcExecutionStep(); + step1.setUuid(UUID.randomUUID().toString()); + step1.setTimestamp(sdf.parse("2008-04-17 18:25")); + step1.setType("LOG"); + step1.addLog("A nother log message"); + + SlcExecutionStepsRequest msgNotif = new SlcExecutionStepsRequest(); + msgNotif.addStep(step0); + msgNotif.addStep(step1); + msgNotif.setSlcExecutionUuid(slcExec.getUuid()); + + StringResult msgNotifXml = marshalAndValidate(msgNotif); + + SlcExecutionRequest msgSaveUnm = unmarshal(msgSaveXml); + assertNotNull(msgSaveUnm); + SlcExecutionTestUtils.assertSlcExecution(slcExec, msgSaveUnm + .getSlcExecution()); + + SlcExecutionStepsRequest msgNotifUnm = unmarshal(msgNotifXml); + assertNotNull(msgNotifUnm); + assertEquals(slcExec.getUuid(), msgNotifUnm.getSlcExecutionUuid()); + assertEquals(2, msgNotifUnm.getSteps().size()); + SlcExecutionTestUtils.assertSlcExecutionStep(step0, msgNotifUnm + .getSteps().get(0)); + SlcExecutionTestUtils.assertSlcExecutionStep(step1, msgNotifUnm + .getSteps().get(1)); + + SlcExecution slcExecUnm = msgSaveUnm.getSlcExecution(); + slcExecUnm.getSteps().addAll(msgNotifUnm.getSteps()); + + SlcExecutionRequest msgUpdate = new SlcExecutionRequest(); + msgUpdate.setSlcExecution(slcExecUnm); + StringResult msgUpdateXml = marshalAndValidate(msgUpdate); + + SlcExecutionRequest msgUpdateUnm = unmarshal(msgUpdateXml); + assertNotNull(msgUpdateUnm); + } + + public void testMarshUnmarsh() throws Exception { + SlcExecution slcExec = SlcExecutionTestUtils + .createSlcExecutionWithRealizedFlows(); + marshUnmarsh(slcExec, false); + } +} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCastorTest.java new file mode 100644 index 000000000..7d6d6e961 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCastorTest.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * 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 org.argeo.slc.castor; + +import static org.argeo.slc.unit.UnitUtils.assertDateSec; +import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createCompleteTreeTestResult; +import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createSimpleResultPartRequest; + +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest; +import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest; +import org.argeo.slc.msg.test.tree.ResultPartRequest; +import org.argeo.slc.unit.test.tree.UnitTestTreeUtil; +import org.springframework.xml.transform.StringResult; + +public class TreeTestResultCastorTest extends AbstractCastorTestCase { + public void testMarshUnmarsh() throws Exception { + TreeTestResult ttr = createCompleteTreeTestResult(); + + StringResult xml = marshalAndValidate(ttr); + + TreeTestResult ttrUnm = unmarshal(xml); + + UnitTestTreeUtil.assertTreeTestResult(ttr, ttrUnm); + } + + public void testCreateTreeTestResultRequest() throws Exception { + CreateTreeTestResultRequest req = new CreateTreeTestResultRequest(); + req.setTreeTestResult(createCompleteTreeTestResult()); + + StringResult xml = marshalAndValidate(req); + + CreateTreeTestResultRequest reqUnm = unmarshal(xml); + + UnitTestTreeUtil.assertTreeTestResult(req.getTreeTestResult(), reqUnm + .getTreeTestResult()); + } + + public void testResultPartRequest() throws Exception { + TreeTestResult ttr = createCompleteTreeTestResult(); + ResultPartRequest req = createSimpleResultPartRequest(ttr); + + StringResult xml = marshalAndValidate(req); + + ResultPartRequest reqUnm = unmarshal(xml); + + UnitTestTreeUtil + .assertPart(req.getResultPart(), reqUnm.getResultPart()); + } + + public void testCloseTreeTestResultRequest() throws Exception { + TreeTestResult ttr = createCompleteTreeTestResult(); + ttr.close(); + + CloseTreeTestResultRequest req = new CloseTreeTestResultRequest(ttr + .getUuid(), ttr.getCloseDate()); + + StringResult xml = marshalAndValidate(req); + + CloseTreeTestResultRequest reqUnm = unmarshal(xml); + + assertEquals(ttr.getUuid(), reqUnm.getResultUuid()); + assertDateSec(ttr.getCloseDate(), ttr.getCloseDate()); + } +} diff --git a/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCollectionCastorTest.java b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCollectionCastorTest.java new file mode 100644 index 000000000..46fc836e1 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/test/java/org/argeo/slc/castor/TreeTestResultCollectionCastorTest.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * 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 org.argeo.slc.castor; + +import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createCompleteTreeTestResult; + +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.core.test.tree.TreeTestResultCollection; +import org.argeo.slc.unit.test.tree.UnitTestTreeUtil; +import org.springframework.xml.transform.StringResult; + +public class TreeTestResultCollectionCastorTest extends AbstractCastorTestCase { + public void testMarshUnmarsh() throws Exception { + TreeTestResult ttr = createCompleteTreeTestResult(); + TreeTestResult ttr2 = createCompleteTreeTestResult(); + + TreeTestResultCollection ttrc = new TreeTestResultCollection(); + ttrc.setId("testCollection"); + ttrc.getResults().add(ttr); + ttrc.getResults().add(ttr2); + + StringResult xml = marshalAndValidate(ttrc); + + TreeTestResultCollection ttrcUnm = unmarshal(xml); + + assertEquals(ttrc.getId(), ttrcUnm.getId()); + assertEquals(ttrc.getResults().size(), ttrcUnm.getResults().size()); + for (TreeTestResult ttrT : ttrc.getResults()) { + if (ttrT.getUuid().equals(ttr.getUuid())) + UnitTestTreeUtil.assertTreeTestResult(ttr, ttrT); + else + UnitTestTreeUtil.assertTreeTestResult(ttr2, ttrT); + } + } +} diff --git a/runtime/org.argeo.slc.support.castor/src/test/resources/log4j.properties b/runtime/org.argeo.slc.support.castor/src/test/resources/log4j.properties new file mode 100644 index 000000000..0133bab88 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/test/resources/log4j.properties @@ -0,0 +1,22 @@ +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=WARN, console + +## Levels +# Slc +log4j.logger.org.argeo=DEBUG + +# Castor +log4j.logger.org.exolab.castor=WARN + +# Spring +log4j.logger.org.springframework=WARN + + +## Appenders +# A1 is set to be a ConsoleAppender. +log4j.appender.console=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c%n + diff --git a/runtime/org.argeo.slc.support.castor/src/test/resources/org/argeo/slc/castor/applicationContext.xml b/runtime/org.argeo.slc.support.castor/src/test/resources/org/argeo/slc/castor/applicationContext.xml new file mode 100644 index 000000000..c479075b8 --- /dev/null +++ b/runtime/org.argeo.slc.support.castor/src/test/resources/org/argeo/slc/castor/applicationContext.xml @@ -0,0 +1,26 @@ + + + + + + + + \ No newline at end of file diff --git a/runtime/pom.xml b/runtime/pom.xml index d272adeee..97d206be0 100644 --- a/runtime/pom.xml +++ b/runtime/pom.xml @@ -22,6 +22,7 @@ org.argeo.slc.support.maven org.argeo.slc.support.jemmy org.argeo.slc.support.jcr + org.argeo.slc.support.castor org.argeo.slc.detached org.argeo.slc.detached.launcher org.argeo.slc.launcher