Index: lutingenerator/src/test/org/codelutin/generator/models/xml/ModelMergeTest.java diff -u /dev/null lutingenerator/src/test/org/codelutin/generator/models/xml/ModelMergeTest.java:1.1 --- /dev/null Thu May 19 09:18:28 2005 +++ lutingenerator/src/test/org/codelutin/generator/models/xml/ModelMergeTest.java Thu May 19 09:18:23 2005 @@ -0,0 +1,98 @@ +/* *##% +* Copyright (C) 2002, 2003, 2004, 2005 Code Lutin, +* Cédric Pineau, Benjamin Poussin, +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* 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 Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*##%*/ + +/* * +* ModelMergeTest.java +* +* Created: 18 mai 2005 +* +* @author Arnaud Thimel +* @version $Revision: 1.1 $ +*/ + + +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) { + 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()); + } + + } +}