[appliweb~src:3] Appliweb designer unit test working

  • From: appliweb@kenai.com
  • To: commits@appliweb.kenai.com
  • Subject: [appliweb~src:3] Appliweb designer unit test working
  • Date: Thu, 10 Jun 2010 19:39:17 +0000

Project:    appliweb
Repository: src
Revision:   3
Author:     appliweb
Date:       2010-06-10 19:39:14 UTC
Link:       

Log Message:
------------
Appliweb designer unit test working


Revisions:
----------
3


Modified Paths:
---------------
trunk/pom.xml
trunk/impl
trunk/api/src/main/java/net/appliweb/designer/model/component/Container.java
trunk/impl/src/main/java/net/appliweb/designer/impl/model/component/ComponentImpl.java
trunk/impl/src/test/java/net/appliweb/designer/test/AppEngineManager.java
trunk/impl/src/test/java/net/appliweb/designer/test/TestAppEngine.java
trunk/impl/pom.xml
trunk/web/src/test/java/net/appliweb/web/dynamic/test/BasicTest.java
trunk/api
trunk/impl/src/test/java/net/appliweb/designer/model/view/test/ViewTest.java
trunk/impl/nbactions.xml
trunk/web
trunk/web/src/main/java/net/appliweb/web/AppliwebApp.java
trunk/impl/src/main/resources/META-INF/persistence.xml
trunk/web/src/main/webapp/META-INF/context.xml
trunk/ear


Added Paths:
------------
trunk/web/src/main/resources/rer.properties
trunk/impl/src/test/java/net/appliweb/designer/test/PersistenceTestBase.java
trunk/web/src/main/resources/rer_gae.properties
trunk/impl/src/test/java/net/appliweb/designer/data/test/CreateDataset.java


Diffs:
------
Index: trunk/impl/nbactions.xml
===================================================================
--- trunk/impl/nbactions.xml    (revision 2)
+++ trunk/impl/nbactions.xml    (revision 3)
@@ -8,6 +8,7 @@
                 <goal>test</goal>
             </goals>
             <activatedProfiles>
+                <activatedProfile>mysql</activatedProfile>
                 <activatedProfile>recreateDb</activatedProfile>
             </activatedProfiles>
             <properties>
Index: 
trunk/impl/src/test/java/net/appliweb/designer/test/PersistenceTestCase.java
===================================================================
--- 
trunk/impl/src/test/java/net/appliweb/designer/test/PersistenceTestCase.java  
      (revision 2)
+++ 
trunk/impl/src/test/java/net/appliweb/designer/test/PersistenceTestCase.java  
      (revision 3)
@@ -1,73 +0,0 @@
-/*
- * This file is released under the Apache 2.0 license.
- * It can be used in GPL or LGPL projects too.
- */
-
-package net.appliweb.designer.test;
-
-import java.util.HashMap;
-import java.util.Map;
-import javax.persistence.EntityManager;
-import junit.framework.TestCase;
-import net.appliweb.rera.dao.DaoFactory;
-import net.appliweb.rera.impl.jpa.JpaDaoHandler;
-import net.appliweb.rera.impl.jpa.JpaDaoHandlerImpl;
-import net.appliweb.rera.impl.model.ModelFactoryImpl;
-import net.appliweb.rera.impl.transaction.JpaTransactionFactory;
-import net.appliweb.rera.impl.transaction.JpaTransactionFactoryImpl;
-import net.appliweb.rera.model.ModelFactory;
-import net.appliweb.rera.transaction.TransactionFactory;
-import net.appliweb.rerb.dao.RerbDaoFactory;
-
-/**
- *
- * @author gerard
- */
-public class PersistenceTestCase extends TestCase {
-
-    @Override
-    public void setUp ()
-    {
-        AppEngineManager.initIfNeeded ();
-    }
-
-    protected void beginTransaction() {
-        beginTransaction(false);
-    }
-
-    protected void beginTransaction(boolean autoCreateTables)
-    {
-        Map props=new HashMap();
-        if( autoCreateTables)
-        {
-            props.put ("datanucleus.autoCreateSchema","true");
-            /*props.put ("datanucleus.autoCreateColumns","true");
-            props.put("datanucleus.autoCreateTables", "true");*/
-        }
-        
-        if (DaoFactory.getFactory()==null)
-        {
-            RerbDaoFactory.setFactory(new RerbDaoFactory(new 
JpaDaoHandlerImpl()));
-            ModelFactory.setFactory(new ModelFactoryImpl());
-
-            TransactionFactory.setFactory(new 
JpaTransactionFactoryImpl(null, props));
-        }
-
-        TransactionFactory.getFactory().begin(props);
-    }
-
-    protected EntityManager getEntityManager ()
-    {
-        return JpaTransactionFactory.getFactory().getEntityManager();
-    }
-
-    protected void rollbackTransaction() {
-        TransactionFactory.getFactory().markRollback();
-        TransactionFactory.getFactory().end();
-    }
-
-    protected void commitTransaction() {
-        TransactionFactory.getFactory().end();
-    }
-
-}
Index: 
trunk/impl/src/test/java/net/appliweb/designer/test/PersistenceTestBase.java
===================================================================
--- 
trunk/impl/src/test/java/net/appliweb/designer/test/PersistenceTestBase.java  
      (revision 0)
