Author: tchemit Date: 2008-10-13 14:50:09 +0000 (Mon, 13 Oct 2008) New Revision: 340 Added: lutingenerator/tags/0.60/ lutingenerator/tags/0.60/changelog lutingenerator/tags/0.60/pom.xml lutingenerator/tags/0.60/src/main/java/org/codelutin/generator/GeneratorTask.java lutingenerator/tags/0.60/src/site/site.xml lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/StateModelTest.java lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParserTest.java lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/xml/ModelMergeTest.java lutingenerator/tags/0.60/src/test/resources/log4j.properties lutingenerator/tags/0.60/src/test/resources/org/ lutingenerator/tags/0.60/src/test/resources/org/codelutin/generator/models/ui/ lutingenerator/tags/0.60/src/test/resources/org/codelutin/generator/models/xml/ Removed: lutingenerator/tags/0.60/changelog lutingenerator/tags/0.60/pom.xml lutingenerator/tags/0.60/src/main/java/org/codelutin/generator/GeneratorTask.java lutingenerator/tags/0.60/src/site/site.xml lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/StateModelTest.java lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/contact.properties lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/contact.statemodel lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/project.statemodel lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParserTest.java lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/test.javaxml lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/test1.javaxml lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/test2.javaxml lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/xml/ModelMergeTest.java lutingenerator/tags/0.60/src/test/resources/security1.objectmodel lutingenerator/tags/0.60/src/test/resources/security1.properties lutingenerator/tags/0.60/src/test/resources/security2.objectmodel lutingenerator/tags/0.60/src/test/resources/security3.objectmodel lutingenerator/tags/0.60/src/test/resources/security4.objectmodel lutingenerator/tags/0.60/src/test/resources/security5.objectmodel lutingenerator/tags/0.60/src/test/resources/security6.objectmodel lutingenerator/tags/0.60/src/test/resources/security6.properties Log: [maven-release-plugin] copy for tag 0.60 Copied: lutingenerator/tags/0.60 (from rev 328, lutingenerator/trunk) Deleted: lutingenerator/tags/0.60/changelog =================================================================== --- lutingenerator/trunk/changelog 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/changelog 2008-10-13 14:50:09 UTC (rev 340) @@ -1,59 +0,0 @@ -ver-0-51 thimel 20080925 - - * 20080925 [thimel] super pom in version 3.0 - * 20080901 [chatellier] Maven2 layout and LGPL3 - * 20070528 [chatellier] add tag values support to stateModel - * 20070528 [chatellier] modify defaut stateModel generation - * 20070523 [chatellier] remove lutinxml dependency - * 20070523 [chatellier] UIModel implementation over digester : - - use generics - - non tested - - no digester rules definided (no samples available) - * 20070523 [chatellier] change property reverveAttribute to - reverveAttributeName to resolve conflict in objectModel model. - * 20070522 [chatellier] modify ObjectModel implementation : - - to use JavaBeans conventions - - parsed with commons-digester - - to use generics - * 20070520 [chatellier] add stateModel (parsed with commons-digester) - * 20070520 [chatellier] correct generic type error on objectModel interfaces - -ver-0-50 poussin 20070425 - - * add associationType for all attributes - * 20070420 [chatellier] Ajout de l'export de la version du modèle xmi dans - xmi1.2ToObjectModel.xsl - * 20070420 [chatellier] ajout de la DTD objectModel - -ver-0-31 thimel 20060825 - - * ajout de isIndexed sur les attributs - * isOrdered est vrai si isIndexed est vrai ou que le tagValue order-by est - present ou que ordering fixe sur ordered - * Ajout de validateurs de modele + impl de validateur "basiques" base sur des - noms (attributs, classes, ...). - -ver-0-30 thimel 20060303 - - * Ajout des exceptions pour les operations - * Correction du support des interfaces et classes abstraites - * Double compatibilite Poseidon 3.2 / 4 - -ver-0-29 thimel 20060228 - - * Support de l'hértage pour les classes d'association - -ver-0-28 thimel 20060224 - - * Support de Poseidon4 - * Possibilite d'avoir des tagValues sur les modeles - * Ajout de l'extraction de ordered et de la navigabilite - -ver-0-27 thimel 20051213 - - * Ajout d'une methode pour avoir la liste des attributs d'une classe - * Correction erreur de fonctionnement dans ObjectModelImpl(XML).getInterface (doit renvoyer null si non trouve) - -0.26 - - * Ajout du support des stereotypes sur les attributs \ No newline at end of file Copied: lutingenerator/tags/0.60/changelog (from rev 334, lutingenerator/trunk/changelog) =================================================================== --- lutingenerator/tags/0.60/changelog (rev 0) +++ lutingenerator/tags/0.60/changelog 2008-10-13 14:50:09 UTC (rev 340) @@ -0,0 +1,64 @@ +0.60 chemit 20081013 + * 20081013 [chemit] + - make tests works again + - clean pom + +ver-0-51 thimel 20080925 + + * 20080925 [thimel] super pom in version 3.0 + * 20080901 [chatellier] Maven2 layout and LGPL3 + * 20070528 [chatellier] add tag values support to stateModel + * 20070528 [chatellier] modify defaut stateModel generation + * 20070523 [chatellier] remove lutinxml dependency + * 20070523 [chatellier] UIModel implementation over digester : + - use generics + - non tested + - no digester rules definided (no samples available) + * 20070523 [chatellier] change property reverveAttribute to + reverveAttributeName to resolve conflict in objectModel model. + * 20070522 [chatellier] modify ObjectModel implementation : + - to use JavaBeans conventions + - parsed with commons-digester + - to use generics + * 20070520 [chatellier] add stateModel (parsed with commons-digester) + * 20070520 [chatellier] correct generic type error on objectModel interfaces + +ver-0-50 poussin 20070425 + + * add associationType for all attributes + * 20070420 [chatellier] Ajout de l'export de la version du modèle xmi dans + xmi1.2ToObjectModel.xsl + * 20070420 [chatellier] ajout de la DTD objectModel + +ver-0-31 thimel 20060825 + + * ajout de isIndexed sur les attributs + * isOrdered est vrai si isIndexed est vrai ou que le tagValue order-by est + present ou que ordering fixe sur ordered + * Ajout de validateurs de modele + impl de validateur "basiques" base sur des + noms (attributs, classes, ...). + +ver-0-30 thimel 20060303 + + * Ajout des exceptions pour les operations + * Correction du support des interfaces et classes abstraites + * Double compatibilite Poseidon 3.2 / 4 + +ver-0-29 thimel 20060228 + + * Support de l'hértage pour les classes d'association + +ver-0-28 thimel 20060224 + + * Support de Poseidon4 + * Possibilite d'avoir des tagValues sur les modeles + * Ajout de l'extraction de ordered et de la navigabilite + +ver-0-27 thimel 20051213 + + * Ajout d'une methode pour avoir la liste des attributs d'une classe + * Correction erreur de fonctionnement dans ObjectModelImpl(XML).getInterface (doit renvoyer null si non trouve) + +0.26 + + * Ajout du support des stereotypes sur les attributs \ No newline at end of file Deleted: lutingenerator/tags/0.60/pom.xml =================================================================== --- lutingenerator/trunk/pom.xml 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/pom.xml 2008-10-13 14:50:09 UTC (rev 340) @@ -1,103 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<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"> - - <!--The version of maven's project object model--> - <modelVersion>4.0.0</modelVersion> - - <!-- parent --> - <parent> - <groupId>org.codelutin</groupId> - <artifactId>lutinproject</artifactId> - <version>3.0</version> - </parent> - - <!--A unique name for this project--> - <groupId>org.codelutin</groupId> - <artifactId>lutingenerator</artifactId> - <name>Lutin Generator</name> - - <!--ejb, jar, war...--> - <packaging>jar</packaging> - - <!--Version--> - <version>0.51-SNAPSHOT</version> - - <!--Description--> - <description> - Générateurs en tout genre. - </description> - <inceptionYear>2004</inceptionYear> - - <!-- Properties --> - <properties> - <!-- id du projet du labs --> - <labs.id>39</labs.id> - - <!-- Test --> - <maven.test.skip>true</maven.test.skip> - </properties> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - </plugin> - - </plugins> - </build> - - <!--Source control management--> - <scm> - <connection>${maven.scm.connection}</connection> - <developerConnection>${maven.scm.developerConnection}</developerConnection> - <url>${maven.scm.url}</url> - </scm> - - <!--Librairies--> - <dependencies> - - <dependency> - <groupId>commons-digester</groupId> - <artifactId>commons-digester</artifactId> - <version>1.8</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.4</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.ant</groupId> - <artifactId>ant</artifactId> - <version>1.7.1</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.codelutin</groupId> - <artifactId>lutinutil</artifactId> - <version>0.30</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>dom4j</groupId> - <artifactId>dom4j</artifactId> - <version>1.6.1</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>jaxen</groupId> - <artifactId>jaxen</artifactId> - <version>1.1.1</version> - <scope>compile</scope> - </dependency> - </dependencies> -</project> Copied: lutingenerator/tags/0.60/pom.xml (from rev 339, lutingenerator/trunk/pom.xml) =================================================================== --- lutingenerator/tags/0.60/pom.xml (rev 0) +++ lutingenerator/tags/0.60/pom.xml 2008-10-13 14:50:09 UTC (rev 340) @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + <parent> + <groupId>org.codelutin</groupId> + <artifactId>lutinproject</artifactId> + <version>3.0</version> + </parent> + + <artifactId>lutingenerator</artifactId> + + <!-- POM Relationships : Inheritance : Dependencies --> + <dependencies> + + <dependency> + <groupId>commons-digester</groupId> + <artifactId>commons-digester</artifactId> + <version>1.8</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.4</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.apache.ant</groupId> + <artifactId>ant</artifactId> + <version>1.7.1</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>lutinutil</artifactId> + <version>0.30</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>dom4j</groupId> + <artifactId>dom4j</artifactId> + <version>1.6.1</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>jaxen</groupId> + <artifactId>jaxen</artifactId> + <version>1.1.1</version> + <scope>compile</scope> + </dependency> + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + <name>Lutin Generator</name> + <version>0.60</version> + <description>Générateurs en tout genre.</description> + <inceptionYear>2004</inceptionYear> + + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> + <packaging>jar</packaging> + + <properties> + + <!-- id du projet du labs --> + <labs.id>39</labs.id> + + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + </plugin> + + </plugins> + </build> + + <!-- ************************************************************* --> + <!-- *** Build Environment ************************************** --> + <!-- ************************************************************* --> + + <!--Source control management--> + <scm> + <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/lutingenerator/lutingenerator/tags/0.60</connection> + <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/lutingenerator/lutingenerator/tags/0.60</developerConnection> + <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/lutingenerator/tags/0.60?root=lutingenerator</url> + </scm> + +</project> Deleted: lutingenerator/tags/0.60/src/main/java/org/codelutin/generator/GeneratorTask.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorTask.java 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/main/java/org/codelutin/generator/GeneratorTask.java 2008-10-13 14:50:09 UTC (rev 340) @@ -1,189 +0,0 @@ -/* *##% Lutin Generator - * Copyright (C) 2004 - 2008 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>. ##%*/ - -/* * - * GeneratorTemplatesTask.java - * - * Created: 14 janv. 2004 - * - * @author Benjamin Poussin <poussin@codelutin.com> - * Copyright Code Lutin - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ - -package org.codelutin.generator; - -import java.io.File; -import java.util.Properties; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.taskdefs.MatchingTask; - -/** - * exemple d'utilisation dans ant <generator - * template="org.codelutin.generator.generators.persistence.TopiaModelToDTOGenerator.java,org.codelutin.generator.generators.persistence.TopiaModelToTJDOGenerator.java" - * destdir="target/gen/java" srcdir="target/gen/model" includes="*.xmi"/> - */ -public class GeneratorTask extends MatchingTask { // GeneratorTask - - public GeneratorTask() { - } - - protected void doExecute(File srcFile, File destDir, Generator[] generators) - throws BuildException { - doExecute(new File[] { srcFile }, destDir, generators); - - } - - protected void doExecute(File[] srcFiles, File destDir, - Generator[] generators) throws BuildException { - for (int i = 0; i < generators.length; i++) { - log("Applying " + generators[i].getClass().getName() + " into " + destDir); - if (generators[i] != null) { - generators[i].setProperties(properties); - generators[i].setOverwrite(overwrite); - generators[i].generate(srcFiles, destDir); - } - } - } - - protected String templates = null; - - protected File srcDir = null; - - protected File srcFile = null; - - protected File destDir = null; - - protected Properties properties = new Properties(); - - protected boolean overwrite = true; - - public void setOverwrite(boolean v) { - overwrite = v; - } - - public void setTemplates(String templates) { - this.templates = templates; - } - - /** - * Permet d'ajouter des properties. exemple: toto=1,package=org.codelutin - */ - public void setProperties(String properties) { - String[] props = properties.split(","); - for (int i = 0; i < props.length; i++) { - String[] pv = props[i].split("="); - this.properties.put(pv[0], pv[1]); - } - Logger.getLogger(getClass().getName() + ".setProperties").log( - Level.FINE, "Properties " + this.properties); - } - - public void setSrcdir(File srcDir) { - this.srcDir = srcDir; - } - - public void setDestdir(File destDir) { - this.destDir = destDir; - } - - public void setSrcFile(File srcFile) { - this.srcFile = srcFile; - } - - public void execute() throws BuildException { - Generator[] generators = null; - if (templates == null) { - throw new BuildException("templates attribute must be set!", - getLocation()); - } - String[] templateGenerators = templates.split(","); - generators = new Generator[templateGenerators.length]; - for (int i = 0; i < templateGenerators.length; i++) { - try { - generators[i] = (Generator) Class - .forName(templateGenerators[i]).newInstance(); - } catch (ClassCastException eee) { - System.out.println("Generator don't herite Generator Class : " - + templateGenerators[i]); - eee.printStackTrace(); - } catch (ClassNotFoundException eee) { - System.out.println("Unable to find generator : " - + templateGenerators[i]); - eee.printStackTrace(); - } catch (InstantiationException eee) { - System.out.println("Unable to instanciate template : " - + templateGenerators[i]); - eee.printStackTrace(); - } catch (IllegalAccessException eee) { - System.out.println("Unable to parse topia input file : " - + templateGenerators[i]); - eee.printStackTrace(); - } - } - - if (generators == null) { - throw new BuildException("templates " + templates - + " can't be found!", getLocation()); - } - - if (destDir == null) { - throw new BuildException("destDir attribute must be set!", - getLocation()); - } - - if (!destDir.isDirectory()) { - throw new BuildException("destination directory \"" + destDir - + "\" does not exist or is not a directory", getLocation()); - } - - if (srcFile == null && srcDir == null) { - throw new BuildException( - "srcFile or srcdir attribute must be set!", getLocation()); - } - - if (srcFile != null && !srcFile.isFile()) { - throw new BuildException("src file \"" + srcFile - + "\" does not exist or is not a file", getLocation()); - } - - if (srcFile != null) { - // generate the source files - doExecute(srcFile, destDir, generators); - } else { - DirectoryScanner scanner; - String[] includedFilenames; - scanner = getDirectoryScanner(srcDir); - - // Process all the files marked for styling - includedFilenames = scanner.getIncludedFiles(); - File[] includedFiles = new File[includedFilenames.length]; - for (int i = 0; i < includedFilenames.length; ++i) { - includedFiles[i] = new File(srcDir, includedFilenames[i]); - } - doExecute(includedFiles, destDir, generators); - } - } - -} // GeneratorTask Copied: lutingenerator/tags/0.60/src/main/java/org/codelutin/generator/GeneratorTask.java (from rev 329, lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorTask.java) =================================================================== --- lutingenerator/tags/0.60/src/main/java/org/codelutin/generator/GeneratorTask.java (rev 0) +++ lutingenerator/tags/0.60/src/main/java/org/codelutin/generator/GeneratorTask.java 2008-10-13 14:50:09 UTC (rev 340) @@ -0,0 +1,190 @@ +/* *##% Lutin Generator + * Copyright (C) 2004 - 2008 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>. ##%*/ + +/* * + * GeneratorTemplatesTask.java + * + * Created: 14 janv. 2004 + * + * @author Benjamin Poussin <poussin@codelutin.com> + * Copyright Code Lutin + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ + +package org.codelutin.generator; + +import java.io.File; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.DirectoryScanner; +import org.apache.tools.ant.taskdefs.MatchingTask; + +/** + * exemple d'utilisation dans ant <generator + * template="org.codelutin.generator.generators.persistence.TopiaModelToDTOGenerator.java,org.codelutin.generator.generators.persistence.TopiaModelToTJDOGenerator.java" + * destdir="target/gen/java" srcdir="target/gen/model" includes="*.xmi"/> + */ +public class GeneratorTask extends MatchingTask { // GeneratorTask + + public GeneratorTask() { + } + + protected void doExecute(File srcFile, File destDir, Generator[] generators) + throws BuildException { + doExecute(new File[] { srcFile }, destDir, generators); + + } + + protected void doExecute(File[] srcFiles, File destDir, + Generator[] generators) throws BuildException { + for (Generator generator : generators) { + if (generator != null) { + log("Applying " + generator.getClass().getName() + " into " + destDir); + generator.setProperties(properties); + generator.setOverwrite(overwrite); + generator.generate(srcFiles, destDir); + } + } + } + + protected String templates = null; + + protected File srcDir = null; + + protected File srcFile = null; + + protected File destDir = null; + + protected Properties properties = new Properties(); + + protected boolean overwrite = true; + + public void setOverwrite(boolean v) { + overwrite = v; + } + + public void setTemplates(String templates) { + this.templates = templates; + } + + /** + * Permet d'ajouter des properties. exemple: toto=1,package=org.codelutin + * @param properties TODO + */ + public void setProperties(String properties) { + String[] props = properties.split(","); + for (String prop : props) { + String[] pv = prop.split("="); + this.properties.put(pv[0], pv[1]); + } + Logger.getLogger(getClass().getName() + ".setProperties").log( + Level.FINE, "Properties " + this.properties); + } + + public void setSrcdir(File srcDir) { + this.srcDir = srcDir; + } + + public void setDestdir(File destDir) { + this.destDir = destDir; + } + + public void setSrcFile(File srcFile) { + this.srcFile = srcFile; + } + + public void execute() throws BuildException { + Generator[] generators; + if (templates == null) { + throw new BuildException("templates attribute must be set!", + getLocation()); + } + String[] templateGenerators = templates.split(","); + generators = new Generator[templateGenerators.length]; + for (int i = 0; i < templateGenerators.length; i++) { + try { + generators[i] = (Generator) Class + .forName(templateGenerators[i]).newInstance(); + } catch (ClassCastException eee) { + System.out.println("Generator don't herite Generator Class : " + + templateGenerators[i]); + eee.printStackTrace(); + } catch (ClassNotFoundException eee) { + System.out.println("Unable to find generator : " + + templateGenerators[i]); + eee.printStackTrace(); + } catch (InstantiationException eee) { + System.out.println("Unable to instanciate template : " + + templateGenerators[i]); + eee.printStackTrace(); + } catch (IllegalAccessException eee) { + System.out.println("Unable to parse topia input file : " + + templateGenerators[i]); + eee.printStackTrace(); + } + } + + if (generators == null) { + throw new BuildException("templates " + templates + + " can't be found!", getLocation()); + } + + if (destDir == null) { + throw new BuildException("destDir attribute must be set!", + getLocation()); + } + + if (!destDir.isDirectory()) { + throw new BuildException("destination directory \"" + destDir + + "\" does not exist or is not a directory", getLocation()); + } + + if (srcFile == null && srcDir == null) { + throw new BuildException( + "srcFile or srcdir attribute must be set!", getLocation()); + } + + if (srcFile != null && !srcFile.isFile()) { + throw new BuildException("src file \"" + srcFile + + "\" does not exist or is not a file", getLocation()); + } + + if (srcFile != null) { + // generate the source files + doExecute(srcFile, destDir, generators); + } else { + DirectoryScanner scanner; + String[] includedFilenames; + scanner = getDirectoryScanner(srcDir); + + // Process all the files marked for styling + includedFilenames = scanner.getIncludedFiles(); + File[] includedFiles = new File[includedFilenames.length]; + for (int i = 0; i < includedFilenames.length; ++i) { + includedFiles[i] = new File(srcDir, includedFilenames[i]); + } + doExecute(includedFiles, destDir, generators); + } + } + +} // GeneratorTask Deleted: lutingenerator/tags/0.60/src/site/site.xml =================================================================== --- lutingenerator/trunk/src/site/site.xml 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/site/site.xml 2008-10-13 14:50:09 UTC (rev 340) @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="LutinGenerator"> - - <skin> - <groupId>org.codelutin</groupId> - <artifactId>maven-lutin-skin</artifactId> - <version>0.2</version> - </skin> - - <bannerLeft> - <name>Lutin Generator</name> - </bannerLeft> - - <bannerRight> - <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src> - <href>http://www.codelutin.com</href> - </bannerRight> - - <poweredBy> - <logo href="http://maven.apache.org" name="Maven" img="images/logos/maven-feather.png"/> - <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="images/jrst-logo.png"/> - <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText" img="images/restructuredtext-logo.png"/> - </poweredBy> - - <body> - <links> - <item name="Maven-generator-plugin" href="http://lutingenerator.labs.libre-entreprise.org/maven-generator-plugin/"/> - <item name="Labs" href="http://labs.libre-entreprise.org/"/> - <item name="Code Lutin" href="http://www.codelutin.com/"/> - </links> - - <menu name="Utilisateur"> - <item href="index.html" name="Accueil"></item> - <item href="http://lutinbuilder.labs.libre-entreprise.org/maven2/lutinlib/lutingenerator..." name="Téléchargement"/> - </menu> - - <menu name="Developpeur"> - <item name="ObjectModel" href="ObjectModel.html"/> - <item name="UIModel" href="DevUIDoc.html"/> - <item name="Todo" href="Todo.html"/> - </menu> - - ${reports} - - </body> -</project> Copied: lutingenerator/tags/0.60/src/site/site.xml (from rev 338, lutingenerator/trunk/src/site/site.xml) =================================================================== --- lutingenerator/tags/0.60/src/site/site.xml (rev 0) +++ lutingenerator/tags/0.60/src/site/site.xml 2008-10-13 14:50:09 UTC (rev 340) @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="${project.name}"> + + <skin> + <groupId>org.codelutin</groupId> + <artifactId>maven-lutin-skin</artifactId> + <version>0.2</version> + </skin> + + <bannerLeft> + <name>${project.name}</name> + </bannerLeft> + + <bannerRight> + <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src> + <href>${project.organization.url}</href> + </bannerRight> + + <poweredBy> + <logo href="http://maven.apache.org" name="Maven" img="images/logos/maven-feather.png"/> + <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="images/jrst-logo.png"/> + <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText" img="images/restructuredtext-logo.png"/> + </poweredBy> + + <body> + <links> + <item name="Maven-generator-plugin" href="http://lutingenerator.labs.libre-entreprise.org/maven-generator-plugin/"/> + <item name="Labs" href="http://labs.libre-entreprise.org/"/> + <item name="Code Lutin" href="http://www.codelutin.com/"/> + </links> + + <menu name="Utilisateur"> + <item href="index.html" name="Accueil"/> + <!--item href="http://lutinbuilder.labs.libre-entreprise.org/maven2/lutinlib/lutingenerator..." name="Téléchargement"/--> + </menu> + + <menu name="Téléchargement"> + <item href="${labs.builder.url}/org/codelutin/${project.artifactId}/${project.version}" + name="Télécharger la dernière version"/> + <item href="${labs.builder.url}/org/codelutin/${project.artifactId}" + name="Voir toutes les versions"/> + </menu> + <menu name="Developpeur"> + <item name="ObjectModel" href="ObjectModel.html"/> + <item name="UIModel" href="DevUIDoc.html"/> + <item name="Todo" href="Todo.html"/> + </menu> + + ${reports} + + </body> +</project> Deleted: lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/StateModelTest.java =================================================================== --- lutingenerator/trunk/src/test/java/org/codelutin/generator/models/state/StateModelTest.java 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/StateModelTest.java 2008-10-13 14:50:09 UTC (rev 340) @@ -1,136 +0,0 @@ -/* *##% Lutin Generator - * Copyright (C) 2004 - 2008 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>. ##%*/ - -package org.codelutin.generator.models.state; - -import java.io.File; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import junit.framework.TestCase; - -import org.codelutin.generator.StateModelGenerator; - -/** - * StateModelTest.java - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class StateModelTest extends TestCase { - - /** model */ - private StateModel stateModel; - - /** init */ - public void setUp() { - - File[] testFiles = { - new File("src/test/org/codelutin/generator/models/state/project.statemodel"), - new File("src/test/org/codelutin/generator/models/state/contact.statemodel") - }; - - StateModelGenerator generator = new StateModelGenerator(); - generator.generate(testFiles, new File("output")); - stateModel = generator.getModel(); - } - - /** various test */ - public void testCorrectStateModel() { - List<StateModelStateChart> lstChart = stateModel.getStateCharts(); - - // trois diagrammes - assertTrue(lstChart.size()==3); - - // les 3 ont des états - for(StateModelStateChart chart : lstChart) { - assertFalse(chart.getStates().isEmpty()); - } - - // diagramme contactManagementUseCase - StateModelStateChart cmChart = null; - for(StateModelStateChart smsc : lstChart) { - if("contactManagementUseCase".equals(smsc.getName())) { - cmChart = smsc; - } - } - assertNotNull(cmChart); - - // package - assertEquals(cmChart.getPackageName(),"org.codelutin.chorem.web.contactManagement"); - - // six etats - Collection<StateModelState> lstStates = cmChart.getStates(); - assertEquals(lstStates.size(),6); - - // le premier etat est initial - StateModelState initState = null; - StateModelState sfUCState = null; - for(StateModelState state : (StateModelState[]) lstStates.toArray(new StateModelState[lstStates.size()])) { - if("initContact".equals(state.getName())) { - initState = state; - } - if("societyFormUC".equals(state.getName())) { - sfUCState = state; - } - } - - // test init - assertNotNull(initState); - assertFalse(initState.isComplex()); - StateModelSimpleState sInitState = (StateModelSimpleState)initState; - assertTrue(sInitState.isInitial()); - - // les 3eme etat est complexe et a 4 etat - assertNotNull(sfUCState); - StateModelComplexState cpxState = (StateModelComplexState)sfUCState; - assertEquals(cpxState.getStates().size(),4); - - // test sur un etat - Collection<StateModelState> lstStatesCpxState = cpxState.getStates(); - StateModelState sfState = null; - for(StateModelState state : (StateModelState[]) lstStatesCpxState.toArray(new StateModelState[lstStatesCpxState.size()])) { - if("societyForm".equals(state.getName())) { - sfState = state; - } - } - assertNotNull(sfState); - assertEquals(sfState.getTransitions().size(), 2); - - // test transition - StateModelTransition trEventCancel = null; - for(StateModelTransition tr : sfState.getTransitions()) { - if("cancel".equals(tr.getEvent())) { - trEventCancel = tr; - } - } - assertNotNull(trEventCancel); - assertNotNull(trEventCancel.getDestinationState()); - assertEquals(trEventCancel.getDestinationState().getName(), "finalSocietyFormCancel"); - - // tagged value test - Map<String,String> tagValues = stateModel.getTagValues(); - assertNotNull(tagValues); - String tagUseCaseEngineExtendedClass = tagValues.get("usecaseengineextendedclass"); - assertNotNull(tagUseCaseEngineExtendedClass); - assertEquals(tagUseCaseEngineExtendedClass,"BasePage"); - } -} Copied: lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/StateModelTest.java (from rev 333, lutingenerator/trunk/src/test/java/org/codelutin/generator/models/state/StateModelTest.java) =================================================================== --- lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/StateModelTest.java (rev 0) +++ lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/StateModelTest.java 2008-10-13 14:50:09 UTC (rev 340) @@ -0,0 +1,136 @@ +/* *##% Lutin Generator + * Copyright (C) 2004 - 2008 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>. ##%*/ + +package org.codelutin.generator.models.state; + +import junit.framework.TestCase; +import org.codelutin.generator.StateModelGenerator; + +import java.io.File; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * StateModelTest.java + * + * @author chatellier + * @version $Revision$ + * <p/> + * Last update : $Date$ + * By : $Author$ + */ +public class StateModelTest extends TestCase { + + /** model */ + private StateModel stateModel; + + /** init */ + public void setUp() throws Exception { + super.setUp(); + File[] testFiles = { + new File(getClass().getResource("project.statemodel").toURI()), + new File(getClass().getResource("contact.statemodel").toURI()) + + }; + + StateModelGenerator generator = new StateModelGenerator(); + generator.generate(testFiles, new File("output")); + stateModel = generator.getModel(); + } + + /** various test */ + public void testCorrectStateModel() { + List<StateModelStateChart> lstChart = stateModel.getStateCharts(); + + // trois diagrammes + assertTrue(lstChart.size() == 3); + + // les 3 ont des états + for (StateModelStateChart chart : lstChart) { + assertFalse(chart.getStates().isEmpty()); + } + + // diagramme contactManagementUseCase + StateModelStateChart cmChart = null; + for (StateModelStateChart smsc : lstChart) { + if ("contactManagementUseCase".equals(smsc.getName())) { + cmChart = smsc; + } + } + assertNotNull(cmChart); + + // package + assertEquals(cmChart.getPackageName(), "org.codelutin.chorem.web.contactManagement"); + + // six etats + Collection<StateModelState> lstStates = cmChart.getStates(); + assertEquals(lstStates.size(), 6); + + // le premier etat est initial + StateModelState initState = null; + StateModelState sfUCState = null; + for (StateModelState state : lstStates.toArray(new StateModelState[lstStates.size()])) { + if ("initContact".equals(state.getName())) { + initState = state; + } + if ("societyFormUC".equals(state.getName())) { + sfUCState = state; + } + } + + // test init + assertNotNull(initState); + assertFalse(initState.isComplex()); + StateModelSimpleState sInitState = (StateModelSimpleState) initState; + assertTrue(sInitState.isInitial()); + + // les 3eme etat est complexe et a 4 etat + assertNotNull(sfUCState); + StateModelComplexState cpxState = (StateModelComplexState) sfUCState; + assertEquals(cpxState.getStates().size(), 4); + + // test sur un etat + Collection<StateModelState> lstStatesCpxState = cpxState.getStates(); + StateModelState sfState = null; + for (StateModelState state : lstStatesCpxState.toArray(new StateModelState[lstStatesCpxState.size()])) { + if ("societyForm".equals(state.getName())) { + sfState = state; + } + } + assertNotNull(sfState); + assertEquals(sfState.getTransitions().size(), 2); + + // test transition + StateModelTransition trEventCancel = null; + for (StateModelTransition tr : sfState.getTransitions()) { + if ("cancel".equals(tr.getEvent())) { + trEventCancel = tr; + } + } + assertNotNull(trEventCancel); + assertNotNull(trEventCancel.getDestinationState()); + assertEquals(trEventCancel.getDestinationState().getName(), "finalSocietyFormCancel"); + + // tagged value test + Map<String, String> tagValues = stateModel.getTagValues(); + assertNotNull(tagValues); + String tagUseCaseEngineExtendedClass = tagValues.get("usecaseengineextendedclass"); + assertNotNull(tagUseCaseEngineExtendedClass); + assertEquals(tagUseCaseEngineExtendedClass, "BasePage"); + } +} Deleted: lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/contact.properties =================================================================== --- lutingenerator/trunk/src/test/java/org/codelutin/generator/models/state/contact.properties 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/contact.properties 2008-10-13 14:50:09 UTC (rev 340) @@ -1 +0,0 @@ -model.tagvalue.usecaseengineextendedclass=BasePage \ No newline at end of file Deleted: lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/contact.statemodel =================================================================== --- lutingenerator/trunk/src/test/java/org/codelutin/generator/models/state/contact.statemodel 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/contact.statemodel 2008-10-13 14:50:09 UTC (rev 340) @@ -1,58 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<stateModel xmlns="http://www.codelutin.org/lutingenerator/stateModel" name="Chorem" version=""> - <stateChart name="contactManagementUseCase" package="org.codelutin.chorem.web.contactManagement"> - <state name="initContact" initial="true"> - <transition event="" toState="contactList"/> - </state> - <state name="contactList"> - <transition event="addContact" toState="contactFormUC"/> - <transition event="view" toState="viewContact"/> - </state> - <complexeState name="contactFormUC"> - <state name="initContactForm" initial="true"> - <transition event="" toState="contactForm"/> - </state> - <state name="contactForm"> - <transition event="contactStore" toState="finalContactFormStore"/> - <transition event="contactCancel" toState="finalContactFormCancel"/> - <transition event="addSociety" toState="societyFormUC"/> - </state> - <state name="finalContactFormStore" final="true"/> - <state name="finalContactFormCancel" final="true"/> - </complexeState> - <complexeState name="societyFormUC"> - <state name="initSocietyForm" initial="true"> - <transition event="" toState="societyForm"/> - </state> - <state name="societyForm"> - <transition event="cancel" toState="finalSocietyFormCancel"/> - <transition event="societyStore" toState="finalSocietyFormStore"/> - </state> - <state name="finalSocietyFormStore" final="true"/> - <state name="finalSocietyFormCancel" final="true"/> - </complexeState> - <state name="viewContact"> - <transition event="edit" toState="contactFormUC"/> - <transition event="viewSociety" toState="societyViewUC"/> - </state> - <complexeState name="societyViewUC"> - <state name="societyView"> - <transition event="ok" toState="finalSocietyViewOk"/> - <transition event="edit" toState="societyFormUC"/> - </state> - <state name="initSocietyView" initial="true"> - <transition event="" toState="societyView"/> - </state> - <state name="finalSocietyViewOk" final="true"/> - </complexeState> - </stateChart> - <stateChart name="lol" package="org.codelutin.chorem.web.newForTest.nothing"> - <state name="initNot" initial="true"> - <transition event="" toState="doNothingState"/> - </state> - <state name="doNothingState"> - <transition event="nothing" toState="finalNot"/> - </state> - <state name="finalNot" final="true"/> - </stateChart> -</stateModel> Deleted: lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/project.statemodel =================================================================== --- lutingenerator/trunk/src/test/java/org/codelutin/generator/models/state/project.statemodel 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/state/project.statemodel 2008-10-13 14:50:09 UTC (rev 340) @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<stateModel xmlns="http://www.codelutin.org/lutingenerator/stateModel" name="Chorem" version=""> - <stateChart name="projectManagementUseCase" package="org.codelutin.chorem.web.contactManagement"> - <initState name="initProject"> - <transition toState="projectList"/> - </initState> - <state name="projectList"> - <transition toState="finalProject"> - <action name="end"/> - </transition> - </state> - <finalState name="finalProject"/> - </stateChart> -</stateModel> \ No newline at end of file Deleted: lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParserTest.java =================================================================== --- lutingenerator/trunk/src/test/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParserTest.java 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParserTest.java 2008-10-13 14:50:09 UTC (rev 340) @@ -1,134 +0,0 @@ -/* *##% Lutin Generator - * Copyright (C) 2004 - 2008 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>. ##%*/ - -/* * - * JavaXMLParserTest.java - * - * Created: Aug 9, 2004 - * - * @author Benjamin Poussin <poussin@codelutin.com> - * Copyright Code Lutin - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ - -package org.codelutin.generator.models.ui.javaxml; - -import java.io.File; -import java.util.ArrayList; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -import org.codelutin.generator.models.ui.UIModel; -import org.codelutin.generator.models.ui.impl.UIModelChildImpl; -import org.codelutin.generator.models.ui.impl.UIModelEventImpl; -import org.codelutin.generator.models.ui.impl.UIModelObjectImpl; - -public class JavaXMLParserTest extends TestCase { // JavaXMLParserTest - - public void testParse() throws Exception { - - // 1 panel, 2 boutons, gridbaglayout - File testFile = new File("src/test/org/codelutin/generator/models/ui/javaxml/test.javaxml"); - - // 1 panel, 1 bouton, borderlayout - File testFile1 = new File("src/test/org/codelutin/generator/models/ui/javaxml/test1.javaxml"); - - // alarmPanel de Chorem dans une JFrame - File testFile2 = new File("src/test/org/codelutin/generator/models/ui/javaxml/test2.javaxml"); - - // - //File testFile3 = new File("src/test/org/codelutin/generator/models/ui/javaxml/org.codelutin.chorem.entities.ui.RelationshipUI.javaxml"); - - if(testFile.exists() && testFile1.exists() && testFile2.exists()){ - - JavaXMLParser parser = new JavaXMLParser(); - UIModel ui = parser.parse(testFile); - UIModel ui1 = parser.parse(testFile1); - UIModel ui2 = parser.parse(testFile2); - //UIModel ui3 = parser.parse(testFile3); - - //System.out.println("UI : \n" + ui); - //System.out.println("UI1 : \n" + ui1); - //System.out.println("UI2 : \n" + ui2); - //System.out.println("UI3 : \n" + ui3); - - // test si l'element racine est parse - assertNotNull(ui.getRoot()); - assertNotNull(ui.getRoot().getName()); - - // tests sur tous les elements du root - assertTrue(ui.getRoot().getArguments().size()==0); - assertTrue(ui.getRoot().getChildren().size()==2); - assertTrue(ui.getRoot().getEvents().size()==1); - assertTrue(ui.getRoot().getProperties().size()==2); - - // test si le layout est bien recupere - UIModelObjectImpl object = (UIModelObjectImpl)ui.getRoot().getProperty("layout").getValue(); - - assertEquals(object.getType(), "java.awt.GridBagLayout"); - - // test sur un event de l'enfant - ArrayList children = (ArrayList)ui.getRoot().getChildren(); - UIModelChildImpl child = (UIModelChildImpl)children.get(0); - - ArrayList events = (ArrayList)child.getObject().getEvents(); - UIModelEventImpl event = (UIModelEventImpl)events.get(0); - - assertEquals(event.getAction(), "actionPerformed"); - assertNotNull(event.getAddMethod()); - - // test sur constraint de l'enfant - UIModelObjectImpl constraint = (UIModelObjectImpl)child.getConstraint().getValue(); - ArrayList argConstraint = (ArrayList)constraint.getArguments(); - - assertEquals(constraint.getType(), "java.awt.GridBagConstraints"); - - assertEquals(argConstraint.get(1).toString(), "0"); - - // test sur le nombre d'enfant d'un enfant - assertTrue(child.getObject().getChildren().size()==0); - - // test sur une contrainte string (BorderLayout) - ArrayList children1 = (ArrayList)ui1.getRoot().getChildren(); - UIModelChildImpl child1 = (UIModelChildImpl)children1.get(0); - - Object constraint1 = child1.getConstraint().getValue(); - assertEquals(constraint1, "Center"); - - // test sur le nombre d'enfants d'une Frame est correct - ArrayList children2 = (ArrayList)ui2.getRoot().getChildren(); - assertTrue(children2.size()==1); - - // test sur une contrainte d'un panel genere - UIModelChildImpl child2 = (UIModelChildImpl)children2.get(0); - - Object constraint2 = child2.getConstraint().getValue(); - assertEquals(constraint2, "Center"); - } - } - - public static Test suite() { - return new TestSuite(JavaXMLParserTest.class); - } - -} // JavaXMLParserTest - Copied: lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParserTest.java (from rev 333, lutingenerator/trunk/src/test/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParserTest.java) =================================================================== --- lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParserTest.java (rev 0) +++ lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParserTest.java 2008-10-13 14:50:09 UTC (rev 340) @@ -0,0 +1,133 @@ +/* *##% Lutin Generator + * Copyright (C) 2004 - 2008 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>. ##%*/ + +/* * + * JavaXMLParserTest.java + * + * Created: Aug 9, 2004 + * + * @author Benjamin Poussin <poussin@codelutin.com> + * Copyright Code Lutin + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ + +package org.codelutin.generator.models.ui.javaxml; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; +import org.codelutin.generator.models.ui.UIModel; +import org.codelutin.generator.models.ui.impl.UIModelChildImpl; +import org.codelutin.generator.models.ui.impl.UIModelEventImpl; +import org.codelutin.generator.models.ui.impl.UIModelObjectImpl; + +import java.io.File; +import java.util.ArrayList; + +public class JavaXMLParserTest extends TestCase { // JavaXMLParserTest + + public void testParse() throws Exception { + + // 1 panel, 2 boutons, gridbaglayout + File testFile = new File(getClass().getResource("test.javaxml").toURI()); + + // 1 panel, 1 bouton, borderlayout + File testFile1 = new File(getClass().getResource("test1.javaxml").toURI()); + + // alarmPanel de Chorem dans une JFrame + File testFile2 = new File(getClass().getResource("test2.javaxml").toURI()); + + // + //File testFile3 = new File("src/test/org/codelutin/generator/models/ui/javaxml/org.codelutin.chorem.entities.ui.RelationshipUI.javaxml"); + + if (testFile.exists() && testFile1.exists() && testFile2.exists()) { + + JavaXMLParser parser = new JavaXMLParser(); + UIModel ui = parser.parse(testFile); + UIModel ui1 = parser.parse(testFile1); + UIModel ui2 = parser.parse(testFile2); + //UIModel ui3 = parser.parse(testFile3); + + //System.out.println("UI : \n" + ui); + //System.out.println("UI1 : \n" + ui1); + //System.out.println("UI2 : \n" + ui2); + //System.out.println("UI3 : \n" + ui3); + + // test si l'element racine est parse + assertNotNull(ui.getRoot()); + assertNotNull(ui.getRoot().getName()); + + // tests sur tous les elements du root + assertTrue(ui.getRoot().getArguments().size() == 0); + assertTrue(ui.getRoot().getChildren().size() == 2); + assertTrue(ui.getRoot().getEvents().size() == 1); + assertTrue(ui.getRoot().getProperties().size() == 2); + + // test si le layout est bien recupere + UIModelObjectImpl object = (UIModelObjectImpl) ui.getRoot().getProperty("layout").getValue(); + + assertEquals(object.getType(), "java.awt.GridBagLayout"); + + // test sur un event de l'enfant + ArrayList children = (ArrayList) ui.getRoot().getChildren(); + UIModelChildImpl child = (UIModelChildImpl) children.get(0); + + ArrayList events = (ArrayList) child.getObject().getEvents(); + UIModelEventImpl event = (UIModelEventImpl) events.get(0); + + assertEquals(event.getAction(), "actionPerformed"); + assertNotNull(event.getAddMethod()); + + // test sur constraint de l'enfant + UIModelObjectImpl constraint = (UIModelObjectImpl) child.getConstraint().getValue(); + ArrayList argConstraint = (ArrayList) constraint.getArguments(); + + assertEquals(constraint.getType(), "java.awt.GridBagConstraints"); + + assertEquals(argConstraint.get(1).toString(), "0"); + + // test sur le nombre d'enfant d'un enfant + assertTrue(child.getObject().getChildren().size() == 0); + + // test sur une contrainte string (BorderLayout) + ArrayList children1 = (ArrayList) ui1.getRoot().getChildren(); + UIModelChildImpl child1 = (UIModelChildImpl) children1.get(0); + + Object constraint1 = child1.getConstraint().getValue(); + assertEquals(constraint1, "Center"); + + // test sur le nombre d'enfants d'une Frame est correct + ArrayList children2 = (ArrayList) ui2.getRoot().getChildren(); + assertTrue(children2.size() == 1); + + // test sur une contrainte d'un panel genere + UIModelChildImpl child2 = (UIModelChildImpl) children2.get(0); + + Object constraint2 = child2.getConstraint().getValue(); + assertEquals(constraint2, "Center"); + } + } + + public static Test suite() { + return new TestSuite(JavaXMLParserTest.class); + } + +} // JavaXMLParserTest + Deleted: lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/test.javaxml =================================================================== --- lutingenerator/trunk/src/test/java/org/codelutin/generator/models/ui/javaxml/test.javaxml 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/test.javaxml 2008-10-13 14:50:09 UTC (rev 340) @@ -1,97 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<java version="1.4.2_02" class="java.beans.XMLDecoder"> - <object class="javax.swing.JPanel"> - <void method="add"> - - <object id="JButton0" class="javax.swing.JButton"> - - <string>toto</string> - <void property="name"> - <string>bouton0</string> - </void> - - <void method="addActionListener"> - <object class="java.beans.EventHandler" method="create"> - <class>java.awt.event.ActionListener</class> - <string>this</string> - <string>on_click</string> - <string>arg</string> - <string>actionPerformed</string> - </object> - </void> - </object> - </void> - - <void method="add"> - <object id="JButton1" class="javax.swing.JButton"> - <string>titi</string> - <void property="name"> - <string>bouton1</string> - </void> - </object> - </void> - - <void property="layout"> - <object class="java.awt.GridBagLayout"> - - <void method="addLayoutComponent"> - <object idref="JButton0"/> - <object class="java.awt.GridBagConstraints"> - <int>0</int> - <int>0</int> - <int>1</int> - <int>1</int> - <double>0.0</double> - <double>0.0</double> - <int>10</int> - <int>0</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - - <void method="addLayoutComponent"> - <object idref="JButton1"/> - <object class="java.awt.GridBagConstraints"> - <int>0</int> - <int>1</int> - <int>1</int> - <int>1</int> - <double>0.0</double> - <double>0.0</double> - <int>10</int> - <int>0</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - </object> - </void> - - <void property="name"> - <string>JPanel0</string> - </void> - - <void method="addAncestorListener"> - <object class="java.beans.EventHandler" method="create"> - <class>javax.swing.event.AncestorListener</class> - <string>this</string> - <string>on_touch</string> - <string>argument</string> - <string>ancestorMoved</string> - </object> - </void> - </object> -</java> Deleted: lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/test1.javaxml =================================================================== --- lutingenerator/trunk/src/test/java/org/codelutin/generator/models/ui/javaxml/test1.javaxml 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/test1.javaxml 2008-10-13 14:50:09 UTC (rev 340) @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<java version="1.4.2_02" class="java.beans.XMLDecoder"> - <object class="javax.swing.JPanel"> - <void method="add"> - <object id="JButton0" class="javax.swing.JButton"> - <string>Save</string> - <void property="name"> - <string>JButton0</string> - </void> - </object> - </void> - <void property="layout"> - <object class="java.awt.BorderLayout"> - <void method="addLayoutComponent"> - <object idref="JButton0"/> - <string>Center</string> - </void> - </object> - </void> - <void property="name"> - <string>JPanel0</string> - </void> - </object> -</java> Deleted: lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/test2.javaxml =================================================================== --- lutingenerator/trunk/src/test/java/org/codelutin/generator/models/ui/javaxml/test2.javaxml 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/ui/javaxml/test2.javaxml 2008-10-13 14:50:09 UTC (rev 340) @@ -1,497 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<java version="1.4.2_02" class="java.beans.XMLDecoder"> - <object class="javax.swing.JFrame"> - <void property="contentPane"> - <void method="add"> - <object id="AlarmPanel0" class="org.codelutin.chorem.entities.ui.AlarmPanel"> - <void method="add"> - <object id="AlarmAttributesPanelPanel0" class="org.codelutin.chorem.entities.ui.AlarmAttributesPanelPanel"> - <void method="add"> - <object id="JLabel0" class="javax.swing.JLabel"> - <void property="name"> - <string>sujetLabel</string> - </void> - <void property="text"> - <string>Sujet</string> - </void> - </object> - </void> - <void method="add"> - <object id="JTextField0" class="javax.swing.JTextField"> - <void property="columns"> - <int>6</int> - </void> - <void property="name"> - <string>sujetEditor</string> - </void> - </object> - </void> - <void method="add"> - <object id="JLabel1" class="javax.swing.JLabel"> - <void property="name"> - <string>activateLabel</string> - </void> - <void property="text"> - <string>Activate</string> - </void> - </object> - </void> - <void method="add"> - <object id="JCheckBox0" class="javax.swing.JCheckBox"> - <void property="name"> - <string>activateEditor</string> - </void> - </object> - </void> - <void method="add"> - <object id="JLabel2" class="javax.swing.JLabel"> - <void property="name"> - <string>descriptionLabel</string> - </void> - <void property="text"> - <string>Description</string> - </void> - </object> - </void> - <void method="add"> - <object id="JTextField1" class="javax.swing.JTextField"> - <void property="columns"> - <int>6</int> - </void> - <void property="name"> - <string>descriptionEditor</string> - </void> - </object> - </void> - <void property="border"> - <object class="javax.swing.border.TitledBorder"> - <object class="javax.swing.border.EtchedBorder"> - <int>0</int> - <null/> - <null/> - </object> - <string>Attributes</string> - <int>0</int> - <int>0</int> - <null/> - <null/> - </object> - </void> - <void property="layout"> - <void method="addLayoutComponent"> - <object idref="JTextField0"/> - <object class="java.awt.GridBagConstraints"> - <int>1</int> - <int>1</int> - <int>1</int> - <int>1</int> - <double>1.0</double> - <double>1.0</double> - <int>10</int> - <int>2</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - <void method="addLayoutComponent"> - <object idref="JTextField1"/> - <object class="java.awt.GridBagConstraints"> - <int>1</int> - <int>3</int> - <int>1</int> - <int>1</int> - <double>1.0</double> - <double>1.0</double> - <int>10</int> - <int>2</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - <void method="addLayoutComponent"> - <object idref="JLabel1"/> - <object class="java.awt.GridBagConstraints"> - <int>0</int> - <int>2</int> - <int>1</int> - <int>1</int> - <double>0.0</double> - <double>0.0</double> - <int>10</int> - <int>1</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - <void method="addLayoutComponent"> - <object idref="JCheckBox0"/> - <object class="java.awt.GridBagConstraints"> - <int>1</int> - <int>2</int> - <int>1</int> - <int>1</int> - <double>0.0</double> - <double>0.0</double> - <int>10</int> - <int>1</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - <void method="addLayoutComponent"> - <object idref="JLabel0"/> - <object class="java.awt.GridBagConstraints"> - <int>0</int> - <int>1</int> - <int>1</int> - <int>1</int> - <double>0.0</double> - <double>0.0</double> - <int>10</int> - <int>1</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - <void method="addLayoutComponent"> - <object idref="JLabel2"/> - <object class="java.awt.GridBagConstraints"> - <int>0</int> - <int>3</int> - <int>1</int> - <int>1</int> - <double>0.0</double> - <double>0.0</double> - <int>10</int> - <int>1</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - </void> - <void property="name"> - <string>AlarmAttributesPanelPanel</string> - </void> - </object> - </void> - <void method="add"> - <object id="ManagementButtonsPanel0" class="org.codelutin.topia.ui.swing.ManagementButtonsPanel"> - <void method="add"> - <object id="JButton0" class="javax.swing.JButton"> - <string>Save</string> - <void method="addActionListener"> - <object class="java.beans.EventHandler" method="create"> - <class>java.awt.event.ActionListener</class> - <object idref="ManagementButtonsPanel0"/> - <string>on_save</string> - </object> - </void> - </object> - </void> - <void method="add"> - <object id="JButton1" class="javax.swing.JButton"> - <string>Cancel</string> - <void method="addActionListener"> - <object class="java.beans.EventHandler" method="create"> - <class>java.awt.event.ActionListener</class> - <object idref="ManagementButtonsPanel0"/> - <string>on_cancel</string> - </object> - </void> - </object> - </void> - <void method="add"> - <object id="JButton2" class="javax.swing.JButton"> - <string>Delete</string> - <void method="addActionListener"> - <object class="java.beans.EventHandler" method="create"> - <class>java.awt.event.ActionListener</class> - <object idref="ManagementButtonsPanel0"/> - <string>on_delete</string> - </object> - </void> - </object> - </void> - <void method="add"> - <object id="JButton3" class="javax.swing.JButton"> - <string>Search</string> - <void method="addActionListener"> - <object class="java.beans.EventHandler" method="create"> - <class>java.awt.event.ActionListener</class> - <object idref="ManagementButtonsPanel0"/> - <string>on_search</string> - </object> - </void> - </object> - </void> - <void property="layout"> - <void method="addLayoutComponent"> - <object idref="JButton1"/> - <object class="java.awt.GridBagConstraints"> - <int>0</int> - <int>1</int> - <int>1</int> - <int>1</int> - <double>0.0</double> - <double>0.0</double> - <int>10</int> - <int>2</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - <void method="addLayoutComponent"> - <object idref="JButton2"/> - <object class="java.awt.GridBagConstraints"> - <int>0</int> - <int>2</int> - <int>1</int> - <int>1</int> - <double>0.0</double> - <double>0.0</double> - <int>10</int> - <int>2</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - <void method="addLayoutComponent"> - <object idref="JButton3"/> - <object class="java.awt.GridBagConstraints"> - <int>0</int> - <int>3</int> - <int>1</int> - <int>1</int> - <double>0.0</double> - <double>0.0</double> - <int>10</int> - <int>2</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - <void method="addLayoutComponent"> - <object idref="JButton0"/> - <object class="java.awt.GridBagConstraints"> - <int>0</int> - <int>0</int> - <int>1</int> - <int>1</int> - <double>0.0</double> - <double>0.0</double> - <int>10</int> - <int>2</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - </void> - <void property="name"> - <string>AlarmButtonsPanel</string> - </void> - </object> - </void> - <void method="add"> - <object id="AlarmTablePanelPanel0" class="org.codelutin.chorem.entities.ui.AlarmTablePanelPanel"> - <void method="add"> - <object id="JScrollPane0" class="javax.swing.JScrollPane"> - <void property="name"> - <string>AlarmScrollPane</string> - </void> - <void property="viewport"> - <void method="add"> - <object class="javax.swing.JTable"> - <void property="model"> - <object class="org.codelutin.topia.ui.swing.TopiaTableModel"/> - </void> - </object> - </void> - </void> - </object> - </void> - <void property="border"> - <object class="javax.swing.border.TitledBorder"> - <object class="javax.swing.border.EtchedBorder"> - <int>0</int> - <null/> - <null/> - </object> - <string>Table</string> - <int>0</int> - <int>0</int> - <null/> - <null/> - </object> - </void> - <void property="layout"> - <void method="addLayoutComponent"> - <object idref="JScrollPane0"/> - <object class="java.awt.GridBagConstraints"> - <int>0</int> - <int>0</int> - <int>1</int> - <int>1</int> - <double>1.0</double> - <double>1.0</double> - <int>10</int> - <int>1</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - </void> - <void property="name"> - <string>AlarmTablePanelPanel</string> - </void> - </object> - </void> - <void property="layout"> - <void method="addLayoutComponent"> - <object idref="AlarmTablePanelPanel0"/> - <object class="java.awt.GridBagConstraints"> - <int>0</int> - <int>1</int> - <int>2</int> - <int>1</int> - <double>1.0</double> - <double>1.0</double> - <int>10</int> - <int>1</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - <void method="addLayoutComponent"> - <object idref="AlarmAttributesPanelPanel0"/> - <object class="java.awt.GridBagConstraints"> - <int>0</int> - <int>0</int> - <int>1</int> - <int>1</int> - <double>1.0</double> - <double>1.0</double> - <int>10</int> - <int>1</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - <void method="addLayoutComponent"> - <object idref="ManagementButtonsPanel0"/> - <object class="java.awt.GridBagConstraints"> - <int>1</int> - <int>0</int> - <int>1</int> - <int>1</int> - <double>1.0</double> - <double>1.0</double> - <int>10</int> - <int>1</int> - <object class="java.awt.Insets"> - <int>0</int> - <int>0</int> - <int>0</int> - <int>0</int> - </object> - <int>0</int> - <int>0</int> - </object> - </void> - </void> - <void property="name"> - <string>AlarmPanel2</string> - </void> - </object> - </void> - <void property="layout"> - <object class="java.awt.BorderLayout"> - <void method="addLayoutComponent"> - <object idref="AlarmPanel0"/> - <string>Center</string> - </void> - </object> - </void> - </void> - <void property="name"> - <string>JFrame1</string> - </void> - </object> -</java> Deleted: lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/xml/ModelMergeTest.java =================================================================== --- lutingenerator/trunk/src/test/java/org/codelutin/generator/models/xml/ModelMergeTest.java 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/xml/ModelMergeTest.java 2008-10-13 14:50:09 UTC (rev 340) @@ -1,96 +0,0 @@ -/* *##% Lutin Generator - * Copyright (C) 2004 - 2008 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>. ##%*/ - -/* * -* ModelMergeTest.java -* -* Created: 18 mai 2005 -* -* @author Arnaud Thimel <thimel@codelutin.com> -* @version $Revision$ -*/ - - -package org.codelutin.generator.models.xml; - -import java.io.File; -import java.util.Iterator; - -import junit.framework.TestCase; - -import org.codelutin.generator.ObjectModelGenerator; -import org.codelutin.generator.models.object.ObjectModel; -import org.codelutin.generator.models.object.ObjectModelClass; - - -public class ModelMergeTest extends TestCase { - - public void testMerge1() throws Exception { - parcourirModel(genModel(1)); - } - - public void testMerge2() throws Exception { - parcourirModel(genModel(2)); - } - - public void testMerge3() throws Exception { - parcourirModel(genModel(3)); - } - - public void testMerge4() throws Exception { - parcourirModel(genModel(4)); - } - - public void testMerge5() throws Exception { - parcourirModel(genModel(5)); - } - - public void testMerge6() throws Exception { - parcourirModel(genModel(6)); - } - - private ObjectModel genModel(int num) { - System.out.println("\n\n============================================\n\t\ttestMerge" + num + "\n============================================"); - ObjectModelGenerator generator = new ObjectModelGenerator(); - File[] files = new File[num]; - for (int j = 1; j < (num+1); j++) - files[j-1] = new File("src/test/security" + j + ".objectmodel"); - generator.generate(files, new File("output")); - return generator.getModel(); - } - - private void parcourirModel(ObjectModel model) { - System.out.println(":::: model tag: " + model.getTagValues()); - for (Iterator it = model.getClasses().iterator(); it.hasNext(); ) { - ObjectModelClass clazz = (ObjectModelClass)it.next(); - System.out.println("\n********* Class : " + clazz.getQualifiedName()); - System.out.println("--- Attributs :"); - for (Iterator attributes = clazz.getAttributes().iterator(); attributes.hasNext(); ) - System.out.println("\t" + attributes.next()); - System.out.println("--- Operations :"); - for (Iterator operations = clazz.getOperations().iterator(); operations.hasNext(); ) - System.out.println("\t" + operations.next()); - System.out.println("--- Interfaces :"); - for (Iterator interfaces = clazz.getInterfaces().iterator(); interfaces.hasNext(); ) - System.out.println("\t" + interfaces.next()); - System.out.println("--- Superclasses :"); - for (Iterator superclasses = clazz.getSuperclasses().iterator(); superclasses.hasNext(); ) - System.out.println("\t" + superclasses.next()); - } - - } -} Copied: lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/xml/ModelMergeTest.java (from rev 333, lutingenerator/trunk/src/test/java/org/codelutin/generator/models/xml/ModelMergeTest.java) =================================================================== --- lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/xml/ModelMergeTest.java (rev 0) +++ lutingenerator/tags/0.60/src/test/java/org/codelutin/generator/models/xml/ModelMergeTest.java 2008-10-13 14:50:09 UTC (rev 340) @@ -0,0 +1,103 @@ +/* *##% Lutin Generator + * Copyright (C) 2004 - 2008 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>. ##%*/ + +/* * +* ModelMergeTest.java +* +* Created: 18 mai 2005 +* +* @author Arnaud Thimel <thimel@codelutin.com> +* @version $Revision$ +*/ + + +package org.codelutin.generator.models.xml; + +import junit.framework.TestCase; +import org.codelutin.generator.ObjectModelGenerator; +import org.codelutin.generator.models.object.ObjectModel; +import org.codelutin.generator.models.object.ObjectModelClass; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; + + +public class ModelMergeTest extends TestCase { + + public void testMerge1() throws Exception { + parcourirModel(genModel(1)); + } + + public void testMerge2() throws Exception { + parcourirModel(genModel(2)); + } + + public void testMerge3() throws Exception { + parcourirModel(genModel(3)); + } + + public void testMerge4() throws Exception { + parcourirModel(genModel(4)); + } + + public void testMerge5() throws Exception { + parcourirModel(genModel(5)); + } + + public void testMerge6() throws Exception { + parcourirModel(genModel(6)); + } + + private ObjectModel genModel(int num) throws URISyntaxException, MalformedURLException { + System.out.println("\n\n============================================\n\t\ttestMerge" + num + "\n============================================"); + ObjectModelGenerator generator = new ObjectModelGenerator(); + File[] files = new File[num]; + for (int j = 1; j < (num + 1); j++) { + URL url = getClass().getResource("security" + j + ".objectmodel"); + files[j - 1] = new File(url.toURI()); + } + generator.generate(files, new File("output")); + return generator.getModel(); + } + + private void parcourirModel(ObjectModel model) { + System.out.println(":::: model tag: " + model.getTagValues()); + for (Object o3 : model.getClasses()) { + ObjectModelClass clazz = (ObjectModelClass) o3; + System.out.println("\n********* Class : " + clazz.getQualifiedName()); + System.out.println("--- Attributs :"); + for (Object o2 : clazz.getAttributes()) { + System.out.println("\t" + o2); + } + System.out.println("--- Operations :"); + for (Object o1 : clazz.getOperations()) { + System.out.println("\t" + o1); + } + System.out.println("--- Interfaces :"); + for (Object o : clazz.getInterfaces()) { + System.out.println("\t" + o); + } + System.out.println("--- Superclasses :"); + for (Object o : clazz.getSuperclasses()) { + System.out.println("\t" + o); + } + } + + } +} Copied: lutingenerator/tags/0.60/src/test/resources/log4j.properties (from rev 332, lutingenerator/trunk/src/test/resources/log4j.properties) =================================================================== --- lutingenerator/tags/0.60/src/test/resources/log4j.properties (rev 0) +++ lutingenerator/tags/0.60/src/test/resources/log4j.properties 2008-10-13 14:50:09 UTC (rev 340) @@ -0,0 +1,9 @@ +# Global logging configuration +log4j.rootLogger=ERROR, stdout +# Console output... +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n +#log4j.appender.stdout.layout.ConversionPattern=%%c=%c %%C=%C %%d=%d %%F=%F %%l=%l %%L=%L %%m=%m %%M=%M %%p=%p %%r=%r %%t=%t %%x=%x %%X=%X +# package level +log4j.logger.org.codelutin=INFO Copied: lutingenerator/tags/0.60/src/test/resources/org (from rev 332, lutingenerator/trunk/src/test/resources/org) Copied: lutingenerator/tags/0.60/src/test/resources/org/codelutin/generator/models/ui (from rev 333, lutingenerator/trunk/src/test/resources/org/codelutin/generator/models/ui) Copied: lutingenerator/tags/0.60/src/test/resources/org/codelutin/generator/models/xml (from rev 333, lutingenerator/trunk/src/test/resources/org/codelutin/generator/models/xml) Deleted: lutingenerator/tags/0.60/src/test/resources/security1.objectmodel =================================================================== --- lutingenerator/trunk/src/test/resources/security1.objectmodel 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/resources/security1.objectmodel 2008-10-13 14:50:09 UTC (rev 340) @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<objectModel xmlns:UML="org.omg.xmi.namespace.UML" xmlns:packageValidator="xalan://org.codelutin.generator.PackageValidator" xmlns="http://www.codelutin.org/lutingenerator/objectModel" name="Security"> - <interface name="TestInterface" package="org.codelutin.topia.security"> - <stereotype name="entity"/> - </interface> - <class name="RolePermission" package="org.codelutin.topia.security.entities"> - <stereotype name="entity"/> - <attribute name="topiaId" visibility="private" type="java.lang.String"/> - <attribute name="role" visibility="public" type="org.codelutin.topia.security.entities.Role" reverseAttribute="permissions" minMultiplicity="1" maxMultiplicity="1"/> - </class> - <class name="User" package="org.codelutin.topia.security.entities"> - <stereotype name="entity"/> - <superclass name="org.codelutin.topia.security.entities.Role" discriminator=""/> - <interface name="org.codelutin.topia.security.TestInterface"/> - <attribute name="password" visibility="private" type="java.lang.String"/> - <attribute name="login" visibility="private" type="java.lang.String"/> - </class> - <class name="Group" package="org.codelutin.topia.security.entities"> - <stereotype name="entity"/> - <superclass name="org.codelutin.topia.security.entities.Role" discriminator=""/> - <attribute name="groupName" visibility="private" type="java.lang.String"/> - <attribute name="members" visibility="public" type="org.codelutin.topia.security.entities.Role" reverseAttribute="parent" associationType="aggregate" minMultiplicity="0" maxMultiplicity="-1"/> - </class> - <class name="Role" package="org.codelutin.topia.security.entities"> - <stereotype name="entity"/> - <attribute name="parent" visibility="public" type="org.codelutin.topia.security.entities.Group" reverseAttribute="members" minMultiplicity="1" maxMultiplicity="1"/> - <attribute name="permissions" visibility="public" type="org.codelutin.topia.security.entities.RolePermission" reverseAttribute="role" minMultiplicity="0" maxMultiplicity="-1"/> - <attribute name="roleName" visibility="public" type="java.lang.String"/> - </class> -</objectModel> Deleted: lutingenerator/tags/0.60/src/test/resources/security1.properties =================================================================== --- lutingenerator/trunk/src/test/resources/security1.properties 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/resources/security1.properties 2008-10-13 14:50:09 UTC (rev 340) @@ -1,7 +0,0 @@ -org.codelutin.topia.security.entities.Role.class.stereotype=Permission -org.codelutin.topia.security.entities.Role.class.tagvalue.role=admin - -org.codelutin.topia.security.entities.RolePermission.attribute.topiaId.stereotype=pk -org.codelutin.topia.security.entities.RolePermission.attribute.topiaId.tagvalue.string= topiaId: - -model.tagvalue.lejoliemodel=toto Deleted: lutingenerator/tags/0.60/src/test/resources/security2.objectmodel =================================================================== --- lutingenerator/trunk/src/test/resources/security2.objectmodel 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/resources/security2.objectmodel 2008-10-13 14:50:09 UTC (rev 340) @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<objectModel xmlns:UML="org.omg.xmi.namespace.UML" xmlns:packageValidator="xalan://org.codelutin.generator.PackageValidator" xmlns="http://www.codelutin.org/lutingenerator/objectModel" name="Security"> - <class name="User" package="org.codelutin.topia.security.entities"> - <stereotype name="entity"/> - <attribute name="nom" visibility="private" type="java.lang.String"/> - <attribute name="login" visibility="private" type="java.lang.String"/> - </class> -</objectModel> Deleted: lutingenerator/tags/0.60/src/test/resources/security3.objectmodel =================================================================== --- lutingenerator/trunk/src/test/resources/security3.objectmodel 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/resources/security3.objectmodel 2008-10-13 14:50:09 UTC (rev 340) @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<objectModel xmlns:UML="org.omg.xmi.namespace.UML" xmlns:packageValidator="xalan://org.codelutin.generator.PackageValidator" xmlns="http://www.codelutin.org/lutingenerator/objectModel" name="Security"> - <class name="User" package="org.codelutin.topia.security.entities"> - <stereotype name="entity"/> - <attribute name="password" visibility="private" type="java.lang.String"/> - <attribute name="nom" visibility="private" type="java.lang.String"/> - <attribute name="prenom" visibility="private" type="java.lang.String"/> - </class> -</objectModel> Deleted: lutingenerator/tags/0.60/src/test/resources/security4.objectmodel =================================================================== --- lutingenerator/trunk/src/test/resources/security4.objectmodel 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/resources/security4.objectmodel 2008-10-13 14:50:09 UTC (rev 340) @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<objectModel xmlns:UML="org.omg.xmi.namespace.UML" xmlns:packageValidator="xalan://org.codelutin.generator.PackageValidator" xmlns="http://www.codelutin.org/lutingenerator/objectModel" name="Security"> - <interface name="ZimZoum" package="org.codelutin.topia.security"> - <stereotype name="entity"/> - </interface> - <class name="RolePermission" package="org.codelutin.topia.security.entities"> - <stereotype name="entity"/> - <attribute name="topiaId" visibility="private" type="java.lang.String"/> - </class> - <class name="User" package="org.codelutin.topia.security.entities"> - <stereotype name="entity"/> - <interface name="org.codelutin.topia.security.ZimZoum"/> - <attribute name="password" visibility="private" type="java.lang.String"/> - <operation name="methode" visibility="public"> - <returnParameter type="void"/> - </operation> - </class> - <class name="Group" package="org.codelutin.topia.security.entities"> - <stereotype name="entity"/> - <attribute name="groupName" visibility="private" type="java.lang.String"/> - <attribute name="groupZimZoum" visibility="private" type="java.lang.String"/> - </class> -</objectModel> Deleted: lutingenerator/tags/0.60/src/test/resources/security5.objectmodel =================================================================== --- lutingenerator/trunk/src/test/resources/security5.objectmodel 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/resources/security5.objectmodel 2008-10-13 14:50:09 UTC (rev 340) @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<objectModel xmlns:UML="org.omg.xmi.namespace.UML" xmlns:packageValidator="xalan://org.codelutin.generator.PackageValidator" xmlns="http://www.codelutin.org/lutingenerator/objectModel" name="Security"> - <class name="RolePermission" package="org.codelutin.topia.security.entities"> - <stereotype name="entity"/> - <attribute name="topiaId" visibility="private" type="java.lang.String"/> - <attribute name="perm" visibility="private" type="java.lang.String"/> - <operation name="permToString" visibility="public"> - <returnParameter type="java.lang.String"/> - </operation> - </class> -</objectModel> Deleted: lutingenerator/tags/0.60/src/test/resources/security6.objectmodel =================================================================== --- lutingenerator/trunk/src/test/resources/security6.objectmodel 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/resources/security6.objectmodel 2008-10-13 14:50:09 UTC (rev 340) @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<objectModel xmlns:UML="org.omg.xmi.namespace.UML" xmlns:packageValidator="xalan://org.codelutin.generator.PackageValidator" xmlns="http://www.codelutin.org/lutingenerator/objectModel" name="Security"> - <interface name="TestInterface" package="org.codelutin.topia.security"> - <stereotype name="entity"/> - </interface> - <class name="RolePermission" package="org.codelutin.topia.security.entities"> - <stereotype name="entity"/> - <attribute name="topiaId" visibility="private" type="java.lang.String"/> - <attribute name="role" visibility="public" type="org.codelutin.topia.security.entities.Role" reverseAttribute="permissions" minMultiplicity="1" maxMultiplicity="1"/> - </class> - <class name="User" package="org.codelutin.topia.security.entities"> - <stereotype name="entity"/> - <superclass name="org.codelutin.topia.security.entities.Role" discriminator=""/> - <interface name="org.codelutin.topia.security.TestInterface"/> - <attribute name="password" visibility="private" type="java.lang.String"/> - <attribute name="login" visibility="private" type="java.lang.String"/> - </class> - <class name="Group" package="org.codelutin.topia.security.entities"> - <stereotype name="entity"/> - <superclass name="org.codelutin.topia.security.entities.Role" discriminator=""/> - <attribute name="groupName" visibility="private" type="java.lang.String"/> - <attribute name="members" visibility="public" type="org.codelutin.topia.security.entities.Role" reverseAttribute="parent" associationType="aggregate" minMultiplicity="0" maxMultiplicity="-1"/> - </class> - <class name="Role" package="org.codelutin.topia.security.entities"> - <stereotype name="entity"/> - <attribute name="parent" visibility="public" type="org.codelutin.topia.security.entities.Group" reverseAttribute="members" minMultiplicity="1" maxMultiplicity="1"/> - <attribute name="permissions" visibility="public" type="org.codelutin.topia.security.entities.RolePermission" reverseAttribute="role" minMultiplicity="0" maxMultiplicity="-1"/> - <attribute name="roleName" visibility="public" type="java.lang.String"/> - </class> -</objectModel> Deleted: lutingenerator/tags/0.60/src/test/resources/security6.properties =================================================================== --- lutingenerator/trunk/src/test/resources/security6.properties 2008-10-02 15:40:56 UTC (rev 328) +++ lutingenerator/tags/0.60/src/test/resources/security6.properties 2008-10-13 14:50:09 UTC (rev 340) @@ -1,5 +0,0 @@ -org.codelutin.topia.security.entities.RolePermission.class.stereotype=Permission -org.codelutin.topia.security.entities.RolePermission.class.tagvalue.role=admin - -org.codelutin.topia.security.entities.RolePermission.attribute.topiaId.stereotype=pk -org.codelutin.topia.security.entities.RolePermission.attribute.topiaId.tagvalue.string= topiaId: