Author: tchemit Date: 2008-10-21 00:48:03 +0000 (Tue, 21 Oct 2008) New Revision: 1189 Added: topia-test/tags/2.0.27/ topia-test/tags/2.0.27/pom.xml topia-test/tags/2.0.27/src/site/ topia-test/tags/2.0.27/src/test/java/org/codelutin/topiatest/TopiaTestCase.java Removed: topia-test/tags/2.0.27/pom.xml topia-test/tags/2.0.27/src/test/java/org/codelutin/topiatest/TopiaTestCase.java Log: [maven-release-plugin] copy for tag 2.0.27 Copied: topia-test/tags/2.0.27 (from rev 1176, topia-test/trunk) Deleted: topia-test/tags/2.0.27/pom.xml =================================================================== --- topia-test/trunk/pom.xml 2008-10-21 00:19:51 UTC (rev 1176) +++ topia-test/tags/2.0.27/pom.xml 2008-10-21 00:48:03 UTC (rev 1189) @@ -1,136 +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"> - - <modelVersion>4.0.0</modelVersion> - - <!-- ************************************************************* --> - <!-- *** POM Relationships *************************************** --> - <!-- ************************************************************* --> - - <parent> - <groupId>org.codelutin</groupId> - <artifactId>lutinproject</artifactId> - <version>3.0</version> - </parent> - - <artifactId>topiatest</artifactId> - - <dependencies> - - <!--Compile--> - <dependency> - <groupId>org.codelutin</groupId> - <artifactId>topia</artifactId> - <version>${topia.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.14</version> - <scope>compile</scope> - </dependency> - - <!-- Test --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.4</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <version>1.0.61</version> - <scope>test</scope> - </dependency> - - </dependencies> - - <!-- ************************************************************* --> - <!-- *** Project Information ************************************* --> - <!-- ************************************************************* --> - - <name>ToPIA Testing</name> - <version>2.0.27</version> - <description>Test de ToPIA</description> - <inceptionYear>2007</inceptionYear> - - <!-- ************************************************************* --> - <!-- *** Build Settings ****************************************** --> - <!-- ************************************************************* --> - - <packaging>jar</packaging> - - <properties> - - <!-- id du projet du labs --> - <labs.id>21</labs.id> - - <!-- nom du projet sur le labs --> - <labs.project>topia</labs.project> - - <!-- topia version --> - <topia.version>2.0.27</topia.version> - - </properties> - - <build> - <plugins> - - <plugin> - <groupId>org.codelutin</groupId> - <artifactId>maven-generator-plugin</artifactId> - <version>0.60</version> - <executions> - <execution> - <id>Generator</id> - <phase>generate-sources</phase> - <configuration> - <srcDirZuml>src/test/xmi</srcDirZuml> - <srcXmiDest>target/generated-sources/xmi/</srcXmiDest> - <fullPackagePath>org.codelutin.topia</fullPackagePath> - <extractedPackages>org.codelutin.topia</extractedPackages> - <!--Config generator--> - <srcGenDest>target/generated-sources/objectmodel/</srcGenDest> - <includes>**/*.objectmodel</includes> - <templates>org.codelutin.topia.generator.TopiaMetaGenerator</templates> - <destDirGen>target/generated-sources/java</destDirGen> - <defaultPackage>org.codelutin.topia</defaultPackage> - </configuration> - <goals> - <goal>zargo2xmi</goal> - <goal>xmi2objectmodel</goal> - <goal>generate</goal> - </goals> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>org.codelutin</groupId> - <artifactId>topia</artifactId> - <version>${topia.version}</version> - <scope>compile</scope> - </dependency> - </dependencies> - </plugin> - - <plugin> - <artifactId>maven-javadoc-plugin</artifactId> - </plugin> - - </plugins> - </build> - - <!-- ************************************************************* --> - <!-- *** Build Environment ************************************** --> - <!-- ************************************************************* --> - <scm> - <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/topia/topiatest/tags/2.0.27</connection> - <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/topia/topiatest/tags/2.0.27</developerConnection> - <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/topiatest/tags/2.0.27?root=topia</url> - </scm> - -</project> Copied: topia-test/tags/2.0.27/pom.xml (from rev 1188, topia-test/trunk/pom.xml) =================================================================== --- topia-test/tags/2.0.27/pom.xml (rev 0) +++ topia-test/tags/2.0.27/pom.xml 2008-10-21 00:48:03 UTC (rev 1189) @@ -0,0 +1,136 @@ +<?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>topia-test</artifactId> + + <dependencies> + + <!--Compile--> + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>topia</artifactId> + <version>${topia.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.14</version> + <scope>compile</scope> + </dependency> + + <!-- Test --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.4</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <version>1.0.61</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + + <name>ToPIA Testing</name> + <version>2.0.27</version> + <description>Test de ToPIA</description> + <inceptionYear>2007</inceptionYear> + + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> + + <packaging>jar</packaging> + + <properties> + + <!-- id du projet du labs --> + <labs.id>21</labs.id> + + <!-- nom du projet sur le labs --> + <labs.project>topia</labs.project> + + <!-- topia version --> + <topia.version>2.0.27</topia.version> + + </properties> + + <build> + <plugins> + + <plugin> + <groupId>org.codelutin</groupId> + <artifactId>maven-generator-plugin</artifactId> + <version>0.60</version> + <executions> + <execution> + <id>Generator</id> + <phase>generate-sources</phase> + <configuration> + <srcDirZuml>src/test/xmi</srcDirZuml> + <srcXmiDest>target/generated-sources/xmi/</srcXmiDest> + <fullPackagePath>org.codelutin.topia</fullPackagePath> + <extractedPackages>org.codelutin.topia</extractedPackages> + <!--Config generator--> + <srcGenDest>target/generated-sources/objectmodel/</srcGenDest> + <includes>**/*.objectmodel</includes> + <templates>org.codelutin.topia.generator.TopiaMetaGenerator</templates> + <destDirGen>target/generated-sources/java</destDirGen> + <defaultPackage>org.codelutin.topia</defaultPackage> + </configuration> + <goals> + <goal>zargo2xmi</goal> + <goal>xmi2objectmodel</goal> + <goal>generate</goal> + </goals> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>topia</artifactId> + <version>${topia.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> + </plugin> + + <plugin> + <artifactId>maven-javadoc-plugin</artifactId> + </plugin> + + </plugins> + </build> + + <!-- ************************************************************* --> + <!-- *** Build Environment ************************************** --> + <!-- ************************************************************* --> + <scm> + <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/topia/topia-test/tags/2.0.27</connection> + <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/topia/topia-test/tags/2.0.27</developerConnection> + <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/topia-test/tags/2.0.27?root=topia</url> + </scm> + +</project> Copied: topia-test/tags/2.0.27/src/site (from rev 1187, topia-test/trunk/src/site) Deleted: topia-test/tags/2.0.27/src/test/java/org/codelutin/topiatest/TopiaTestCase.java =================================================================== --- topia-test/trunk/src/test/java/org/codelutin/topiatest/TopiaTestCase.java 2008-10-21 00:19:51 UTC (rev 1176) +++ topia-test/tags/2.0.27/src/test/java/org/codelutin/topiatest/TopiaTestCase.java 2008-10-21 00:48:03 UTC (rev 1189) @@ -1,173 +0,0 @@ -/* *##% ToPIA Testing - * Copyright (C) 2007 - 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.topiatest; - -import java.util.Properties; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.codelutin.topia.TopiaContext; -import org.codelutin.topia.TopiaContextFactory; -import org.codelutin.topia.TopiaException; -import org.codelutin.topia.TopiaNotFoundException; -import org.codelutin.topia.TopiaTestDAOHelper; -import org.hibernate.cfg.Environment; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -/** - * TopiaTestCase - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class TopiaTestCase { - - /** Logger */ - private final static Log log = LogFactory.getLog(TopiaTestCase.class); - - /** Proprietes */ - protected Properties config = null; - - /** TopiaContext */ - protected TopiaContext context = null; - - /** - * Retourne les proprietes de connection a la base - * @return la config - */ - protected Properties getProperties() { - - // javassist pour les out of memery error de cglib - System.setProperty("hibernate.bytecode.provider", "javassist"); - - Properties config = new Properties(); - config.setProperty("topia.persistence.classes",TopiaTestDAOHelper.entitiesList); - - config.setProperty(Environment.USER, "sa"); - config.setProperty(Environment.PASS, ""); - config.setProperty(Environment.CURRENT_SESSION_CONTEXT_CLASS, "thread"); - config.setProperty(Environment.DIALECT,"org.hibernate.dialect.H2Dialect"); - config.setProperty(Environment.DRIVER,"org.h2.Driver"); - config.setProperty(Environment.URL,"jdbc:h2:file:/tmp/db/data"); - - return config; - } - - /** - * Init - */ - protected void init() { - if(config == null) { - config = getProperties(); - } - } - - @Before - public void setUp() { - if(log.isInfoEnabled()) { - log.info("Junit beforeTest"); - } - - init(); - - try { - context = TopiaContextFactory.getContext(config); - - try { - context.createSchema(); - } catch (TopiaException e) { - log.error("Erreur à la creation du schema",e); - } - } catch (TopiaNotFoundException e) { - log.error("Erreur à la creation du topia context",e); - } - } - - @Test - public void testCompositeAssociations() { - if(log.isInfoEnabled()) { - log.info("Junit Test testCompositeAssociations"); - } - - try { - TopiaContext newContext = context.beginTransaction(); - - CompanyDAO companyDAO = TopiaTestDAOHelper.getCompanyDAO(newContext); - DepartmentDAO departmentDAO = TopiaTestDAOHelper.getDepartmentDAO(newContext); - - Company company = companyDAO.create(); - company.setName("Ma société"); - - - Department dep1 = departmentDAO.create(); - dep1.setName("Departement 1"); - Department dep2 = departmentDAO.create(); - dep2.setName("Departement 2"); - Department dep3 = departmentDAO.create(); - dep3.setName("Departement 3"); - Department dep4 = departmentDAO.create(); - dep4.setName("Departement 7"); - - departmentDAO.update(dep1); - departmentDAO.update(dep2); - departmentDAO.update(dep3); - departmentDAO.update(dep4); - - company.addDepartment(dep1); - company.addDepartment(dep2); - company.addDepartment(dep3); - company.addDepartment(dep4); - - companyDAO.update(company); - newContext.commitTransaction(); - - newContext = context.beginTransaction(); - - companyDAO = TopiaTestDAOHelper.getCompanyDAO(newContext); - - company = companyDAO.findByTopiaId(company.getTopiaId()); - - assertEquals(company.getName(),"Ma société"); - assertEquals(company.getDepartment().size(),4); - - newContext.commitTransaction(); - } catch (TopiaException e) { - log.error("Erreur pendant le test testCompositeAssociations",e); - } - } - - /*@Test - public void testOther() { - if(log.isInfoEnabled()) { - log.info("Junit Test testOther"); - } - }*/ - - @After - public void tearDown() { - if(log.isInfoEnabled()) { - log.info("Junit afterTest"); - } - } -} Copied: topia-test/tags/2.0.27/src/test/java/org/codelutin/topiatest/TopiaTestCase.java (from rev 1186, topia-test/trunk/src/test/java/org/codelutin/topiatest/TopiaTestCase.java) =================================================================== --- topia-test/tags/2.0.27/src/test/java/org/codelutin/topiatest/TopiaTestCase.java (rev 0) +++ topia-test/tags/2.0.27/src/test/java/org/codelutin/topiatest/TopiaTestCase.java 2008-10-21 00:48:03 UTC (rev 1189) @@ -0,0 +1,174 @@ +/* *##% ToPIA Testing + * Copyright (C) 2007 - 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.topiatest; + +import java.util.Properties; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codelutin.topia.TopiaContext; +import org.codelutin.topia.TopiaContextFactory; +import org.codelutin.topia.TopiaException; +import org.codelutin.topia.TopiaNotFoundException; +import org.codelutin.topia.TopiaTestDAOHelper; +import org.hibernate.cfg.Environment; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +/** + * TopiaTestCase + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class TopiaTestCase { + + /** Logger */ + private final static Log log = LogFactory.getLog(TopiaTestCase.class); + + /** Proprietes */ + protected Properties config = null; + + /** TopiaContext */ + protected TopiaContext context = null; + + /** + * Retourne les proprietes de connection a la base + * @return la config + */ + protected Properties getProperties() { + + // javassist pour les out of memery error de cglib + System.setProperty("hibernate.bytecode.provider", "javassist"); + + Properties config = new Properties(); + config.setProperty("topia.persistence.classes",TopiaTestDAOHelper.entitiesList); + + config.setProperty(Environment.USER, "sa"); + config.setProperty(Environment.PASS, ""); + config.setProperty(Environment.CURRENT_SESSION_CONTEXT_CLASS, "thread"); + config.setProperty(Environment.DIALECT,"org.hibernate.dialect.H2Dialect"); + config.setProperty(Environment.DRIVER,"org.h2.Driver"); + config.setProperty(Environment.URL,"jdbc:h2:file:/tmp/db/data"); + + return config; + } + + /** + * Init + */ + protected void init() { + if(config == null) { + config = getProperties(); + } + } + + @Before + public void setUp() { + if(log.isInfoEnabled()) { + log.info("Junit beforeTest"); + } + + init(); + + try { + context = TopiaContextFactory.getContext(config); + + try { + context.createSchema(); + } catch (TopiaException e) { + log.error("Erreur à la creation du schema",e); + } + } catch (TopiaNotFoundException e) { + log.error("Erreur à la creation du topia context",e); + } + } + + @Test + public void testCompositeAssociations() { + if(log.isInfoEnabled()) { + log.info("Junit Test testCompositeAssociations"); + } + + try { + TopiaContext newContext = context.beginTransaction(); + + CompanyDAO companyDAO = TopiaTestDAOHelper.getCompanyDAO(newContext); + DepartmentDAO departmentDAO = TopiaTestDAOHelper.getDepartmentDAO(newContext); + + Company company = companyDAO.create(); + company.setName("Ma société"); + + + Department dep1 = departmentDAO.create(); + dep1.setName("Departement 1"); + Department dep2 = departmentDAO.create(); + dep2.setName("Departement 2"); + Department dep3 = departmentDAO.create(); + dep3.setName("Departement 3"); + Department dep4 = departmentDAO.create(); + dep4.setName("Departement 7"); + + departmentDAO.update(dep1); + departmentDAO.update(dep2); + departmentDAO.update(dep3); + departmentDAO.update(dep4); + + company.addDepartment(dep1); + company.addDepartment(dep2); + company.addDepartment(dep3); + company.addDepartment(dep4); + + companyDAO.update(company); + newContext.commitTransaction(); + + newContext = context.beginTransaction(); + + companyDAO = TopiaTestDAOHelper.getCompanyDAO(newContext); + + company = companyDAO.findByTopiaId(company.getTopiaId()); + + assertEquals(company.getName(),"Ma société"); + assertEquals(company.getDepartment().size(),4); + + newContext.commitTransaction(); + newContext.closeContext(); + } catch (TopiaException e) { + log.error("Erreur pendant le test testCompositeAssociations",e); + } + } + + /*@Test + public void testOther() { + if(log.isInfoEnabled()) { + log.info("Junit Test testOther"); + } + }*/ + + @After + public void tearDown() { + if(log.isInfoEnabled()) { + log.info("Junit afterTest"); + } + } +}