Author: tchemit Date: 2008-12-05 14:55:08 +0000 (Fri, 05 Dec 2008) New Revision: 1243 Added: topia-service/trunk/README topia-test/trunk/README topia/trunk/README topia/trunk/topia-persistence/README topia/trunk/topia-persistence/changelog topia/trunk/topia-soa/README topia/trunk/topia-soa/changelog topia/trunk/topia-ui/README topia/trunk/topia-ui/changelog Modified: topia-service/trunk/changelog topia-service/trunk/pom.xml topia-service/trunk/src/test/java/org/codelutin/topia/history/HistoryTest.java topia-service/trunk/src/test/java/org/codelutin/topia/index/IndexTest.java topia-service/trunk/src/test/java/org/codelutin/topia/migration/common/VersionTest.java topia-service/trunk/src/test/java/org/codelutin/topia/migration/kernel/ConfigurationAdapterTest.java topia-service/trunk/src/test/java/org/codelutin/topia/security/TopiaSecurityTest.java topia-test/trunk/pom.xml topia/trunk/changelog topia/trunk/topia-persistence/src/main/java/org/codelutin/topia/framework/TopiaUtil.java topia/trunk/topia-persistence/src/test/java/org/codelutin/topia/framework/TopiaUtilTest.java Log: - improve poms, use lutinproject 3.2 - use JUnit4 for test, fix some tests (but not all). - add some usefull method to build regex on topiaIds Added: topia/trunk/README =================================================================== --- topia/trunk/README (rev 0) +++ topia/trunk/README 2008-12-05 14:55:08 UTC (rev 1243) @@ -0,0 +1,2 @@ +To deploy new version of pom: mvn deploy +To install localy: mvn install Modified: topia/trunk/changelog =================================================================== --- topia/trunk/changelog 2008-12-04 23:33:31 UTC (rev 1242) +++ topia/trunk/changelog 2008-12-05 14:55:08 UTC (rev 1243) @@ -1,7 +1,7 @@ -ver-2-1 chatellier 20081118 - * 20081205 - improve poms, use lutinproject 3.2 - - use JUnit4 for test, fix some tests (but not all). - - add some usefull method to build regex on topiaIds +2.1.0 ?? 200812?? + * 20081205 [chemit] - improve poms, use lutinproject 3.2 + - use JUnit4 for test, fix some tests (but not all). + - add some usefull method to build regex on topiaIds * 20081118 Switch to multi module project ver-2-0-29 chatellier 20081117 Added: topia/trunk/topia-persistence/README =================================================================== --- topia/trunk/topia-persistence/README (rev 0) +++ topia/trunk/topia-persistence/README 2008-12-05 14:55:08 UTC (rev 1243) @@ -0,0 +1,2 @@ +To deploy new version of pom: mvn deploy +To install localy: mvn install Copied: topia/trunk/topia-persistence/changelog (from rev 1242, topia/trunk/changelog) =================================================================== --- topia/trunk/topia-persistence/changelog (rev 0) +++ topia/trunk/topia-persistence/changelog 2008-12-05 14:55:08 UTC (rev 1243) @@ -0,0 +1,3 @@ +2.1.0 ?? 200812?? +* 20081205 [chemit] - improve poms, use lutinproject 3.2 + - add some usefull methods in TopiaUtil to help with regex on topiaId expression \ No newline at end of file Property changes on: topia/trunk/topia-persistence/changelog ___________________________________________________________________ Name: svn:mergeinfo + Name: svn:eol-style + native Modified: topia/trunk/topia-persistence/src/main/java/org/codelutin/topia/framework/TopiaUtil.java =================================================================== --- topia/trunk/topia-persistence/src/main/java/org/codelutin/topia/framework/TopiaUtil.java 2008-12-04 23:33:31 UTC (rev 1242) +++ topia/trunk/topia-persistence/src/main/java/org/codelutin/topia/framework/TopiaUtil.java 2008-12-05 14:55:08 UTC (rev 1243) @@ -97,17 +97,17 @@ * <p/> * A {@link String#format(String, Object[])} will be apply to <code>format</code>, with * for parameters the list of <code>klass</code> transformed in topia pattern via method - * {@link #getTopiaIdPattern(Class)}. + * {@link #getTopiaIdPattern(Class)} ready to be capture (enclosed by ()). * - * @param format the format - * @param klass the list of class to use + * @param format the format + * @param classes the list of class to use * @return the pattern computed */ - public static Pattern getTopiaPattern(String format, Class<? extends TopiaEntity>... klass) { - String[] entityPatterns = new String[klass.length]; - for (int i = 0; i < klass.length; i++) { - Class<? extends TopiaEntity> klas = klass[i]; - entityPatterns[i] = getTopiaIdPattern(klas); + public static Pattern getTopiaPattern(String format, Class<? extends TopiaEntity>... classes) { + String[] entityPatterns = new String[classes.length]; + for (int i = 0; i < classes.length; i++) { + Class<? extends TopiaEntity> aClass = classes[i]; + entityPatterns[i] = "(" + getTopiaIdPattern(aClass) + ")"; } String s = String.format(format, entityPatterns); if (log.isDebugEnabled()) { Modified: topia/trunk/topia-persistence/src/test/java/org/codelutin/topia/framework/TopiaUtilTest.java =================================================================== --- topia/trunk/topia-persistence/src/test/java/org/codelutin/topia/framework/TopiaUtilTest.java 2008-12-04 23:33:31 UTC (rev 1242) +++ topia/trunk/topia-persistence/src/test/java/org/codelutin/topia/framework/TopiaUtilTest.java 2008-12-05 14:55:08 UTC (rev 1243) @@ -1,13 +1,19 @@ package org.codelutin.topia.framework; import org.codelutin.topia.Person; +import org.junit.Assert; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import java.util.regex.Matcher; import java.util.regex.Pattern; /** @author chemit */ public class TopiaUtilTest { + protected static final String PERSON_ID = "org.codelutin.topia.Person#1226701039001#0.6502325993664224"; + protected static final String PERSON_ID2 = "org.codelutin.topia.Person#1226701039001#0.6502325993664999"; + @org.junit.Test public void testGetTopiaIdPattern() throws Exception { String expected; @@ -21,11 +27,24 @@ @org.junit.Test public void testGetTopiaPattern() throws Exception { String expected; - Pattern actual; + Pattern pattern; - expected = "org\\.codelutin\\.topia\\.Person#(?:\\d+?)#(?:\\d+)\\.(?:\\d+)(.*)"; - actual = TopiaUtil.getTopiaPattern("%1$s(.*)",Person.class); - assertEquals(expected, actual.toString()); + expected = "(\\d+)-(org\\.codelutin\\.topia\\.Person#(?:\\d+?)#(?:\\d+)\\.(?:\\d+))-(org\\.codelutin\\.topia\\.Person#(?:\\d+?)#(?:\\d+)\\.(?:\\d+))(.*)"; + pattern = TopiaUtil.getTopiaPattern("(\\d+)-%1$s-%1$s(.*)", Person.class); + assertEquals(expected, pattern.toString()); + + String expression = 123 + "-" + PERSON_ID + "-" + PERSON_ID2 + "-afterall"; + + Matcher matcher = pattern.matcher(expression); + + Assert.assertTrue(matcher.matches()); + + assertTrue(matcher.matches()); + assertEquals(4, matcher.groupCount()); + assertEquals("123", matcher.group(1)); + assertEquals(PERSON_ID, matcher.group(2)); + assertEquals(PERSON_ID2, matcher.group(3)); + assertEquals("-afterall", matcher.group(4)); } Added: topia/trunk/topia-soa/README =================================================================== --- topia/trunk/topia-soa/README (rev 0) +++ topia/trunk/topia-soa/README 2008-12-05 14:55:08 UTC (rev 1243) @@ -0,0 +1,2 @@ +To deploy new version of pom: mvn deploy +To install localy: mvn install Copied: topia/trunk/topia-soa/changelog (from rev 1242, topia/trunk/changelog) =================================================================== --- topia/trunk/topia-soa/changelog (rev 0) +++ topia/trunk/topia-soa/changelog 2008-12-05 14:55:08 UTC (rev 1243) @@ -0,0 +1,2 @@ +2.1.0 ?? 200812?? +* 20081205 [chemit] - improve poms, use lutinproject 3.2 \ No newline at end of file Property changes on: topia/trunk/topia-soa/changelog ___________________________________________________________________ Name: svn:mergeinfo + Name: svn:eol-style + native Added: topia/trunk/topia-ui/README =================================================================== --- topia/trunk/topia-ui/README (rev 0) +++ topia/trunk/topia-ui/README 2008-12-05 14:55:08 UTC (rev 1243) @@ -0,0 +1,2 @@ +To deploy new version of pom: mvn deploy +To install localy: mvn install Copied: topia/trunk/topia-ui/changelog (from rev 1242, topia/trunk/changelog) =================================================================== --- topia/trunk/topia-ui/changelog (rev 0) +++ topia/trunk/topia-ui/changelog 2008-12-05 14:55:08 UTC (rev 1243) @@ -0,0 +1,2 @@ +2.1.0 ?? 200812?? +* 20081205 [chemit] - improve poms, use lutinproject 3.2 Property changes on: topia/trunk/topia-ui/changelog ___________________________________________________________________ Name: svn:mergeinfo + Name: svn:eol-style + native Added: topia-service/trunk/README =================================================================== --- topia-service/trunk/README (rev 0) +++ topia-service/trunk/README 2008-12-05 14:55:08 UTC (rev 1243) @@ -0,0 +1,2 @@ +To deploy new version of pom: mvn deploy +To install localy: mvn install Modified: topia-service/trunk/changelog =================================================================== --- topia-service/trunk/changelog 2008-12-04 23:33:31 UTC (rev 1242) +++ topia-service/trunk/changelog 2008-12-05 14:55:08 UTC (rev 1243) @@ -1,3 +1,6 @@ +1.0 ?? 200812?? + * 20081205 [chemit] - improve poms, use lutinproject 3.2, migrate tests to JUnit4 + 0.9.1 * [chatellier] Correction d'un bug de recherche de mapping sous windows (\) Modified: topia-service/trunk/pom.xml =================================================================== --- topia-service/trunk/pom.xml 2008-12-04 23:33:31 UTC (rev 1242) +++ topia-service/trunk/pom.xml 2008-12-05 14:55:08 UTC (rev 1243) @@ -1,5 +1,6 @@ <?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"> +<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> @@ -9,12 +10,12 @@ <parent> <groupId>org.codelutin</groupId> <artifactId>lutinproject</artifactId> - <version>3.0</version> + <version>3.2</version> </parent> <artifactId>topia-service</artifactId> - <version>1.0.0-SNAPSHOT</version> - + <version>1.0.0-SNAPSHOT</version> + <dependencies> <!--Compile--> @@ -28,7 +29,7 @@ <dependency> <groupId>org.codelutin</groupId> <artifactId>lutinutil</artifactId> - <version>0.31</version> + <version>${lutinutil.version}</version> <scope>compile</scope> </dependency> @@ -38,7 +39,7 @@ <version>2.3.2</version> <scope>compile</scope> </dependency> - + <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> @@ -79,11 +80,18 @@ <!-- nom du projet sur le labs --> <labs.project>topia</labs.project> + <!-- Ignore failure test for now --> + <maven.test.testFailureIgnore>true</maven.test.testFailureIgnore> + <!-- topia version --> <topia.version>2.1.0-SNAPSHOT</topia.version> - <!-- Test FIXME : should be ok --> - <maven.test.skip>true</maven.test.skip> + <!-- generator version --> + <generator.version>0.62-SNAPSHOT</generator.version> + + <!-- lutinutil version --> + <lutinutil.version>0.31</lutinutil.version> + </properties> <build> @@ -93,7 +101,7 @@ <plugin> <groupId>org.codelutin</groupId> <artifactId>maven-generator-plugin</artifactId> - <version>0.62-SNAPSHOT</version> + <version>${generator.version}</version> <executions> <execution> <phase>generate-sources</phase> @@ -130,6 +138,26 @@ </plugin> <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.2</version> + <executions> + <execution> + <phase>test-compile</phase> + <goals> + <goal>add-test-source</goal> + </goals> + <configuration> + <sources> + <source>${maven.gen.dir}/java</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + + + <plugin> <artifactId>maven-javadoc-plugin</artifactId> </plugin> Modified: topia-service/trunk/src/test/java/org/codelutin/topia/history/HistoryTest.java =================================================================== --- topia-service/trunk/src/test/java/org/codelutin/topia/history/HistoryTest.java 2008-12-04 23:33:31 UTC (rev 1242) +++ topia-service/trunk/src/test/java/org/codelutin/topia/history/HistoryTest.java 2008-12-05 14:55:08 UTC (rev 1243) @@ -29,12 +29,6 @@ package org.codelutin.topia.history; -import java.io.File; -import java.util.List; -import java.util.Properties; - -import junit.framework.TestCase; - import org.codelutin.topia.TopiaContext; import org.codelutin.topia.TopiaContextFactory; import org.codelutin.topia.TopiaServiceDAOHelper; @@ -42,18 +36,21 @@ import org.codelutin.topia.test.entities.Person; import org.codelutin.topia.test.entities.PersonDAO; import org.codelutin.util.FileUtil; +import org.junit.Assert; +import org.junit.Test; +import java.io.File; +import java.util.List; +import java.util.Properties; -/** - * @author poussin - * - */ -public class HistoryTest extends TestCase { +/** @author poussin */ +public class HistoryTest extends Assert { + protected static String entitiesList = - "org.codelutin.topia.test.entities.PersonImpl," + - "org.codelutin.topia.test.entities.PetImpl"; + "org.codelutin.topia.test.entities.PersonImpl," + + "org.codelutin.topia.test.entities.PetImpl"; protected static Properties getProperties() throws Exception { Properties config = new Properties(); @@ -61,7 +58,7 @@ config.setProperty("hibernate.show_sql", "true"); config.setProperty("topia.persistence.classes", entitiesList); - + config.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); config.setProperty("hibernate.connection.username", "sa"); config.setProperty("hibernate.connection.password", ""); @@ -69,18 +66,19 @@ File tmp = FileUtil.createTempDirectory("topia-test-service", "history"); config.setProperty("hibernate.connection.url", - "jdbc:h2:" + tmp.getCanonicalPath() + "/data;LOCK_METHOD=NO"); - + "jdbc:h2:" + tmp.getCanonicalPath() + "/data;create=true;LOCK_MODE=0"); + config.setProperty("topia.history", "org.codelutin.topia.history.TopiaHistoryServiceImpl"); return config; } + @Test public void testHistory() throws Exception { Properties config = getProperties(); TopiaContext context = TopiaContextFactory.getContext(config); - + /* Tests */ TopiaContext childContext = context.beginTransaction(); Modified: topia-service/trunk/src/test/java/org/codelutin/topia/index/IndexTest.java =================================================================== --- topia-service/trunk/src/test/java/org/codelutin/topia/index/IndexTest.java 2008-12-04 23:33:31 UTC (rev 1242) +++ topia-service/trunk/src/test/java/org/codelutin/topia/index/IndexTest.java 2008-12-05 14:55:08 UTC (rev 1243) @@ -29,28 +29,27 @@ package org.codelutin.topia.index; -import java.io.File; -import java.util.Properties; -import java.util.SortedSet; - -import junit.framework.TestCase; - import org.codelutin.topia.TopiaContext; import org.codelutin.topia.TopiaContextFactory; import org.codelutin.topia.framework.TopiaContextImplementor; import org.codelutin.topia.persistence.TopiaDAO; import org.codelutin.topia.test.entities.Person; +import org.codelutin.topia.test.entities.PersonImpl; +import org.codelutin.topia.test.entities.PetImpl; +import org.junit.Assert; +import org.junit.Test; +import java.io.File; +import java.util.Properties; +import java.util.SortedSet; -/** - * @author poussin - * - */ -public class IndexTest extends TestCase { +/** @author poussin */ - protected String entitiesList = Person.class.getName(); +public class IndexTest extends Assert { + protected String entitiesList = PersonImpl.class.getName() + "," + PetImpl.class.getName(); + protected Properties getH2Properties() { Properties config = new Properties(); config.setProperty("hibernate.show_sql", "true"); @@ -61,7 +60,7 @@ config.setProperty("topia.dao.flatfile.mapping.key", "firstname"); config.setProperty("topia.persistence.classes", entitiesList); - config.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); + config.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); config.setProperty("hibernate.connection.driver_class", "org.h2.Driver"); config.setProperty("hibernate.connection.url", "jdbc:h2:file:/tmp/topiaderby;create=true"); @@ -82,7 +81,7 @@ return result; } - + @Test public void testIndex() throws Exception { System.out.println("Debut du test index"); @@ -107,13 +106,13 @@ childContext.commitTransaction(); childContext.closeContext(); - + TopiaIndexService ie = context.getService(TopiaIndexService.class); SortedSet<IndexEntry> results = ie.search("poussin"); - + System.out.println("Index result: " + results.size()); - for (IndexEntry result : results) { - System.out.println("Index result: " + result.getScore()+ " topiaId: " + result.getTopiaId()); + for (IndexEntry result : results) { + System.out.println("Index result: " + result.getScore() + " topiaId: " + result.getTopiaId()); } } Modified: topia-service/trunk/src/test/java/org/codelutin/topia/migration/common/VersionTest.java =================================================================== --- topia-service/trunk/src/test/java/org/codelutin/topia/migration/common/VersionTest.java 2008-12-04 23:33:31 UTC (rev 1242) +++ topia-service/trunk/src/test/java/org/codelutin/topia/migration/common/VersionTest.java 2008-12-05 14:55:08 UTC (rev 1243) @@ -18,23 +18,27 @@ */ package org.codelutin.topia.migration.common; -import junit.framework.TestCase; +import org.junit.Assert; +import org.junit.Test; -public class VersionTest extends TestCase { +public class VersionTest extends Assert { - public void testCompareTo() { - Version v2_1_2 = new Version("2.1.2"); - Version v1_9 = new Version("1.9"); - assertTrue(v2_1_2.compareTo(v1_9) > 0); - assertTrue(v1_9.compareTo(v2_1_2)<0); - } + @Test + public void testCompareTo() { + Version v2_1_2 = new Version("2.1.2"); + Version v1_9 = new Version("1.9"); + assertTrue(v2_1_2.compareTo(v1_9) > 0); + assertTrue(v1_9.compareTo(v2_1_2) < 0); + } - public void testCompareTo2(){ - assertTrue(new Version("10.1.2").compareTo(new Version("9.9"))>0); - } - - public void testCompareTo_Equal(){ - assertTrue(new Version("6.2").compareTo(new Version("6.2")) == 0); - } + @Test + public void testCompareTo2() { + assertTrue(new Version("10.1.2").compareTo(new Version("9.9")) > 0); + } + + @Test + public void testCompareTo_Equal() { + assertTrue(new Version("6.2").compareTo(new Version("6.2")) == 0); + } } Modified: topia-service/trunk/src/test/java/org/codelutin/topia/migration/kernel/ConfigurationAdapterTest.java =================================================================== --- topia-service/trunk/src/test/java/org/codelutin/topia/migration/kernel/ConfigurationAdapterTest.java 2008-12-04 23:33:31 UTC (rev 1242) +++ topia-service/trunk/src/test/java/org/codelutin/topia/migration/kernel/ConfigurationAdapterTest.java 2008-12-05 14:55:08 UTC (rev 1243) @@ -18,17 +18,19 @@ */ package org.codelutin.topia.migration.kernel; -import junit.framework.TestCase; - import org.codelutin.topia.migration.common.Version; import org.hibernate.EntityMode; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; -public class ConfigurationAdapterTest extends TestCase { +public class ConfigurationAdapterTest { ConfigurationAdapter confa; + @Before public void beforetest() { Configuration confHib = new Configuration(); confHib.configure(); @@ -37,9 +39,10 @@ confa = new ConfigurationAdapter(confHib, new Version("1")); } + @Test public void testDependencies() { beforetest(); DependenciesHelper conf = confa.getDependenciesHelper(); - assertNotNull(conf); + Assert.assertNotNull(conf); } } Modified: topia-service/trunk/src/test/java/org/codelutin/topia/security/TopiaSecurityTest.java =================================================================== --- topia-service/trunk/src/test/java/org/codelutin/topia/security/TopiaSecurityTest.java 2008-12-04 23:33:31 UTC (rev 1242) +++ topia-service/trunk/src/test/java/org/codelutin/topia/security/TopiaSecurityTest.java 2008-12-05 14:55:08 UTC (rev 1243) @@ -75,7 +75,7 @@ config.setProperty("hibernate.connection.password", ""); config.setProperty("hibernate.connection.driver_class", "org.h2.Driver"); - config.setProperty("hibernate.connection.url", "jdbc:h2:data/topia-security;LOCK_METHOD=NO"); + config.setProperty("hibernate.connection.url", "jdbc:h2:data/topia-security;create=true;LOCK_MODE=0"); return config; } Added: topia-test/trunk/README =================================================================== --- topia-test/trunk/README (rev 0) +++ topia-test/trunk/README 2008-12-05 14:55:08 UTC (rev 1243) @@ -0,0 +1,2 @@ +To deploy new version of pom: mvn deploy +To install localy: mvn install Modified: topia-test/trunk/pom.xml =================================================================== --- topia-test/trunk/pom.xml 2008-12-04 23:33:31 UTC (rev 1242) +++ topia-test/trunk/pom.xml 2008-12-05 14:55:08 UTC (rev 1243) @@ -11,7 +11,7 @@ <parent> <groupId>org.codelutin</groupId> <artifactId>lutinproject</artifactId> - <version>3.0</version> + <version>3.2</version> </parent> <artifactId>topia-test</artifactId> @@ -35,13 +35,6 @@ <!-- 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> @@ -76,6 +69,8 @@ <!-- topia version --> <topia.version>2.0.27</topia.version> + <!-- generator version --> + <generator.version>0.62-SNAPSHOT</generator.version> </properties> <build> @@ -84,7 +79,7 @@ <plugin> <groupId>org.codelutin</groupId> <artifactId>maven-generator-plugin</artifactId> - <version>0.60</version> + <version>${generator.version}</version> <executions> <execution> <id>Generator</id>