Author: tchemit Date: 2011-10-12 20:54:15 +0200 (Wed, 12 Oct 2011) New Revision: 1103 Url: http://nuiton.org/repositories/revision/eugene/1103 Log: Evolution #1772: Generate enumerations present in model Evolution #1771: Add an option to never generate a class already defined in classpath Added: trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaEnumerationTransformer.java trunk/maven-eugene-plugin/src/it/evol-308/ trunk/maven-eugene-plugin/src/it/evol-308/invoker.properties trunk/maven-eugene-plugin/src/it/evol-308/pom.xml trunk/maven-eugene-plugin/src/it/evol-308/src/ trunk/maven-eugene-plugin/src/it/evol-308/src/main/ trunk/maven-eugene-plugin/src/it/evol-308/src/main/java/ trunk/maven-eugene-plugin/src/it/evol-308/src/main/java/org/ trunk/maven-eugene-plugin/src/it/evol-308/src/main/java/org/nuiton/ trunk/maven-eugene-plugin/src/it/evol-308/src/main/java/org/nuiton/eugene/ trunk/maven-eugene-plugin/src/it/evol-308/src/main/java/org/nuiton/eugene/test/ trunk/maven-eugene-plugin/src/it/evol-308/src/main/java/org/nuiton/eugene/test/MyEnumeration2.java trunk/maven-eugene-plugin/src/it/evol-308/src/main/xmi/ trunk/maven-eugene-plugin/src/it/evol-308/src/test/ trunk/maven-eugene-plugin/src/it/evol-308/src/test/java/ trunk/maven-eugene-plugin/src/it/evol-308/src/test/java/org/ trunk/maven-eugene-plugin/src/it/evol-308/src/test/java/org/nuiton/ trunk/maven-eugene-plugin/src/it/evol-308/src/test/java/org/nuiton/eugene/ trunk/maven-eugene-plugin/src/it/evol-308/src/test/java/org/nuiton/eugene/test/ trunk/maven-eugene-plugin/src/it/evol-308/src/test/java/org/nuiton/eugene/test/EnumerationTest.java trunk/maven-eugene-plugin/src/it/evol-308/verify.groovy Modified: trunk/eugene/src/main/java/org/nuiton/eugene/EugeneStereoTypes.java trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGeneratorUtil.java trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java trunk/maven-eugene-plugin/pom.xml Modified: trunk/eugene/src/main/java/org/nuiton/eugene/EugeneStereoTypes.java =================================================================== --- trunk/eugene/src/main/java/org/nuiton/eugene/EugeneStereoTypes.java 2011-09-22 17:23:25 UTC (rev 1102) +++ trunk/eugene/src/main/java/org/nuiton/eugene/EugeneStereoTypes.java 2011-10-12 18:54:15 UTC (rev 1103) @@ -25,6 +25,7 @@ package org.nuiton.eugene; import org.nuiton.eugene.java.JavaBeanTransformer; +import org.nuiton.eugene.java.JavaEnumerationTransformer; import org.nuiton.eugene.java.JavaGeneratorUtil; import org.nuiton.eugene.models.object.ObjectModelAttribute; import org.nuiton.eugene.models.object.ObjectModelClassifier; @@ -71,4 +72,14 @@ documentation = "To specify that a attribute is ordered") String STEREOTYPE_ORDERED = "ordered"; + /** + * Stereotype for enumeration objects to place on a classifier. + * + * @see JavaEnumerationTransformer + * @see JavaGeneratorUtil#hasBeanStereotype(ObjectModelClassifier) + */ + @StereotypeDefinition(target = ObjectModelClassifier.class, + documentation = "To specify that a class is a enumeration to generate") + String STEREOTYPE_ENUMERATION = "enumeration"; + } Added: trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaEnumerationTransformer.java =================================================================== --- trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaEnumerationTransformer.java (rev 0) +++ trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaEnumerationTransformer.java 2011-10-12 18:54:15 UTC (rev 1103) @@ -0,0 +1,59 @@ +package org.nuiton.eugene.java; + + +/*{generator option: parentheses = false}*/ +/*{generator option: writeString = +}*/ + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.eugene.models.object.ObjectModelEnumeration; + +import java.util.Collection; + +/** + * JavaEnumerationTransformer generates a enumeration for enuration with + * stereotype enumeration. + * + * @author tchemit <chemit@codelutin.com> + * @plexus.component role="org.nuiton.eugene.Template" role-hint="org.nuiton.eugene.java.JavaEnumerationTransformer" + * @since 2.5 + */ +public class JavaEnumerationTransformer extends ObjectModelTransformerToJava { + + private static final Log log = + LogFactory.getLog(JavaEnumerationTransformer.class); + + @Override + public void transformFromEnumeration(ObjectModelEnumeration input) { + if (!canGenerate(input)) { + + if (log.isDebugEnabled()) { + log.debug("Skip generation for " + input.getQualifiedName()); + } + return; + } + + ObjectModelEnumeration output = + createEnumeration(input.getName(), input.getPackageName()); + + if (log.isDebugEnabled()) { + log.debug("will generate " + output.getQualifiedName()); + } + + Collection<String> literals = input.getLiterals(); + + for (String literal : literals) { + addLiteral(output, literal); + } + } + + protected boolean canGenerate(ObjectModelEnumeration input) { + boolean b = JavaGeneratorUtil.hasEnumerationStereotype(input); + if (b) { + + // check if not found in class-path + b = !isInClassPath(input); + } + return b; + } +} \ No newline at end of file Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGeneratorUtil.java =================================================================== --- trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGeneratorUtil.java 2011-09-22 17:23:25 UTC (rev 1102) +++ trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGeneratorUtil.java 2011-10-12 18:54:15 UTC (rev 1103) @@ -130,6 +130,19 @@ } /** + * Check if the given classifier has the + * {@link EugeneStereoTypes#STEREOTYPE_ENUMERATION} stereotype. + * + * @param classifier classifier to test + * @return {@code true} if stereotype was found, {@code false otherwise} + * @see EugeneStereoTypes#STEREOTYPE_ENUMERATION + * @since 2.5 + */ + public static boolean hasEnumerationStereotype(ObjectModelClassifier classifier) { + return classifier.hasStereotype(EugeneStereoTypes.STEREOTYPE_ENUMERATION); + } + + /** * Cherche et renvoie le prefixe i18n à utiliser sur cet element, sinon sur * le model. * Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java =================================================================== --- trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java 2011-09-22 17:23:25 UTC (rev 1102) +++ trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java 2011-10-12 18:54:15 UTC (rev 1103) @@ -33,28 +33,12 @@ import org.nuiton.eugene.GeneratorUtil; import org.nuiton.eugene.Template; import org.nuiton.eugene.java.extension.ImportsManager; -import org.nuiton.eugene.models.object.ObjectModel; -import org.nuiton.eugene.models.object.ObjectModelAttribute; -import org.nuiton.eugene.models.object.ObjectModelClass; -import org.nuiton.eugene.models.object.ObjectModelClassifier; -import org.nuiton.eugene.models.object.ObjectModelDependency; -import org.nuiton.eugene.models.object.ObjectModelElement; -import org.nuiton.eugene.models.object.ObjectModelEnumeration; -import org.nuiton.eugene.models.object.ObjectModelInterface; -import org.nuiton.eugene.models.object.ObjectModelModifier; -import org.nuiton.eugene.models.object.ObjectModelOperation; -import org.nuiton.eugene.models.object.ObjectModelParameter; -import org.nuiton.eugene.models.object.ObjectModelTransformer; -import org.nuiton.eugene.models.object.ObjectModelType; +import org.nuiton.eugene.models.object.*; import org.nuiton.i18n.I18n; import java.beans.Introspector; import java.net.URL; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import java.util.*; /** * Created: 28 oct. 2009 @@ -66,7 +50,9 @@ private static final Log log = LogFactory.getLog(ObjectModelTransformerToJava.class); - /** internal builder */ + /** + * internal builder + */ protected JavaBuilder builder; private String constantPrefix; @@ -102,11 +88,11 @@ } for (ObjectModelAttribute attribute : clazz.getAttributes()) { log.debug(" attribute : " + attribute.getType() + - " " + attribute.getName()); + " " + attribute.getName()); } for (ObjectModelOperation operation : clazz.getOperations()) { log.debug(" operation : " + operation.getReturnType() + - " " + operation.getName()); + " " + operation.getName()); } } } @@ -373,7 +359,7 @@ /** * Adds a navigable flag to the given {@code attribute}. * - * @param attribute the attribute on which the navigable flag will be setted + * @param attribute the attribute on which the navigable flag will be setted * @param navigable the navigable flag to set * @since 2.3 */ @@ -401,13 +387,13 @@ /** * add an operation to the classifier with the form of a simple block * of code. - * + * <p/> * use it to add a "static {}" block into an classifier, then use * setOperationBody with the returned value of this method to complete * the creation of the static block - * + * * @param classifier the classifier where the block will be added - * @param modifiers modifiers for the block + * @param modifiers modifiers for the block * @return the block added */ public ObjectModelOperation addBlock(ObjectModelClassifier classifier, @@ -431,10 +417,10 @@ * name, returnType, parameters, exceptions and tagValues will be cloned. * You can specify {@code modifiers} for the result operation. * - * @param source operation to clone - * @param destination classifier where result operation will be added + * @param source operation to clone + * @param destination classifier where result operation will be added * @param cloneDocumentation flag to add documentation if some found in model - * @param modifiers extra modifiers + * @param modifiers extra modifiers * @return the new operation created in destination classifier * @since 2.1.2 */ @@ -473,11 +459,11 @@ * Clone the {@code source} operation into the {@code destination} classifier. * whole signature, tagValues and body code will be cloned. You can specify * {@code modifiers} for the result operation. - * - * @param source operation to clone - * @param destination classifier where result operation will be added + * + * @param source operation to clone + * @param destination classifier where result operation will be added * @param cloneDocumentation flag to add documentation if some found in model - * @param modifiers extra modifiers + * @param modifiers extra modifiers * @return the new operation created in destination classifier * @since 2.1.2 */ @@ -508,11 +494,11 @@ /** * clone a given attribute into a classifier of the output model - * - * @param source the original attribute - * @param destination classifier where the clone will be added + * + * @param source the original attribute + * @param destination classifier where the clone will be added * @param cloneDocumentation flag to add documentation if some found in model - * @param modifiers extra modifiers + * @param modifiers extra modifiers * @return the clone attribute * @since 2.1.2 */ @@ -522,8 +508,8 @@ ObjectModelModifier... modifiers) { ObjectModelAttribute outputAttribute = addAttribute(destination, - source.getName(), source.getType(), - source.getDefaultValue(), modifiers); + source.getName(), source.getType(), + source.getDefaultValue(), modifiers); cloneTagValues(source, outputAttribute); @@ -537,7 +523,7 @@ setMinMultiplicity(outputAttribute, source.getMinMultiplicity()); setMaxMultiplicity(outputAttribute, source.getMaxMultiplicity()); - setNavigable(outputAttribute,source.isNavigable()); + setNavigable(outputAttribute, source.isNavigable()); return outputAttribute; } @@ -546,7 +532,7 @@ * Copy all tag values fro the given {@code source} to the given * {@code destination}. * - * @param source the source element + * @param source the source element * @param destination the destination element * @since 2.3 */ @@ -554,12 +540,11 @@ ObjectModelElement destination) { Map<String, String> tags = source.getTagValues(); for (Map.Entry<String, String> entry : tags.entrySet()) { - addTagValue(destination,entry.getKey(),entry.getValue()); + addTagValue(destination, entry.getKey(), entry.getValue()); } } /** - * * @param source * @param destination * @since 2.3 @@ -569,22 +554,22 @@ Collection<String> stereotypes = source.getStereotypes(); for (String stereotype : stereotypes) { - addStereotype(destination,stereotype); + addStereotype(destination, stereotype); } } - + /** * copy attributes, interfaces declartion and operation of a given classifier * into another classifier. - * + * <p/> * class-specific, enumeration-specific and interface-specific features * of the given classifier <strong>will not</strong> be present in the clone. * To copy those specific elements, use + * + * @param source the classifier to clone from the source model + * @param destination where to clone the given source one + * @param copyDocumentation flag to add documentation if some found in model * @link {@link #cloneClassifier(ObjectModelClassifier, boolean)} - * - * @param source the classifier to clone from the source model - * @param destination where to clone the given source one - * @param copyDocumentation flag to add documentation if some found in model * @since 2.1.2 * @deprecated since 2.3, prefer use the {@link #cloneClass(ObjectModelClass, boolean)} method */ @@ -599,20 +584,20 @@ /** * copy attributes, interfaces declartion and operation of a given classifier * into another classifier. - * + * <p/> * class-specific, enumeration-specific and interface-specific features * of the given classifier <strong>will not</strong> be present in the clone. * To copy those specific elements, use - * @link {@link #cloneClassifier(ObjectModelClassifier, boolean)} * - * @param source the classifier to clone from the source model - * @param destination where to clone the given source one + * @param source the classifier to clone from the source model + * @param destination where to clone the given source one * @param copyDocumentation flag to add documentation if some found in model + * @link {@link #cloneClassifier(ObjectModelClassifier, boolean)} * @since 2.3 */ protected void cloneClassifier(ObjectModelClassifier source, - ObjectModelClassifier destination, - boolean copyDocumentation) { + ObjectModelClassifier destination, + boolean copyDocumentation) { cloneTagValues(source, destination); @@ -636,8 +621,8 @@ * creates a clone of the given {@code source} class in the output model * and clones attributes, inheritence declarations and operations into the * clone - * - * @param source the class to clone from the source model + * + * @param source the class to clone from the source model * @param cloneDocumentation flag to add documentation if some found in model * @return the clone of the given class * @since 2.1.2 @@ -646,7 +631,7 @@ boolean cloneDocumentation) { ObjectModelClass outputClass = createClass(source.getName(), source.getPackageName()); - + cloneClassifier(source, outputClass, cloneDocumentation); if (source.getSuperclasses().size() > 1) { @@ -655,7 +640,7 @@ for (ObjectModelClass superClass : source.getSuperclasses()) { setSuperClass(outputClass, superClass.getQualifiedName()); - + // TODO 20100812 bleny is there something to do with discriminator for superClass ? } @@ -664,8 +649,8 @@ ObjectModelClassifier innerClassifierClone = cloneClassifier(classifier, cloneDocumentation); addInnerClassifier(outputClass, - ObjectModelType.OBJECT_MODEL_CLASSIFIER, - innerClassifierClone.getName()); + ObjectModelType.OBJECT_MODEL_CLASSIFIER, + innerClassifierClone.getName()); } } return outputClass; @@ -675,8 +660,8 @@ * creates a clone of the given {@code source} interface in the output model * and clones attributes, inheritence declaration and operations into the * clone - * - * @param source the interface to clone from the source model + * + * @param source the interface to clone from the source model * @param cloneDocumentation flag to add documentation if some found in model * @return the clone of the given interface * @since 2.1.2 @@ -685,10 +670,10 @@ boolean cloneDocumentation) { ObjectModelInterface outputInterface = createInterface(source.getName(), source.getPackageName()); - + cloneClassifier(source, outputInterface, cloneDocumentation); // nothing more to do. copyClassifier already done the job - + return outputInterface; } @@ -696,8 +681,8 @@ * creates a clone of the given {@code source} enumeration in the output * model and clones attributes, inheritence declaration, operations and * literals into the clone - * - * @param source the enumeration to clone from the source model + * + * @param source the enumeration to clone from the source model * @param cloneDocumentation flag to add documentation if some found in model * @return the clone of the given enumeration * @since 2.1.2 @@ -705,25 +690,25 @@ public ObjectModelEnumeration cloneEnumeration(ObjectModelEnumeration source, boolean cloneDocumentation) { ObjectModelEnumeration outputEnumeration = - createEnumeration(source.getName(), source.getPackageName()); + createEnumeration(source.getName(), source.getPackageName()); cloneClassifier(source, outputEnumeration, cloneDocumentation); - + for (String literal : source.getLiterals()) { addLiteral(outputEnumeration, literal); } - + return outputEnumeration; } /** * creates a clone of the given {@code source} classifier in the output * model and clones attributes, inheritence declaration and operations - * + * <p/> * class-specific, enumeration-specific and interface-specific features * of the given classifier <strong>will</strong> be present in the clone - * - * @param source the classifier to clone from the source model + * + * @param source the classifier to clone from the source model * @param cloneDocumentation flag to add documentation if some found in model * @return the clone of the given classifier * @since 2.1.2 @@ -736,7 +721,7 @@ } else if (source.isClass()) { clone = cloneClass((ObjectModelClass) source, cloneDocumentation); } else if (source.isEnum()) { - clone = cloneEnumeration((ObjectModelEnumeration) source, cloneDocumentation); + clone = cloneEnumeration((ObjectModelEnumeration) source, cloneDocumentation); } else { // should never occur log.error("strange classifier " + source); @@ -792,10 +777,10 @@ String constantName = getConstantName(literal); addConstant(output, - constantName, - String.class, - "\"" + literal + "\"", - ObjectModelModifier.PUBLIC + constantName, + String.class, + "\"" + literal + "\"", + ObjectModelModifier.PUBLIC ); constantNames.add(constantName); } @@ -832,9 +817,9 @@ /** * Generates a static block with I18n keys for each navigable attributes * prefixed by the given {@code i18nPrefix}. - * - * @param input the input classifier - * @param output the output classifier (to generate) + * + * @param input the input classifier + * @param output the output classifier (to generate) * @param i18nPrefix the i81n prefix to use */ protected void generateI18nBlock(ObjectModelClassifier input, @@ -860,11 +845,37 @@ } protected void addI18n(StringBuilder buffer, String i18nPrefix, - String suffix) { + String suffix) { buffer.append("\n I18n.n_(\""); buffer.append(i18nPrefix); buffer.append(suffix); buffer.append("\");"); } + protected boolean isInClassPath(ObjectModelClassifier classifier) { + return isInClassPath(classifier.getQualifiedName()); + } + + protected boolean isInClassPath(String fqn) { + + URL fileLocation = getFileInClassPath(fqn); + + if (fileLocation != null) { + + // there is already a existing file in class-path, skip + + if (isVerbose()) { + + log.info("Will not generate [" + fqn + "], already found in class-path at location : " + fileLocation); + } else { + + log.info("Will not generate [" + fqn + "], already found in class-path."); + } + + return true; + } + + // is not found + return false; + } } Modified: trunk/maven-eugene-plugin/pom.xml =================================================================== --- trunk/maven-eugene-plugin/pom.xml 2011-09-22 17:23:25 UTC (rev 1102) +++ trunk/maven-eugene-plugin/pom.xml 2011-10-12 18:54:15 UTC (rev 1103) @@ -221,13 +221,14 @@ <artifactId>maven-invoker-plugin</artifactId> <configuration> <pomIncludes> - <pomInclude>evol-879/zargo/pom.xml</pomInclude> - <pomInclude>evol-879/xmi/pom.xml</pomInclude> - <pomInclude>copyVersionFiles/anomalie163/pom.xml</pomInclude> - <pomInclude>smart-generate/only-zargo/pom.xml</pomInclude> - <pomInclude>smart-generate/only-zargo-xmi/pom.xml</pomInclude> - <pomInclude>smart-generate/all/pom.xml</pomInclude> - <pomInclude>smart-generate/generators/pom.xml</pomInclude> + <pomInclude>evol-308/pom.xml</pomInclude> + <!--<pomInclude>evol-879/zargo/pom.xml</pomInclude>--> + <!--<pomInclude>evol-879/xmi/pom.xml</pomInclude>--> + <!--<pomInclude>copyVersionFiles/anomalie163/pom.xml</pomInclude>--> + <!--<pomInclude>smart-generate/only-zargo/pom.xml</pomInclude>--> + <!--<pomInclude>smart-generate/only-zargo-xmi/pom.xml</pomInclude>--> + <!--<pomInclude>smart-generate/all/pom.xml</pomInclude>--> + <!--<pomInclude>smart-generate/generators/pom.xml</pomInclude>--> <!-- this test used topia and must be move in topia not here --> <!--<pomInclude>evol-879/model/pom.xml</pomInclude>--> </pomIncludes> Added: trunk/maven-eugene-plugin/src/it/evol-308/invoker.properties =================================================================== --- trunk/maven-eugene-plugin/src/it/evol-308/invoker.properties (rev 0) +++ trunk/maven-eugene-plugin/src/it/evol-308/invoker.properties 2011-10-12 18:54:15 UTC (rev 1103) @@ -0,0 +1 @@ +invoker.goals=clean test \ No newline at end of file Added: trunk/maven-eugene-plugin/src/it/evol-308/pom.xml =================================================================== --- trunk/maven-eugene-plugin/src/it/evol-308/pom.xml (rev 0) +++ trunk/maven-eugene-plugin/src/it/evol-308/pom.xml 2011-10-12 18:54:15 UTC (rev 1103) @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + EUGene :: Maven plugin + + $Id: pom.xml 1079 2011-06-28 09:15:23Z tchemit $ + $HeadURL: http://svn.nuiton.org/svn/eugene/trunk/maven-eugene-plugin/src/it/evol-879/x... $ + %% + Copyright (C) 2006 - 2010 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + +<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> + + <groupId>org.nuiton.eugene.test</groupId> + <artifactId>testEvol308-xmi</artifactId> + <version>2.0.0</version> + + <name>EUGene Test :: testEvol308</name> + + <properties> + + <eugeneVersion>@pom.version@</eugeneVersion> + + <!-- default encoding --> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + + <!-- compiler configuration --> + <maven.compiler.source>1.6</maven.compiler.source> + <maven.compiler.target>1.6</maven.compiler.target> + + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + <version>4.9</version> + </dependency> + </dependencies> + + <build> + + <plugins> + + <plugin> + <groupId>org.nuiton.eugene</groupId> + <artifactId>maven-eugene-plugin</artifactId> + <version>${eugeneVersion}</version> + <configuration> + <fullPackagePath>org.nuiton.euegne.test</fullPackagePath> + <defaultPackage>org.nuiton.euegne.test</defaultPackage> + <resolver>org.nuiton.util.FasterCachedResourceResolver</resolver> + <inputs>src/main/xmi:model.zargo</inputs> + <templates> + org.nuiton.eugene.java.JavaEnumerationTransformer + </templates> + </configuration> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>smart-generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> + + Added: trunk/maven-eugene-plugin/src/it/evol-308/src/main/java/org/nuiton/eugene/test/MyEnumeration2.java =================================================================== --- trunk/maven-eugene-plugin/src/it/evol-308/src/main/java/org/nuiton/eugene/test/MyEnumeration2.java (rev 0) +++ trunk/maven-eugene-plugin/src/it/evol-308/src/main/java/org/nuiton/eugene/test/MyEnumeration2.java 2011-10-12 18:54:15 UTC (rev 1103) @@ -0,0 +1,6 @@ +package org.nuiton.eugene.test; + + +public enum MyEnumeration2 { + one2; +} \ No newline at end of file Added: trunk/maven-eugene-plugin/src/it/evol-308/src/test/java/org/nuiton/eugene/test/EnumerationTest.java =================================================================== --- trunk/maven-eugene-plugin/src/it/evol-308/src/test/java/org/nuiton/eugene/test/EnumerationTest.java (rev 0) +++ trunk/maven-eugene-plugin/src/it/evol-308/src/test/java/org/nuiton/eugene/test/EnumerationTest.java 2011-10-12 18:54:15 UTC (rev 1103) @@ -0,0 +1,17 @@ +package org.nuiton.eugene.test; + +import org.junit.Assert; +import org.junit.Test; + +public class EnumerationTest { + + @Test + public void testEnumeration() { + Assert.assertNotNull(MyEnumeration.values()); + Assert.assertEquals(3,MyEnumeration.values().length); + Assert.assertNotNull(MyEnumeration.one); + Assert.assertNotNull(MyEnumeration.two); + Assert.assertNotNull(MyEnumeration.three); + + } +} Added: trunk/maven-eugene-plugin/src/it/evol-308/verify.groovy =================================================================== --- trunk/maven-eugene-plugin/src/it/evol-308/verify.groovy (rev 0) +++ trunk/maven-eugene-plugin/src/it/evol-308/verify.groovy 2011-10-12 18:54:15 UTC (rev 1103) @@ -0,0 +1,12 @@ + +outputDir = new File(basedir, 'target/generated-sources/java'); + +// already in class-path +file = new File(outputDir, 'org/nuiton/eugene/test/MyEnumeration2'); +assert !file.exists(); + +// not with stereotype enumeration +file = new File(outputDir, 'org/nuiton/eugene/test/MyEnumeration3'); +assert !file.exists(); + +return true; \ No newline at end of file