Author: mic...@jb... Date: 2005-12-29 00:51:39 -0500 (Thu, 29 Dec 2005) New Revision: 1952 Added: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/HibernateTester.java trunk/labs/jbossrules/drools-repository/src/test/resources/ trunk/labs/jbossrules/drools-repository/src/test/resources/hibernate.cfg.xml Removed: trunk/labs/jbossrules/drools-repository/src/main/resources/hibernate.cfg.xml Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleDef.java trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RepositoryImplTest.java Log: Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleDef.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleDef.java 2005-12-29 02:16:45 UTC (rev 1951) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleDef.java 2005-12-29 05:51:39 UTC (rev 1952) @@ -11,7 +11,7 @@ private MetaData metaData; private String status; private boolean checkedOut; - private String checkOutBy; + private String checkedOutBy; private String versionComment; private Set tags; private String documentation; @@ -65,11 +65,11 @@ public void setCheckedOut(boolean checkedOut){ this.checkedOut = checkedOut; } - public String getCheckOutBy(){ - return checkOutBy; + public String getCheckedOutBy(){ + return checkedOutBy; } - public void setCheckOutBy(String checkOutBy){ - this.checkOutBy = checkOutBy; + public void setCheckedOutBy(String checkOutBy){ + this.checkedOutBy = checkOutBy; } public boolean isHead(){ return isHead; @@ -116,8 +116,9 @@ public String getName(){ return name; } - public void setName(String name){ + public RuleDef setName(String name){ this.name = name; + return this; } Deleted: trunk/labs/jbossrules/drools-repository/src/main/resources/hibernate.cfg.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/hibernate.cfg.xml 2005-12-29 02:16:45 UTC (rev 1951) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/hibernate.cfg.xml 2005-12-29 05:51:39 UTC (rev 1952) @@ -1,38 +0,0 @@ -<?xml version='1.0' encoding='utf-8'?> -<!DOCTYPE hibernate-configuration PUBLIC - "-//Hibernate/Hibernate Configuration DTD 3.0//EN" - "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> - -<hibernate-configuration> - - <session-factory> - - <!-- Database connection settings --> - <property name="connection.driver_class">org.hsqldb.jdbcDriver</property> - <property name="connection.url">jdbc:hsqldb:hsql://localhost</property> - <property name="connection.username">sa</property> - <property name="connection.password"></property> - - <!-- JDBC connection pool (use the built-in) --> - <property name="connection.pool_size">1</property> - - <!-- SQL dialect --> - <property name="dialect">org.hibernate.dialect.HSQLDialect</property> - - <!-- Enable Hibernate's automatic session context management --> - <property name="current_session_context_class">thread</property> - - <!-- Disable the second-level cache --> - <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> - - <!-- Echo all executed SQL to stdout --> - <property name="show_sql">true</property> - - <!-- Drop and re-create the database schema on startup --> - <property name="hbm2ddl.auto">create</property> - - <mapping resource="org/drools/repository/RuleDef.hbm.xml"/> - - </session-factory> - -</hibernate-configuration> \ No newline at end of file Modified: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml 2005-12-29 02:16:45 UTC (rev 1951) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml 2005-12-29 05:51:39 UTC (rev 1952) @@ -10,20 +10,19 @@ <id name="id" column="RULE_ID"> <generator class="native"/> </id> - -<!-- - <property name="dateSaved" type="timestamp" column="DATE_CREATED"/> <property name="name"/> - <property name="versionNumber"/> - <property name="content" /> - <property name="status" /> - <property name="checkedOut" /> - <property name="checkedOutBy" /> + <property name="versionNumber"/> + <property name="content" /> + <property name="status" /> + <property name="checkedOut" /> + <property name="checkedOutBy" /> <property name="versionComment" /> <property name="documentation" /> <property name="effectiveDate" /> - <property name="expiryDate" /> - --> + <property name="expiryDate" /> + <property name="dateSaved" type="timestamp" column="DATE_CREATED"/> + + </class> </hibernate-mapping> \ No newline at end of file Added: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/HibernateTester.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/HibernateTester.java 2005-12-29 02:16:45 UTC (rev 1951) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/HibernateTester.java 2005-12-29 05:51:39 UTC (rev 1952) @@ -0,0 +1,28 @@ +package org.drools.repository.db; + +import org.hsqldb.Server; + +import junit.framework.TestCase; + +public class HibernateTester extends TestCase { + + private static Server server; + + public static void startServer() { + if (server == null) { + System.out.println("Starting HSQLDB for tests."); + server = new Server(); + server.start(); + try { + Thread.sleep(3000); + } + catch ( InterruptedException e ) {} + } + } + + public static void stopServer() { + System.out.println("Starting HSQLDB for tests."); + server.stop(); + } + +} Property changes on: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/HibernateTester.java ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RepositoryImplTest.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RepositoryImplTest.java 2005-12-29 02:16:45 UTC (rev 1951) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RepositoryImplTest.java 2005-12-29 05:51:39 UTC (rev 1952) @@ -4,12 +4,18 @@ import junit.framework.TestCase; -public class RepositoryImplTest extends TestCase { +public class RepositoryImplTest extends HibernateTester { public void testStoreNewRuleDef() throws Exception { + RepositoryImpl repo = new RepositoryImpl(); RuleDef def = repo.addNewRule("myRule", "A rule", "some comment"); assertNotNull(def.getId()); + + + + + } } Added: trunk/labs/jbossrules/drools-repository/src/test/resources/hibernate.cfg.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/resources/hibernate.cfg.xml 2005-12-29 02:16:45 UTC (rev 1951) +++ trunk/labs/jbossrules/drools-repository/src/test/resources/hibernate.cfg.xml 2005-12-29 05:51:39 UTC (rev 1952) @@ -0,0 +1,41 @@ +<?xml version='1.0' encoding='utf-8'?> +<!DOCTYPE hibernate-configuration PUBLIC + "-//Hibernate/Hibernate Configuration DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> + +<hibernate-configuration> + + <session-factory> + + <!-- Database connection settings --> + <property name="connection.driver_class">org.hsqldb.jdbcDriver</property> +<!-- <property name="connection.url">jdbc:hsqldb:hsql://localhost</property> --> + <property name="connection.url">jdbc:hsqldb:mem:unittest</property> + + + <property name="connection.username">sa</property> + <property name="connection.password"></property> + + <!-- JDBC connection pool (use the built-in) --> + <property name="connection.pool_size">1</property> + + <!-- SQL dialect --> + <property name="dialect">org.hibernate.dialect.HSQLDialect</property> + + <!-- Enable Hibernate's automatic session context management --> + <property name="current_session_context_class">thread</property> + + <!-- Disable the second-level cache --> + <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> + + <!-- Echo all executed SQL to stdout --> + <property name="show_sql">true</property> + + <!-- Drop and re-create the database schema on startup --> + <property name="hbm2ddl.auto">create</property> + + <mapping resource="org/drools/repository/RuleDef.hbm.xml"/> + + </session-factory> + +</hibernate-configuration> \ No newline at end of file Property changes on: trunk/labs/jbossrules/drools-repository/src/test/resources/hibernate.cfg.xml ___________________________________________________________________ Name: svn:eol-style + native |