[exo-jcr-commits] exo-jcr SVN: r581 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Nov 12 03:35:28 EST 2009


Author: pnedonosko
Date: 2009-11-12 03:35:27 -0500 (Thu, 12 Nov 2009)
New Revision: 581

Modified:
   jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
Log:


Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java	2009-11-12 08:31:37 UTC (rev 580)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java	2009-11-12 08:35:27 UTC (rev 581)
@@ -22,6 +22,7 @@
 
 import org.apache.commons.dbcp.BasicDataSourceFactory;
 import org.exoplatform.services.idgenerator.impl.IDGeneratorServiceImpl;
+import org.exoplatform.services.jcr.access.AccessControlList;
 import org.exoplatform.services.jcr.config.CacheEntry;
 import org.exoplatform.services.jcr.config.ContainerEntry;
 import org.exoplatform.services.jcr.config.LockManagerEntry;
@@ -32,7 +33,13 @@
 import org.exoplatform.services.jcr.config.ValueStorageEntry;
 import org.exoplatform.services.jcr.config.ValueStorageFilterEntry;
 import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.datamodel.InternalQName;
 import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.datamodel.QPath;
+import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
+import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
+import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
 import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
 import org.exoplatform.services.jcr.impl.storage.value.StandaloneStoragePluginProvider;
 import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
@@ -67,13 +74,13 @@
     */
    protected void setUp() throws Exception
    {
-      
+
       super.setUp();
-      
+
       initPersistence();
-      
+
       loader = new JDBCCacheLoader();
-      loader.injectDependencies(persistentContainer);      
+      loader.injectDependencies(persistentContainer);
    }
 
    protected void initPersistence() throws Exception
@@ -221,22 +228,47 @@
       PreparedStatement st = connection.prepareStatement("create database " + dbName);
       st.executeQuery();
    }
+   
+   
+   private void initJCRRoot() throws Exception {
+      // prepare     
+      WorkspaceStorageConnection conn = persistentContainer.openConnection();
 
+      // add root (/)
+      conn.add(new TransientNodeData(Constants.ROOT_PATH, Constants.ROOT_UUID, 1, Constants.NT_UNSTRUCTURED,
+         new InternalQName[0], 0, null, new AccessControlList()));
+
+      // add property (/jcr:primaryType)
+      String propId1 = "1";
+      QPath propPath1 = QPath.makeChildPath(Constants.ROOT_PATH, Constants.JCR_PRIMARYTYPE);
+      TransientPropertyData propData1 = new TransientPropertyData(propPath1, propId1, 1, 1, Constants.ROOT_UUID, false);
+      String propValue1 = "Property value #1";
+      propData1.setValue(new TransientValueData(propValue1));
+      conn.add(propData1);
+
+      // add property (/jcr:mixinTypes)
+      String propId2 = "2";
+      QPath propPath2 = QPath.makeChildPath(Constants.ROOT_PATH, Constants.JCR_MIXINTYPES);
+      TransientPropertyData propData2 = new TransientPropertyData(propPath2, propId2, 1, 1, Constants.ROOT_UUID, false);
+      String propValue2 = "Property value #2";
+      propData2.setValue(new TransientValueData(propValue2));
+      conn.add(propData2);
+
+      conn.commit();
+   }
+
    // ============= TESTS =============
-   
+
    public void testAddNode() throws Exception
    {
-      // prepare     
+      // prepare
+      initJCRRoot();
       
       
       // tests
-      WorkspaceStorageConnection connection = persistentContainer.openConnection();
+      WorkspaceStorageConnection conn = persistentContainer.openConnection();
 
-      NodeData nd = (NodeData)connection.getItemData("1");
-      assertNotNull(nd);
-      assertEquals("[]:1[]node:1", nd.getQPath().getAsString());
-      
-      //Map<Serializable, Object> data = cache.getData(Fqn.fromString("/"+JBossCacheStorage.NODES + "/" + Constants.ROOT_UUID));
+      //??? Map<Serializable, Object> data = cache.getData(Fqn.fromString("/"+JBossCacheStorage.NODES + "/" + Constants.ROOT_UUID));
    }
 
    public void testAddProperty() throws Exception
@@ -255,7 +287,7 @@
       // tests it
 
    }
-   
+
    public void testDeleteProperty() throws Exception
    {
 
@@ -264,7 +296,7 @@
       // tests it
 
    }
-   
+
    public void testUpdateNode() throws Exception
    {
 
@@ -273,7 +305,7 @@
       // tests it
 
    }
-   
+
    public void testUpdateProperty() throws Exception
    {
 
@@ -282,7 +314,7 @@
       // tests it
 
    }
-   
+
    public void testRenameNode() throws Exception
    {
 
@@ -291,7 +323,7 @@
       // tests it
 
    }
-   
+
    public void testGetNodeByIdentifier() throws Exception
    {
 
@@ -300,7 +332,7 @@
       // tests it
 
    }
-   
+
    public void testGetNodeByName() throws Exception
    {
 
@@ -309,7 +341,7 @@
       // tests it
 
    }
-   
+
    public void testGetPropertyByIdentifier() throws Exception
    {
 
@@ -318,7 +350,7 @@
       // tests it
 
    }
-   
+
    public void testGetPropertyByName() throws Exception
    {
 
@@ -327,7 +359,7 @@
       // tests it
 
    }
-   
+
    public void testGetChildNodes() throws Exception
    {
 
@@ -336,7 +368,7 @@
       // tests it
 
    }
-   
+
    public void testGetChildProperties() throws Exception
    {
 
@@ -345,7 +377,7 @@
       // tests it
 
    }
-   
+
    public void testGetReferences() throws Exception
    {
 



More information about the exo-jcr-commits mailing list