+++ 
trunk/impl/src/test/java/net/appliweb/designer/test/PersistenceTestBase.java  
      (revision 3)
@@ -0,0 +1,74 @@
+/*
+ * This file is released under the Apache 2.0 license.
+ * It can be used in GPL or LGPL projects too.
+ */
+
+package net.appliweb.designer.test;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.persistence.EntityManager;
+import junit.framework.TestCase;
+import net.appliweb.rera.dao.DaoFactory;
+import net.appliweb.rera.impl.jpa.JpaDaoHandler;
+import net.appliweb.rera.impl.jpa.JpaDaoHandlerImpl;
+import net.appliweb.rera.impl.model.ModelFactoryImpl;
+import net.appliweb.rera.impl.transaction.JpaTransactionFactory;
+import net.appliweb.rera.impl.transaction.JpaTransactionFactoryImpl;
+import net.appliweb.rera.model.ModelFactory;
+import net.appliweb.rera.transaction.TransactionFactory;
+import net.appliweb.rerb.dao.RerbDaoFactory;
+
+/**
+ *
+ * @author gerard
+ */
+public class PersistenceTestBase extends TestCase {
+
+    @Override
+    public void setUp ()
+    {
+        //AppEngineManager.initIfNeeded ();
+        TestManager.initIfNeeded();
+    }
+
+    protected void beginTransaction() {
+        beginTransaction(false);
+    }
+
+    protected void beginTransaction(boolean autoCreateTables)
+    {
+        Map props=new HashMap();
+        if( autoCreateTables)
+        {
+            props.put ("datanucleus.autoCreateSchema","true");
+            /*props.put ("datanucleus.autoCreateColumns","true");
+            props.put("datanucleus.autoCreateTables", "true");*/
+        }
+        
+        if (DaoFactory.getFactory()==null)
+        {
+            RerbDaoFactory.setFactory(new RerbDaoFactory(new 
JpaDaoHandlerImpl()));
+            ModelFactory.setFactory(new ModelFactoryImpl());
+
+            TransactionFactory.setFactory(new 
JpaTransactionFactoryImpl(null, props));
+        }
+
+        TransactionFactory.getFactory().begin(props);
+    }
+
+    protected EntityManager getEntityManager ()
+    {
+        return JpaTransactionFactory.getFactory().getEntityManager();
+    }
+
+    protected void rollbackTransaction() {
+        TransactionFactory.getFactory().markRollback();
+        TransactionFactory.getFactory().end();
+    }
+
+    protected void commitTransaction() {
+        TransactionFactory.getFactory().end();
+    }
+
+}

Property changes on: 
trunk/impl/src/test/java/net/appliweb/designer/test/PersistenceTestBase.java
___________________________________________________________________
Added: svn:mergeinfo

Index: 
trunk/impl/src/test/java/net/appliweb/designer/test/AppEngineManager.java
===================================================================
--- trunk/impl/src/test/java/net/appliweb/designer/test/AppEngineManager.java 
  (revision 2)
+++ trunk/impl/src/test/java/net/appliweb/designer/test/AppEngineManager.java 
  (revision 3)
