-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
But they do not work. Hopefully someone picks it up. Basically following comments should not have been accepted: 198388f 998c45c 6cf6da8 As Snakeyaml 1.x to 2.x migration is not simple and currently this modello plugin is busted: it generates uncompilable code (sue Snakeyaml breaking changes).
- Loading branch information
Showing
5 changed files
with
276 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...snakeyaml/src/test/java/org/codehaus/modello/plugin/snakeyaml/SnakeyamlGeneratorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package org.codehaus.modello.plugin.snakeyaml; | ||
|
||
/* | ||
* Copyright (c) 2013, Codehaus.org | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
* of the Software, and to permit persons to whom the Software is furnished to do | ||
* so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
import java.util.List; | ||
import java.util.Properties; | ||
|
||
import org.codehaus.modello.AbstractModelloJavaGeneratorTest; | ||
import org.codehaus.modello.core.ModelloCore; | ||
import org.codehaus.modello.model.Model; | ||
import org.codehaus.modello.model.ModelClass; | ||
import org.codehaus.modello.model.Version; | ||
|
||
/** | ||
* @author <a href="mailto:simonetripodi@apache.org">Simone Tripodi</a> | ||
*/ | ||
public class SnakeyamlGeneratorTest extends AbstractModelloJavaGeneratorTest { | ||
public SnakeyamlGeneratorTest() { | ||
super("snakeyaml"); | ||
} | ||
|
||
public void testXpp3Generator() throws Throwable { | ||
ModelloCore modello = (ModelloCore) lookup(ModelloCore.ROLE); | ||
|
||
Model model = modello.loadModel(getXmlResourceReader("/ibcore-executor.mdo")); | ||
|
||
// check some elements read from the model | ||
List<ModelClass> classesList = model.getClasses(new Version("4.0.0")); | ||
|
||
assertEquals(3, classesList.size()); | ||
|
||
ModelClass clazz = (ModelClass) classesList.get(0); | ||
|
||
assertEquals("GeneratedProcessExecution", clazz.getName()); | ||
|
||
// now generate sources and test them | ||
Properties parameters = getModelloParameters("4.0.0"); | ||
|
||
modello.generate(model, "java", parameters); | ||
modello.generate(model, "snakeyaml-reader", parameters); | ||
modello.generate(model, "snakeyaml-writer", parameters); | ||
|
||
addDependency("org.yaml", "snakeyaml"); | ||
compileGeneratedSources(); | ||
|
||
// TODO: see why without this, version system property is set to "2.4.1" value after verify | ||
System.setProperty("version", getModelloVersion()); | ||
|
||
verifyCompiledGeneratedSources("org.codehaus.modello.generator.xml.sax.SaxVerifier"); | ||
} | ||
} |
174 changes: 174 additions & 0 deletions
174
modello-plugins/modello-plugin-snakeyaml/src/test/resources/ibcore-executor.mdo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<model | ||
xmlns="http://codehaus-plexus.github.io/MODELLO/1.8.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://codehaus-plexus.github.io/MODELLO/1.8.0 http://codehaus-plexus.github.io/modello/xsd/modello-1.8.0.xsd" | ||
java.suppressAllWarnings="false" | ||
xml.namespace="https://resources.infrastructurebuilder.org/IBDataSet/${apiVersion}" | ||
xml.schemaLocation="https://resources.infrastructurebuilder.org/xsd/IBDataSet-${apiVersion}" | ||
xsd.namespace="https://resources.infrastructurebuilder.org/IBDataSet/${apiVersion}" | ||
xsd.targetNamespace="https://resources.infrastructurebuilder.org/IBDataSet/${apiVersion}" | ||
> | ||
<id>execution</id> | ||
<name>ProcessExecutionModel</name> <!-- Must be a single (no spaces, no dashes, no periods) identifier in order | ||
to create reader/writer --> | ||
<description>Model for ProcessExecution instances</description> | ||
|
||
<defaults> | ||
<default> | ||
<key>package</key> | ||
<value>org.infrastructurebuilder.util.executor.execution.model</value> | ||
</default> | ||
</defaults> | ||
|
||
<classes> | ||
<!-- MODEL --> | ||
<class | ||
xml.tagName="processExecution" | ||
rootElement="true" | ||
java.clone="deep" | ||
> | ||
<name>GeneratedProcessExecution</name> | ||
<description>Persistence for ibcore-executor ProcessExecution instances</description> | ||
<version>1.0.0+</version> | ||
<fields> | ||
<field> | ||
<name>id</name> | ||
<version>1.0.0+</version> | ||
<required>true</required> | ||
<description>Processing ID</description> | ||
<type>String</type> | ||
</field> | ||
<field> | ||
<name>executable</name> | ||
<version>1.0.0+</version> | ||
<required>true</required> | ||
<description>Path to executable</description> | ||
<type>String</type> | ||
</field> | ||
<field> | ||
<name>arguments</name> | ||
<version>1.0.0+</version> | ||
<required>true</required> | ||
<association> | ||
<type>String</type> | ||
<multiplicity>*</multiplicity> | ||
</association> | ||
<description>Arguments passed to execution</description> | ||
</field> | ||
<field> | ||
<name>timeout</name> | ||
<version>1.0.0+</version> | ||
<required>false</required> | ||
<description>Optional timeout</description> | ||
<type>String</type> | ||
</field> | ||
<field> | ||
<name>optional</name> | ||
<version>1.0.0+</version> | ||
<required>false</required> | ||
<defaultValue>false</defaultValue> | ||
<description>Is the successful execution of this optional</description> | ||
<type>boolean</type> | ||
</field> | ||
<field> | ||
<name>background</name> | ||
<version>1.0.0+</version> | ||
<required>false</required> | ||
<defaultValue>false</defaultValue> | ||
<description>Is the execution to be in the background</description> | ||
<type>boolean</type> | ||
</field> | ||
<field xdoc.separator="blank"> | ||
<name>environment</name> | ||
<version>1.0.0+</version> | ||
<description>Environment variables</description> | ||
<type>Properties</type> | ||
<association xml.mapStyle="inline"> | ||
<type>String</type> | ||
<multiplicity>*</multiplicity> | ||
</association> | ||
</field> | ||
<field> | ||
<name>exy</name> | ||
<description>Extra vocabulary as key/value.</description> | ||
<version>1.0.0+</version> | ||
<identifier>true</identifier> | ||
<type>Map</type> | ||
<association xml.mapStyle="inline"> | ||
<type>String</type> | ||
<multiplicity>*</multiplicity> | ||
</association> | ||
</field> | ||
|
||
<field> | ||
<name>workDirectory</name> | ||
<version>1.0.0+</version> | ||
<required>false</required> | ||
<type>String</type> | ||
<description>Work directory</description> | ||
</field> | ||
<field> | ||
<name>exitValues</name> | ||
<version>1.0.0+</version> | ||
<required>false</required> | ||
<association> | ||
<type>String</type> | ||
<multiplicity>*</multiplicity> | ||
</association> | ||
<description>"successful" exit codes(parsed as integers)</description> | ||
</field> | ||
<field> | ||
<name>stdOutPath</name> | ||
<version>1.0.0+</version> | ||
<required>false</required> | ||
<description>Path to write stdout</description> | ||
<type>String</type> | ||
</field> | ||
<field> | ||
<name>stdErrPath</name> | ||
<version>1.0.0+</version> | ||
<required>false</required> | ||
<description>Path to write stderr</description> | ||
<type>String</type> | ||
</field> | ||
<field> | ||
<name>stdInPath</name> | ||
<version>1.0.0+</version> | ||
<required>false</required> | ||
<description>Path to read as stdin</description> | ||
<type>String</type> | ||
</field> | ||
<field> | ||
<name>relativeRoot</name> | ||
<version>1.0.0+</version> | ||
<required>false</required> | ||
<description>Path to Relative root</description> | ||
<type>String</type> | ||
</field> | ||
|
||
|
||
</fields> | ||
|
||
</class> | ||
<class | ||
locationTracker="locations" | ||
java.clone="shallow" | ||
> | ||
<name>IBExecInputLocation</name> | ||
<version>1.0.0+</version> | ||
<fields> | ||
<!-- line, column and source fields are auto-generated by Modello --> | ||
</fields> | ||
</class> | ||
<class | ||
sourceTracker="source" | ||
java.clone="shallow" | ||
> | ||
<name>IBExecInputSource</name> | ||
<version>1.0.0+</version> | ||
<fields> | ||
</fields> | ||
</class> | ||
</classes> | ||
</model> |