--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="src" output="target/classes" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.argeo.slc.support.castor</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+#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
--- /dev/null
+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/
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.argeo.slc</groupId>
+ <artifactId>runtime</artifactId>
+ <version>1.1.3-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.argeo.slc.support.castor</artifactId>
+ <name>SLC Support Castor</name>
+ <description>Implementations of SLC Specs using Castor</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Export-Package>
+ org.argeo.slc.*
+ </Export-Package>
+ <Import-Package>
+ 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,
+ *
+ </Import-Package>
+ <Fragment-Host>org.castor</Fragment-Host>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.argeo.slc</groupId>
+ <artifactId>org.argeo.slc.core</artifactId>
+ <version>1.1.3-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.argeo.tp</groupId>
+ <artifactId>org.springframework.oxm</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.argeo.tp</groupId>
+ <artifactId>org.castor</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.argeo.tp</groupId>
+ <artifactId>org.apache.xerces</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.argeo.tp</groupId>
+ <artifactId>org.apache.xalan</artifactId>
+ </dependency>
+
+ <!-- Unit Tests -->
+ <dependency>
+ <groupId>org.argeo.slc</groupId>
+ <artifactId>org.argeo.slc.unit</artifactId>
+ <scope>test</scope>
+ <version>1.1.3-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
--- /dev/null
+/*
+ * 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));
+ }
+
+}
--- /dev/null
+/*
+ * 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()));
+ }
+
+}
--- /dev/null
+/*
+ * 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);
+ }
+
+}
--- /dev/null
+/*\r
+ * Copyright (C) 2007-2012 Mathieu Baudier\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.argeo.slc.xml.process;\r
+\r
+import java.io.File;\r
+import java.io.FileWriter;\r
+import java.util.HashMap;\r
+import java.util.List;\r
+import java.util.Map;\r
+\r
+import javax.xml.transform.stream.StreamResult;\r
+\r
+import org.apache.commons.io.IOUtils;\r
+import org.argeo.slc.SlcException;\r
+import org.argeo.slc.execution.ExecutionProcess;\r
+import org.argeo.slc.process.SlcExecution;\r
+import org.argeo.slc.process.SlcExecutionNotifier;\r
+import org.argeo.slc.execution.ExecutionStep;\r
+import org.argeo.slc.process.SlcExecutionStep;\r
+import org.springframework.oxm.Marshaller;\r
+\r
+/** @deprecated Probably not even working anymore */\r
+public class FileSlcExecutionNotifier implements SlcExecutionNotifier {\r
+ // private final static SimpleDateFormat sdf = new SimpleDateFormat(\r
+ // "yyyyMMdd-HHmmss");\r
+ //\r
+ // private String basePath;\r
+ private Marshaller marshaller;\r
+\r
+ private Map<String, String> uuidToDir = new HashMap<String, String>();\r
+\r
+ public void addSteps(ExecutionProcess slcExecution,\r
+ List<ExecutionStep> additionalSteps) {\r
+ writeSlcExecution(slcExecution);\r
+ }\r
+\r
+ public void updateStatus(ExecutionProcess slcExecution, String oldStatus,\r
+ String newStatus) {\r
+ writeSlcExecution(slcExecution);\r
+ }\r
+\r
+ protected void writeSlcExecution(ExecutionProcess process) {\r
+ if (!(process instanceof SlcExecution))\r
+ throw new SlcException("Unsupported process type "\r
+ + process.getClass());\r
+ SlcExecution slcExecution = (SlcExecution) process;\r
+ FileWriter out = null;\r
+ try {\r
+ out = new FileWriter(getFilePath(slcExecution));\r
+ marshaller.marshal(slcExecution, new StreamResult(out));\r
+ } catch (Exception e) {\r
+ throw new SlcException("Cannot marshall SlcExecution to "\r
+ + getFilePath(slcExecution), e);\r
+ } finally {\r
+ IOUtils.closeQuietly(out);\r
+ }\r
+ }\r
+\r
+ protected String getFileName(SlcExecution slcExecution) {\r
+ return "SlcExecution-" + slcExecution.getUuid() + ".xml";\r
+ }\r
+\r
+ protected String getFilePath(SlcExecution slcExecution) {\r
+ String dirPath = uuidToDir.get(slcExecution.getUuid());\r
+ return dirPath + File.separator + "SlcExecution-"\r
+ + slcExecution.getUuid() + ".xml";\r
+ }\r
+\r
+ public void setBasePath(String basePath) {\r
+ // this.basePath = basePath;\r
+ }\r
+\r
+ public void setMarshaller(Marshaller marshaller) {\r
+ this.marshaller = marshaller;\r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (C) 2007-2012 Mathieu Baudier\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.argeo.slc.xml.test.tree;\r
+\r
+import java.io.File;\r
+import java.io.FileOutputStream;\r
+import java.io.InputStream;\r
+import java.io.OutputStream;\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
+import javax.xml.parsers.DocumentBuilder;\r
+import javax.xml.parsers.DocumentBuilderFactory;\r
+import javax.xml.transform.Templates;\r
+import javax.xml.transform.Transformer;\r
+import javax.xml.transform.TransformerFactory;\r
+import javax.xml.transform.dom.DOMResult;\r
+import javax.xml.transform.dom.DOMSource;\r
+import javax.xml.transform.stream.StreamResult;\r
+import javax.xml.transform.stream.StreamSource;\r
+\r
+import org.springframework.core.io.Resource;\r
+import org.springframework.oxm.Marshaller;\r
+import org.springframework.xml.transform.StringResult;\r
+import org.w3c.dom.Document;\r
+\r
+import org.apache.commons.io.IOUtils;\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+import org.argeo.slc.SlcException;\r
+import org.argeo.slc.core.test.tree.TreeTestResult;\r
+import org.argeo.slc.test.TestResultListener;\r
+import org.argeo.slc.test.TestResultPart;\r
+\r
+/** Build a report based on a tree test result using an XSLT stylesheet. */\r
+public class XsltReportGenerator implements TestResultListener<TreeTestResult> {\r
+ private final static Log log = LogFactory.getLog(XsltReportGenerator.class);\r
+\r
+ private DocumentBuilder documentBuilder = null;\r
+\r
+ private Resource xsltStyleSheet;\r
+\r
+ private Templates templates;\r
+\r
+ private Marshaller marshaller;\r
+\r
+ private String outputDir;\r
+ private String outputFileExtension = "html";\r
+\r
+ private Boolean logXml = false;\r
+\r
+ private Map<String, String> xsltParameters = new HashMap<String, String>();\r
+\r
+ public void init() {\r
+ if (templates != null)\r
+ return;\r
+\r
+ if (xsltStyleSheet == null)\r
+ throw new SlcException("XSLT style sheet not specified.");\r
+\r
+ InputStream in = null;\r
+ try {\r
+ TransformerFactory transformerFactory = TransformerFactory\r
+ .newInstance();\r
+ in = xsltStyleSheet.getInputStream();\r
+ StreamSource xsltSource = new StreamSource(in);\r
+ templates = transformerFactory.newTemplates(xsltSource);\r
+ } catch (Exception e) {\r
+ throw new SlcException("Could not initialize templates", e);\r
+ } finally {\r
+ IOUtils.closeQuietly(in);\r
+ }\r
+ }\r
+\r
+ public void resultPartAdded(TreeTestResult testResult,\r
+ TestResultPart testResultPart) {\r
+\r
+ }\r
+\r
+ public void close(TreeTestResult testResult) {\r
+ if (templates == null)\r
+ throw new SlcException("XSLT template not initialized");\r
+\r
+ File file = getFile(testResult);\r
+ OutputStream out = null;\r
+\r
+ try {\r
+ Transformer transformer = templates.newTransformer();\r
+ for (String paramKey : xsltParameters.keySet()) {\r
+ transformer\r
+ .setParameter(paramKey, xsltParameters.get(paramKey));\r
+ if (log.isTraceEnabled())\r
+ log.trace("Set XSLT parameter " + paramKey + " to "\r
+ + xsltParameters.get(paramKey));\r
+ }\r
+\r
+ if (documentBuilder == null)\r
+ documentBuilder = DocumentBuilderFactory.newInstance()\r
+ .newDocumentBuilder();\r
+\r
+ Document document = documentBuilder.newDocument();\r
+ DOMResult marshallResult = new DOMResult(document);\r
+ marshaller.marshal(testResult, marshallResult);\r
+\r
+ if (logXml) {\r
+ Transformer identityTransformer = TransformerFactory\r
+ .newInstance().newTransformer();\r
+ StringResult xmlResult = new StringResult();\r
+ identityTransformer.transform(new DOMSource(marshallResult\r
+ .getNode()), xmlResult);\r
+ log.info("Marshalled XML:\n" + xmlResult);\r
+ }\r
+\r
+ DOMSource transfoSource = new DOMSource(marshallResult.getNode());\r
+\r
+ if (outputDir != null) {\r
+ File dir = new File(outputDir);\r
+ dir.mkdirs();\r
+ out = new FileOutputStream(file);\r
+ StreamResult outputResult = new StreamResult(out);\r
+ transformer.transform(transfoSource, outputResult);\r
+ } else {\r
+ // print on console if no output dir\r
+ StringResult result = new StringResult();\r
+ transformer.transform(transfoSource, result);\r
+ log.info("Generated report:\n" + result);\r
+ }\r
+ } catch (Exception e) {\r
+ throw new SlcException(\r
+ "Could not transform test result to " + file, e);\r
+ } finally {\r
+ IOUtils.closeQuietly(out);\r
+ }\r
+ }\r
+\r
+ public Resource getXsltStyleSheet() {\r
+ return xsltStyleSheet;\r
+ }\r
+\r
+ public void setXsltStyleSheet(Resource xsltStyleSheet) {\r
+ this.xsltStyleSheet = xsltStyleSheet;\r
+ }\r
+\r
+ public void setTemplates(Templates templates) {\r
+ this.templates = templates;\r
+ }\r
+\r
+ public void setMarshaller(Marshaller marshaller) {\r
+ this.marshaller = marshaller;\r
+ }\r
+\r
+ public void setOutputDir(String outputDir) {\r
+ this.outputDir = outputDir;\r
+ }\r
+\r
+ public void setOutputFileExtension(String outputFileExtension) {\r
+ this.outputFileExtension = outputFileExtension;\r
+ }\r
+\r
+ protected File getFile(TreeTestResult result) {\r
+ Long time = System.currentTimeMillis();\r
+ return new File(outputDir + File.separator + time + "-"\r
+ + result.getUuid() + "." + outputFileExtension);\r
+ }\r
+\r
+ public void setLogXml(Boolean logXml) {\r
+ this.logXml = logXml;\r
+ }\r
+\r
+ public void setXsltParameters(Map<String, String> xsltParameters) {\r
+ this.xsltParameters = xsltParameters;\r
+ }\r
+\r
+}\r
--- /dev/null
+<?xml version="1.0"?>\r
+<!--\r
+\r
+ Copyright (C) 2007-2012 Mathieu Baudier\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+-->\r
+<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd">\r
+\r
+<mapping>\r
+ <description>Attachment objects XML mapping</description>\r
+\r
+ <class name="org.argeo.slc.core.attachment.SimpleAttachment">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="uuid" type="string" />\r
+ <field name="name" type="string" />\r
+ <field name="contentType" type="string" />\r
+ </class>\r
+\r
+</mapping>
\ No newline at end of file
--- /dev/null
+<?xml version="1.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.
+
+-->
+<mapping>
+ <description>Build objects XML mapping</description>
+
+ <class name="org.argeo.slc.BasicNameVersion">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="name">
+ <bind-xml name="name" node="attribute" />
+ </field>
+ <field name="version">
+ <bind-xml name="version" node="attribute" />
+ </field>
+ </class>
+</mapping>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0"?>\r
+<!--\r
+\r
+ Copyright (C) 2007-2012 Mathieu Baudier\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+-->\r
+<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd">\r
+\r
+<mapping>\r
+ <description>Execution objects XML mapping</description>\r
+\r
+ <class name="org.argeo.slc.execution.ExecutionModuleDescriptor">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="name" />\r
+ <field name="version" />\r
+ <field name="label" />\r
+ <field name="description" />\r
+ <field name="executionFlows" collection="arraylist"\r
+ type="org.argeo.slc.execution.ExecutionFlowDescriptor">\r
+ <bind-xml auto-naming="deriveByClass" location="execution-flows" />\r
+ </field>\r
+ <field name="executionSpecs" collection="arraylist"\r
+ type="org.argeo.slc.execution.ExecutionSpec">\r
+ <bind-xml auto-naming="deriveByClass" location="execution-specs" />\r
+ </field>\r
+ </class>\r
+\r
+ <class name="org.argeo.slc.execution.ExecutionFlowDescriptor">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="name" identity="true">\r
+ <bind-xml name="name" node="attribute" />\r
+ </field>\r
+ <field name="path">\r
+ <bind-xml name="path" node="attribute" />\r
+ </field>\r
+ <field name="executionSpec">\r
+ <bind-xml name="executionSpec" node="attribute" reference="true" />\r
+ </field>\r
+ <field name="values" collection="map">\r
+ <bind-xml name="value" location="values">\r
+ <class name="org.exolab.castor.mapping.MapItem">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="key" type="string">\r
+ <bind-xml name="key" node="attribute" />\r
+ </field>\r
+ <field name="value"\r
+ type="org.argeo.slc.core.execution.AbstractExecutionValue">\r
+ <bind-xml auto-naming="deriveByClass" />\r
+ </field>\r
+ </class>\r
+ </bind-xml>\r
+ </field>\r
+ </class>\r
+\r
+ <!-- Specs -->\r
+ <class name="org.argeo.slc.core.execution.DefaultExecutionSpec">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="name" identity="true">\r
+ <bind-xml name="name" node="attribute" />\r
+ </field>\r
+ <field name="attributes" collection="map">\r
+ <bind-xml name="value" location="values">\r
+ <class name="org.exolab.castor.mapping.MapItem">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="key" type="string">\r
+ <bind-xml name="key" node="attribute" />\r
+ </field>\r
+ <field name="value"\r
+ type="org.argeo.slc.core.execution.AbstractSpecAttribute">\r
+ <bind-xml auto-naming="deriveByClass" />\r
+ </field>\r
+ </class>\r
+ </bind-xml>\r
+ </field>\r
+ </class>\r
+\r
+ <class name="org.argeo.slc.core.execution.AbstractSpecAttribute">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="isParameter">\r
+ <bind-xml name="isParameter" node="attribute" />\r
+ </field>\r
+ <field name="isFrozen">\r
+ <bind-xml name="isFrozen" node="attribute" />\r
+ </field>\r
+ <field name="isHidden">\r
+ <bind-xml name="isHidden" node="attribute" />\r
+ </field>\r
+ </class>\r
+\r
+ <class name="org.argeo.slc.core.execution.PrimitiveSpecAttribute"\r
+ extends="org.argeo.slc.core.execution.AbstractSpecAttribute">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="type">\r
+ <bind-xml name="type" node="attribute" />\r
+ </field>\r
+ <field name="value" type="string"\r
+ handler="org.argeo.slc.castor.execution.PrimitiveFieldHandler">\r
+ <bind-xml node="text" />\r
+ </field>\r
+ </class>\r
+\r
+ <class name="org.argeo.slc.core.execution.RefSpecAttribute"\r
+ extends="org.argeo.slc.core.execution.AbstractSpecAttribute">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="targetClassName">\r
+ <bind-xml name="targetClassName" node="attribute" />\r
+ </field>\r
+ <field name="choices" collection="arraylist"\r
+ type="org.argeo.slc.core.execution.RefValueChoice">\r
+ <bind-xml auto-naming="deriveByClass" location="choices" />\r
+ </field>\r
+ </class>\r
+\r
+ <!-- Values -->\r
+ <class name="org.argeo.slc.core.execution.AbstractExecutionValue">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ </class>\r
+\r
+ <class name="org.argeo.slc.core.execution.PrimitiveValue"\r
+ extends="org.argeo.slc.core.execution.AbstractExecutionValue">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="type">\r
+ <bind-xml name="type" node="attribute" />\r
+ </field>\r
+ <field name="value" type="string"\r
+ handler="org.argeo.slc.castor.execution.PrimitiveFieldHandler">\r
+ <bind-xml node="text" />\r
+ </field>\r
+ </class>\r
+\r
+ <class name="org.argeo.slc.core.execution.RefValue" extends="org.argeo.slc.core.execution.AbstractExecutionValue">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="ref">\r
+ <bind-xml name="ref" node="attribute" />\r
+ </field>\r
+ <field name="type">\r
+ <bind-xml name="type" node="attribute" />\r
+ </field>\r
+ </class>\r
+\r
+ <class name="org.argeo.slc.core.execution.RefValueChoice">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="name">\r
+ <bind-xml name="name" node="attribute" />\r
+ </field>\r
+ <field name="description" />\r
+ </class>\r
+</mapping>
\ No newline at end of file
--- /dev/null
+<?xml version="1.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.
+
+-->
+<!-- Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org> 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. -->
+
+
+<mapping>
+ <description>Message objects XML mapping</description>
+
+ <!-- TODO: use XML entities to factorize patterns -->
+
+ <!-- BASIC -->
+ <class name="org.argeo.slc.msg.ExecutionAnswer">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="status" />
+ <field name="message" />
+ </class>
+
+ <class name="org.argeo.slc.msg.ReferenceList">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="references" collection="arraylist" type="string">
+ <bind-xml name="ref" />
+ </field>
+ </class>
+
+ <class name="org.argeo.slc.msg.ObjectList">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="objects" collection="arraylist" type="java.io.Serializable">
+ <bind-xml auto-naming="deriveByClass" />
+ </field>
+ </class>
+
+ <!-- BUILD -->
+ <class name="org.argeo.slc.msg.build.ModularDistributionDescriptor"
+ extends="org.argeo.slc.BasicNameVersion">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="modulesDescriptors" collection="map">
+ <bind-xml name="modulesDescriptor" location="modulesDescriptors">
+ <class name="org.exolab.castor.mapping.MapItem">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="key" type="string">
+ <bind-xml name="type" node="attribute" />
+ </field>
+ <field name="value" type="string">
+ <bind-xml name="url" node="attribute" />
+ </field>
+ </class>
+ </bind-xml>
+ </field>
+ </class>
+
+ <!-- TESTS -->
+ <class name="org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="treeTestResult" type="org.argeo.slc.core.test.tree.TreeTestResult" />
+ <field name="testRunDescriptor" />
+ </class>
+
+ <class name="org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="resultUuid" />
+ <field name="closeDate" />
+ </class>
+
+ <class name="org.argeo.slc.msg.test.tree.AddTreeTestResultAttachmentRequest">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="resultUuid" />
+ <field name="attachment" type="org.argeo.slc.core.attachment.SimpleAttachment">
+ <bind-xml auto-naming="deriveByClass" />
+ </field>
+ </class>
+
+ <class name="org.argeo.slc.msg.test.tree.ResultPartRequest">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="resultUuid" />
+ <field name="resultPart" type="org.argeo.slc.core.test.SimpleResultPart">
+ <bind-xml auto-naming="deriveByClass" />
+ </field>
+
+ <field name="relatedElements" collection="map">
+ <bind-xml name="element" location="related-elements">
+ <class name="org.exolab.castor.mapping.MapItem">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="key" type="org.argeo.slc.core.structure.tree.TreeSPath"
+ handler="org.argeo.slc.castor.structure.tree.TreeSPathFieldHandler">
+ <bind-xml name="path" node="attribute" />
+ </field>
+ <field name="value" type="org.argeo.slc.core.structure.SimpleSElement">
+ <bind-xml auto-naming="deriveByClass" />
+ </field>
+ </class>
+ </bind-xml>
+ </field>
+ <field name="path">
+ <bind-xml auto-naming="deriveByClass" />
+ </field>
+ <field name="testRunDescriptor" />
+ <field name="attributes" collection="hashtable">
+ <bind-xml name="attribute" location="attributes">
+ <class name="org.exolab.castor.mapping.MapItem">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="key" type="string">
+ <bind-xml name="name" node="attribute" />
+ </field>
+ <field name="value" type="string">
+ <bind-xml node="text" />
+ </field>
+ </class>
+ </bind-xml>
+ </field>
+ </class>
+
+ <class name="org.argeo.slc.core.test.tree.ResultAttributes">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="uuid" />
+ <field name="closeDate" />
+ <field name="attributes" collection="hashtable">
+ <bind-xml name="attribute" location="attributes">
+ <class name="org.exolab.castor.mapping.MapItem">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="key" type="string">
+ <bind-xml name="name" node="attribute" />
+ </field>
+ <field name="value" type="string">
+ <bind-xml node="text" />
+ </field>
+ </class>
+ </bind-xml>
+ </field>
+ <field name="attachments" collection="arraylist"
+ type="org.argeo.slc.core.attachment.SimpleAttachment">
+ <bind-xml auto-naming="deriveByClass" location="attachments" />
+ </field>
+ </class>
+
+
+ <!-- PROCESS -->
+ <class name="org.argeo.slc.msg.process.SlcExecutionStepsRequest">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="slcExecutionUuid" />
+ <field name="steps" collection="arraylist"
+ type="org.argeo.slc.process.SlcExecutionStep">
+ <bind-xml auto-naming="deriveByClass" location="steps" />
+ </field>
+ </class>
+
+ <class name="org.argeo.slc.msg.process.SlcExecutionStatusRequest">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="slcExecutionUuid" />
+ <field name="newStatus" />
+ </class>
+
+ <class name="org.argeo.slc.msg.process.SlcExecutionRequest">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="slcExecution" type="org.argeo.slc.process.SlcExecution" />
+ </class>
+
+ <!-- EVENTS -->
+
+ <class name="org.argeo.slc.msg.event.SlcEvent">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="headers" collection="map">
+ <bind-xml name="header" location="headers">
+ <class name="org.exolab.castor.mapping.MapItem">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="key" type="string">
+ <bind-xml name="name" node="attribute" />
+ </field>
+ <field name="value" type="string">
+ <bind-xml node="text" />
+ </field>
+ </class>
+ </bind-xml>
+ </field>
+ </class>
+
+</mapping>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0"?>\r
+<!--\r
+\r
+ Copyright (C) 2007-2012 Mathieu Baudier\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+-->\r
+<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd">\r
+\r
+<mapping>\r
+ <description>Process objects XML mapping</description>\r
+\r
+ <class name="org.argeo.slc.process.SlcExecution">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="uuid" identity="true">\r
+ <bind-xml node="attribute" />\r
+ </field>\r
+ <field name="status" />\r
+ <field name="type" />\r
+ <field name="host" />\r
+ <field name="user" />\r
+ <field name="realizedFlows" collection="arraylist"\r
+ type="org.argeo.slc.process.RealizedFlow">\r
+ <bind-xml auto-naming="deriveByClass" location="realized-flows" />\r
+ </field>\r
+ <field name="steps" collection="arraylist"\r
+ type="org.argeo.slc.process.SlcExecutionStep">\r
+ <bind-xml auto-naming="deriveByClass" location="steps" />\r
+ </field>\r
+ <field name="attributes" collection="map">\r
+ <bind-xml name="attribute" location="attributes">\r
+ <class name="org.exolab.castor.mapping.MapItem">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="key" type="string">\r
+ <bind-xml name="name" node="attribute" />\r
+ </field>\r
+ <field name="value" type="string">\r
+ <bind-xml node="text" />\r
+ </field>\r
+ </class>\r
+ </bind-xml>\r
+ </field>\r
+ </class>\r
+\r
+ <class name="org.argeo.slc.process.RealizedFlow">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="moduleName"/>\r
+ <field name="moduleVersion" />\r
+ <field name="flowDescriptor">\r
+ <bind-xml auto-naming="deriveByClass" />\r
+ </field>\r
+ </class>\r
+\r
+ <class name="org.argeo.slc.process.SlcExecutionStep">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="uuid" identity="true">\r
+ <bind-xml node="attribute" />\r
+ </field>\r
+ <field name="type" />\r
+ <field name="thread" />\r
+ <field name="timestamp" />\r
+ <field name="logLines" collection="arraylist" type="string">\r
+ <bind-xml name="log-line" location="log-lines" />\r
+ </field>\r
+ </class>\r
+\r
+</mapping>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0"?>\r
+<!--\r
+\r
+ Copyright (C) 2007-2012 Mathieu Baudier\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+-->\r
+<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd">\r
+\r
+<mapping>\r
+ <description>Runtime objects XML mapping</description>\r
+\r
+ <class name="org.argeo.slc.runtime.SlcAgentDescriptor">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="uuid" identity="true">\r
+ <bind-xml node="attribute" />\r
+ </field>\r
+ <field name="host" />\r
+ <field name="moduleDescriptors" collection="arraylist"\r
+ type="org.argeo.slc.execution.ExecutionModuleDescriptor">\r
+ <bind-xml auto-naming="deriveByClass" />\r
+ </field>\r
+ </class>\r
+</mapping>
\ No newline at end of file
--- /dev/null
+<!--
+
+ 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.
+
+-->
+
+<!-- Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org> 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. -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
+ default-lazy-init="true">
+
+ <bean id="slcDefault.castor.marshaller" class="org.springframework.oxm.castor.CastorMarshaller">
+ <property name="mappingLocations">
+ <list>
+ <value>classpath:org/argeo/slc/castor/common.xml</value>
+ <value>classpath:org/argeo/slc/castor/msg.xml</value>
+ <value>classpath:org/argeo/slc/castor/process.xml</value>
+ <value>classpath:org/argeo/slc/castor/runtime.xml</value>
+ <value>classpath:org/argeo/slc/castor/structure.xml</value>
+ <value>classpath:org/argeo/slc/castor/test.xml</value>
+ <value>classpath:org/argeo/slc/castor/execution.xml</value>
+ <value>classpath:org/argeo/slc/castor/attachment.xml</value>
+ </list>
+ </property>
+ <property name="whitespacePreserve" value="true" />
+ <property name="encoding" value="UTF-8" />
+ </bean>
+
+ <bean id="slcDefault.castor.xsltReportGenerator" class="org.argeo.slc.xml.test.tree.XsltReportGenerator"
+ init-method="init">
+ <property name="xsltStyleSheet"
+ value="classpath:/org/argeo/slc/core/test/tree/basicReport.xslt" />
+ <property name="marshaller" ref="slcDefault.castor.marshaller" />
+ <property name="logXml" value="false" />
+ <property name="outputDir" value="${user.dir}/results/html" />
+ </bean>
+
+ <bean name="slcDefault.castor.fileSlcExecutionNotifier" class="org.argeo.slc.xml.process.FileSlcExecutionNotifier">
+ <property name="basePath" value="${user.dir}/process" />
+ <property name="marshaller" ref="slcDefault.castor.marshaller" />
+ </bean>
+
+</beans>
--- /dev/null
+<?xml version="1.0"?>\r
+<!--\r
+\r
+ Copyright (C) 2007-2012 Mathieu Baudier\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+-->\r
+<mapping>\r
+ <description>Structure related objects XML mapping</description>\r
+\r
+ <class name="org.argeo.slc.core.structure.tree.TreeSPath"\r
+ auto-complete="false">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="asUniqueString" type="string">\r
+ <bind-xml node="attribute" />\r
+ </field>\r
+ </class>\r
+\r
+ <class name="org.argeo.slc.core.structure.SimpleSElement"\r
+ auto-complete="false">\r
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
+ ns-prefix="slc" />\r
+ <field name="label" type="string" />\r
+ <field name="tags" collection="map">\r
+ <bind-xml name="tag" location="tags">\r
+ <class name="org.exolab.castor.mapping.MapItem">\r
+ <map-to\r
+ ns-uri="http://argeo.org/projects/slc/schemas" ns-prefix="slc" />\r
+ <field name="key" type="string">\r
+ <bind-xml name="name" node="attribute" />\r
+ </field>\r
+ <field name="value" type="string">\r
+ <bind-xml name="tag-value" />\r
+ </field>\r
+ </class>\r
+ </bind-xml>\r
+ </field>\r
+ </class>\r
+</mapping>
\ No newline at end of file
--- /dev/null
+<?xml version="1.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.
+
+-->
+<mapping>
+ <description>Test objects XML mapping</description>
+
+ <class name="org.argeo.slc.test.TestRunDescriptor" auto-complete="false">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="testRunUuid" />
+ <field name="slcExecutionUuid" />
+ <field name="slcExecutionStepUuid" />
+ <field name="testResultUuid" />
+ <field name="deployedSytemId" />
+ </class>
+
+ <class name="org.argeo.slc.core.test.tree.TreeTestResult"
+ auto-complete="false">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="uuid" type="string">
+ <bind-xml name="uuid" node="attribute" />
+ </field>
+ <field name="closeDate" />
+ <field name="attributes" collection="map">
+ <bind-xml name="attribute" location="attributes">
+ <class name="org.exolab.castor.mapping.MapItem">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="key" type="string">
+ <bind-xml name="name" node="attribute" />
+ </field>
+ <field name="value" type="string">
+ <bind-xml node="text" />
+ </field>
+ </class>
+ </bind-xml>
+ </field>
+ <field name="resultParts" collection="sortedmap">
+ <bind-xml name="result-part" location="result-parts">
+ <class name="org.exolab.castor.mapping.MapItem">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="key" type="org.argeo.slc.core.structure.tree.TreeSPath"
+ handler="org.argeo.slc.castor.structure.tree.TreeSPathFieldHandler">
+ <bind-xml name="path" node="attribute" />
+ </field>
+ <field name="value" type="org.argeo.slc.core.test.tree.PartSubList">
+ <bind-xml name="part-sub-list" />
+ </field>
+ </class>
+ </bind-xml>
+ </field>
+ <field name="elements" collection="sortedmap">
+ <bind-xml name="element" location="elements">
+ <class name="org.exolab.castor.mapping.MapItem">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="key" type="org.argeo.slc.core.structure.tree.TreeSPath"
+ handler="org.argeo.slc.castor.structure.tree.TreeSPathFieldHandler">
+ <bind-xml name="path" node="attribute" />
+ </field>
+ <field name="value" type="org.argeo.slc.core.structure.SimpleSElement">
+ <bind-xml auto-naming="deriveByClass" />
+ </field>
+ </class>
+ </bind-xml>
+ </field>
+ <field name="attachments" collection="arraylist"
+ type="org.argeo.slc.core.attachment.SimpleAttachment">
+ <bind-xml auto-naming="deriveByClass" location="attachments" />
+ </field>
+ </class>
+
+ <class name="org.argeo.slc.core.test.tree.PartSubList"
+ auto-complete="false">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="parts" collection="arraylist"
+ type="org.argeo.slc.core.test.SimpleResultPart">
+ <bind-xml auto-naming="deriveByClass" location="parts" />
+ </field>
+ </class>
+
+ <class name="org.argeo.slc.core.test.SimpleResultPart"
+ auto-complete="false">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="testRunUuid" type="string" />
+ <field name="message" type="string" />
+ <field name="status" type="string"
+ handler="org.argeo.slc.castor.test.tree.StatusFieldHandler" />
+ <field name="exceptionMessage" type="string" />
+ </class>
+
+ <class name="org.argeo.slc.core.test.tree.TreeTestResultCollection"
+ auto-complete="false">
+ <map-to ns-uri="http://argeo.org/projects/slc/schemas"
+ ns-prefix="slc" />
+ <field name="id" type="string">
+ <bind-xml name="id" node="attribute" />
+ </field>
+ <field name="results" collection="set"
+ type="org.argeo.slc.core.test.tree.TreeTestResult">
+ <bind-xml auto-naming="deriveByClass" location="results" />
+ </field>
+ </class>
+</mapping>
\ No newline at end of file
--- /dev/null
+Argeo SLC Site
\ No newline at end of file
--- /dev/null
+/*
+ * 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> T unmarshal(StringResult xml) throws Exception {
+ return (T) unmarshaller.unmarshal(new StringSource(xml.toString()));
+ }
+
+ @SuppressWarnings("unchecked")
+ protected <T> T marshUnmarsh(Object obj, boolean validate) throws Exception {
+ StringResult xml = marshal(obj, validate);
+ return (T) unmarshal(xml);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected <T> T marshUnmarsh(Object obj) throws Exception {
+ return (T) marshUnmarsh(obj, true);
+ }
+}
--- /dev/null
+/*\r
+ * Copyright (C) 2007-2012 Mathieu Baudier\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.argeo.slc.castor;\r
+\r
+import org.argeo.slc.msg.ExecutionAnswer;\r
+\r
+public class ExecutionAnswerCastorTest extends AbstractCastorTestCase {\r
+ public void testMarshUnmarshOk() throws Exception {\r
+ ExecutionAnswer answer = new ExecutionAnswer(ExecutionAnswer.OK,\r
+ "No problem!");\r
+ ExecutionAnswer answerUnm = marshUnmarsh(answer);\r
+ assertExecutionAnswer(answer, answerUnm);\r
+ }\r
+\r
+ public void testMarshUnmarshError() throws Exception {\r
+ ExecutionAnswer answer = new ExecutionAnswer(ExecutionAnswer.ERROR,\r
+ "Oooops...");\r
+ ExecutionAnswer answerUnm = marshUnmarsh(answer);\r
+ assertExecutionAnswer(answer, answerUnm);\r
+ }\r
+\r
+ public static void assertExecutionAnswer(ExecutionAnswer expected,\r
+ ExecutionAnswer reached) {\r
+ assertEquals(expected.getStatus(), reached.getStatus());\r
+ assertEquals(expected.getMessage(), reached.getMessage());\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (C) 2007-2012 Mathieu Baudier\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.argeo.slc.castor;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.argeo.slc.execution.ExecutionFlowDescriptor;\r
+import org.argeo.slc.execution.ExecutionModuleDescriptor;\r
+import org.argeo.slc.execution.ExecutionSpec;\r
+import org.argeo.slc.unit.execution.ExecutionFlowDescriptorTestUtils;\r
+\r
+public class ExecutionModuleDescriptorCastorTest extends AbstractCastorTestCase {\r
+ public void testMarshUnmarsh() throws Exception {\r
+ ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor();\r
+ moduleDescriptor.setName("test.module");\r
+ moduleDescriptor.setVersion("1.0.0");\r
+ moduleDescriptor.setLabel("Test Module");\r
+ moduleDescriptor.setDescription("module descriptor");\r
+\r
+ ExecutionFlowDescriptor flowDescriptor = ExecutionFlowDescriptorTestUtils\r
+ .createSimpleExecutionFlowDescriptor();\r
+\r
+ List<ExecutionFlowDescriptor> flows = new ArrayList<ExecutionFlowDescriptor>();\r
+ flows.add(flowDescriptor);\r
+ moduleDescriptor.setExecutionFlows(flows);\r
+\r
+ List<ExecutionSpec> specs = new ArrayList<ExecutionSpec>();\r
+ specs.add(flowDescriptor.getExecutionSpec());\r
+ moduleDescriptor.setExecutionSpecs(specs);\r
+\r
+ marshUnmarsh(moduleDescriptor, false);\r
+ }\r
+\r
+ public void testMarshUnmarshMini() throws Exception {\r
+ ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor();\r
+ moduleDescriptor.setName("test.moodule");\r
+ moduleDescriptor.setVersion("1.0.0");\r
+ marshUnmarsh(moduleDescriptor, false);\r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (C) 2007-2012 Mathieu Baudier\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.argeo.slc.castor;\r
+\r
+import org.argeo.slc.msg.ObjectList;\r
+import org.argeo.slc.msg.build.ModularDistributionDescriptor;\r
+\r
+public class ModularDistributionCastorTest extends AbstractCastorTestCase {\r
+ public void testModularDistributionDescriptor() throws Exception {\r
+ ModularDistributionDescriptor mdd = new ModularDistributionDescriptor();\r
+ mdd.setName("name");\r
+ mdd.setVersion("0.1.0");\r
+ mdd.getModulesDescriptors().put("eclipse",\r
+ "http://localhost/updateSite");\r
+ mdd.getModulesDescriptors().put("modularDistribution",\r
+ "http://localhost/modularDistribution");\r
+\r
+ marshUnmarsh(mdd, false);\r
+ }\r
+\r
+ public void testModularDistributionDescriptorList() throws Exception {\r
+ ModularDistributionDescriptor mdd = new ModularDistributionDescriptor();\r
+ mdd.setName("name");\r
+ mdd.setVersion("0.1.0");\r
+ mdd.getModulesDescriptors().put("eclipse",\r
+ "http://localhost/updateSite");\r
+ mdd.getModulesDescriptors().put("modularDistribution",\r
+ "http://localhost/modularDistribution");\r
+\r
+ ModularDistributionDescriptor mdd2 = new ModularDistributionDescriptor();\r
+ mdd2.setName("name2");\r
+ mdd2.setVersion("0.1.1");\r
+ mdd2.getModulesDescriptors().put("eclipse",\r
+ "http://localhost/updateSite2");\r
+ mdd2.getModulesDescriptors().put("modularDistribution",\r
+ "http://localhost/modularDistribution2");\r
+\r
+ ObjectList ol = new ObjectList();\r
+ ol.getObjects().add(mdd);\r
+ ol.getObjects().add(mdd2);\r
+\r
+ marshUnmarsh(ol, false);\r
+ }\r
+\r
+}\r
--- /dev/null
+/*
+ * 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());
+ }
+}
--- /dev/null
+/*\r
+ * Copyright (C) 2007-2012 Mathieu Baudier\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.argeo.slc.castor;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.argeo.slc.execution.ExecutionModuleDescriptor;\r
+import org.argeo.slc.runtime.SlcAgentDescriptor;\r
+\r
+public class SlcAgentDescriptorCastorTest extends AbstractCastorTestCase {\r
+ public void testMarshUnmarshMini() throws Exception {\r
+ SlcAgentDescriptor agentDescriptor = createMiniAgentDescriptor();\r
+ SlcAgentDescriptor agentDescriptorUnm = marshUnmarsh(agentDescriptor,\r
+ false);\r
+ assertSlcAgentDescriptor(agentDescriptor, agentDescriptorUnm);\r
+ }\r
+\r
+ public void testMarshUnmarshWithModuleDescriptor() throws Exception {\r
+ SlcAgentDescriptor agentDescriptor = createMiniAgentDescriptor();\r
+\r
+ List<ExecutionModuleDescriptor> lst = new ArrayList<ExecutionModuleDescriptor>();\r
+ ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor();\r
+ moduleDescriptor.setName("test.moodule");\r
+ moduleDescriptor.setVersion("1.0.0");\r
+ lst.add(moduleDescriptor);\r
+ agentDescriptor.setModuleDescriptors(lst);\r
+\r
+ SlcAgentDescriptor agentDescriptorUnm = marshUnmarsh(agentDescriptor,\r
+ false);\r
+ assertSlcAgentDescriptor(agentDescriptor, agentDescriptorUnm);\r
+ }\r
+\r
+ protected static SlcAgentDescriptor createMiniAgentDescriptor() {\r
+ SlcAgentDescriptor agentDescriptor = new SlcAgentDescriptor();\r
+ agentDescriptor.setHost("localhost");\r
+ agentDescriptor.setUuid("555");\r
+ return agentDescriptor;\r
+ }\r
+\r
+ protected static void assertSlcAgentDescriptor(SlcAgentDescriptor expected,\r
+ SlcAgentDescriptor reached) {\r
+ assertNotNull(reached);\r
+ assertEquals(expected.getHost(), reached.getHost());\r
+ assertEquals(expected.getUuid(), expected.getUuid());\r
+ assertEquals(expected.getModuleDescriptors().size(), reached\r
+ .getModuleDescriptors().size());\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (C) 2007-2012 Mathieu Baudier\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.argeo.slc.castor;\r
+\r
+import java.text.SimpleDateFormat;\r
+import java.util.UUID;\r
+\r
+import org.argeo.slc.msg.process.SlcExecutionRequest;\r
+import org.argeo.slc.msg.process.SlcExecutionStepsRequest;\r
+import org.argeo.slc.process.SlcExecution;\r
+import org.argeo.slc.process.SlcExecutionStep;\r
+import org.argeo.slc.unit.process.SlcExecutionTestUtils;\r
+import org.springframework.xml.transform.StringResult;\r
+\r
+public class SlcExecutionCastorTest extends AbstractCastorTestCase {\r
+ public void testMarshalling() throws Exception {\r
+ SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution();\r
+\r
+ SlcExecutionRequest msgSave = new SlcExecutionRequest();\r
+ msgSave.setSlcExecution(slcExec);\r
+\r
+ StringResult msgSaveXml = marshalAndValidate(msgSave);\r
+\r
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");\r
+ SlcExecutionStep step0 = new SlcExecutionStep();\r
+ step0.setUuid(UUID.randomUUID().toString());\r
+ step0.setTimestamp(sdf.parse("2008-04-17 18:21"));\r
+ step0.setType("LOG");\r
+ step0.addLog("A log message\nand another line");\r
+\r
+ SlcExecutionStep step1 = new SlcExecutionStep();\r
+ step1.setUuid(UUID.randomUUID().toString());\r
+ step1.setTimestamp(sdf.parse("2008-04-17 18:25"));\r
+ step1.setType("LOG");\r
+ step1.addLog("A nother log message");\r
+\r
+ SlcExecutionStepsRequest msgNotif = new SlcExecutionStepsRequest();\r
+ msgNotif.addStep(step0);\r
+ msgNotif.addStep(step1);\r
+ msgNotif.setSlcExecutionUuid(slcExec.getUuid());\r
+\r
+ StringResult msgNotifXml = marshalAndValidate(msgNotif);\r
+\r
+ SlcExecutionRequest msgSaveUnm = unmarshal(msgSaveXml);\r
+ assertNotNull(msgSaveUnm);\r
+ SlcExecutionTestUtils.assertSlcExecution(slcExec, msgSaveUnm\r
+ .getSlcExecution());\r
+\r
+ SlcExecutionStepsRequest msgNotifUnm = unmarshal(msgNotifXml);\r
+ assertNotNull(msgNotifUnm);\r
+ assertEquals(slcExec.getUuid(), msgNotifUnm.getSlcExecutionUuid());\r
+ assertEquals(2, msgNotifUnm.getSteps().size());\r
+ SlcExecutionTestUtils.assertSlcExecutionStep(step0, msgNotifUnm\r
+ .getSteps().get(0));\r
+ SlcExecutionTestUtils.assertSlcExecutionStep(step1, msgNotifUnm\r
+ .getSteps().get(1));\r
+\r
+ SlcExecution slcExecUnm = msgSaveUnm.getSlcExecution();\r
+ slcExecUnm.getSteps().addAll(msgNotifUnm.getSteps());\r
+\r
+ SlcExecutionRequest msgUpdate = new SlcExecutionRequest();\r
+ msgUpdate.setSlcExecution(slcExecUnm);\r
+ StringResult msgUpdateXml = marshalAndValidate(msgUpdate);\r
+\r
+ SlcExecutionRequest msgUpdateUnm = unmarshal(msgUpdateXml);\r
+ assertNotNull(msgUpdateUnm);\r
+ }\r
+\r
+ public void testMarshUnmarsh() throws Exception {\r
+ SlcExecution slcExec = SlcExecutionTestUtils\r
+ .createSlcExecutionWithRealizedFlows();\r
+ marshUnmarsh(slcExec, false);\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (C) 2007-2012 Mathieu Baudier\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.argeo.slc.castor;\r
+\r
+import static org.argeo.slc.unit.UnitUtils.assertDateSec;\r
+import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createCompleteTreeTestResult;\r
+import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createSimpleResultPartRequest;\r
+\r
+import org.argeo.slc.core.test.tree.TreeTestResult;\r
+import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest;\r
+import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest;\r
+import org.argeo.slc.msg.test.tree.ResultPartRequest;\r
+import org.argeo.slc.unit.test.tree.UnitTestTreeUtil;\r
+import org.springframework.xml.transform.StringResult;\r
+\r
+public class TreeTestResultCastorTest extends AbstractCastorTestCase {\r
+ public void testMarshUnmarsh() throws Exception {\r
+ TreeTestResult ttr = createCompleteTreeTestResult();\r
+\r
+ StringResult xml = marshalAndValidate(ttr);\r
+\r
+ TreeTestResult ttrUnm = unmarshal(xml);\r
+\r
+ UnitTestTreeUtil.assertTreeTestResult(ttr, ttrUnm);\r
+ }\r
+\r
+ public void testCreateTreeTestResultRequest() throws Exception {\r
+ CreateTreeTestResultRequest req = new CreateTreeTestResultRequest();\r
+ req.setTreeTestResult(createCompleteTreeTestResult());\r
+\r
+ StringResult xml = marshalAndValidate(req);\r
+\r
+ CreateTreeTestResultRequest reqUnm = unmarshal(xml);\r
+\r
+ UnitTestTreeUtil.assertTreeTestResult(req.getTreeTestResult(), reqUnm\r
+ .getTreeTestResult());\r
+ }\r
+\r
+ public void testResultPartRequest() throws Exception {\r
+ TreeTestResult ttr = createCompleteTreeTestResult();\r
+ ResultPartRequest req = createSimpleResultPartRequest(ttr);\r
+\r
+ StringResult xml = marshalAndValidate(req);\r
+\r
+ ResultPartRequest reqUnm = unmarshal(xml);\r
+\r
+ UnitTestTreeUtil\r
+ .assertPart(req.getResultPart(), reqUnm.getResultPart());\r
+ }\r
+\r
+ public void testCloseTreeTestResultRequest() throws Exception {\r
+ TreeTestResult ttr = createCompleteTreeTestResult();\r
+ ttr.close();\r
+\r
+ CloseTreeTestResultRequest req = new CloseTreeTestResultRequest(ttr\r
+ .getUuid(), ttr.getCloseDate());\r
+\r
+ StringResult xml = marshalAndValidate(req);\r
+\r
+ CloseTreeTestResultRequest reqUnm = unmarshal(xml);\r
+\r
+ assertEquals(ttr.getUuid(), reqUnm.getResultUuid());\r
+ assertDateSec(ttr.getCloseDate(), ttr.getCloseDate());\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (C) 2007-2012 Mathieu Baudier\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.argeo.slc.castor;\r
+\r
+import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createCompleteTreeTestResult;\r
+\r
+import org.argeo.slc.core.test.tree.TreeTestResult;\r
+import org.argeo.slc.core.test.tree.TreeTestResultCollection;\r
+import org.argeo.slc.unit.test.tree.UnitTestTreeUtil;\r
+import org.springframework.xml.transform.StringResult;\r
+\r
+public class TreeTestResultCollectionCastorTest extends AbstractCastorTestCase {\r
+ public void testMarshUnmarsh() throws Exception {\r
+ TreeTestResult ttr = createCompleteTreeTestResult();\r
+ TreeTestResult ttr2 = createCompleteTreeTestResult();\r
+\r
+ TreeTestResultCollection ttrc = new TreeTestResultCollection();\r
+ ttrc.setId("testCollection");\r
+ ttrc.getResults().add(ttr);\r
+ ttrc.getResults().add(ttr2);\r
+\r
+ StringResult xml = marshalAndValidate(ttrc);\r
+\r
+ TreeTestResultCollection ttrcUnm = unmarshal(xml);\r
+\r
+ assertEquals(ttrc.getId(), ttrcUnm.getId());\r
+ assertEquals(ttrc.getResults().size(), ttrcUnm.getResults().size());\r
+ for (TreeTestResult ttrT : ttrc.getResults()) {\r
+ if (ttrT.getUuid().equals(ttr.getUuid()))\r
+ UnitTestTreeUtil.assertTreeTestResult(ttr, ttrT);\r
+ else\r
+ UnitTestTreeUtil.assertTreeTestResult(ttr2, ttrT);\r
+ }\r
+ }\r
+}\r
--- /dev/null
+# Set root logger level to DEBUG and its only appender to A1.\r
+log4j.rootLogger=WARN, console\r
+\r
+## Levels\r
+# Slc\r
+log4j.logger.org.argeo=DEBUG\r
+\r
+# Castor\r
+log4j.logger.org.exolab.castor=WARN\r
+\r
+# Spring\r
+log4j.logger.org.springframework=WARN\r
+\r
+\r
+## Appenders\r
+# A1 is set to be a ConsoleAppender.\r
+log4j.appender.console=org.apache.log4j.ConsoleAppender\r
+\r
+# A1 uses PatternLayout.\r
+log4j.appender.console.layout=org.apache.log4j.PatternLayout\r
+log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c%n\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
+\r
+ Copyright (C) 2007-2012 Mathieu Baudier\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+-->\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
+\r
+ <import resource="classpath:/org/argeo/slc/xml/spring.xml" />\r
+ <import resource="classpath:/org/argeo/slc/castor/spring.xml" />\r
+\r
+</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.support.castor</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-#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
+++ /dev/null
-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/
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.argeo.slc</groupId>
- <artifactId>runtime</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <artifactId>org.argeo.slc.support.castor</artifactId>
- <name>SLC Support Castor</name>
- <description>Implementations of SLC Specs using Castor</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Export-Package>
- org.argeo.slc.*
- </Export-Package>
- <Import-Package>
- 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,
- *
- </Import-Package>
- <Fragment-Host>org.castor</Fragment-Host>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
-
- <dependency>
- <groupId>org.argeo.slc</groupId>
- <artifactId>org.argeo.slc.core</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.springframework.oxm</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.castor</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.apache.xerces</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.apache.xalan</artifactId>
- </dependency>
-
- <!-- Unit Tests -->
- <dependency>
- <groupId>org.argeo.slc</groupId>
- <artifactId>org.argeo.slc.unit</artifactId>
- <scope>test</scope>
- <version>1.1.3-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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));
- }
-
-}
+++ /dev/null
-/*
- * 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()));
- }
-
-}
+++ /dev/null
-/*
- * 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);
- }
-
-}
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.xml.process;\r
-\r
-import java.io.File;\r
-import java.io.FileWriter;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import javax.xml.transform.stream.StreamResult;\r
-\r
-import org.apache.commons.io.IOUtils;\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.execution.ExecutionProcess;\r
-import org.argeo.slc.process.SlcExecution;\r
-import org.argeo.slc.process.SlcExecutionNotifier;\r
-import org.argeo.slc.execution.ExecutionStep;\r
-import org.argeo.slc.process.SlcExecutionStep;\r
-import org.springframework.oxm.Marshaller;\r
-\r
-/** @deprecated Probably not even working anymore */\r
-public class FileSlcExecutionNotifier implements SlcExecutionNotifier {\r
- // private final static SimpleDateFormat sdf = new SimpleDateFormat(\r
- // "yyyyMMdd-HHmmss");\r
- //\r
- // private String basePath;\r
- private Marshaller marshaller;\r
-\r
- private Map<String, String> uuidToDir = new HashMap<String, String>();\r
-\r
- public void addSteps(ExecutionProcess slcExecution,\r
- List<ExecutionStep> additionalSteps) {\r
- writeSlcExecution(slcExecution);\r
- }\r
-\r
- public void updateStatus(ExecutionProcess slcExecution, String oldStatus,\r
- String newStatus) {\r
- writeSlcExecution(slcExecution);\r
- }\r
-\r
- protected void writeSlcExecution(ExecutionProcess process) {\r
- if (!(process instanceof SlcExecution))\r
- throw new SlcException("Unsupported process type "\r
- + process.getClass());\r
- SlcExecution slcExecution = (SlcExecution) process;\r
- FileWriter out = null;\r
- try {\r
- out = new FileWriter(getFilePath(slcExecution));\r
- marshaller.marshal(slcExecution, new StreamResult(out));\r
- } catch (Exception e) {\r
- throw new SlcException("Cannot marshall SlcExecution to "\r
- + getFilePath(slcExecution), e);\r
- } finally {\r
- IOUtils.closeQuietly(out);\r
- }\r
- }\r
-\r
- protected String getFileName(SlcExecution slcExecution) {\r
- return "SlcExecution-" + slcExecution.getUuid() + ".xml";\r
- }\r
-\r
- protected String getFilePath(SlcExecution slcExecution) {\r
- String dirPath = uuidToDir.get(slcExecution.getUuid());\r
- return dirPath + File.separator + "SlcExecution-"\r
- + slcExecution.getUuid() + ".xml";\r
- }\r
-\r
- public void setBasePath(String basePath) {\r
- // this.basePath = basePath;\r
- }\r
-\r
- public void setMarshaller(Marshaller marshaller) {\r
- this.marshaller = marshaller;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.xml.test.tree;\r
-\r
-import java.io.File;\r
-import java.io.FileOutputStream;\r
-import java.io.InputStream;\r
-import java.io.OutputStream;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import javax.xml.parsers.DocumentBuilder;\r
-import javax.xml.parsers.DocumentBuilderFactory;\r
-import javax.xml.transform.Templates;\r
-import javax.xml.transform.Transformer;\r
-import javax.xml.transform.TransformerFactory;\r
-import javax.xml.transform.dom.DOMResult;\r
-import javax.xml.transform.dom.DOMSource;\r
-import javax.xml.transform.stream.StreamResult;\r
-import javax.xml.transform.stream.StreamSource;\r
-\r
-import org.springframework.core.io.Resource;\r
-import org.springframework.oxm.Marshaller;\r
-import org.springframework.xml.transform.StringResult;\r
-import org.w3c.dom.Document;\r
-\r
-import org.apache.commons.io.IOUtils;\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.test.TestResultListener;\r
-import org.argeo.slc.test.TestResultPart;\r
-\r
-/** Build a report based on a tree test result using an XSLT stylesheet. */\r
-public class XsltReportGenerator implements TestResultListener<TreeTestResult> {\r
- private final static Log log = LogFactory.getLog(XsltReportGenerator.class);\r
-\r
- private DocumentBuilder documentBuilder = null;\r
-\r
- private Resource xsltStyleSheet;\r
-\r
- private Templates templates;\r
-\r
- private Marshaller marshaller;\r
-\r
- private String outputDir;\r
- private String outputFileExtension = "html";\r
-\r
- private Boolean logXml = false;\r
-\r
- private Map<String, String> xsltParameters = new HashMap<String, String>();\r
-\r
- public void init() {\r
- if (templates != null)\r
- return;\r
-\r
- if (xsltStyleSheet == null)\r
- throw new SlcException("XSLT style sheet not specified.");\r
-\r
- InputStream in = null;\r
- try {\r
- TransformerFactory transformerFactory = TransformerFactory\r
- .newInstance();\r
- in = xsltStyleSheet.getInputStream();\r
- StreamSource xsltSource = new StreamSource(in);\r
- templates = transformerFactory.newTemplates(xsltSource);\r
- } catch (Exception e) {\r
- throw new SlcException("Could not initialize templates", e);\r
- } finally {\r
- IOUtils.closeQuietly(in);\r
- }\r
- }\r
-\r
- public void resultPartAdded(TreeTestResult testResult,\r
- TestResultPart testResultPart) {\r
-\r
- }\r
-\r
- public void close(TreeTestResult testResult) {\r
- if (templates == null)\r
- throw new SlcException("XSLT template not initialized");\r
-\r
- File file = getFile(testResult);\r
- OutputStream out = null;\r
-\r
- try {\r
- Transformer transformer = templates.newTransformer();\r
- for (String paramKey : xsltParameters.keySet()) {\r
- transformer\r
- .setParameter(paramKey, xsltParameters.get(paramKey));\r
- if (log.isTraceEnabled())\r
- log.trace("Set XSLT parameter " + paramKey + " to "\r
- + xsltParameters.get(paramKey));\r
- }\r
-\r
- if (documentBuilder == null)\r
- documentBuilder = DocumentBuilderFactory.newInstance()\r
- .newDocumentBuilder();\r
-\r
- Document document = documentBuilder.newDocument();\r
- DOMResult marshallResult = new DOMResult(document);\r
- marshaller.marshal(testResult, marshallResult);\r
-\r
- if (logXml) {\r
- Transformer identityTransformer = TransformerFactory\r
- .newInstance().newTransformer();\r
- StringResult xmlResult = new StringResult();\r
- identityTransformer.transform(new DOMSource(marshallResult\r
- .getNode()), xmlResult);\r
- log.info("Marshalled XML:\n" + xmlResult);\r
- }\r
-\r
- DOMSource transfoSource = new DOMSource(marshallResult.getNode());\r
-\r
- if (outputDir != null) {\r
- File dir = new File(outputDir);\r
- dir.mkdirs();\r
- out = new FileOutputStream(file);\r
- StreamResult outputResult = new StreamResult(out);\r
- transformer.transform(transfoSource, outputResult);\r
- } else {\r
- // print on console if no output dir\r
- StringResult result = new StringResult();\r
- transformer.transform(transfoSource, result);\r
- log.info("Generated report:\n" + result);\r
- }\r
- } catch (Exception e) {\r
- throw new SlcException(\r
- "Could not transform test result to " + file, e);\r
- } finally {\r
- IOUtils.closeQuietly(out);\r
- }\r
- }\r
-\r
- public Resource getXsltStyleSheet() {\r
- return xsltStyleSheet;\r
- }\r
-\r
- public void setXsltStyleSheet(Resource xsltStyleSheet) {\r
- this.xsltStyleSheet = xsltStyleSheet;\r
- }\r
-\r
- public void setTemplates(Templates templates) {\r
- this.templates = templates;\r
- }\r
-\r
- public void setMarshaller(Marshaller marshaller) {\r
- this.marshaller = marshaller;\r
- }\r
-\r
- public void setOutputDir(String outputDir) {\r
- this.outputDir = outputDir;\r
- }\r
-\r
- public void setOutputFileExtension(String outputFileExtension) {\r
- this.outputFileExtension = outputFileExtension;\r
- }\r
-\r
- protected File getFile(TreeTestResult result) {\r
- Long time = System.currentTimeMillis();\r
- return new File(outputDir + File.separator + time + "-"\r
- + result.getUuid() + "." + outputFileExtension);\r
- }\r
-\r
- public void setLogXml(Boolean logXml) {\r
- this.logXml = logXml;\r
- }\r
-\r
- public void setXsltParameters(Map<String, String> xsltParameters) {\r
- this.xsltParameters = xsltParameters;\r
- }\r
-\r
-}\r
+++ /dev/null
-<?xml version="1.0"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd">\r
-\r
-<mapping>\r
- <description>Attachment objects XML mapping</description>\r
-\r
- <class name="org.argeo.slc.core.attachment.SimpleAttachment">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="uuid" type="string" />\r
- <field name="name" type="string" />\r
- <field name="contentType" type="string" />\r
- </class>\r
-\r
-</mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.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.
-
--->
-<mapping>
- <description>Build objects XML mapping</description>
-
- <class name="org.argeo.slc.BasicNameVersion">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="name">
- <bind-xml name="name" node="attribute" />
- </field>
- <field name="version">
- <bind-xml name="version" node="attribute" />
- </field>
- </class>
-</mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd">\r
-\r
-<mapping>\r
- <description>Execution objects XML mapping</description>\r
-\r
- <class name="org.argeo.slc.execution.ExecutionModuleDescriptor">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="name" />\r
- <field name="version" />\r
- <field name="label" />\r
- <field name="description" />\r
- <field name="executionFlows" collection="arraylist"\r
- type="org.argeo.slc.execution.ExecutionFlowDescriptor">\r
- <bind-xml auto-naming="deriveByClass" location="execution-flows" />\r
- </field>\r
- <field name="executionSpecs" collection="arraylist"\r
- type="org.argeo.slc.execution.ExecutionSpec">\r
- <bind-xml auto-naming="deriveByClass" location="execution-specs" />\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.execution.ExecutionFlowDescriptor">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="name" identity="true">\r
- <bind-xml name="name" node="attribute" />\r
- </field>\r
- <field name="path">\r
- <bind-xml name="path" node="attribute" />\r
- </field>\r
- <field name="executionSpec">\r
- <bind-xml name="executionSpec" node="attribute" reference="true" />\r
- </field>\r
- <field name="values" collection="map">\r
- <bind-xml name="value" location="values">\r
- <class name="org.exolab.castor.mapping.MapItem">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="key" type="string">\r
- <bind-xml name="key" node="attribute" />\r
- </field>\r
- <field name="value"\r
- type="org.argeo.slc.core.execution.AbstractExecutionValue">\r
- <bind-xml auto-naming="deriveByClass" />\r
- </field>\r
- </class>\r
- </bind-xml>\r
- </field>\r
- </class>\r
-\r
- <!-- Specs -->\r
- <class name="org.argeo.slc.core.execution.DefaultExecutionSpec">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="name" identity="true">\r
- <bind-xml name="name" node="attribute" />\r
- </field>\r
- <field name="attributes" collection="map">\r
- <bind-xml name="value" location="values">\r
- <class name="org.exolab.castor.mapping.MapItem">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="key" type="string">\r
- <bind-xml name="key" node="attribute" />\r
- </field>\r
- <field name="value"\r
- type="org.argeo.slc.core.execution.AbstractSpecAttribute">\r
- <bind-xml auto-naming="deriveByClass" />\r
- </field>\r
- </class>\r
- </bind-xml>\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.core.execution.AbstractSpecAttribute">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="isParameter">\r
- <bind-xml name="isParameter" node="attribute" />\r
- </field>\r
- <field name="isFrozen">\r
- <bind-xml name="isFrozen" node="attribute" />\r
- </field>\r
- <field name="isHidden">\r
- <bind-xml name="isHidden" node="attribute" />\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.core.execution.PrimitiveSpecAttribute"\r
- extends="org.argeo.slc.core.execution.AbstractSpecAttribute">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="type">\r
- <bind-xml name="type" node="attribute" />\r
- </field>\r
- <field name="value" type="string"\r
- handler="org.argeo.slc.castor.execution.PrimitiveFieldHandler">\r
- <bind-xml node="text" />\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.core.execution.RefSpecAttribute"\r
- extends="org.argeo.slc.core.execution.AbstractSpecAttribute">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="targetClassName">\r
- <bind-xml name="targetClassName" node="attribute" />\r
- </field>\r
- <field name="choices" collection="arraylist"\r
- type="org.argeo.slc.core.execution.RefValueChoice">\r
- <bind-xml auto-naming="deriveByClass" location="choices" />\r
- </field>\r
- </class>\r
-\r
- <!-- Values -->\r
- <class name="org.argeo.slc.core.execution.AbstractExecutionValue">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- </class>\r
-\r
- <class name="org.argeo.slc.core.execution.PrimitiveValue"\r
- extends="org.argeo.slc.core.execution.AbstractExecutionValue">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="type">\r
- <bind-xml name="type" node="attribute" />\r
- </field>\r
- <field name="value" type="string"\r
- handler="org.argeo.slc.castor.execution.PrimitiveFieldHandler">\r
- <bind-xml node="text" />\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.core.execution.RefValue" extends="org.argeo.slc.core.execution.AbstractExecutionValue">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="ref">\r
- <bind-xml name="ref" node="attribute" />\r
- </field>\r
- <field name="type">\r
- <bind-xml name="type" node="attribute" />\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.core.execution.RefValueChoice">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="name">\r
- <bind-xml name="name" node="attribute" />\r
- </field>\r
- <field name="description" />\r
- </class>\r
-</mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.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.
-
--->
-<!-- Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org> 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. -->
-
-
-<mapping>
- <description>Message objects XML mapping</description>
-
- <!-- TODO: use XML entities to factorize patterns -->
-
- <!-- BASIC -->
- <class name="org.argeo.slc.msg.ExecutionAnswer">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="status" />
- <field name="message" />
- </class>
-
- <class name="org.argeo.slc.msg.ReferenceList">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="references" collection="arraylist" type="string">
- <bind-xml name="ref" />
- </field>
- </class>
-
- <class name="org.argeo.slc.msg.ObjectList">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="objects" collection="arraylist" type="java.io.Serializable">
- <bind-xml auto-naming="deriveByClass" />
- </field>
- </class>
-
- <!-- BUILD -->
- <class name="org.argeo.slc.msg.build.ModularDistributionDescriptor"
- extends="org.argeo.slc.BasicNameVersion">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="modulesDescriptors" collection="map">
- <bind-xml name="modulesDescriptor" location="modulesDescriptors">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="string">
- <bind-xml name="type" node="attribute" />
- </field>
- <field name="value" type="string">
- <bind-xml name="url" node="attribute" />
- </field>
- </class>
- </bind-xml>
- </field>
- </class>
-
- <!-- TESTS -->
- <class name="org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="treeTestResult" type="org.argeo.slc.core.test.tree.TreeTestResult" />
- <field name="testRunDescriptor" />
- </class>
-
- <class name="org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="resultUuid" />
- <field name="closeDate" />
- </class>
-
- <class name="org.argeo.slc.msg.test.tree.AddTreeTestResultAttachmentRequest">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="resultUuid" />
- <field name="attachment" type="org.argeo.slc.core.attachment.SimpleAttachment">
- <bind-xml auto-naming="deriveByClass" />
- </field>
- </class>
-
- <class name="org.argeo.slc.msg.test.tree.ResultPartRequest">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="resultUuid" />
- <field name="resultPart" type="org.argeo.slc.core.test.SimpleResultPart">
- <bind-xml auto-naming="deriveByClass" />
- </field>
-
- <field name="relatedElements" collection="map">
- <bind-xml name="element" location="related-elements">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="org.argeo.slc.core.structure.tree.TreeSPath"
- handler="org.argeo.slc.castor.structure.tree.TreeSPathFieldHandler">
- <bind-xml name="path" node="attribute" />
- </field>
- <field name="value" type="org.argeo.slc.core.structure.SimpleSElement">
- <bind-xml auto-naming="deriveByClass" />
- </field>
- </class>
- </bind-xml>
- </field>
- <field name="path">
- <bind-xml auto-naming="deriveByClass" />
- </field>
- <field name="testRunDescriptor" />
- <field name="attributes" collection="hashtable">
- <bind-xml name="attribute" location="attributes">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="string">
- <bind-xml name="name" node="attribute" />
- </field>
- <field name="value" type="string">
- <bind-xml node="text" />
- </field>
- </class>
- </bind-xml>
- </field>
- </class>
-
- <class name="org.argeo.slc.core.test.tree.ResultAttributes">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="uuid" />
- <field name="closeDate" />
- <field name="attributes" collection="hashtable">
- <bind-xml name="attribute" location="attributes">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="string">
- <bind-xml name="name" node="attribute" />
- </field>
- <field name="value" type="string">
- <bind-xml node="text" />
- </field>
- </class>
- </bind-xml>
- </field>
- <field name="attachments" collection="arraylist"
- type="org.argeo.slc.core.attachment.SimpleAttachment">
- <bind-xml auto-naming="deriveByClass" location="attachments" />
- </field>
- </class>
-
-
- <!-- PROCESS -->
- <class name="org.argeo.slc.msg.process.SlcExecutionStepsRequest">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="slcExecutionUuid" />
- <field name="steps" collection="arraylist"
- type="org.argeo.slc.process.SlcExecutionStep">
- <bind-xml auto-naming="deriveByClass" location="steps" />
- </field>
- </class>
-
- <class name="org.argeo.slc.msg.process.SlcExecutionStatusRequest">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="slcExecutionUuid" />
- <field name="newStatus" />
- </class>
-
- <class name="org.argeo.slc.msg.process.SlcExecutionRequest">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="slcExecution" type="org.argeo.slc.process.SlcExecution" />
- </class>
-
- <!-- EVENTS -->
-
- <class name="org.argeo.slc.msg.event.SlcEvent">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="headers" collection="map">
- <bind-xml name="header" location="headers">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="string">
- <bind-xml name="name" node="attribute" />
- </field>
- <field name="value" type="string">
- <bind-xml node="text" />
- </field>
- </class>
- </bind-xml>
- </field>
- </class>
-
-</mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd">\r
-\r
-<mapping>\r
- <description>Process objects XML mapping</description>\r
-\r
- <class name="org.argeo.slc.process.SlcExecution">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="uuid" identity="true">\r
- <bind-xml node="attribute" />\r
- </field>\r
- <field name="status" />\r
- <field name="type" />\r
- <field name="host" />\r
- <field name="user" />\r
- <field name="realizedFlows" collection="arraylist"\r
- type="org.argeo.slc.process.RealizedFlow">\r
- <bind-xml auto-naming="deriveByClass" location="realized-flows" />\r
- </field>\r
- <field name="steps" collection="arraylist"\r
- type="org.argeo.slc.process.SlcExecutionStep">\r
- <bind-xml auto-naming="deriveByClass" location="steps" />\r
- </field>\r
- <field name="attributes" collection="map">\r
- <bind-xml name="attribute" location="attributes">\r
- <class name="org.exolab.castor.mapping.MapItem">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="key" type="string">\r
- <bind-xml name="name" node="attribute" />\r
- </field>\r
- <field name="value" type="string">\r
- <bind-xml node="text" />\r
- </field>\r
- </class>\r
- </bind-xml>\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.process.RealizedFlow">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="moduleName"/>\r
- <field name="moduleVersion" />\r
- <field name="flowDescriptor">\r
- <bind-xml auto-naming="deriveByClass" />\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.process.SlcExecutionStep">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="uuid" identity="true">\r
- <bind-xml node="attribute" />\r
- </field>\r
- <field name="type" />\r
- <field name="thread" />\r
- <field name="timestamp" />\r
- <field name="logLines" collection="arraylist" type="string">\r
- <bind-xml name="log-line" location="log-lines" />\r
- </field>\r
- </class>\r
-\r
-</mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd">\r
-\r
-<mapping>\r
- <description>Runtime objects XML mapping</description>\r
-\r
- <class name="org.argeo.slc.runtime.SlcAgentDescriptor">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="uuid" identity="true">\r
- <bind-xml node="attribute" />\r
- </field>\r
- <field name="host" />\r
- <field name="moduleDescriptors" collection="arraylist"\r
- type="org.argeo.slc.execution.ExecutionModuleDescriptor">\r
- <bind-xml auto-naming="deriveByClass" />\r
- </field>\r
- </class>\r
-</mapping>
\ No newline at end of file
+++ /dev/null
-<!--
-
- 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.
-
--->
-
-<!-- Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org> 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. -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
- default-lazy-init="true">
-
- <bean id="slcDefault.castor.marshaller" class="org.springframework.oxm.castor.CastorMarshaller">
- <property name="mappingLocations">
- <list>
- <value>classpath:org/argeo/slc/castor/common.xml</value>
- <value>classpath:org/argeo/slc/castor/msg.xml</value>
- <value>classpath:org/argeo/slc/castor/process.xml</value>
- <value>classpath:org/argeo/slc/castor/runtime.xml</value>
- <value>classpath:org/argeo/slc/castor/structure.xml</value>
- <value>classpath:org/argeo/slc/castor/test.xml</value>
- <value>classpath:org/argeo/slc/castor/execution.xml</value>
- <value>classpath:org/argeo/slc/castor/attachment.xml</value>
- </list>
- </property>
- <property name="whitespacePreserve" value="true" />
- <property name="encoding" value="UTF-8" />
- </bean>
-
- <bean id="slcDefault.castor.xsltReportGenerator" class="org.argeo.slc.xml.test.tree.XsltReportGenerator"
- init-method="init">
- <property name="xsltStyleSheet"
- value="classpath:/org/argeo/slc/core/test/tree/basicReport.xslt" />
- <property name="marshaller" ref="slcDefault.castor.marshaller" />
- <property name="logXml" value="false" />
- <property name="outputDir" value="${user.dir}/results/html" />
- </bean>
-
- <bean name="slcDefault.castor.fileSlcExecutionNotifier" class="org.argeo.slc.xml.process.FileSlcExecutionNotifier">
- <property name="basePath" value="${user.dir}/process" />
- <property name="marshaller" ref="slcDefault.castor.marshaller" />
- </bean>
-
-</beans>
+++ /dev/null
-<?xml version="1.0"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<mapping>\r
- <description>Structure related objects XML mapping</description>\r
-\r
- <class name="org.argeo.slc.core.structure.tree.TreeSPath"\r
- auto-complete="false">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="asUniqueString" type="string">\r
- <bind-xml node="attribute" />\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.core.structure.SimpleSElement"\r
- auto-complete="false">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="label" type="string" />\r
- <field name="tags" collection="map">\r
- <bind-xml name="tag" location="tags">\r
- <class name="org.exolab.castor.mapping.MapItem">\r
- <map-to\r
- ns-uri="http://argeo.org/projects/slc/schemas" ns-prefix="slc" />\r
- <field name="key" type="string">\r
- <bind-xml name="name" node="attribute" />\r
- </field>\r
- <field name="value" type="string">\r
- <bind-xml name="tag-value" />\r
- </field>\r
- </class>\r
- </bind-xml>\r
- </field>\r
- </class>\r
-</mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.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.
-
--->
-<mapping>
- <description>Test objects XML mapping</description>
-
- <class name="org.argeo.slc.test.TestRunDescriptor" auto-complete="false">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="testRunUuid" />
- <field name="slcExecutionUuid" />
- <field name="slcExecutionStepUuid" />
- <field name="testResultUuid" />
- <field name="deployedSytemId" />
- </class>
-
- <class name="org.argeo.slc.core.test.tree.TreeTestResult"
- auto-complete="false">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="uuid" type="string">
- <bind-xml name="uuid" node="attribute" />
- </field>
- <field name="closeDate" />
- <field name="attributes" collection="map">
- <bind-xml name="attribute" location="attributes">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="string">
- <bind-xml name="name" node="attribute" />
- </field>
- <field name="value" type="string">
- <bind-xml node="text" />
- </field>
- </class>
- </bind-xml>
- </field>
- <field name="resultParts" collection="sortedmap">
- <bind-xml name="result-part" location="result-parts">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="org.argeo.slc.core.structure.tree.TreeSPath"
- handler="org.argeo.slc.castor.structure.tree.TreeSPathFieldHandler">
- <bind-xml name="path" node="attribute" />
- </field>
- <field name="value" type="org.argeo.slc.core.test.tree.PartSubList">
- <bind-xml name="part-sub-list" />
- </field>
- </class>
- </bind-xml>
- </field>
- <field name="elements" collection="sortedmap">
- <bind-xml name="element" location="elements">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="org.argeo.slc.core.structure.tree.TreeSPath"
- handler="org.argeo.slc.castor.structure.tree.TreeSPathFieldHandler">
- <bind-xml name="path" node="attribute" />
- </field>
- <field name="value" type="org.argeo.slc.core.structure.SimpleSElement">
- <bind-xml auto-naming="deriveByClass" />
- </field>
- </class>
- </bind-xml>
- </field>
- <field name="attachments" collection="arraylist"
- type="org.argeo.slc.core.attachment.SimpleAttachment">
- <bind-xml auto-naming="deriveByClass" location="attachments" />
- </field>
- </class>
-
- <class name="org.argeo.slc.core.test.tree.PartSubList"
- auto-complete="false">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="parts" collection="arraylist"
- type="org.argeo.slc.core.test.SimpleResultPart">
- <bind-xml auto-naming="deriveByClass" location="parts" />
- </field>
- </class>
-
- <class name="org.argeo.slc.core.test.SimpleResultPart"
- auto-complete="false">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="testRunUuid" type="string" />
- <field name="message" type="string" />
- <field name="status" type="string"
- handler="org.argeo.slc.castor.test.tree.StatusFieldHandler" />
- <field name="exceptionMessage" type="string" />
- </class>
-
- <class name="org.argeo.slc.core.test.tree.TreeTestResultCollection"
- auto-complete="false">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="id" type="string">
- <bind-xml name="id" node="attribute" />
- </field>
- <field name="results" collection="set"
- type="org.argeo.slc.core.test.tree.TreeTestResult">
- <bind-xml auto-naming="deriveByClass" location="results" />
- </field>
- </class>
-</mapping>
\ No newline at end of file
+++ /dev/null
-Argeo SLC Site
\ No newline at end of file
+++ /dev/null
-/*
- * 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> T unmarshal(StringResult xml) throws Exception {
- return (T) unmarshaller.unmarshal(new StringSource(xml.toString()));
- }
-
- @SuppressWarnings("unchecked")
- protected <T> T marshUnmarsh(Object obj, boolean validate) throws Exception {
- StringResult xml = marshal(obj, validate);
- return (T) unmarshal(xml);
- }
-
- @SuppressWarnings("unchecked")
- protected <T> T marshUnmarsh(Object obj) throws Exception {
- return (T) marshUnmarsh(obj, true);
- }
-}
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.castor;\r
-\r
-import org.argeo.slc.msg.ExecutionAnswer;\r
-\r
-public class ExecutionAnswerCastorTest extends AbstractCastorTestCase {\r
- public void testMarshUnmarshOk() throws Exception {\r
- ExecutionAnswer answer = new ExecutionAnswer(ExecutionAnswer.OK,\r
- "No problem!");\r
- ExecutionAnswer answerUnm = marshUnmarsh(answer);\r
- assertExecutionAnswer(answer, answerUnm);\r
- }\r
-\r
- public void testMarshUnmarshError() throws Exception {\r
- ExecutionAnswer answer = new ExecutionAnswer(ExecutionAnswer.ERROR,\r
- "Oooops...");\r
- ExecutionAnswer answerUnm = marshUnmarsh(answer);\r
- assertExecutionAnswer(answer, answerUnm);\r
- }\r
-\r
- public static void assertExecutionAnswer(ExecutionAnswer expected,\r
- ExecutionAnswer reached) {\r
- assertEquals(expected.getStatus(), reached.getStatus());\r
- assertEquals(expected.getMessage(), reached.getMessage());\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.castor;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.argeo.slc.execution.ExecutionFlowDescriptor;\r
-import org.argeo.slc.execution.ExecutionModuleDescriptor;\r
-import org.argeo.slc.execution.ExecutionSpec;\r
-import org.argeo.slc.unit.execution.ExecutionFlowDescriptorTestUtils;\r
-\r
-public class ExecutionModuleDescriptorCastorTest extends AbstractCastorTestCase {\r
- public void testMarshUnmarsh() throws Exception {\r
- ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor();\r
- moduleDescriptor.setName("test.module");\r
- moduleDescriptor.setVersion("1.0.0");\r
- moduleDescriptor.setLabel("Test Module");\r
- moduleDescriptor.setDescription("module descriptor");\r
-\r
- ExecutionFlowDescriptor flowDescriptor = ExecutionFlowDescriptorTestUtils\r
- .createSimpleExecutionFlowDescriptor();\r
-\r
- List<ExecutionFlowDescriptor> flows = new ArrayList<ExecutionFlowDescriptor>();\r
- flows.add(flowDescriptor);\r
- moduleDescriptor.setExecutionFlows(flows);\r
-\r
- List<ExecutionSpec> specs = new ArrayList<ExecutionSpec>();\r
- specs.add(flowDescriptor.getExecutionSpec());\r
- moduleDescriptor.setExecutionSpecs(specs);\r
-\r
- marshUnmarsh(moduleDescriptor, false);\r
- }\r
-\r
- public void testMarshUnmarshMini() throws Exception {\r
- ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor();\r
- moduleDescriptor.setName("test.moodule");\r
- moduleDescriptor.setVersion("1.0.0");\r
- marshUnmarsh(moduleDescriptor, false);\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.castor;\r
-\r
-import org.argeo.slc.msg.ObjectList;\r
-import org.argeo.slc.msg.build.ModularDistributionDescriptor;\r
-\r
-public class ModularDistributionCastorTest extends AbstractCastorTestCase {\r
- public void testModularDistributionDescriptor() throws Exception {\r
- ModularDistributionDescriptor mdd = new ModularDistributionDescriptor();\r
- mdd.setName("name");\r
- mdd.setVersion("0.1.0");\r
- mdd.getModulesDescriptors().put("eclipse",\r
- "http://localhost/updateSite");\r
- mdd.getModulesDescriptors().put("modularDistribution",\r
- "http://localhost/modularDistribution");\r
-\r
- marshUnmarsh(mdd, false);\r
- }\r
-\r
- public void testModularDistributionDescriptorList() throws Exception {\r
- ModularDistributionDescriptor mdd = new ModularDistributionDescriptor();\r
- mdd.setName("name");\r
- mdd.setVersion("0.1.0");\r
- mdd.getModulesDescriptors().put("eclipse",\r
- "http://localhost/updateSite");\r
- mdd.getModulesDescriptors().put("modularDistribution",\r
- "http://localhost/modularDistribution");\r
-\r
- ModularDistributionDescriptor mdd2 = new ModularDistributionDescriptor();\r
- mdd2.setName("name2");\r
- mdd2.setVersion("0.1.1");\r
- mdd2.getModulesDescriptors().put("eclipse",\r
- "http://localhost/updateSite2");\r
- mdd2.getModulesDescriptors().put("modularDistribution",\r
- "http://localhost/modularDistribution2");\r
-\r
- ObjectList ol = new ObjectList();\r
- ol.getObjects().add(mdd);\r
- ol.getObjects().add(mdd2);\r
-\r
- marshUnmarsh(ol, false);\r
- }\r
-\r
-}\r
+++ /dev/null
-/*
- * 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());
- }
-}
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.castor;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.argeo.slc.execution.ExecutionModuleDescriptor;\r
-import org.argeo.slc.runtime.SlcAgentDescriptor;\r
-\r
-public class SlcAgentDescriptorCastorTest extends AbstractCastorTestCase {\r
- public void testMarshUnmarshMini() throws Exception {\r
- SlcAgentDescriptor agentDescriptor = createMiniAgentDescriptor();\r
- SlcAgentDescriptor agentDescriptorUnm = marshUnmarsh(agentDescriptor,\r
- false);\r
- assertSlcAgentDescriptor(agentDescriptor, agentDescriptorUnm);\r
- }\r
-\r
- public void testMarshUnmarshWithModuleDescriptor() throws Exception {\r
- SlcAgentDescriptor agentDescriptor = createMiniAgentDescriptor();\r
-\r
- List<ExecutionModuleDescriptor> lst = new ArrayList<ExecutionModuleDescriptor>();\r
- ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor();\r
- moduleDescriptor.setName("test.moodule");\r
- moduleDescriptor.setVersion("1.0.0");\r
- lst.add(moduleDescriptor);\r
- agentDescriptor.setModuleDescriptors(lst);\r
-\r
- SlcAgentDescriptor agentDescriptorUnm = marshUnmarsh(agentDescriptor,\r
- false);\r
- assertSlcAgentDescriptor(agentDescriptor, agentDescriptorUnm);\r
- }\r
-\r
- protected static SlcAgentDescriptor createMiniAgentDescriptor() {\r
- SlcAgentDescriptor agentDescriptor = new SlcAgentDescriptor();\r
- agentDescriptor.setHost("localhost");\r
- agentDescriptor.setUuid("555");\r
- return agentDescriptor;\r
- }\r
-\r
- protected static void assertSlcAgentDescriptor(SlcAgentDescriptor expected,\r
- SlcAgentDescriptor reached) {\r
- assertNotNull(reached);\r
- assertEquals(expected.getHost(), reached.getHost());\r
- assertEquals(expected.getUuid(), expected.getUuid());\r
- assertEquals(expected.getModuleDescriptors().size(), reached\r
- .getModuleDescriptors().size());\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.castor;\r
-\r
-import java.text.SimpleDateFormat;\r
-import java.util.UUID;\r
-\r
-import org.argeo.slc.msg.process.SlcExecutionRequest;\r
-import org.argeo.slc.msg.process.SlcExecutionStepsRequest;\r
-import org.argeo.slc.process.SlcExecution;\r
-import org.argeo.slc.process.SlcExecutionStep;\r
-import org.argeo.slc.unit.process.SlcExecutionTestUtils;\r
-import org.springframework.xml.transform.StringResult;\r
-\r
-public class SlcExecutionCastorTest extends AbstractCastorTestCase {\r
- public void testMarshalling() throws Exception {\r
- SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution();\r
-\r
- SlcExecutionRequest msgSave = new SlcExecutionRequest();\r
- msgSave.setSlcExecution(slcExec);\r
-\r
- StringResult msgSaveXml = marshalAndValidate(msgSave);\r
-\r
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");\r
- SlcExecutionStep step0 = new SlcExecutionStep();\r
- step0.setUuid(UUID.randomUUID().toString());\r
- step0.setTimestamp(sdf.parse("2008-04-17 18:21"));\r
- step0.setType("LOG");\r
- step0.addLog("A log message\nand another line");\r
-\r
- SlcExecutionStep step1 = new SlcExecutionStep();\r
- step1.setUuid(UUID.randomUUID().toString());\r
- step1.setTimestamp(sdf.parse("2008-04-17 18:25"));\r
- step1.setType("LOG");\r
- step1.addLog("A nother log message");\r
-\r
- SlcExecutionStepsRequest msgNotif = new SlcExecutionStepsRequest();\r
- msgNotif.addStep(step0);\r
- msgNotif.addStep(step1);\r
- msgNotif.setSlcExecutionUuid(slcExec.getUuid());\r
-\r
- StringResult msgNotifXml = marshalAndValidate(msgNotif);\r
-\r
- SlcExecutionRequest msgSaveUnm = unmarshal(msgSaveXml);\r
- assertNotNull(msgSaveUnm);\r
- SlcExecutionTestUtils.assertSlcExecution(slcExec, msgSaveUnm\r
- .getSlcExecution());\r
-\r
- SlcExecutionStepsRequest msgNotifUnm = unmarshal(msgNotifXml);\r
- assertNotNull(msgNotifUnm);\r
- assertEquals(slcExec.getUuid(), msgNotifUnm.getSlcExecutionUuid());\r
- assertEquals(2, msgNotifUnm.getSteps().size());\r
- SlcExecutionTestUtils.assertSlcExecutionStep(step0, msgNotifUnm\r
- .getSteps().get(0));\r
- SlcExecutionTestUtils.assertSlcExecutionStep(step1, msgNotifUnm\r
- .getSteps().get(1));\r
-\r
- SlcExecution slcExecUnm = msgSaveUnm.getSlcExecution();\r
- slcExecUnm.getSteps().addAll(msgNotifUnm.getSteps());\r
-\r
- SlcExecutionRequest msgUpdate = new SlcExecutionRequest();\r
- msgUpdate.setSlcExecution(slcExecUnm);\r
- StringResult msgUpdateXml = marshalAndValidate(msgUpdate);\r
-\r
- SlcExecutionRequest msgUpdateUnm = unmarshal(msgUpdateXml);\r
- assertNotNull(msgUpdateUnm);\r
- }\r
-\r
- public void testMarshUnmarsh() throws Exception {\r
- SlcExecution slcExec = SlcExecutionTestUtils\r
- .createSlcExecutionWithRealizedFlows();\r
- marshUnmarsh(slcExec, false);\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.castor;\r
-\r
-import static org.argeo.slc.unit.UnitUtils.assertDateSec;\r
-import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createCompleteTreeTestResult;\r
-import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createSimpleResultPartRequest;\r
-\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest;\r
-import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest;\r
-import org.argeo.slc.msg.test.tree.ResultPartRequest;\r
-import org.argeo.slc.unit.test.tree.UnitTestTreeUtil;\r
-import org.springframework.xml.transform.StringResult;\r
-\r
-public class TreeTestResultCastorTest extends AbstractCastorTestCase {\r
- public void testMarshUnmarsh() throws Exception {\r
- TreeTestResult ttr = createCompleteTreeTestResult();\r
-\r
- StringResult xml = marshalAndValidate(ttr);\r
-\r
- TreeTestResult ttrUnm = unmarshal(xml);\r
-\r
- UnitTestTreeUtil.assertTreeTestResult(ttr, ttrUnm);\r
- }\r
-\r
- public void testCreateTreeTestResultRequest() throws Exception {\r
- CreateTreeTestResultRequest req = new CreateTreeTestResultRequest();\r
- req.setTreeTestResult(createCompleteTreeTestResult());\r
-\r
- StringResult xml = marshalAndValidate(req);\r
-\r
- CreateTreeTestResultRequest reqUnm = unmarshal(xml);\r
-\r
- UnitTestTreeUtil.assertTreeTestResult(req.getTreeTestResult(), reqUnm\r
- .getTreeTestResult());\r
- }\r
-\r
- public void testResultPartRequest() throws Exception {\r
- TreeTestResult ttr = createCompleteTreeTestResult();\r
- ResultPartRequest req = createSimpleResultPartRequest(ttr);\r
-\r
- StringResult xml = marshalAndValidate(req);\r
-\r
- ResultPartRequest reqUnm = unmarshal(xml);\r
-\r
- UnitTestTreeUtil\r
- .assertPart(req.getResultPart(), reqUnm.getResultPart());\r
- }\r
-\r
- public void testCloseTreeTestResultRequest() throws Exception {\r
- TreeTestResult ttr = createCompleteTreeTestResult();\r
- ttr.close();\r
-\r
- CloseTreeTestResultRequest req = new CloseTreeTestResultRequest(ttr\r
- .getUuid(), ttr.getCloseDate());\r
-\r
- StringResult xml = marshalAndValidate(req);\r
-\r
- CloseTreeTestResultRequest reqUnm = unmarshal(xml);\r
-\r
- assertEquals(ttr.getUuid(), reqUnm.getResultUuid());\r
- assertDateSec(ttr.getCloseDate(), ttr.getCloseDate());\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.castor;\r
-\r
-import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createCompleteTreeTestResult;\r
-\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.core.test.tree.TreeTestResultCollection;\r
-import org.argeo.slc.unit.test.tree.UnitTestTreeUtil;\r
-import org.springframework.xml.transform.StringResult;\r
-\r
-public class TreeTestResultCollectionCastorTest extends AbstractCastorTestCase {\r
- public void testMarshUnmarsh() throws Exception {\r
- TreeTestResult ttr = createCompleteTreeTestResult();\r
- TreeTestResult ttr2 = createCompleteTreeTestResult();\r
-\r
- TreeTestResultCollection ttrc = new TreeTestResultCollection();\r
- ttrc.setId("testCollection");\r
- ttrc.getResults().add(ttr);\r
- ttrc.getResults().add(ttr2);\r
-\r
- StringResult xml = marshalAndValidate(ttrc);\r
-\r
- TreeTestResultCollection ttrcUnm = unmarshal(xml);\r
-\r
- assertEquals(ttrc.getId(), ttrcUnm.getId());\r
- assertEquals(ttrc.getResults().size(), ttrcUnm.getResults().size());\r
- for (TreeTestResult ttrT : ttrc.getResults()) {\r
- if (ttrT.getUuid().equals(ttr.getUuid()))\r
- UnitTestTreeUtil.assertTreeTestResult(ttr, ttrT);\r
- else\r
- UnitTestTreeUtil.assertTreeTestResult(ttr2, ttrT);\r
- }\r
- }\r
-}\r
+++ /dev/null
-# Set root logger level to DEBUG and its only appender to A1.\r
-log4j.rootLogger=WARN, console\r
-\r
-## Levels\r
-# Slc\r
-log4j.logger.org.argeo=DEBUG\r
-\r
-# Castor\r
-log4j.logger.org.exolab.castor=WARN\r
-\r
-# Spring\r
-log4j.logger.org.springframework=WARN\r
-\r
-\r
-## Appenders\r
-# A1 is set to be a ConsoleAppender.\r
-log4j.appender.console=org.apache.log4j.ConsoleAppender\r
-\r
-# A1 uses PatternLayout.\r
-log4j.appender.console.layout=org.apache.log4j.PatternLayout\r
-log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c%n\r
-\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
-\r
- <import resource="classpath:/org/argeo/slc/xml/spring.xml" />\r
- <import resource="classpath:/org/argeo/slc/castor/spring.xml" />\r
-\r
-</beans>
\ No newline at end of file
<module>org.argeo.slc.support.maven</module>
<module>org.argeo.slc.support.jemmy</module>
<module>org.argeo.slc.support.jcr</module>
- <module>org.argeo.slc.support.castor</module>
<module>org.argeo.slc.detached</module>
<module>org.argeo.slc.detached.launcher</module>
<module>org.argeo.slc.launcher</module>