@@ -28,7 +28,7 @@
     {
         if( !initialized)
         {
-            ResourceBundle bundle =ResourceBundle.getBundle("datanucleus");
+            ResourceBundle bundle =ResourceBundle.getBundle("rer");
             String type=bundle.getString("datanucleus.storeManagerType");
             if( "appengine".equals (type))
             {
Index: trunk/impl/src/test/java/net/appliweb/designer/test/TestAppEngine.java
===================================================================
--- trunk/impl/src/test/java/net/appliweb/designer/test/TestAppEngine.java    
  (revision 2)
+++ trunk/impl/src/test/java/net/appliweb/designer/test/TestAppEngine.java    
  (revision 3)
@@ -18,12 +18,12 @@
 
     public void testRun ()
     {
-        AppEngineManager.initIfNeeded();
+        /*AppEngineManager.initIfNeeded();
         LocalServiceTestHelper helper= AppEngineManager.getHelper();
         ApiProxyLocal proxy= helper.getApiProxyLocal();
         LocalRpcService service= helper.getLocalService("datastore");
 
-        System.out.println(service.getPackage());
+        System.out.println(service.getPackage());*/
     }
 
 }
Index: 
trunk/impl/src/test/java/net/appliweb/designer/model/view/test/ViewTest.java
===================================================================
--- 
trunk/impl/src/test/java/net/appliweb/designer/model/view/test/ViewTest.java  
      (revision 2)
+++ 
trunk/impl/src/test/java/net/appliweb/designer/model/view/test/ViewTest.java  
      (revision 3)
@@ -7,7 +7,7 @@
 
 import net.appliweb.designer.model.component.Component;
 import net.appliweb.designer.model.view.View;
-import net.appliweb.designer.test.PersistenceTestCase;
+import net.appliweb.designer.test.PersistenceTestBase;
 import net.appliweb.rera.dao.DaoFactory;
 import net.appliweb.rera.model.ModelFactory;
 
@@ -15,7 +15,7 @@
  *
  * @author gerard
  */
-public class ViewTest extends PersistenceTestCase {
+public class ViewTest extends PersistenceTestBase {
 
     public void testLoadSampleView ()
     {
Index: 
trunk/impl/src/test/java/net/appliweb/designer/data/test/TestDataset.java
===================================================================
--- trunk/impl/src/test/java/net/appliweb/designer/data/test/TestDataset.java 
  (revision 2)
+++ trunk/impl/src/test/java/net/appliweb/designer/data/test/TestDataset.java 
  (revision 3)
@@ -1,168 +0,0 @@
-/*
- * This file is released under the Apache 2.0 license.
- * It can be used in GPL or LGPL projects too.
- */
-
-package net.appliweb.designer.data.test;
-
-import java.sql.Driver;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.sql.Statement;
-import net.appliweb.designer.impl.ReferenceDataCodes;
-import net.appliweb.designer.model.component.Component;
-import net.appliweb.designer.model.component.ComponentType;
-import net.appliweb.designer.model.view.View;
-import net.appliweb.designer.sample.SampleDataConstants;
-import net.appliweb.designer.test.PersistenceTestCase;
-import net.appliweb.rera.dao.Dao;
-import net.appliweb.rera.dao.DaoFactory;
-import net.appliweb.rera.impl.transaction.JpaTransactionFactory;
-import net.appliweb.rera.model.ModelFactory;
-import net.appliweb.rerb.dao.RerbDaoFactory;
-
-/**
- * Insert the sample dataset for testing purpose
- * @author gerard
- */
-public class TestDataset extends PersistenceTestCase {
-
-    /**
-     * Destroy the db and reconstruct it with ref and sample data
-     */
-    public void testCreateSampleDatabase ()
-    {
-        recreateBase();
-
-        insertReference();
-        insertTest ();
-    }
-
-    /**
-     * Recreates the entire DB
-     */
-    public void recreateBase ()
-    {
-        Connection connection=null;
-        Statement statement=null;
-        try {
-            Class<Driver> jdbcDriver = 
(Class<Driver>)Class.forName(System.getProperty("jdbc.driver"));
-            DriverManager.registerDriver(jdbcDriver.newInstance());
-            
connection=DriverManager.getConnection(System.getProperty("jdbc.url"),
-                    System.getProperty("jdbc.username"),
-                    System.getProperty("jdbc.password"));
-
-            statement=connection.createStatement();
-            statement.execute("drop database 
"+System.getProperty("persistence.manager"));
-            statement.execute("create database 
"+System.getProperty("persistence.manager"));
-
-        }catch (RuntimeException ex) {
-            throw ex;
-        } catch (Exception ex) {
-            throw new RuntimeException (ex);
-        } finally
-        {
-            try {
-                if (statement != null) {
-                    statement.close();
-                }
-                if (connection != null) {
-                    connection.close();
-                }
-            } catch (SQLException ex) {
-                throw new RuntimeException (ex);
-            }
-        }
-    }
-
-    /**
-     * Begin a special transaction for recreating the tables
-     */
-    protected void beginRecreateTransaction ()
-    {
-        beginTransaction(true);
-    }
-
-    /**
-     * Inserts the reference data, that is, data that must always exist
-     * For the application to work
-     */
-    public void insertReference ()
-    {
-        beginRecreateTransaction();
-        try
-        {
-            createComponentType ();
-            commitTransaction();
-        } catch (RuntimeException e)
-        {
-            rollbackTransaction();
-            throw e;
-        }
-    }
-
-    /**
-     * Creates the type of components needed
-     */
-    protected void createComponentType ()
-    {
-        Dao<ComponentType> 
componentTypeDao=DaoFactory.findDao(ComponentType.class);
-        ComponentType componentType = 
ModelFactory.createEntity(ComponentType.class);
-
-        componentType.setCode(ReferenceDataCodes.COMPONENT_TYPE_LABEL);
-        componentType.setName("Label");
-        componentTypeDao.create(componentType);
-
-        componentType = ModelFactory.createEntity(ComponentType.class);
-        componentType.setCode(ReferenceDataCodes.COMPONENT_TYPE_INPUT);
-        componentType.setName("Input");
-        componentTypeDao.create(componentType);
-
-    }
-
-     /**
-     * Inserts the test data.
-      * Some data needed for testing
-     */
-    public void insertTest ()
-    {
-        beginRecreateTransaction();
-        try
-        {
-            createSampleView ();
-            commitTransaction();
-        } catch (RuntimeException e)
-        {
-            rollbackTransaction();
-            throw e;
-        }
-    }
-
-    /**
-     * Creates a sample view
-     */
-    protected void createSampleView() {
-        View newView=ModelFactory.createEntity(View.class);
-        newView.setName(SampleDataConstants.VIEW_TEST1);
-
-        Component newComponent=ModelFactory.createEntity(Component.class);
-        newComponent.setName(SampleDataConstants.COMPONENT_LBL_TEST1);
-        newComponent.setParent(newView);
-        newComponent.setType(RerbDaoFactory.loadByCode(ComponentType.class, 
ReferenceDataCodes.COMPONENT_TYPE_LABEL));
-        newView.getChildren().add(newComponent);
-
-        Component newInput=ModelFactory.createEntity(Component.class);
-        newInput.setName(SampleDataConstants.COMPONENT_INPUT_TEST2);
-        newInput.setParent(newView);
-        newInput.setType(RerbDaoFactory.loadByCode(ComponentType.class, 
ReferenceDataCodes.COMPONENT_TYPE_INPUT));
-        newView.getChildren().add(newInput);
-
-        DaoFactory.create(newView);
-        DaoFactory.create(newComponent);
-        DaoFactory.create(newInput);
-
-        JpaTransactionFactory.getFactory().getEntityManager().flush();
-    }
-
-}
Index: 
trunk/impl/src/test/java/net/appliweb/designer/data/test/CreateDataset.java
===================================================================
--- 
trunk/impl/src/test/java/net/appliweb/designer/data/test/CreateDataset.java 
(revision 0)
+++ 
trunk/impl/src/test/java/net/appliweb/designer/data/test/CreateDataset.java 
(revision 3)
@@ -0,0 +1,168 @@
+/*
+ * This file is released under the Apache 2.0 license.
+ * It can be used in GPL or LGPL projects too.
+ */
+
+package net.appliweb.designer.data.test;
+
+import java.sql.Driver;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+import net.appliweb.designer.impl.ReferenceDataCodes;
+import net.appliweb.designer.model.component.Component;
+import net.appliweb.designer.model.component.ComponentType;
+import net.appliweb.designer.model.view.View;
+import net.appliweb.designer.sample.SampleDataConstants;
+import net.appliweb.designer.test.PersistenceTestBase;
+import net.appliweb.rera.dao.Dao;
+import net.appliweb.rera.dao.DaoFactory;
+import net.appliweb.rera.impl.transaction.JpaTransactionFactory;
+import net.appliweb.rera.model.ModelFactory;
+import net.appliweb.rerb.dao.RerbDaoFactory;
+
+/**
+ * Insert the sample dataset for testing purpose
+ * @author gerard
+ */
+public class CreateDataset extends PersistenceTestBase {
+
+    /**
+     * Destroy the db and reconstruct it with ref and sample data
+     */
+    public void testCreateSampleDatabase ()
+    {
+        recreateBase();
+
+        insertReference();
+        insertTest ();
+    }
+
+    /**
+     * Recreates the entire DB
+     */
+    public void recreateBase ()
+    {
+        Connection connection=null;
+        Statement statement=null;
+        try {
+            Class<Driver> jdbcDriver = 
(Class<Driver>)Class.forName(System.getProperty("jdbc.driver"));
+            DriverManager.registerDriver(jdbcDriver.newInstance());
+            
connection=DriverManager.getConnection(System.getProperty("jdbc.url"),
+                    System.getProperty("jdbc.username"),
+                    System.getProperty("jdbc.password"));
+
+            statement=connection.createStatement();
+            statement.execute("drop database 
"+System.getProperty("persistence.manager"));
+            statement.execute("create database 
"+System.getProperty("persistence.manager"));
+
+        }catch (RuntimeException ex) {
+            throw ex;
+        } catch (Exception ex) {
+            throw new RuntimeException (ex);
+        } finally
+        {
+            try {
+                if (statement != null) {
+                    statement.close();
+                }
+                if (connection != null) {
+                    connection.close();
+                }
+            } catch (SQLException ex) {
+                throw new RuntimeException (ex);
+            }
+        }
+    }
+
+    /**
+     * Begin a special transaction for recreating the tables
+     */
+    protected void beginRecreateTransaction ()
+    {
+        beginTransaction(true);
+    }
+
+    /**
+     * Inserts the reference data, that is, data that must always exist
+     * For the application to work
+     */
+    public void insertReference ()
+    {
+        beginRecreateTransaction();
+        try
+        {
+            createComponentType ();
+            commitTransaction();
+        } catch (RuntimeException e)
+        {
+            rollbackTransaction();
+            throw e;
+        }
+    }
+
+    /**
+     * Creates the type of components needed
+     */
+    protected void createComponentType ()
+    {
+        Dao<ComponentType> 
componentTypeDao=DaoFactory.findDao(ComponentType.class);
+        ComponentType componentType = 
ModelFactory.createEntity(ComponentType.class);
+
+        componentType.setCode(ReferenceDataCodes.COMPONENT_TYPE_LABEL);
+        componentType.setName("Label");
+        componentTypeDao.create(componentType);
+
+        componentType = ModelFactory.createEntity(ComponentType.class);
+        componentType.setCode(ReferenceDataCodes.COMPONENT_TYPE_INPUT);
+        componentType.setName("Input");
+        componentTypeDao.create(componentType);
+
+    }
+
+     /**
+     * Inserts the test data.
+      * Some data needed for testing
+     */
+    public void insertTest ()
+    {
+        beginRecreateTransaction();
+        try
+        {
+            createSampleView ();
+            commitTransaction();
+        } catch (RuntimeException e)
+        {
+            rollbackTransaction();
+            throw e;
+        }
+    }
+
+    /**
+     * Creates a sample view
+     */
+    protected void createSampleView() {
+        View newView=ModelFactory.createEntity(View.class);
+        newView.setName(SampleDataConstants.VIEW_TEST1);
+
+        Component newComponent=ModelFactory.createEntity(Component.class);
+        newComponent.setName(SampleDataConstants.COMPONENT_LBL_TEST1);
+        newComponent.setParent(newView);
+        newComponent.setType(RerbDaoFactory.loadByCode(ComponentType.class, 
ReferenceDataCodes.COMPONENT_TYPE_LABEL));
+        newView.getChildren().add(newComponent);
+
+        Component newInput=ModelFactory.createEntity(Component.class);
+        newInput.setName(SampleDataConstants.COMPONENT_INPUT_TEST2);
+        newInput.setParent(newView);
+        newInput.setType(RerbDaoFactory.loadByCode(ComponentType.class, 
ReferenceDataCodes.COMPONENT_TYPE_INPUT));
+        newView.getChildren().add(newInput);
+
+        DaoFactory.create(newView);
+        DaoFactory.create(newComponent);
+        DaoFactory.create(newInput);
+
+        JpaTransactionFactory.getFactory().getEntityManager().flush();
+    }
+
+}

Property changes on: 
trunk/impl/src/test/java/net/appliweb/designer/data/test/CreateDataset.java
___________________________________________________________________
Added: svn:mergeinfo

Index: 
trunk/impl/src/main/java/net/appliweb/designer/impl/model/component/ComponentImpl.java
===================================================================
--- 
trunk/impl/src/main/java/net/appliweb/designer/impl/model/component/ComponentImpl.java
      (revision 2)
+++ 
trunk/impl/src/main/java/net/appliweb/designer/impl/model/component/ComponentImpl.java
      (revision 3)
@@ -42,7 +42,7 @@
     @Column(name="NAME")
     protected String name;
 
-    @OneToMany(mappedBy="parent")
+    @OneToMany(mappedBy="parent", targetEntity=ComponentImpl.class)
     protected List<AbstractComponent> children=new 
ArrayList<AbstractComponent>();
 
     @ManyToOne(optional=false)
Index: trunk/impl/src/main/resources/META-INF/persistence.xml
===================================================================
--- trunk/impl/src/main/resources/META-INF/persistence.xml      (revision 2)
+++ trunk/impl/src/main/resources/META-INF/persistence.xml      (revision 3)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" ;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ;
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence ;
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd";>
-  <persistence-unit name="designer" transaction-type="RESOURCE_LOCAL">
+  <persistence-unit name="appliwebDesigner" 
transaction-type="RESOURCE_LOCAL">
     <!-- provider>${persistence.provider}</provider -->
     <class>net.appliweb.designer.impl.model.view.LinkImpl</class>
     <class>net.appliweb.designer.impl.model.component.ComponentImpl</class>
Index: trunk/impl/pom.xml
===================================================================
--- trunk/impl/pom.xml  (revision 2)
+++ trunk/impl/pom.xml  (revision 3)
@@ -216,7 +216,7 @@
                               <configuration>
                                   <!-- argLine>-Xmx512M</argLine -->
                                   <includes>
-                                      
<include>net/appliweb/data/test/*</include>
+                                      
<include>net/appliweb/designer/data/test/CreateDataset.java</include>
                                   </includes>
                                   <systemProperties>
                                       <property>

Property changes on: trunk/impl
___________________________________________________________________
Added: svn:ignore
   + target



Property changes on: trunk/ear
___________________________________________________________________
Added: svn:ignore
   + target


Index: 
trunk/api/src/main/java/net/appliweb/designer/model/component/Container.java
===================================================================
--- 
trunk/api/src/main/java/net/appliweb/designer/model/component/Container.java  
      (revision 2)
+++ 
trunk/api/src/main/java/net/appliweb/designer/model/component/Container.java  
      (revision 3)
@@ -11,7 +11,7 @@
  * A Container can contains other components
  * @author gerard
  */
-public interface Container extends AbstractComponent{
+public interface Container extends Component{
 
     /**
      * The children of this container

Property changes on: trunk/api
___________________________________________________________________
Added: svn:ignore
   + target


Index: trunk/pom.xml
===================================================================
--- trunk/pom.xml       (revision 2)
+++ trunk/pom.xml       (revision 3)
@@ -159,7 +159,7 @@
                 <version>2.4.3</version>
                 <configuration>
                   <!-- argLine>-Xmx512M</argLine -->
-                  <includes><include>**/*Test.java</include></includes>
+                  <!-- includes><include>**/*Test.java</include></includes 
-->
                   <!-- systemProperties>
                       <property>
                           <name>jdbc.driver</name>
@@ -282,7 +282,7 @@
     </profile>
 </profiles>
 <properties>
-  <persistence.manager>designer</persistence.manager>
+  <persistence.manager>appliwebDesigner</persistence.manager>
 </properties>
 <repositories>
     <repository>
Index: trunk/web/src/test/java/net/appliweb/web/dynamic/test/BasicTest.java
===================================================================
--- trunk/web/src/test/java/net/appliweb/web/dynamic/test/BasicTest.java      
  (revision 2)
+++ trunk/web/src/test/java/net/appliweb/web/dynamic/test/BasicTest.java      
  (revision 3)
@@ -9,6 +9,7 @@
 import net.appliweb.web.home.HomePage;
 import net.appliweb.web.target.GenericPage;
 import net.appliweb.web.test.WicketTestBase;
+import org.apache.wicket.markup.html.form.TextField;
 
 /**
  * We just test the basic behavior the dynamic pages
@@ -22,6 +23,7 @@
         tester.clickLink("GenericPage");
         tester.assertRenderedPage(GenericPage.class);
 //        tester.assertContains("My Dynamic Page");
+        tester.assertComponent("Input2", TextField.class);
 
         tester.clickLink("backToHome");
         tester.clickLink("GenericPage");
Index: trunk/web/src/main/java/net/appliweb/web/AppliwebApp.java
===================================================================
--- trunk/web/src/main/java/net/appliweb/web/AppliwebApp.java   (revision 2)
+++ trunk/web/src/main/java/net/appliweb/web/AppliwebApp.java   (revision 3)
@@ -1,11 +1,15 @@
 package net.appliweb.web;
 
+import net.appliweb.designer.impl.model.component.ComponentImpl;
 import net.appliweb.rera.dao.DaoFactory;
 import net.appliweb.rera.impl.jpa.JpaDaoHandlerImpl;
+import net.appliweb.rera.impl.model.MappedModelFactoryImpl;
 import net.appliweb.rera.impl.model.ModelFactoryImpl;
 import net.appliweb.rera.impl.transaction.JpaTransactionFactoryImpl;
 import net.appliweb.rera.model.ModelFactory;
 import net.appliweb.rera.transaction.TransactionFactory;
+import net.appliweb.rerb.dao.RerbDaoFactory;
+import net.appliweb.rerb.impl.jpa.dao.RerbJpaDaoHandlerImpl;
 import net.appliweb.web.home.HomePage;
 import net.appliweb.web.util.ResourceFinder;
 import org.apache.wicket.Request;
@@ -50,8 +54,11 @@
         super.init();
 
         // getResourceSettings().setResourceStreamLocator(new 
DynamicResourceStreamLocator());
-        DaoFactory.setFactory(new DaoFactory(new JpaDaoHandlerImpl()));
-        ModelFactory.setFactory(new ModelFactoryImpl());
+        MappedModelFactoryImpl modelFactory=new 
MappedModelFactoryImpl("impl", "Impl", "model");
+        modelFactory.addImplementationClass(ComponentImpl.class);
+        ModelFactory.setFactory(modelFactory);
+
+        DaoFactory.setFactory(new RerbDaoFactory(new 
RerbJpaDaoHandlerImpl(false, false)));
         String persistenceName=null;
         TransactionFactory.setFactory(new JpaTransactionFactoryImpl());
 
Index: trunk/web/src/main/resources/datanucleus_gae.properties
===================================================================
--- trunk/web/src/main/resources/datanucleus_gae.properties     (revision 2)
+++ trunk/web/src/main/resources/datanucleus_gae.properties     (revision 3)
@@ -1,33 +0,0 @@
-# maven-datanucleus.properties
-#              DataNucleus properties used by DataNucleus Maven plugin.
-#              - the ${jobfilter.testdb.*} placeholders are substituted at 
build time by Maven
-#
-
-# JDO persistence manager factory implementation class
-javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.jdo.JDOPersistenceManagerFactory
-
-# data source settings
-javax.jdo.option.ConnectionURL=appengine
-
-datanucleus.ConnectionURL=appengine
-
-# allow reads outside transactions -e.g. in JSPs
-javax.jdo.option.NontransactionalRead=true
-javax.jdo.option.NontransactionalWrite=true
-
-# datastore is an RDBMS
-datanucleus.storeManagerType=appengine
-
-# ensure that table and column names are passed to DB in lowercase
-#datanucleus.identifier.case=lowercase
-
-# disable checking of column lengths against JDO defaults
-datanucleus.validateColumns=false
-
-# max depth of a fetch group - use -1 (== unlimted) as we have no recursive 
structures
-datanucleus.maxFetchDepth=-1
-
-# automatically create tables and columns - required for first run of tests 
where initial
-# drop of tables will otherwise fail due to tables not existing
-datanucleus.autoCreateTables=false
-datanucleus.autoCreateColumns=false
\ No newline at end of file
Index: trunk/web/src/main/resources/datanucleus.properties
===================================================================
--- trunk/web/src/main/resources/datanucleus.properties (revision 2)
+++ trunk/web/src/main/resources/datanucleus.properties (revision 3)
@@ -1,32 +0,0 @@
-# maven-datanucleus.properties
-#              DataNucleus properties used by DataNucleus Maven plugin.
-#              - the ${jobfilter.testdb.*} placeholders are substituted at 
build time by Maven
-#
-
-persistence.manager=${persistence.manager}
-# data source settings
-
-datanucleus.ConnectionURL=${jdbc.url}
-datanucleus.ConnectionUserName=${jdbc.username}
-datanucleus.ConnectionPassword=${jdbc.password}
-datanucleus.ConnectionDriverName=${jdbc.driver}
-
-# allow reads outside transactions -e.g. in JSPs
-javax.jdo.option.NontransactionalRead=true
-
-# datastore is an RDBMS
-datanucleus.storeManagerType=rdbms
-
-# ensure that table and column names are passed to DB in lowercase
-#datanucleus.identifier.case=lowercase
-
-# disable checking of column lengths against JDO defaults
-datanucleus.validateColumns=false
-
-# max depth of a fetch group - use -1 (== unlimted) as we have no recursive 
structures
-datanucleus.maxFetchDepth=-1
-
-# automatically create tables and columns - required for first run of tests 
where initial
-# drop of tables will otherwise fail due to tables not existing
-datanucleus.autoCreateTables=false
-datanucleus.autoCreateColumns=false
\ No newline at end of file
Index: trunk/web/src/main/resources/rer_gae.properties
===================================================================
--- trunk/web/src/main/resources/rer_gae.properties     (revision 0)
+++ trunk/web/src/main/resources/rer_gae.properties     (revision 3)
@@ -0,0 +1,33 @@
+# maven-datanucleus.properties
+#              DataNucleus properties used by DataNucleus Maven plugin.
+#              - the ${jobfilter.testdb.*} placeholders are substituted at 
build time by Maven
+#
+
+# JDO persistence manager factory implementation class
+javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.jdo.JDOPersistenceManagerFactory
+
+# data source settings
+javax.jdo.option.ConnectionURL=appengine
+
+datanucleus.ConnectionURL=appengine
+
+# allow reads outside transactions -e.g. in JSPs
+javax.jdo.option.NontransactionalRead=true
+javax.jdo.option.NontransactionalWrite=true
+
+# datastore is an RDBMS
+datanucleus.storeManagerType=appengine
+
+# ensure that table and column names are passed to DB in lowercase
+#datanucleus.identifier.case=lowercase
+
+# disable checking of column lengths against JDO defaults
+datanucleus.validateColumns=false
+
+# max depth of a fetch group - use -1 (== unlimted) as we have no recursive 
structures
+datanucleus.maxFetchDepth=-1
+
+# automatically create tables and columns - required for first run of tests 
where initial
+# drop of tables will otherwise fail due to tables not existing
+datanucleus.autoCreateTables=false
+datanucleus.autoCreateColumns=false
\ No newline at end of file

Property changes on: trunk/web/src/main/resources/rer_gae.properties
___________________________________________________________________
Added: svn:mergeinfo

Index: trunk/web/src/main/resources/rer.properties
===================================================================
--- trunk/web/src/main/resources/rer.properties (revision 0)
+++ trunk/web/src/main/resources/rer.properties (revision 3)
@@ -0,0 +1,35 @@
+# maven-datanucleus.properties
+#              DataNucleus properties used by DataNucleus Maven plugin.
+#              - the ${jobfilter.testdb.*} placeholders are substituted at 
build time by Maven
+#
+
+# data source settings
+
+datanucleus.ConnectionURL=${jdbc.url}
+datanucleus.ConnectionUserName=${jdbc.username}
+datanucleus.ConnectionPassword=${jdbc.password}
+datanucleus.ConnectionDriverName=${jdbc.driver}
+
+# allow reads outside transactions -e.g. in JSPs
+javax.jdo.option.NontransactionalRead=true
+
+# datastore is an RDBMS
+datanucleus.storeManagerType=rdbms
+
+# ensure that table and column names are passed to DB in lowercase
+#datanucleus.identifier.case=lowercase
+
+# disable checking of column lengths against JDO defaults
+datanucleus.validateColumns=false
+
+# max depth of a fetch group - use -1 (== unlimted) as we have no recursive 
structures
+datanucleus.maxFetchDepth=-1
+
+# automatically create tables and columns - required for first run of tests 
where initial
+# drop of tables will otherwise fail due to tables not existing
+datanucleus.autoCreateTables=false
+datanucleus.autoCreateColumns=false
+
+#Which properties must be passed to the jpa implementation ?
+entity.propKeywords=datanucleus,javax.jdo
+entity.manager=${persistence.manager}

Property changes on: trunk/web/src/main/resources/rer.properties
___________________________________________________________________
Added: svn:mergeinfo

Index: trunk/web/src/main/webapp/META-INF/context.xml
===================================================================
--- trunk/web/src/main/webapp/META-INF/context.xml      (revision 2)
+++ trunk/web/src/main/webapp/META-INF/context.xml      (revision 3)
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<Context antiJARLocking="true" path="/maventest"/>
+<Context antiJARLocking="true" path="/designer"/>

Property changes on: trunk/web
___________________________________________________________________
Added: svn:ignore
   + target







[appliweb~src:3] Appliweb designer unit test working

appliweb 06/10/2010
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close