[jboss-svn-commits] JBoss Portal SVN: r5225 - in trunk/cms: . src/main/org/jboss/portal/cms/hibernate/state src/main/org/jboss/portal/test/cms/commands src/resources/hibernate src/resources/test src/resources/test/jcr

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Sep 18 18:34:17 EDT 2006


Author: sohil.shah at jboss.com
Date: 2006-09-18 18:34:16 -0400 (Mon, 18 Sep 2006)
New Revision: 5225

Added:
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCopy.java
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreate.java
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreateFailed.java
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileDelete.java
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGet.java
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetList.java
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileUpdate.java
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCopy.java
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCreate.java
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderDelete.java
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderGet.java
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderUpdate.java
   trunk/cms/src/resources/test/log4j.xml
   trunk/cms/src/resources/test/pm-cache.xml
Removed:
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCommands.java
   trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCommands.java
Modified:
   trunk/cms/build.xml
   trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java
   trunk/cms/src/resources/hibernate/domain.hbm.xml
   trunk/cms/src/resources/test/jcr/repository.xml
Log:
cms test suite fixes

Modified: trunk/cms/build.xml
===================================================================
--- trunk/cms/build.xml	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/build.xml	2006-09-18 22:34:16 UTC (rev 5225)
@@ -229,13 +229,31 @@
    <target name="tests" depends="init">
       <execute-tests>
          <x-test>
+			<!-- general cms setup related tests -->
             <test todir="${test.reports}" name="org.jboss.portal.test.cms.JackrabbitTestCase"/>
             <test todir="${test.reports}" name="org.jboss.portal.test.cms.TestRepositoryBootStrap"/>
+			<test todir="${test.reports}" name="org.jboss.portal.test.cms.TestRegEx"/>
+	
+	        <!-- repository utility tests -->
             <test todir="${test.reports}" name="org.jboss.portal.test.cms.TestRepositoryUtil"/>
-            <test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileCommands"/>
-            <test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderCommands"/>
-            <test todir="${test.reports}" name="org.jboss.portal.test.cms.TestRegEx"/>
-            <!--test todir="${test.reports}" name="org.jboss.portal.test.cms.TestAll"/-->
+	
+	        <!-- cms file command tests -->
+      		<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileDelete"/>			
+      		<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileCreate"/>
+      		<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileUpdate"/>
+      		<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileArchiveUpload"/>			
+			<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileGet"/>			
+			<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileGetVersion"/>
+			<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileGetList"/>
+			<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileCopy"/>			
+			<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileCreateFailed"/>
+	
+	        <!-- cms folder command tests -->
+			<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderCopy"/>            
+			<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderCreate"/>            
+            <test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderDelete"/>            			
+			<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderGet"/>            			
+			<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFolderUpdate"/>            			
          </x-test>
          <x-classpath>
             <path refid="apache.logging.classpath"/>
@@ -251,8 +269,7 @@
             <path refid="jakarta.io.classpath"/>
             <path refid="apache.collections.classpath"/>
             <path refid="apache.lucene.classpath"/>
-            <path refid="junit.junit.classpath"/>
-            <path refid="jackrabbit.jackrabbit.classpath"/>
+            <path refid="junit.junit.classpath"/>            
             <path refid="slf4j.slf4j.classpath"/>
             <path refid="sun.jaf.classpath"/>
             <path refid="xdoclet.xdoclet.classpath"/>
@@ -271,6 +288,10 @@
             <pathelement location="${build.resources}/test"/>
             <pathelement location="${build.resources}/hibernate"/>
             <pathelement location="${jboss.portal-test.root}/etc"/>
+	        <!-- jbosscachepersistence manager integration -->
+			<path refid="jackrabbit.jackrabbit.classpath"/>
+	        <pathelement location="jackrabbit-customization/lib/jboss-cache.jar"/>
+			<pathelement location="jackrabbit-customization/lib/jgroups.jar"/>
          </x-classpath>
       </execute-tests>
    </target>

Modified: trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/cms/hibernate/state/JBossCachePersistenceManager.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -21,6 +21,7 @@
 */
 package org.jboss.portal.cms.hibernate.state;
 
+
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.InputStream;
@@ -56,16 +57,16 @@
 
 import org.jboss.portal.cms.hibernate.HibernateStoreConstants;
 
+import org.jboss.cache.PropertyConfigurator;
+import org.jboss.cache.TreeCache;
 import org.jboss.cache.TreeCacheMBean;
 import org.jboss.cache.CacheException;
 import org.jboss.mx.util.MBeanProxyExt;
 import org.jboss.mx.util.MBeanServerLocator;
 
 import org.hibernate.Hibernate;
-import org.hibernate.HibernateException;
 import org.hibernate.Query;
 import org.hibernate.Session;
-import org.hibernate.SessionFactory;
 import org.hibernate.Transaction;
 
 /*
@@ -207,10 +208,44 @@
         try
         { 
            Tools.init(this.jndiName);
+           
 	       if(JBossCachePersistenceManager.pmCache == null)
 	       {
-	           MBeanServer server=MBeanServerLocator.locateJBoss();
-		       JBossCachePersistenceManager.pmCache = (TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class,"cms.pm.cache:service=TreeCache",server);
+	           try
+	           {
+	               MBeanServer server=MBeanServerLocator.locateJBoss();
+	               JBossCachePersistenceManager.pmCache = (TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class,"cms.pm.cache:service=TreeCache",server);
+	           }
+	           catch(Exception e)
+	           {
+	               JBossCachePersistenceManager.pmCache = null;
+	           }
+	           
+	           //try to load from specified configuration if any
+	           //if nothing found in the environment...chances are running in a non-managed environment
+	           if(JBossCachePersistenceManager.pmCache == null)
+	           {
+	               InputStream is = null;
+	               try
+	               {
+		                JBossCachePersistenceManager.pmCache = new TreeCache();
+					    
+					    //configure the cache
+					    PropertyConfigurator configurator = new PropertyConfigurator();
+					    is = JBossCachePersistenceManager.class.getClassLoader().getResourceAsStream("pm-cache.xml");
+					    configurator.configure(JBossCachePersistenceManager.pmCache,is);
+					    			    
+					    JBossCachePersistenceManager.pmCache.createService();
+					    JBossCachePersistenceManager.pmCache.startService();
+	               }
+	               finally
+	               {
+	                   if(is != null)
+	                   {
+	                       is.close();
+	                   }
+	               }
+	           }
 	       }
 	       
 	       //pre-load the cache with property nodes
@@ -983,11 +1018,19 @@
 	        if(this.schemaObjectPrefix.equalsIgnoreCase(HibernateStoreConstants.wspPrefix))
 	        {
 	            Object o = this.pmCache.get(PortalCMSCacheLoader.WSP_REF_NODE+"/"+PortalCMSCacheLoader.parseNodeName(nodeId),nodeId);
+	            if(o == null || !(o instanceof Base))
+	            {
+	                throw new NoSuchItemStateException(targetId.toString()); 
+	            }
 	            nodeData = ((WSPRefs)o).getData();
 	        }
 	        else if(this.schemaObjectPrefix.equalsIgnoreCase(HibernateStoreConstants.versionPrefix))
 	        {
 	            Object o = this.pmCache.get(PortalCMSCacheLoader.VERSION_REF_NODE+"/"+PortalCMSCacheLoader.parseNodeName(nodeId),nodeId);
+	            if(o == null || !(o instanceof Base))
+	            {
+	                throw new NoSuchItemStateException(targetId.toString()); 
+	            }
 	            nodeData = ((VersionRefs)o).getData();
 	        }
 	        

Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/AbstractCommandTestCase.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,86 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This 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 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.test.cms.commands;
+
+import java.util.Locale;
+
+import org.jboss.portal.cms.impl.jcr.JCRCMS;
+import org.jboss.portal.common.util.CLLoader;
+import org.jboss.portal.common.util.LoaderResource;
+import org.jboss.portal.common.util.XML;
+import org.jboss.portal.test.cms.AbstractCMSTestCase;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.w3c.dom.Document;
+
+/*
+ * Created on Sep 18, 2006
+ *
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class AbstractCommandTestCase extends AbstractCMSTestCase
+{
+    /**
+     * 
+     */
+    protected JCRCMS service;
+    
+    /**
+     * 
+     *
+     */
+    public AbstractCommandTestCase(DataSourceSupport.Config dsCfg)
+    {
+       super(dsCfg);
+    }
+    
+    /**
+     * 
+     */
+    public void setUp() throws Exception
+    {       
+       super.setUp();
+       
+       
+
+       LoaderResource res = new CLLoader().getResource("jcr/repository.xml");
+       Document config = res.asDocument(XML.getDocumentBuilderFactory().newDocumentBuilder());
+
+       service = new JCRCMS();
+       service.setDoChecking(true);
+       service.setDefaultLocale(Locale.ENGLISH.getDisplayName());
+       service.setDefaultContentLocation("default-content/default");
+
+       service.setConfig(config.getDocumentElement());
+       service.setRepositoryName("repo");
+       service.setHomeDir("repotest");
+       service.start();
+    }
+
+    /**
+     * 
+     */
+    public void tearDown() throws Exception
+    {
+       service.stop();      
+       super.tearDown();
+    }
+}

Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.commands;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.Locale;
+
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
+
+
+/**
+ * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class TestFileArchiveUpload extends AbstractCommandTestCase
+{
+    String sFilePath = "/testdoc.gif";
+
+    String sCopyToFilePath = "/testdoccopy.gif";
+
+    // zip vars
+    String sZipPath = "/poop";
+
+    String sZipFile = "resources/test/jcr/ziptest.zip";
+
+    String sJPG = "/hibernate_logo.gif";
+
+    String sText = "/training.txt";
+    
+
+   /**
+    * 
+    *
+    */
+   public TestFileArchiveUpload(DataSourceSupport.Config dsCfg)
+   {
+      super(dsCfg);
+   }
+   
+   /**
+    * 
+    *
+    */
+   public static TestSuite suite() throws Exception
+   {
+      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
+      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
+      suite.addTestCase(TestFileArchiveUpload.class);
+      return suite;       
+   }
+
+   public void testArchiveUpload() throws CMSException, IOException
+   {
+      service.setDefaultLocale(Locale.ENGLISH.getLanguage());
+      InputStream is = new FileInputStream(sZipFile);
+      Command storearchiveCMD = service.getCommandFactory().createStoreArchiveCommand("", is, "en");
+      List contentsToVersion = (List) service.execute(storearchiveCMD);
+
+      Command createVersions = service.getCommandFactory()
+            .createContentCreateNewVersionCommand(contentsToVersion, true);
+      service.execute(createVersions);
+
+      // retrieve list
+      Command listCMD = service.getCommandFactory().createFolderGetListCommand("/ziptest/poop");
+      Folder whopper = (Folder) service.execute(listCMD);
+      List folders = whopper.getFolders();
+      List files = whopper.getFiles();
+      assertEquals("Folder Size incorrect", folders.size(), 1);
+      assertEquals("File Size incorrect", files.size(), 1);
+
+      // retrieve list
+      Command listCMD2 = service.getCommandFactory().createFolderGetListCommand("/ziptest/poop/music");
+      Folder whopper2 = (Folder) service.execute(listCMD2);
+      List folders2 = whopper2.getFolders();
+      List files2 = whopper2.getFiles();
+      assertEquals("Folder Size incorrect", folders2.size(), 0);
+      assertEquals("File Size incorrect", files2.size(), 1);
+
+      // retrieve list
+      Command listCMD3 = service.getCommandFactory().createFolderGetListCommand("/");
+      Folder whopper3 = (Folder) service.execute(listCMD3);
+      List folders3 = whopper3.getFolders();
+      List files3 = whopper3.getFiles();
+
+      is.close();
+   }      
+}

Deleted: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCommands.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCommands.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCommands.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -1,470 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This 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 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.portal.test.cms.commands;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.net.URL;
-import java.util.List;
-import java.util.Locale;
-
-import javax.jcr.Item;
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.Session;
-
-import junit.framework.TestSuite;
-
-import org.jboss.portal.cms.Command;
-import org.jboss.portal.cms.CMSException;
-import org.jboss.portal.cms.impl.ContentImpl;
-import org.jboss.portal.cms.impl.FileImpl;
-import org.jboss.portal.cms.impl.jcr.JCRCMS;
-import org.jboss.portal.cms.impl.jcr.JCRCompositeCommand;
-import org.jboss.portal.cms.impl.jcr.composite.NewFileCommand;
-import org.jboss.portal.cms.impl.jcr.util.VersionUtil;
-import org.jboss.portal.cms.model.Content;
-import org.jboss.portal.cms.model.File;
-import org.jboss.portal.cms.model.Folder;
-import org.jboss.portal.cms.util.NodeUtil;
-import org.jboss.portal.cms.util.RepositoryUtil;
-import org.jboss.portal.common.util.CLLoader;
-import org.jboss.portal.common.util.LoaderResource;
-import org.jboss.portal.common.util.XML;
-import org.jboss.portal.test.cms.AbstractCMSTestCase;
-import org.jboss.portal.test.cms.mock.RuntimeExceptionCommand;
-import org.jboss.portal.test.framework.embedded.DataSourceSupport;
-import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
-import org.w3c.dom.Document;
-
-/**
- * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- */
-public class TestFileCommands extends AbstractCMSTestCase
-{
-   JCRCMS service;
-
-   String sFilePath = "/testdoc.gif";
-
-   String sCopyToFilePath = "/testdoccopy.gif";
-
-   // zip vars
-   String sZipPath = "/poop";
-
-   String sZipFile = "resources/test/jcr/ziptest.zip";
-
-   String sJPG = "/hibernate_logo.gif";
-
-   String sText = "/training.txt";
-
-   public TestFileCommands(DataSourceSupport.Config dsCfg)
-   {
-      super(dsCfg);
-   }
-
-   public static TestSuite suite() throws Exception
-   {
-      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
-      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
-      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
-      suite.addTestCase(TestFileCommands.class);
-      return suite;
-   }
-
-   public void setUp() throws Exception
-   {
-      super.setUp();
-
-      // Load config
-      LoaderResource res = new CLLoader().getResource("jcr/repository.xml");
-      Document config = res.asDocument(XML.getDocumentBuilderFactory().newDocumentBuilder());
-
-      service = new JCRCMS();
-      service.setRepositoryName("repo");
-      service.setConfig(config.getDocumentElement());
-      service.setHomeDir("repotest");
-      service.setDoChecking(false);
-      service.start();
-
-   }
-
-   public void tearDown() throws Exception
-   {
-      service.stop();
-      super.tearDown();
-   }
-
-   /*
-    public static Test suite()
-    {
-    return new TestSuite(TestFileCommands.class);
-    }
-    */
-   public void testFileDelete() throws Exception
-   {
-      createFile();
-      // delete old test nodes
-      Command deleteCMD = service.getCommandFactory().createDeleteCommand(sFilePath);
-      service.execute(deleteCMD);
-      Command deleteToCMD = service.getCommandFactory().createDeleteCommand(sCopyToFilePath);
-      service.execute(deleteToCMD);
-
-      // zip deletes
-      Command deleteZipCMD = service.getCommandFactory().createDeleteCommand(sZipPath);
-      service.execute(deleteZipCMD);
-      Command deleteZipJCMD = service.getCommandFactory().createDeleteCommand(sJPG);
-      service.execute(deleteZipJCMD);
-      Command deleteZipTCMD = service.getCommandFactory().createDeleteCommand(sText);
-      service.execute(deleteZipTCMD);
-
-      Session session = RepositoryUtil.login(service.getRepository(), "anonid", "");
-      assertFalse(sFilePath + " not Deleted", session.itemExists(sFilePath));
-      assertFalse(sCopyToFilePath + " not Deleted", session.itemExists(sCopyToFilePath));
-      assertFalse(sZipPath + " not Deleted", session.itemExists(sZipPath));
-      assertFalse(sJPG + " not Deleted", session.itemExists(sJPG));
-      assertFalse(sText + " not Deleted", session.itemExists(sText));
-
-      RepositoryUtil.safeLogout(session);
-   }
-
-   private void createFile() throws CMSException
-   {
-      // create file english
-      File file = new FileImpl();
-      file.setBasePath(sFilePath);
-
-      Content content = new ContentImpl();
-      content.setEncoding("UTF-8");
-      content.setTitle("English Title");
-      content.setDescription("English Description");
-      content.setBasePath(sFilePath + "/" + Locale.ENGLISH.getLanguage());
-      content.setBytes("1234567890".getBytes());
-      content.setMimeType("image/gif");
-      file.setContent(Locale.ENGLISH, content);
-
-      Command newFileCMD = service.getCommandFactory().createNewFileCommand(file, content);
-      service.execute(newFileCMD);
-
-      // create content spanish
-      Content contentSP = new ContentImpl();
-      contentSP.setEncoding("UTF-8");
-      contentSP.setTitle("Spanish Title");
-      contentSP.setDescription("Spanish Description");
-      contentSP.setBasePath(sFilePath + "/es");
-      contentSP.setBytes("0987654321".getBytes());
-      contentSP.setMimeType("image/gif");
-      file.setContent(new Locale("es"), contentSP);
-
-      Command newFileSPCMD = service.getCommandFactory().createNewFileCommand(file, contentSP);
-      service.execute(newFileSPCMD);
-   }
-   
-   
-   public void testFileCreate() throws Exception
-   {
-      // create file english
-      File file = new FileImpl();
-      file.setBasePath(sFilePath);
-
-      Content content = new ContentImpl();
-      content.setEncoding("UTF-8");
-      content.setTitle("English Title");
-      content.setDescription("English Description");
-      content.setBasePath(sFilePath + "/" + Locale.ENGLISH.getLanguage());
-      content.setBytes("1234567890".getBytes());
-      content.setMimeType("image/gif");
-      file.setContent(Locale.ENGLISH, content);
-
-      // save english file
-      Command saveFileCMD = service.getCommandFactory().createFileSaveCommand(file);
-      service.execute(saveFileCMD);
-
-      //save english content
-      Command saveContentCMD = service.getCommandFactory().createContentSaveCommand(file);
-      service.execute(saveContentCMD);
-
-      // version the english content node
-      Command verCMD = service.getCommandFactory().createContentCreateNewVersionCommand(content, true);
-      service.execute(verCMD);
-
-      // create content spanish
-      Content contentSP = new ContentImpl();
-      contentSP.setEncoding("UTF-8");
-      contentSP.setTitle("Spanish Title");
-      contentSP.setDescription("Spanish Description");
-      contentSP.setBasePath(sFilePath + "/es");
-      contentSP.setBytes("0987654321".getBytes());
-      contentSP.setMimeType("image/gif");
-      file.setContent(new Locale("es"), contentSP);
-
-      //save spanish content
-      Command saveSPContentCMD = service.getCommandFactory().createContentSaveCommand(file);
-      service.execute(saveSPContentCMD);
-
-      // version the spanish content node
-      Command verSPCMD = service.getCommandFactory().createContentCreateNewVersionCommand(contentSP, true);
-      service.execute(verSPCMD);
-
-      Session session = null;
-
-      session = RepositoryUtil.login(service.getRepository(), "anonid", "");
-      Node fileNode = (Node) session.getItem(sFilePath);
-      assertEquals("Name incorrect", NodeUtil.getNodeName(file.getBasePath()), fileNode.getName());
-
-      Node contentNodeEN = fileNode.getNode(Locale.ENGLISH.getLanguage());
-      assertEquals("Encoding Incorrect", content.getEncoding(), contentNodeEN.getProperty("jcr:encoding").getString());
-      assertEquals("Mimetype Incorrect", content.getMimeType(), contentNodeEN.getProperty("jcr:mimeType").getString());
-      assertEquals("Language Incorrect", content.getLocale().getLanguage(), contentNodeEN.getProperty(
-            "portalcms:language").getString());
-      assertEquals("Title Incorrect", content.getTitle(), contentNodeEN.getProperty("portalcms:title").getString());
-      assertEquals("Desc Incorrect", content.getDescription(), contentNodeEN.getProperty("portalcms:description")
-            .getString());
-
-      Node contentNodeSP = fileNode.getNode("es");
-      assertEquals("Encoding Incorrect", contentSP.getEncoding(), contentNodeSP.getProperty("jcr:encoding").getString());
-      assertEquals("Mimetype Incorrect", contentSP.getMimeType(), contentNodeSP.getProperty("jcr:mimeType").getString());
-      assertEquals("Language Incorrect", contentSP.getLocale().getLanguage(), contentNodeSP.getProperty(
-            "portalcms:language").getString());
-      assertEquals("Title Incorrect", contentSP.getTitle(), contentNodeSP.getProperty("portalcms:title").getString());
-      assertEquals("Desc Incorrect", contentSP.getDescription(), contentNodeSP.getProperty("portalcms:description")
-            .getString());
-
-      session.logout();
-   }
-
-   /**
-    * Tests retrieval of the version labeled LIVE.
-    */
-   public void testFileGet() throws CMSException
-   {
-      createFile();
-      Command getCMD = service.getCommandFactory().createFileGetCommand(sFilePath, Locale.ENGLISH);
-      File newfile = (File) service.execute(getCMD);
-
-      Content content = newfile.getContent();
-      assertEquals("Encoding Incorrect", content.getEncoding(), "UTF-8");
-      assertEquals("Mimetype Incorrect", content.getMimeType(), "image/gif");
-      assertEquals("Language Incorrect", content.getLocale().getLanguage(), "en");
-      assertEquals("Title Incorrect", content.getTitle(), "English Title");
-      assertEquals("Desc Incorrect", content.getDescription(), "English Description");
-   }
-
-   /**
-    * Tests updating a file and its content.
-    * @throws Exception 
-    */
-   public void testFileUpdate() throws Exception
-   {
-      createFile();
-      Session session = RepositoryUtil.login(service.getRepository(), "anonid", "");
-      Command getCMD = service.getCommandFactory().createFileGetCommand(sFilePath, Locale.ENGLISH);
-      File newfile = (File) service.execute(getCMD);
-      Content content = newfile.getContent();
-      content.setDescription("New English Description");
-      newfile.setContent(content.getLocale(), content);
-      // update file and make "LIVE"
-      Command cmdUpdate = service.getCommandFactory().createFileUpdateCommand(newfile);
-      service.execute(cmdUpdate);
-
-      Command cmdVersion = service.getCommandFactory().createContentCreateNewVersionCommand(content, true);
-      service.execute(cmdVersion);
-
-      boolean descriptionupdated = ((Property) session.getItem("/testdoc.gif/en/portalcms:description")).getString()
-            .equals("New English Description");
-      assertTrue("Incorrect description for file object", descriptionupdated);
-
-      // version std out dump
-      VersionUtil.print((Node) session.getItem(content.getBasePath()));
-   }
-
-   /**
-    * Tests retrieval of a specific version by version number.
-    */
-   public void testFileGetVersion() throws CMSException
-   {
-      createFile();
-      // get specific file version
-      Command getCMDV = service.getCommandFactory().createFileGetCommand(sFilePath, "1.0", Locale.ENGLISH);
-      File Vnewfile = (File) service.execute(getCMDV);
-      assertTrue("Incorrect version number for file object", Vnewfile.getContent().getVersionNumber().equals("1.0"));
-   }
-
-   /**
-    * Tests retrieving a list of contents under a file and the versions for contents.
-    */
-   public void testFileList() throws CMSException
-   {
-      createFile();
-      Command getFileListCMD = service.getCommandFactory().createFileGetListCommand(sFilePath);
-      List contentList = (List) service.execute(getFileListCMD);
-      assertTrue("Incorrect list size", contentList.size() == 2);
-
-      for (int i = 0; i < contentList.size(); i++)
-      {
-         Content content = (Content) contentList.get(i);
-         Command getContentVersionsCMD = service.getCommandFactory().createContentGetVersionsCommand(
-               content.getBasePath());
-         List versionList = (List) service.execute(getContentVersionsCMD);
-      }
-   }
-
-   public void testFileCopy() throws CMSException
-   {
-      createFile();
-      // copy file
-      Command copyCMD = service.getCommandFactory().createCopyCommand(sFilePath, sCopyToFilePath);
-      service.execute(copyCMD);
-
-      Command getCMD = service.getCommandFactory().createFileGetCommand(sCopyToFilePath, Locale.ENGLISH);
-      File newfile = (File) service.execute(getCMD);
-      Content content = newfile.getContent();
-      assertEquals("Encoding Incorrect", content.getEncoding(), "UTF-8");
-      assertEquals("Mimetype Incorrect", content.getMimeType(), "image/gif");
-      assertEquals("Language Incorrect", content.getLocale().getLanguage(), "en");
-      assertEquals("Title Incorrect", content.getTitle(), "English Title");
-      assertEquals("Desc Incorrect", content.getDescription(), "English Description");
-
-      Command getCMDSP = service.getCommandFactory().createFileGetCommand(sCopyToFilePath, new Locale("es"));
-      File newfileSP = (File) service.execute(getCMDSP);
-      Content contentSP = newfileSP.getContent();
-      assertEquals("Encoding Incorrect", contentSP.getEncoding(), "UTF-8");
-      assertEquals("Mimetype Incorrect", contentSP.getMimeType(), "image/gif");
-      assertEquals("Language Incorrect", contentSP.getLocale().getLanguage(), "es");
-      assertEquals("Title Incorrect", contentSP.getTitle(), "Spanish Title");
-      assertEquals("Desc Incorrect", contentSP.getDescription(), "Spanish Description");
-   }
-
-   public void testArchiveUpload() throws CMSException, IOException
-   {
-      service.setDefaultLocale(Locale.ENGLISH.getLanguage());
-      InputStream is = new FileInputStream(sZipFile);
-      Command storearchiveCMD = service.getCommandFactory().createStoreArchiveCommand("", is, "en");
-      List contentsToVersion = (List) service.execute(storearchiveCMD);
-
-      Command createVersions = service.getCommandFactory()
-            .createContentCreateNewVersionCommand(contentsToVersion, true);
-      service.execute(createVersions);
-
-      // retrieve list
-      Command listCMD = service.getCommandFactory().createFolderGetListCommand("/ziptest/poop");
-      Folder whopper = (Folder) service.execute(listCMD);
-      List folders = whopper.getFolders();
-      List files = whopper.getFiles();
-      assertEquals("Folder Size incorrect", folders.size(), 1);
-      assertEquals("File Size incorrect", files.size(), 1);
-
-      // retrieve list
-      Command listCMD2 = service.getCommandFactory().createFolderGetListCommand("/ziptest/poop/music");
-      Folder whopper2 = (Folder) service.execute(listCMD2);
-      List folders2 = whopper2.getFolders();
-      List files2 = whopper2.getFiles();
-      assertEquals("Folder Size incorrect", folders2.size(), 0);
-      assertEquals("File Size incorrect", files2.size(), 1);
-
-      // retrieve list
-      Command listCMD3 = service.getCommandFactory().createFolderGetListCommand("/");
-      Folder whopper3 = (Folder) service.execute(listCMD3);
-      List folders3 = whopper3.getFolders();
-      List files3 = whopper3.getFiles();
-
-      is.close();
-   }
-
-   /*
-    public void testArchiveDownload()
-    {
-    Command getArchiveCMD = service.getCommandFactory().createGetArchiveCommand("/", "en");
-    java.io.File zipOut = (java.io.File) service.execute(getArchiveCMD);
-    try
-    {
-    //System.out.println("%%%%%% " + zipOut.getName() + " %%%%%" + zipOut.getCanonicalPath());
-    }
-    catch(Exception e)
-    {
-    e.printStackTrace();
-    }
-    }
-
-    */
-
-   public void testFileCreateFailed() throws Exception
-   {
-      Session session = null;
-
-      session = RepositoryUtil.login(service.getRepository(), "anonid", "");
-
-      if (session.itemExists(sFilePath))
-      {
-         Item item = session.getItem(sFilePath);
-         Node parentNode = item.getParent();
-         item.remove();
-         parentNode.save();
-      }
-
-      // create file english
-      File file = new FileImpl();
-      file.setBasePath(sFilePath);
-
-      Content content = new ContentImpl();
-      content.setEncoding("UTF-8");
-      content.setTitle("English Title");
-      content.setDescription("English Description");
-      content.setBasePath(sFilePath + "/" + Locale.ENGLISH.getLanguage());
-      content.setBytes("1234567890".getBytes());
-      content.setMimeType("image/gif");
-      file.setContent(Locale.ENGLISH, content);
-
-      // save english file
-
-      class TestCommand extends JCRCompositeCommand
-      {
-         /** The serialVersionUID */
-         private static final long serialVersionUID = -4206026300826187649L;
-
-         public TestCommand(File file, Content content)
-         {
-            Command newFileCMD = new NewFileCommand(file, content);
-            commands.add(newFileCMD);
-            Command runtimeExceptionCMD = new RuntimeExceptionCommand();
-            commands.add(runtimeExceptionCMD);
-         }
-      }
-
-      Command newFileCMD = new TestCommand(file, content);
-
-      try
-      {
-         service.execute(newFileCMD);
-      }
-      catch (RuntimeException e)
-      {
-         // Ignore
-      }
-
-      assertFalse("File has been copied and not rolledback", session.itemExists(sFilePath));
-   }
-
-}
\ No newline at end of file

Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCopy.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCopy.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCopy.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,148 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.commands;
+
+import java.net.URL;
+import java.util.Locale;
+
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
+
+
+/**
+ * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class TestFileCopy extends AbstractCommandTestCase
+{
+    String sFilePath = "/testdoc.gif";
+
+    String sCopyToFilePath = "/testdoccopy.gif";
+
+    // zip vars
+    String sZipPath = "/poop";
+
+    String sZipFile = "resources/test/jcr/ziptest.zip";
+
+    String sJPG = "/hibernate_logo.gif";
+
+    String sText = "/training.txt";
+    
+
+   /**
+    * 
+    *
+    */
+   public TestFileCopy(DataSourceSupport.Config dsCfg)
+   {
+      super(dsCfg);
+   }
+   
+   /**
+    * 
+    *
+    */
+   public static TestSuite suite() throws Exception
+   {
+      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
+      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
+      suite.addTestCase(TestFileCopy.class);
+      return suite;       
+   }
+
+   /**
+    * 
+    *
+    */
+   public void testFileCopy() throws CMSException
+   {
+      createFile();
+      // copy file
+      Command copyCMD = service.getCommandFactory().createCopyCommand(sFilePath, sCopyToFilePath);
+      service.execute(copyCMD);
+
+      Command getCMD = service.getCommandFactory().createFileGetCommand(sCopyToFilePath, Locale.ENGLISH);
+      File newfile = (File) service.execute(getCMD);
+      Content content = newfile.getContent();
+      assertEquals("Encoding Incorrect", content.getEncoding(), "UTF-8");
+      assertEquals("Mimetype Incorrect", content.getMimeType(), "image/gif");
+      assertEquals("Language Incorrect", content.getLocale().getLanguage(), "en");
+      assertEquals("Title Incorrect", content.getTitle(), "English Title");
+      assertEquals("Desc Incorrect", content.getDescription(), "English Description");
+
+      Command getCMDSP = service.getCommandFactory().createFileGetCommand(sCopyToFilePath, new Locale("es"));
+      File newfileSP = (File) service.execute(getCMDSP);
+      Content contentSP = newfileSP.getContent();
+      assertEquals("Encoding Incorrect", contentSP.getEncoding(), "UTF-8");
+      assertEquals("Mimetype Incorrect", contentSP.getMimeType(), "image/gif");
+      assertEquals("Language Incorrect", contentSP.getLocale().getLanguage(), "es");
+      assertEquals("Title Incorrect", contentSP.getTitle(), "Spanish Title");
+      assertEquals("Desc Incorrect", contentSP.getDescription(), "Spanish Description");
+   }   
+   
+   /**
+    * 
+    *
+    */
+   private void createFile() throws CMSException
+   {
+      // create file english
+      File file = new FileImpl();
+      file.setBasePath(sFilePath);
+
+      Content content = new ContentImpl();
+      content.setEncoding("UTF-8");
+      content.setTitle("English Title");
+      content.setDescription("English Description");
+      content.setBasePath(sFilePath + "/" + Locale.ENGLISH.getLanguage());
+      content.setBytes("1234567890".getBytes());
+      content.setMimeType("image/gif");
+      file.setContent(Locale.ENGLISH, content);
+
+      Command newFileCMD = service.getCommandFactory().createNewFileCommand(file, content);
+      service.execute(newFileCMD);
+
+      // create content spanish
+      Content contentSP = new ContentImpl();
+      contentSP.setEncoding("UTF-8");
+      contentSP.setTitle("Spanish Title");
+      contentSP.setDescription("Spanish Description");
+      contentSP.setBasePath(sFilePath + "/es");
+      contentSP.setBytes("0987654321".getBytes());
+      contentSP.setMimeType("image/gif");
+      file.setContent(new Locale("es"), contentSP);
+
+      Command newFileSPCMD = service.getCommandFactory().createNewFileCommand(file, contentSP);
+      service.execute(newFileSPCMD);
+   }
+}

Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreate.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreate.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreate.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,162 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.commands;
+
+import java.net.URL;
+import java.util.Locale;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.util.NodeUtil;
+import org.jboss.portal.cms.util.RepositoryUtil;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
+
+
+/**
+ * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class TestFileCreate extends AbstractCommandTestCase
+{
+    String sFilePath = "/testdoc.gif";
+
+    String sCopyToFilePath = "/testdoccopy.gif";
+
+    // zip vars
+    String sZipPath = "/poop";
+
+    String sZipFile = "resources/test/jcr/ziptest.zip";
+
+    String sJPG = "/hibernate_logo.gif";
+
+    String sText = "/training.txt";
+    
+
+   /**
+    * 
+    *
+    */
+   public TestFileCreate(DataSourceSupport.Config dsCfg)
+   {
+      super(dsCfg);
+   }
+   
+   /**
+    * 
+    *
+    */
+   public static TestSuite suite() throws Exception
+   {
+      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
+      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
+      suite.addTestCase(TestFileCreate.class);
+      return suite;       
+   }
+
+   /**
+    * 
+    *
+    */
+   public void testFileCreate() throws Exception
+   {
+      // create file english
+      File file = new FileImpl();
+      file.setBasePath(sFilePath);
+
+      Content content = new ContentImpl();
+      content.setEncoding("UTF-8");
+      content.setTitle("English Title");
+      content.setDescription("English Description");
+      content.setBasePath(sFilePath + "/" + Locale.ENGLISH.getLanguage());
+      content.setBytes("1234567890".getBytes());
+      content.setMimeType("image/gif");
+      file.setContent(Locale.ENGLISH, content);
+
+      // save english file
+      Command saveFileCMD = service.getCommandFactory().createFileSaveCommand(file);
+      service.execute(saveFileCMD);
+
+      //save english content
+      Command saveContentCMD = service.getCommandFactory().createContentSaveCommand(file);
+      service.execute(saveContentCMD);
+
+      // version the english content node
+      Command verCMD = service.getCommandFactory().createContentCreateNewVersionCommand(content, true);
+      service.execute(verCMD);
+
+      // create content spanish
+      Content contentSP = new ContentImpl();
+      contentSP.setEncoding("UTF-8");
+      contentSP.setTitle("Spanish Title");
+      contentSP.setDescription("Spanish Description");
+      contentSP.setBasePath(sFilePath + "/es");
+      contentSP.setBytes("0987654321".getBytes());
+      contentSP.setMimeType("image/gif");
+      file.setContent(new Locale("es"), contentSP);
+
+      //save spanish content
+      Command saveSPContentCMD = service.getCommandFactory().createContentSaveCommand(file);
+      service.execute(saveSPContentCMD);
+
+      // version the spanish content node
+      Command verSPCMD = service.getCommandFactory().createContentCreateNewVersionCommand(contentSP, true);
+      service.execute(verSPCMD);
+
+      Session session = null;
+
+      session = RepositoryUtil.login(service.getRepository(), "anonid", "");
+      Node fileNode = (Node) session.getItem(sFilePath);
+      assertEquals("Name incorrect", NodeUtil.getNodeName(file.getBasePath()), fileNode.getName());
+
+      Node contentNodeEN = fileNode.getNode(Locale.ENGLISH.getLanguage());
+      assertEquals("Encoding Incorrect", content.getEncoding(), contentNodeEN.getProperty("jcr:encoding").getString());
+      assertEquals("Mimetype Incorrect", content.getMimeType(), contentNodeEN.getProperty("jcr:mimeType").getString());
+      assertEquals("Language Incorrect", content.getLocale().getLanguage(), contentNodeEN.getProperty(
+            "portalcms:language").getString());
+      assertEquals("Title Incorrect", content.getTitle(), contentNodeEN.getProperty("portalcms:title").getString());
+      assertEquals("Desc Incorrect", content.getDescription(), contentNodeEN.getProperty("portalcms:description")
+            .getString());
+
+      Node contentNodeSP = fileNode.getNode("es");
+      assertEquals("Encoding Incorrect", contentSP.getEncoding(), contentNodeSP.getProperty("jcr:encoding").getString());
+      assertEquals("Mimetype Incorrect", contentSP.getMimeType(), contentNodeSP.getProperty("jcr:mimeType").getString());
+      assertEquals("Language Incorrect", contentSP.getLocale().getLanguage(), contentNodeSP.getProperty(
+            "portalcms:language").getString());
+      assertEquals("Title Incorrect", contentSP.getTitle(), contentNodeSP.getProperty("portalcms:title").getString());
+      assertEquals("Desc Incorrect", contentSP.getDescription(), contentNodeSP.getProperty("portalcms:description")
+            .getString());
+
+      session.logout();
+   }
+}

Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreateFailed.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreateFailed.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreateFailed.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.commands;
+
+import java.net.URL;
+import java.util.Locale;
+
+import javax.jcr.Item;
+import javax.jcr.Node;
+import javax.jcr.Session;
+
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.impl.jcr.JCRCompositeCommand;
+import org.jboss.portal.cms.impl.jcr.composite.NewFileCommand;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.util.RepositoryUtil;
+import org.jboss.portal.test.cms.mock.RuntimeExceptionCommand;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
+
+
+/**
+ * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class TestFileCreateFailed extends AbstractCommandTestCase
+{
+    String sFilePath = "/testdoc.gif";
+
+    String sCopyToFilePath = "/testdoccopy.gif";
+
+    // zip vars
+    String sZipPath = "/poop";
+
+    String sZipFile = "resources/test/jcr/ziptest.zip";
+
+    String sJPG = "/hibernate_logo.gif";
+
+    String sText = "/training.txt";
+    
+
+   /**
+    * 
+    *
+    */
+   public TestFileCreateFailed(DataSourceSupport.Config dsCfg)
+   {
+      super(dsCfg);
+   }
+   
+   /**
+    * 
+    *
+    */
+   public static TestSuite suite() throws Exception
+   {
+      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
+      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
+      suite.addTestCase(TestFileCreateFailed.class);
+      return suite;       
+   }
+
+   /**
+    * 
+    *
+    */
+   public void testFileCreateFailed() throws Exception
+   {
+      Session session = null;
+
+      session = RepositoryUtil.login(service.getRepository(), "anonid", "");
+
+      if (session.itemExists(sFilePath))
+      {
+         Item item = session.getItem(sFilePath);
+         Node parentNode = item.getParent();
+         item.remove();
+         parentNode.save();
+      }
+
+      // create file english
+      File file = new FileImpl();
+      file.setBasePath(sFilePath);
+
+      Content content = new ContentImpl();
+      content.setEncoding("UTF-8");
+      content.setTitle("English Title");
+      content.setDescription("English Description");
+      content.setBasePath(sFilePath + "/" + Locale.ENGLISH.getLanguage());
+      content.setBytes("1234567890".getBytes());
+      content.setMimeType("image/gif");
+      file.setContent(Locale.ENGLISH, content);
+
+      // save english file
+
+      class TestCommand extends JCRCompositeCommand
+      {
+         /** The serialVersionUID */
+         private static final long serialVersionUID = -4206026300826187649L;
+
+         public TestCommand(File file, Content content)
+         {
+            Command newFileCMD = new NewFileCommand(file, content);
+            commands.add(newFileCMD);
+            Command runtimeExceptionCMD = new RuntimeExceptionCommand();
+            commands.add(runtimeExceptionCMD);
+         }
+      }
+
+      Command newFileCMD = new TestCommand(file, content);
+
+      try
+      {
+         service.execute(newFileCMD);
+      }
+      catch (RuntimeException e)
+      {
+         // Ignore
+      }
+
+      assertFalse("File has been copied and not rolledback", session.itemExists(sFilePath));
+   }
+}

Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileDelete.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileDelete.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileDelete.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,153 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.commands;
+
+import java.net.URL;
+import java.util.Locale;
+
+import javax.jcr.Session;
+
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.util.RepositoryUtil;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
+
+
+/**
+ * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class TestFileDelete extends AbstractCommandTestCase
+{
+    String sFilePath = "/testdoc.gif";
+
+    String sCopyToFilePath = "/testdoccopy.gif";
+
+    // zip vars
+    String sZipPath = "/poop";
+
+    String sZipFile = "resources/test/jcr/ziptest.zip";
+
+    String sJPG = "/hibernate_logo.gif";
+
+    String sText = "/training.txt";
+    
+
+   /**
+    * 
+    *
+    */
+   public TestFileDelete(DataSourceSupport.Config dsCfg)
+   {
+      super(dsCfg);
+   }
+   
+   /**
+    * 
+    *
+    */
+   public static TestSuite suite() throws Exception
+   {
+      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
+      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
+      suite.addTestCase(TestFileDelete.class);
+      return suite;       
+   }
+
+   /**
+    * 
+    *
+    */
+   public void testFileDelete() throws Exception
+   {
+      createFile();
+      
+      // delete old test nodes
+      Command deleteCMD = service.getCommandFactory().createDeleteCommand(sFilePath);
+      service.execute(deleteCMD);
+      Command deleteToCMD = service.getCommandFactory().createDeleteCommand(sCopyToFilePath);
+      service.execute(deleteToCMD);
+
+      // zip deletes
+      Command deleteZipCMD = service.getCommandFactory().createDeleteCommand(sZipPath);
+      service.execute(deleteZipCMD);
+      Command deleteZipJCMD = service.getCommandFactory().createDeleteCommand(sJPG);
+      service.execute(deleteZipJCMD);
+      Command deleteZipTCMD = service.getCommandFactory().createDeleteCommand(sText);
+      service.execute(deleteZipTCMD);
+
+      Session session = RepositoryUtil.login(service.getRepository(), "anonid", "");
+      assertFalse(sFilePath + " not Deleted", session.itemExists(sFilePath));
+      assertFalse(sCopyToFilePath + " not Deleted", session.itemExists(sCopyToFilePath));
+      assertFalse(sZipPath + " not Deleted", session.itemExists(sZipPath));
+      assertFalse(sJPG + " not Deleted", session.itemExists(sJPG));
+      assertFalse(sText + " not Deleted", session.itemExists(sText));
+
+      RepositoryUtil.safeLogout(session);
+   }   
+   
+   /**
+    * 
+    *
+    */
+   private void createFile() throws CMSException
+   {
+      // create file english
+      File file = new FileImpl();
+      file.setBasePath(sFilePath);
+
+      Content content = new ContentImpl();
+      content.setEncoding("UTF-8");
+      content.setTitle("English Title");
+      content.setDescription("English Description");
+      content.setBasePath(sFilePath + "/" + Locale.ENGLISH.getLanguage());
+      content.setBytes("1234567890".getBytes());
+      content.setMimeType("image/gif");
+      file.setContent(Locale.ENGLISH, content);
+
+      Command newFileCMD = service.getCommandFactory().createNewFileCommand(file, content);
+      service.execute(newFileCMD);
+
+      // create content spanish
+      Content contentSP = new ContentImpl();
+      contentSP.setEncoding("UTF-8");
+      contentSP.setTitle("Spanish Title");
+      contentSP.setDescription("Spanish Description");
+      contentSP.setBasePath(sFilePath + "/es");
+      contentSP.setBytes("0987654321".getBytes());
+      contentSP.setMimeType("image/gif");
+      file.setContent(new Locale("es"), contentSP);
+
+      Command newFileSPCMD = service.getCommandFactory().createNewFileCommand(file, contentSP);
+      service.execute(newFileSPCMD);
+   }
+}

Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGet.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGet.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGet.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.commands;
+
+import java.net.URL;
+import java.util.Locale;
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
+
+
+/**
+ * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class TestFileGet extends AbstractCommandTestCase
+{
+    String sFilePath = "/testdoc.gif";
+
+    String sCopyToFilePath = "/testdoccopy.gif";
+
+    // zip vars
+    String sZipPath = "/poop";
+
+    String sZipFile = "resources/test/jcr/ziptest.zip";
+
+    String sJPG = "/hibernate_logo.gif";
+
+    String sText = "/training.txt";
+    
+
+   /**
+    * 
+    *
+    */
+   public TestFileGet(DataSourceSupport.Config dsCfg)
+   {
+      super(dsCfg);
+   }
+   
+   /**
+    * 
+    *
+    */
+   public static TestSuite suite() throws Exception
+   {
+      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
+      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
+      suite.addTestCase(TestFileGet.class);
+      return suite;       
+   }
+
+   /**
+    * Tests retrieval of the version labeled LIVE.
+    */
+   public void testFileGet() throws CMSException
+   {
+      createFile();
+      Command getCMD = service.getCommandFactory().createFileGetCommand(sFilePath, Locale.ENGLISH);
+      File newfile = (File) service.execute(getCMD);
+
+      Content content = newfile.getContent();
+      assertEquals("Encoding Incorrect", content.getEncoding(), "UTF-8");
+      assertEquals("Mimetype Incorrect", content.getMimeType(), "image/gif");
+      assertEquals("Language Incorrect", content.getLocale().getLanguage(), "en");
+      assertEquals("Title Incorrect", content.getTitle(), "English Title");
+      assertEquals("Desc Incorrect", content.getDescription(), "English Description");
+   }   
+   
+   /**
+    * 
+    *
+    */
+   private void createFile() throws CMSException
+   {
+      // create file english
+      File file = new FileImpl();
+      file.setBasePath(sFilePath);
+
+      Content content = new ContentImpl();
+      content.setEncoding("UTF-8");
+      content.setTitle("English Title");
+      content.setDescription("English Description");
+      content.setBasePath(sFilePath + "/" + Locale.ENGLISH.getLanguage());
+      content.setBytes("1234567890".getBytes());
+      content.setMimeType("image/gif");
+      file.setContent(Locale.ENGLISH, content);
+
+      Command newFileCMD = service.getCommandFactory().createNewFileCommand(file, content);
+      service.execute(newFileCMD);
+
+      // create content spanish
+      Content contentSP = new ContentImpl();
+      contentSP.setEncoding("UTF-8");
+      contentSP.setTitle("Spanish Title");
+      contentSP.setDescription("Spanish Description");
+      contentSP.setBasePath(sFilePath + "/es");
+      contentSP.setBytes("0987654321".getBytes());
+      contentSP.setMimeType("image/gif");
+      file.setContent(new Locale("es"), contentSP);
+
+      Command newFileSPCMD = service.getCommandFactory().createNewFileCommand(file, contentSP);
+      service.execute(newFileSPCMD);
+   }
+}

Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetList.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetList.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetList.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.commands;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Locale;
+
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
+
+
+/**
+ * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class TestFileGetList extends AbstractCommandTestCase
+{
+    String sFilePath = "/testdoc.gif";
+
+    String sCopyToFilePath = "/testdoccopy.gif";
+
+    // zip vars
+    String sZipPath = "/poop";
+
+    String sZipFile = "resources/test/jcr/ziptest.zip";
+
+    String sJPG = "/hibernate_logo.gif";
+
+    String sText = "/training.txt";
+    
+
+   /**
+    * 
+    *
+    */
+   public TestFileGetList(DataSourceSupport.Config dsCfg)
+   {
+      super(dsCfg);
+   }
+   
+   /**
+    * 
+    *
+    */
+   public static TestSuite suite() throws Exception
+   {
+      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
+      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
+      suite.addTestCase(TestFileGetList.class);
+      return suite;       
+   }
+
+   /**
+    * Tests retrieving a list of contents under a file and the versions for contents.
+    */
+   public void testFileList() throws CMSException
+   {
+      createFile();
+      Command getFileListCMD = service.getCommandFactory().createFileGetListCommand(sFilePath);
+      List contentList = (List) service.execute(getFileListCMD);
+      assertTrue("Incorrect list size", contentList.size() == 2);
+
+      for (int i = 0; i < contentList.size(); i++)
+      {
+         Content content = (Content) contentList.get(i);
+         Command getContentVersionsCMD = service.getCommandFactory().createContentGetVersionsCommand(
+               content.getBasePath());
+         List versionList = (List) service.execute(getContentVersionsCMD);
+      }
+   }   
+   
+   /**
+    * 
+    *
+    */
+   private void createFile() throws CMSException
+   {
+      // create file english
+      File file = new FileImpl();
+      file.setBasePath(sFilePath);
+
+      Content content = new ContentImpl();
+      content.setEncoding("UTF-8");
+      content.setTitle("English Title");
+      content.setDescription("English Description");
+      content.setBasePath(sFilePath + "/" + Locale.ENGLISH.getLanguage());
+      content.setBytes("1234567890".getBytes());
+      content.setMimeType("image/gif");
+      file.setContent(Locale.ENGLISH, content);
+
+      Command newFileCMD = service.getCommandFactory().createNewFileCommand(file, content);
+      service.execute(newFileCMD);
+
+      // create content spanish
+      Content contentSP = new ContentImpl();
+      contentSP.setEncoding("UTF-8");
+      contentSP.setTitle("Spanish Title");
+      contentSP.setDescription("Spanish Description");
+      contentSP.setBasePath(sFilePath + "/es");
+      contentSP.setBytes("0987654321".getBytes());
+      contentSP.setMimeType("image/gif");
+      file.setContent(new Locale("es"), contentSP);
+
+      Command newFileSPCMD = service.getCommandFactory().createNewFileCommand(file, contentSP);
+      service.execute(newFileSPCMD);
+   }
+}

Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileGetVersion.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.commands;
+
+import java.net.URL;
+import java.util.Locale;
+
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
+
+
+/**
+ * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class TestFileGetVersion extends AbstractCommandTestCase
+{
+    String sFilePath = "/testdoc.gif";
+
+    String sCopyToFilePath = "/testdoccopy.gif";
+
+    // zip vars
+    String sZipPath = "/poop";
+
+    String sZipFile = "resources/test/jcr/ziptest.zip";
+
+    String sJPG = "/hibernate_logo.gif";
+
+    String sText = "/training.txt";
+    
+
+   /**
+    * 
+    *
+    */
+   public TestFileGetVersion(DataSourceSupport.Config dsCfg)
+   {
+      super(dsCfg);
+   }
+   
+   /**
+    * 
+    *
+    */
+   public static TestSuite suite() throws Exception
+   {
+      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
+      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
+      suite.addTestCase(TestFileGetVersion.class);
+      return suite;       
+   }
+
+   /**
+    * Tests retrieval of a specific version by version number.
+    */
+   public void testFileGetVersion() throws CMSException
+   {
+      createFile();
+      // get specific file version
+      Command getCMDV = service.getCommandFactory().createFileGetCommand(sFilePath, "1.0", Locale.ENGLISH);
+      File Vnewfile = (File) service.execute(getCMDV);
+      assertTrue("Incorrect version number for file object", Vnewfile.getContent().getVersionNumber().equals("1.0"));
+   }   
+   
+   /**
+    * 
+    *
+    */
+   private void createFile() throws CMSException
+   {
+      // create file english
+      File file = new FileImpl();
+      file.setBasePath(sFilePath);
+
+      Content content = new ContentImpl();
+      content.setEncoding("UTF-8");
+      content.setTitle("English Title");
+      content.setDescription("English Description");
+      content.setBasePath(sFilePath + "/" + Locale.ENGLISH.getLanguage());
+      content.setBytes("1234567890".getBytes());
+      content.setMimeType("image/gif");
+      file.setContent(Locale.ENGLISH, content);
+
+      Command newFileCMD = service.getCommandFactory().createNewFileCommand(file, content);
+      service.execute(newFileCMD);
+
+      // create content spanish
+      Content contentSP = new ContentImpl();
+      contentSP.setEncoding("UTF-8");
+      contentSP.setTitle("Spanish Title");
+      contentSP.setDescription("Spanish Description");
+      contentSP.setBasePath(sFilePath + "/es");
+      contentSP.setBytes("0987654321".getBytes());
+      contentSP.setMimeType("image/gif");
+      file.setContent(new Locale("es"), contentSP);
+
+      Command newFileSPCMD = service.getCommandFactory().createNewFileCommand(file, contentSP);
+      service.execute(newFileSPCMD);
+   }
+}

Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileUpdate.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileUpdate.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFileUpdate.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.commands;
+
+import java.net.URL;
+import java.util.Locale;
+
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.Session;
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.impl.jcr.util.VersionUtil;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.util.RepositoryUtil;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
+
+
+/**
+ * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class TestFileUpdate extends AbstractCommandTestCase
+{
+    String sFilePath = "/testdoc.gif";
+
+    String sCopyToFilePath = "/testdoccopy.gif";
+
+    // zip vars
+    String sZipPath = "/poop";
+
+    String sZipFile = "resources/test/jcr/ziptest.zip";
+
+    String sJPG = "/hibernate_logo.gif";
+
+    String sText = "/training.txt";
+    
+
+   /**
+    * 
+    *
+    */
+   public TestFileUpdate(DataSourceSupport.Config dsCfg)
+   {
+      super(dsCfg);
+   }
+   
+   /**
+    * 
+    *
+    */
+   public static TestSuite suite() throws Exception
+   {
+      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
+      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
+      suite.addTestCase(TestFileUpdate.class);
+      return suite;       
+   }
+
+   /**
+    * Tests updating a file and its content.
+    * @throws Exception 
+    */
+   public void testFileUpdate() throws Exception
+   {
+      createFile();
+      Session session = RepositoryUtil.login(service.getRepository(), "anonid", "");
+      Command getCMD = service.getCommandFactory().createFileGetCommand(sFilePath, Locale.ENGLISH);
+      File newfile = (File) service.execute(getCMD);
+      Content content = newfile.getContent();
+      content.setDescription("New English Description");
+      newfile.setContent(content.getLocale(), content);
+      // update file and make "LIVE"
+      Command cmdUpdate = service.getCommandFactory().createFileUpdateCommand(newfile);
+      service.execute(cmdUpdate);
+
+      Command cmdVersion = service.getCommandFactory().createContentCreateNewVersionCommand(content, true);
+      service.execute(cmdVersion);
+
+      boolean descriptionupdated = ((Property) session.getItem("/testdoc.gif/en/portalcms:description")).getString()
+            .equals("New English Description");
+      assertTrue("Incorrect description for file object", descriptionupdated);
+
+      // version std out dump
+      VersionUtil.print((Node) session.getItem(content.getBasePath()));
+   }   
+   
+   /**
+    * 
+    *
+    */
+   private void createFile() throws CMSException
+   {
+      // create file english
+      File file = new FileImpl();
+      file.setBasePath(sFilePath);
+
+      Content content = new ContentImpl();
+      content.setEncoding("UTF-8");
+      content.setTitle("English Title");
+      content.setDescription("English Description");
+      content.setBasePath(sFilePath + "/" + Locale.ENGLISH.getLanguage());
+      content.setBytes("1234567890".getBytes());
+      content.setMimeType("image/gif");
+      file.setContent(Locale.ENGLISH, content);
+
+      Command newFileCMD = service.getCommandFactory().createNewFileCommand(file, content);
+      service.execute(newFileCMD);
+
+      // create content spanish
+      Content contentSP = new ContentImpl();
+      contentSP.setEncoding("UTF-8");
+      contentSP.setTitle("Spanish Title");
+      contentSP.setDescription("Spanish Description");
+      contentSP.setBasePath(sFilePath + "/es");
+      contentSP.setBytes("0987654321".getBytes());
+      contentSP.setMimeType("image/gif");
+      file.setContent(new Locale("es"), contentSP);
+
+      Command newFileSPCMD = service.getCommandFactory().createNewFileCommand(file, contentSP);
+      service.execute(newFileSPCMD);
+   }
+}

Deleted: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCommands.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCommands.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCommands.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -1,342 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This 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 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.portal.test.cms.commands;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.net.URL;
-import java.util.Date;
-import java.util.Locale;
-
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.Session;
-
-import junit.framework.TestSuite;
-
-import org.jboss.portal.cms.Command;
-import org.jboss.portal.cms.CMSException;
-import org.jboss.portal.cms.impl.ContentImpl;
-import org.jboss.portal.cms.impl.FileImpl;
-import org.jboss.portal.cms.impl.FolderImpl;
-import org.jboss.portal.cms.impl.jcr.JCRCMS;
-import org.jboss.portal.cms.model.Content;
-import org.jboss.portal.cms.model.File;
-import org.jboss.portal.cms.model.Folder;
-import org.jboss.portal.cms.util.RepositoryUtil;
-import org.jboss.portal.common.util.CLLoader;
-import org.jboss.portal.common.util.LoaderResource;
-import org.jboss.portal.common.util.XML;
-import org.jboss.portal.test.cms.AbstractCMSTestCase;
-import org.jboss.portal.test.framework.embedded.DataSourceSupport;
-import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
-
-/**
- * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- */
-public class TestFolderCommands extends AbstractCMSTestCase
-{
-   /**
-    * A test folder path *
-    */
-   String sFolderPath = "/alpha";
-
-   /**
-    * A test folder path for copied folder trees *
-    */
-   String sCopyToFolderPath = "/alpha/beta";
-
-   JCRCMS service;
-
-   public TestFolderCommands(DataSourceSupport.Config dsCfg)
-   {
-      super(dsCfg);
-   }
-
-   public void setUp() throws Exception
-   {
-      super.setUp();
-
-      LoaderResource res = new CLLoader().getResource("jcr/repository.xml");
-
-      service = new JCRCMS();
-      service.setDoChecking(true);
-      service.setDefaultLocale(Locale.ENGLISH.getDisplayName());
-      service.setDefaultContentLocation("default-content/default");
-
-      service.setConfig(res.asDocument(XML.getDocumentBuilderFactory().newDocumentBuilder()).getDocumentElement());
-      service.setRepositoryName("repo");
-      service.setHomeDir("repo");
-      service.start();
-   }
-
-   public void tearDown() throws Exception
-   {
-      service.stop();
-      super.tearDown();
-   }
-
-   public static TestSuite suite() throws Exception
-   {
-      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
-      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
-      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
-      suite.addTestCase(TestFolderCommands.class);
-      return suite;
-   }
-
-   /**
-    * Deleted test data from repo, and also tests delete cmd.
-    * @throws Exception
-    */
-   public void testFolderDelete() throws Exception
-   {
-      Session session = RepositoryUtil.login(service.getRepository(), "anonid", "");
-      Command deleteCMD = service.getCommandFactory().createDeleteCommand(sFolderPath);
-      service.execute(deleteCMD);
-      assertFalse(sFolderPath + " failed to delete.", session.itemExists(sFolderPath));
-
-      Command deleteToCMD = service.getCommandFactory().createDeleteCommand(sCopyToFolderPath);
-      service.execute(deleteToCMD);
-      assertFalse(sCopyToFolderPath + " failed to delete.", session.itemExists(sCopyToFolderPath));
-   }
-
-   /**
-    * Copy test data from repo
-    */
-
-   public void testFolderCopy() throws CMSException
-   {
-      // create folder object
-      Folder folder = new FolderImpl();
-      folder.setCreationDate(new Date());
-      folder.setDescription("Folder description");
-      folder.setTitle("Folder Title");
-      folder.setLastModified(new Date());
-      folder.setName("Alpha Folder");
-      folder.setBasePath("/alpha1");
-
-      // save folder
-      Command saveCMD = service.getCommandFactory().createFolderSaveCommand(folder);
-      service.execute(saveCMD);
-
-      // create file english
-      File file = new FileImpl();
-      file.setBasePath("/alpha1/toto.txt");
-
-      Content content = new ContentImpl();
-      content.setEncoding("UTF-8");
-      content.setTitle("English Title");
-      content.setDescription("English Description");
-      content.setBasePath("/alpha1/toto.txt/" + Locale.ENGLISH.getLanguage());
-      content.setBytes("1234567890".getBytes());
-      content.setMimeType("image/gif");
-
-      file.setContent(Locale.ENGLISH, content);
-
-      // save english file
-      Command saveFileCMD = service.getCommandFactory().createNewFileCommand(file, content);
-      service.execute(saveFileCMD);
-
-      Folder folder2 = new FolderImpl();
-      folder2.setCreationDate(new Date());
-      folder2.setDescription("Folder description");
-      folder2.setTitle("Folder Title");
-      folder2.setLastModified(new Date());
-      folder2.setName("Beta Folder");
-      folder2.setBasePath("/beta1");
-
-      // save folder
-      Command saveCMD2 = service.getCommandFactory().createFolderSaveCommand(folder2);
-      service.execute(saveCMD2);
-
-      Command copyFolderCMD = service.getCommandFactory().createCopyCommand("/alpha1", "/beta1/test");
-      service.execute(copyFolderCMD);
-
-      Command getLiveCMD = service.getCommandFactory().createFileGetCommand("/alpha1/toto.txt", Locale.ENGLISH);
-      File fileOrig = (File) service.execute(getLiveCMD);
-
-      assertNotNull("Content of the original file is null", fileOrig.getContent());
-
-      getLiveCMD = service.getCommandFactory().createFileGetCommand("/beta1/test/toto.txt", Locale.ENGLISH);
-      File fileCopy = (File) service.execute(getLiveCMD);
-
-      assertNotNull("Content of the copied file is null", fileCopy.getContent());
-   }
-
-   public void testFolderCreate() throws Exception
-   {
-      // create folder object
-      Folder folder = new FolderImpl();
-      folder.setCreationDate(new Date());
-      folder.setDescription("Folder description");
-      folder.setTitle("Folder Title");
-      folder.setLastModified(new Date());
-      folder.setName("Alpha Folder");
-      folder.setBasePath(sFolderPath);
-
-      // save folder
-      Command saveCMD = service.getCommandFactory().createFolderSaveCommand(folder);
-      service.execute(saveCMD);
-
-      // get folder - RAW
-      Session session = RepositoryUtil.login(service.getRepository(), "anonid", "");
-      Node folderNode = (Node) session.getItem(sFolderPath);
-      assertNotNull("FolderNodeis null", folderNode);
-      assertTrue("Incorrect primarynodetype", folderNode.getPrimaryNodeType().getName().equals("portalcms:folder"));
-      assertTrue("Incorrect Name for " + sFolderPath, folderNode.getName().equals("alpha"));
-      session.save();
-
-      Property description = folderNode.getProperty("portalcms:description");
-      assertNotNull("Folder description  is null", description);
-      assertTrue("Incorrect description for " + sFolderPath, description.getString().equals("Folder description"));
-   }
-
-   public void testFolderGet() throws CMSException
-   {
-      createFolder();
-      // get folder
-      Command getCMD = service.getCommandFactory().createFolderGetCommand(sFolderPath);
-      Folder newFolder = (Folder) service.execute(getCMD);
-      assertTrue("Folder retrieval failed.", newFolder.getDescription().equals("Folder description"));
-   }
-
-   public void testFolderUpdate() throws Exception
-   {
-      createFolder();
-      // get folder
-      Command getCMD = service.getCommandFactory().createFolderGetCommand(sFolderPath);
-      Folder newFolder = (Folder) service.execute(getCMD);
-
-      // update folder
-      newFolder.setDescription("new folder description");
-      Command cmdUpdate = service.getCommandFactory().createFolderUpdateCommand(newFolder);
-      service.execute(cmdUpdate);
-
-      Session session = RepositoryUtil.login(service.getRepository(), "anonid", "");
-      Property prop = (Property) session.getItem("/alpha/portalcms:description");
-      System.out.println(prop.getString());
-      boolean descriptionupdated = ((Property) session.getItem("/alpha/portalcms:description")).getString().equals(
-            "new folder description");
-      assertTrue("Incorrect description for folder: ", descriptionupdated);
-      session.save();
-   }
-
-   public void createFolder() throws CMSException
-   {
-      // create folder object
-      Folder folder = new FolderImpl();
-      folder.setCreationDate(new Date());
-      folder.setDescription("Folder description");
-      folder.setTitle("Folder Title");
-      folder.setLastModified(new Date());
-      folder.setName("Alpha Folder");
-      folder.setBasePath(sFolderPath);
-
-      // save folder
-      Command saveCMD = service.getCommandFactory().createFolderSaveCommand(folder);
-      service.execute(saveCMD);
-   }
-
-   //   public void testFolderCopy()
-   //   {
-   //      try
-   //      {
-   //         // copy folder tree
-   //         Command copyCMD = service.getCommandFactory().createCopyCommand(sFolderPath, sCopyToFolderPath);
-   //         service.execute(copyCMD);
-   //
-   //         Command getcopiedCMD = service.getCommandFactory().createFolderGetCommand(sCopyToFolderPath);
-   //         Folder copiedfolder = (Folder) service.execute(getcopiedCMD);
-   //         assertTrue("Incorrect description for folder object", copiedfolder.getDescription().equals("new folder description"));
-   //      }
-   //      catch(Exception e)
-   //      {
-   //         e.printStackTrace();
-   //         fail("" + e);
-   //      }
-   //   }
-   //
-   //   public void testFolderList()
-   //   {
-   ///*
-   //      // delete old test nodes
-   //      Command deleteCMD = service.getCommandFactory().createDeleteCommand(sFolderPath + "/foo.gif");
-   //      service.execute(deleteCMD);
-   //      Command deleteToCMD = service.getCommandFactory().createDeleteCommand(sFolderPath + "/bar.zip");
-   //      service.execute(deleteToCMD);
-   //
-   //      // create 2 files
-   //      File file = new FileImpl();
-   //      file.setDescription("File description");
-   //      file.setTitle("File Title");
-   //      file.setLastModified(new Date());
-   //      file.setName("foo");
-   ////      file.setLanguage("en");
-   //      Content content = new ContentImpl();
-   ////      content.setContent("1234567890".getBytes());
-   ////      file.setMimeType("plain/text");
-   //      content.setEncoding("utf-8");
-   ////      file.setContent(content);
-   //      file.setBasePath(sFolderPath + "/foo.gif");
-   //      Command saveCMD = service.getCommandFactory().createFileSaveCommand(file);
-   //      service.execute(saveCMD);
-   //      Command verCMD = service.getCommandFactory().createContentCreateNewVersionCommand(file);
-   //      service.execute(verCMD);
-   //
-   //      File file2 = new FileImpl();
-   //      file2.setDescription("File description");
-   //      file2.setTitle("File Title");
-   //      file2.setLastModified(new Date());
-   //      file2.setName("bar");
-   ////      file2.setLanguage("en");
-   //      Content content2 = new ContentImpl();
-   ////      content2.setContent("0987654321".getBytes());
-   ////      file2.setMimeType("text/html");
-   //      content2.setEncoding("utf-8");
-   ////      file2.setContent(content2);
-   //      file2.setBasePath(sFolderPath + "/bar.zip");
-   //      Command saveCMD2 = service.getCommandFactory().createFileSaveCommand(file2);
-   //      service.execute(saveCMD2);
-   //      Command verCMD2 = service.getCommandFactory().createContentCreateNewVersionCommand(file2);
-   //      service.execute(verCMD2);
-   //
-   //      // create child folder object
-   //      Folder folder = new FolderImpl();
-   //      folder.setCreationDate(new Date());
-   //      folder.setDescription("Omega Folder description");
-   //      folder.setTitle("Omega Folder Title");
-   //      folder.setLastModified(new Date());
-   //      folder.setName("Omega Folder");
-   //      folder.setBasePath(sFolderPath + "/omega");
-   //
-   //      // retrieve list
-   //      Command listCMD = service.getCommandFactory().createFolderGetListCommand(sFolderPath);
-   //      Folder whopper = (Folder) service.execute(listCMD);
-   //      List folders = whopper.getFolders();
-   //      List files = whopper.getFiles();
-   //      assertTrue("Incorrect folder size", folders.size() == 1);
-   //      assertTrue("Incorrect number of files in folder", files.size() == 2);
-   //      */
-   //   }
-}

Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCopy.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCopy.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCopy.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,143 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.commands;
+
+import java.net.URL;
+import java.util.Date;
+import java.util.Locale;
+
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.impl.FolderImpl;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
+
+
+/**
+ * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class TestFolderCopy extends AbstractCommandTestCase
+{
+   /**
+    * A test folder path *
+    */
+   String sFolderPath = "/alpha";
+
+   /**
+    * A test folder path for copied folder trees *
+    */
+   String sCopyToFolderPath = "/alpha/beta";
+
+   /**
+    * 
+    *
+    */
+   public TestFolderCopy(DataSourceSupport.Config dsCfg)
+   {
+      super(dsCfg);
+   }
+   
+   /**
+    * 
+    *
+    */
+   public static TestSuite suite() throws Exception
+   {
+      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
+      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
+      suite.addTestCase(TestFolderCopy.class);
+      return suite;       
+   }
+
+   
+   /**
+    * Copy test data from repo
+    */
+   public void testFolderCopy() throws Exception
+   {
+	      // create folder object
+	      Folder folder = new FolderImpl();
+	      folder.setCreationDate(new Date());
+	      folder.setDescription("Folder description");
+	      folder.setTitle("Folder Title");
+	      folder.setLastModified(new Date());
+	      folder.setName("Alpha Folder");
+	      folder.setBasePath("/alpha1");
+	
+	      // save folder
+	      Command saveCMD = service.getCommandFactory().createFolderSaveCommand(folder);
+	      service.execute(saveCMD);
+	
+	      // create file english
+	      File file = new FileImpl();
+	      file.setBasePath("/alpha1/toto.txt");
+	
+	      Content content = new ContentImpl();
+	      content.setEncoding("UTF-8");
+	      content.setTitle("English Title");
+	      content.setDescription("English Description");
+	      content.setBasePath("/alpha1/toto.txt/" + Locale.ENGLISH.getLanguage());
+	      content.setBytes("1234567890".getBytes());
+	      content.setMimeType("image/gif");
+	
+	      file.setContent(Locale.ENGLISH, content);
+	
+	      // save english file
+	      Command saveFileCMD = service.getCommandFactory().createNewFileCommand(file, content);
+	      service.execute(saveFileCMD);
+	
+	      Folder folder2 = new FolderImpl();
+	      folder2.setCreationDate(new Date());
+	      folder2.setDescription("Folder description");
+	      folder2.setTitle("Folder Title");
+	      folder2.setLastModified(new Date());
+	      folder2.setName("Beta Folder");
+	      folder2.setBasePath("/beta1");
+	
+	      // save folder
+	      Command saveCMD2 = service.getCommandFactory().createFolderSaveCommand(folder2);
+	      service.execute(saveCMD2);
+	
+	      Command copyFolderCMD = service.getCommandFactory().createCopyCommand("/alpha1", "/beta1/test");
+	      service.execute(copyFolderCMD);
+	
+	      Command getLiveCMD = service.getCommandFactory().createFileGetCommand("/alpha1/toto.txt", Locale.ENGLISH);
+	      File fileOrig = (File) service.execute(getLiveCMD);
+	
+	      assertNotNull("Content of the original file is null", fileOrig.getContent());
+	
+	      getLiveCMD = service.getCommandFactory().createFileGetCommand("/beta1/test/toto.txt", Locale.ENGLISH);
+	      File fileCopy = (File) service.execute(getLiveCMD);
+	
+	      assertNotNull("Content of the copied file is null", fileCopy.getContent());
+   }   
+}

Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCreate.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCreate.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCreate.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.commands;
+
+import java.net.URL;
+import java.util.Date;
+
+
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.Session;
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.impl.FolderImpl;
+import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.cms.util.RepositoryUtil;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
+
+
+/**
+ * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class TestFolderCreate extends AbstractCommandTestCase
+{
+   /**
+    * A test folder path *
+    */
+   String sFolderPath = "/alpha";
+
+   /**
+    * A test folder path for copied folder trees *
+    */
+   String sCopyToFolderPath = "/alpha/beta";
+
+   /**
+    * 
+    *
+    */
+   public TestFolderCreate(DataSourceSupport.Config dsCfg)
+   {
+      super(dsCfg);
+   }
+   
+   /**
+    * 
+    *
+    */
+   public static TestSuite suite() throws Exception
+   {
+      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
+      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
+      suite.addTestCase(TestFolderCreate.class);
+      return suite;       
+   }
+
+   
+   /**
+    * 
+    *
+    */
+   public void testFolderCreate() throws Exception
+   {
+      // create folder object
+      Folder folder = new FolderImpl();
+      folder.setCreationDate(new Date());
+      folder.setDescription("Folder description");
+      folder.setTitle("Folder Title");
+      folder.setLastModified(new Date());
+      folder.setName("Alpha Folder");
+      folder.setBasePath(sFolderPath);
+
+      // save folder
+      Command saveCMD = service.getCommandFactory().createFolderSaveCommand(folder);
+      service.execute(saveCMD);
+
+      // get folder - RAW
+      Session session = RepositoryUtil.login(service.getRepository(), "anonid", "");
+      Node folderNode = (Node) session.getItem(sFolderPath);
+      assertNotNull("FolderNodeis null", folderNode);
+      assertTrue("Incorrect primarynodetype", folderNode.getPrimaryNodeType().getName().equals("portalcms:folder"));
+      assertTrue("Incorrect Name for " + sFolderPath, folderNode.getName().equals("alpha"));
+      session.save();
+
+      Property description = folderNode.getProperty("portalcms:description");
+      assertNotNull("Folder description  is null", description);
+      assertTrue("Incorrect description for " + sFolderPath, description.getString().equals("Folder description"));
+   }   
+}

Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderDelete.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderDelete.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderDelete.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.commands;
+
+import java.net.URL;
+
+import javax.jcr.Session;
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.util.RepositoryUtil;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
+
+
+/**
+ * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class TestFolderDelete extends AbstractCommandTestCase
+{
+   /**
+    * A test folder path *
+    */
+   String sFolderPath = "/alpha";
+
+   /**
+    * A test folder path for copied folder trees *
+    */
+   String sCopyToFolderPath = "/alpha/beta";
+
+   /**
+    * 
+    *
+    */
+   public TestFolderDelete(DataSourceSupport.Config dsCfg)
+   {
+      super(dsCfg);
+   }
+   
+   /**
+    * 
+    *
+    */
+   public static TestSuite suite() throws Exception
+   {
+      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
+      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
+      suite.addTestCase(TestFolderDelete.class);
+      return suite;       
+   }
+
+   /**
+    * Deleted test data from repo, and also tests delete cmd.
+    * @throws Exception
+    */
+   public void testFolderDelete() throws Exception
+   {
+       Session session = RepositoryUtil.login(service.getRepository(), "anonid", "");
+	   Command deleteCMD = service.getCommandFactory().createDeleteCommand(sFolderPath);
+       service.execute(deleteCMD);
+       assertFalse(sFolderPath + " failed to delete.", session.itemExists(sFolderPath));
+
+       Command deleteToCMD = service.getCommandFactory().createDeleteCommand(sCopyToFolderPath);
+       service.execute(deleteToCMD);
+       assertFalse(sCopyToFolderPath + " failed to delete.", session.itemExists(sCopyToFolderPath));
+   }   
+}

Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderGet.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderGet.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderGet.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.commands;
+
+import java.net.URL;
+import java.util.Date;
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.impl.FolderImpl;
+import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
+
+/**
+ * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class TestFolderGet extends AbstractCommandTestCase
+{
+   /**
+    * A test folder path *
+    */
+   String sFolderPath = "/alpha";
+
+   /**
+    * A test folder path for copied folder trees *
+    */
+   String sCopyToFolderPath = "/alpha/beta";
+
+   /**
+    * 
+    *
+    */
+   public TestFolderGet(DataSourceSupport.Config dsCfg)
+   {
+      super(dsCfg);
+   }
+   
+   /**
+    * 
+    *
+    */
+   public static TestSuite suite() throws Exception
+   {
+      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
+      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
+      suite.addTestCase(TestFolderGet.class);
+      return suite;       
+   }
+
+   
+   /**
+    * 
+    *
+    */
+   public void testFolderGet() throws CMSException
+   {
+      createFolder();
+      // get folder
+      Command getCMD = service.getCommandFactory().createFolderGetCommand(sFolderPath);
+      Folder newFolder = (Folder) service.execute(getCMD);
+      assertTrue("Folder retrieval failed.", newFolder.getDescription().equals("Folder description"));
+   }
+   
+   /**
+    * 
+    *
+    */
+   public void createFolder() throws CMSException
+   {
+      // create folder object
+      Folder folder = new FolderImpl();
+      folder.setCreationDate(new Date());
+      folder.setDescription("Folder description");
+      folder.setTitle("Folder Title");
+      folder.setLastModified(new Date());
+      folder.setName("Alpha Folder");
+      folder.setBasePath(sFolderPath);
+
+      // save folder
+      Command saveCMD = service.getCommandFactory().createFolderSaveCommand(folder);
+      service.execute(saveCMD);
+   }
+}

Added: trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderUpdate.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderUpdate.java	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderUpdate.java	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.portal.test.cms.commands;
+
+import java.net.URL;
+import java.util.Date;
+
+
+import javax.jcr.Property;
+import javax.jcr.Session;
+
+import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.impl.FolderImpl;
+import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.cms.util.RepositoryUtil;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
+
+/**
+ * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ */
+public class TestFolderUpdate extends AbstractCommandTestCase
+{
+   /**
+    * A test folder path *
+    */
+   String sFolderPath = "/alpha";
+
+   /**
+    * A test folder path for copied folder trees *
+    */
+   String sCopyToFolderPath = "/alpha/beta";
+
+   /**
+    * 
+    *
+    */
+   public TestFolderUpdate(DataSourceSupport.Config dsCfg)
+   {
+      super(dsCfg);
+   }
+   
+   /**
+    * 
+    *
+    */
+   public static TestSuite suite() throws Exception
+   {
+      URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+      DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
+      DatabaseTestSuite suite = new DatabaseTestSuite(configs);
+      suite.addTestCase(TestFolderUpdate.class);
+      return suite;       
+   }
+
+   
+   /**
+    * 
+    *
+    */
+   public void testFolderUpdate() throws Exception
+   {
+      createFolder();
+      // get folder
+      Command getCMD = service.getCommandFactory().createFolderGetCommand(sFolderPath);
+      Folder newFolder = (Folder) service.execute(getCMD);
+
+      // update folder
+      newFolder.setDescription("new folder description");
+      Command cmdUpdate = service.getCommandFactory().createFolderUpdateCommand(newFolder);
+      service.execute(cmdUpdate);
+
+      Session session = RepositoryUtil.login(service.getRepository(), "anonid", "");
+      Property prop = (Property) session.getItem("/alpha/portalcms:description");
+      System.out.println(prop.getString());
+      boolean descriptionupdated = ((Property) session.getItem("/alpha/portalcms:description")).getString().equals(
+            "new folder description");
+      assertTrue("Incorrect description for folder: ", descriptionupdated);
+      session.save();
+   }
+   
+   /**
+    * 
+    *
+    */
+   public void createFolder() throws CMSException
+   {
+      // create folder object
+      Folder folder = new FolderImpl();
+      folder.setCreationDate(new Date());
+      folder.setDescription("Folder description");
+      folder.setTitle("Folder Title");
+      folder.setLastModified(new Date());
+      folder.setName("Alpha Folder");
+      folder.setBasePath(sFolderPath);
+
+      // save folder
+      Command saveCMD = service.getCommandFactory().createFolderSaveCommand(folder);
+      service.execute(saveCMD);
+   }
+}

Modified: trunk/cms/src/resources/hibernate/domain.hbm.xml
===================================================================
--- trunk/cms/src/resources/hibernate/domain.hbm.xml	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/resources/hibernate/domain.hbm.xml	2006-09-18 22:34:16 UTC (rev 5225)
@@ -30,14 +30,14 @@
          <generator class="native"/>
       </id>
       <property
-            name="id"
+            name="nodeId"
             column="NODE_ID"
             type="string"
             length="36"/>
       <property
             name="data"
             column="NODE_DATA"
-            type="blob"
+            type="binary"
             length="100000000"
             not-null="true"/>
    </class>
@@ -49,14 +49,14 @@
          <generator class="native"/>
       </id>
       <property
-            name="id"
+            name="propId"
             column="PROP_ID"
             type="string"
             length="255"/>
       <property
             name="data"
             column="PROP_DATA"
-            type="blob"
+            type="binary"
             length="100000000"
             not-null="true"/>
    </class>
@@ -68,14 +68,14 @@
          <generator class="native"/>
       </id>
       <property
-            name="id"
+            name="refId"
             column="NODE_ID"
             type="string"
             length="36"/>
       <property
             name="data"
             column="REFS_DATA"
-            type="blob"
+            type="binary"
             length="100000000"
             not-null="true"/>
    </class>
@@ -106,14 +106,14 @@
          <generator class="native"/>
       </id>
       <property
-            name="id"
+            name="nodeId"
             column="NODE_ID"
             type="string"
             length="36"/>
       <property
             name="data"
             column="NODE_DATA"
-            type="blob"
+            type="binary"
             length="100000000"
             not-null="true"/>
    </class>
@@ -125,14 +125,14 @@
          <generator class="native"/>
       </id>
       <property
-            name="id"
+            name="propId"
             column="PROP_ID"
             type="string"
             length="255"/>
       <property
             name="data"
             column="PROP_DATA"
-            type="blob"
+            type="binary"
             length="100000000"
             not-null="true"/>
    </class>
@@ -144,14 +144,14 @@
          <generator class="native"/>
       </id>
       <property
-            name="id"
+            name="refId"
             column="NODE_ID"
             type="string"
             length="36"/>
       <property
             name="data"
             column="REFS_DATA"
-            type="blob"
+            type="binary"
             length="100000000"
             not-null="true"/>
    </class>
@@ -252,3 +252,4 @@
                 not-null="true"/>
    </class>
 </hibernate-mapping>
+

Modified: trunk/cms/src/resources/test/jcr/repository.xml
===================================================================
--- trunk/cms/src/resources/test/jcr/repository.xml	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/resources/test/jcr/repository.xml	2006-09-18 22:34:16 UTC (rev 5225)
@@ -43,7 +43,7 @@
        -->
        
        <!-- HibernatePersistentManager: uses RDBMS + Hibernate for storage -->
-       <PersistenceManager class="org.jboss.portal.cms.hibernate.state.HibernatePersistenceManager">
+       <PersistenceManager class="org.jboss.portal.cms.hibernate.state.JBossCachePersistenceManager">
           <param name="schemaObjectPrefix" value="WSP"/>
           <param name="JNDIName" value="java:/SessionFactory"/>
           <param name="externalBLOBs" value="false"/>
@@ -90,7 +90,7 @@
        -->
        
        <!-- HibernatePersistentManager: uses RDBMS + Hibernate for storage -->
-       <PersistenceManager class="org.jboss.portal.cms.hibernate.state.HibernatePersistenceManager">
+       <PersistenceManager class="org.jboss.portal.cms.hibernate.state.JBossCachePersistenceManager">
           <param name="schemaObjectPrefix" value="Version"/>
           <param name="JNDIName" value="java:/SessionFactory"/>
           <param name="externalBLOBs" value="false"/>

Added: trunk/cms/src/resources/test/log4j.xml
===================================================================
--- trunk/cms/src/resources/test/log4j.xml	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/resources/test/log4j.xml	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,305 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml,v 1.26.2.10 2006/04/21 17:29:20 csuconic Exp $ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <!-- ================================= -->
+   <!-- Preserve messages in a local file -->
+   <!-- ================================= -->
+
+   <!-- A time/date based rolling appender -->
+   <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      <param name="File" value="${jboss.server.log.dir}/server.log"/>
+      <param name="Append" value="false"/>
+      <param name="Threshold" value="ERROR"/>
+
+      <!-- Rollover at midnight each day -->
+      <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+      <!-- Rollover at the top of each hour
+      <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+      -->
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+         <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+         <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+          -->
+      </layout>
+   </appender>
+
+   <!-- A size based file rolling appender
+   <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+     <param name="File" value="${jboss.server.log.dir}/server.log"/>
+     <param name="Append" value="false"/>
+     <param name="MaxFileSize" value="500KB"/>
+     <param name="MaxBackupIndex" value="1"/>
+
+     <layout class="org.apache.log4j.PatternLayout">
+       <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+     </layout>	    
+   </appender>
+   -->
+
+   <!-- ============================== -->
+   <!-- Append messages to the console -->
+   <!-- ============================== -->
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <!-- ====================== -->
+   <!-- More Appender examples -->
+   <!-- ====================== -->
+
+   <!-- Buffer events and log them asynchronously
+   <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
+     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+     <appender-ref ref="FILE"/>
+     <appender-ref ref="CONSOLE"/>
+     <appender-ref ref="SMTP"/>
+   </appender>
+   -->
+
+   <!-- EMail events to an administrator
+   <appender name="SMTP" class="org.apache.log4j.net.SMTPAppender">
+     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+     <param name="Threshold" value="ERROR"/>
+     <param name="To" value="admin at myhost.domain.com"/>
+     <param name="From" value="nobody at myhost.domain.com"/>
+     <param name="Subject" value="JBoss Sever Errors"/>
+     <param name="SMTPHost" value="localhost"/>
+     <param name="BufferSize" value="10"/>
+     <layout class="org.apache.log4j.PatternLayout">
+       <param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m%n"/>
+     </layout>
+   </appender>
+   -->
+
+   <!-- Syslog events
+   <appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">
+     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+     <param name="Facility" value="LOCAL7"/>
+     <param name="FacilityPrinting" value="true"/>
+     <param name="SyslogHost" value="localhost"/>
+     <layout class="org.apache.log4j.PatternLayout">
+       <param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m%n"/>
+     </layout>
+   </appender>
+   -->
+
+   <!-- Log events to JMS (requires a topic to be created)
+   <appender name="JMS" class="org.apache.log4j.net.JMSAppender">
+     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+     <param name="Threshold" value="ERROR"/>
+     <param name="TopicConnectionFactoryBindingName" value="java:/ConnectionFactory"/>
+     <param name="TopicBindingName" value="topic/MyErrorsTopic"/>
+   </appender>
+   -->
+
+   <!-- Log events through SNMP
+   <appender name="TRAP_LOG" class="org.apache.log4j.ext.SNMPTrapAppender">
+     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+     <param name="ImplementationClassName" value="org.apache.log4j.ext.JoeSNMPTrapSender"/>
+     <param name="ManagementHost" value="127.0.0.1"/>
+     <param name="ManagementHostTrapListenPort" value="162"/>
+     <param name="EnterpriseOID" value="1.3.6.1.4.1.24.0"/>
+     <param name="LocalIPAddress" value="127.0.0.1"/>
+     <param name="LocalTrapSendPort" value="161"/>
+     <param name="GenericTrapType" value="6"/>
+     <param name="SpecificTrapType" value="12345678"/>
+     <param name="CommunityString" value="public"/>
+     <param name="ForwardStackTraceWithTrap" value="true"/>
+     <param name="Threshold" value="DEBUG"/>
+     <param name="ApplicationTrapOID" value="1.3.6.1.4.1.24.12.10.22.64"/>
+     <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%d,%p,[%t],[%c],%m%n"/>
+     </layout>
+   </appender>
+   -->
+
+   <!--  Emit events as JMX notifications
+   <appender name="JMX" class="org.jboss.monitor.services.JMXNotificationAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      
+      <param name="Threshold" value="WARN"/>
+      <param name="ObjectName" value="jboss.system:service=Logging,type=JMXNotificationAppender"/>
+      
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d %-5p [%c] %m"/>
+      </layout>
+   </appender>
+   -->
+   
+   <!-- ================ -->
+   <!-- Limit categories -->
+   <!-- ================ -->
+
+   <!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
+   <category name="org.apache">
+      <priority value="INFO"/>
+   </category>
+
+   <!-- Limit the org.jboss.serial (jboss-serialization) to INFO as its DEBUG is verbose -->
+   <category name="org.jboss.serial">
+      <priority value="INFO"/>
+   </category>
+
+   <!-- Limit the org.jgroups category to WARN as its INFO is verbose -->
+   <category name="org.jgroups">
+      <priority value="ERROR"/>
+   </category>
+   
+   <category name="org.jboss.cache">
+         <priority value="ERROR"/>
+   </category>
+
+   <!-- Limit the jacorb category to WARN as its INFO is verbose -->
+   <category name="jacorb">
+      <priority value="WARN"/>
+   </category>
+
+   <!-- Limit JBoss categories
+   <category name="org.jboss">
+      <priority value="INFO"/>
+   </category>
+   -->
+
+   <!-- Limit the JSR77 categories -->
+   <category name="org.jboss.management">
+      <priority value="INFO"/>
+   </category>
+
+   <!-- Limit Axis based webservice category -->
+   <category name="org.jboss.webservice">
+      <priority value="DEBUG"/>
+   </category>
+   <category name="org.jboss.axis">
+      <priority value="INFO"/>
+   </category>
+
+   <!-- Limit JBossWS webservice category
+   <category name="org.jboss.ws">
+      <priority value="DEBUG"/>
+   </category>
+   -->
+
+   <!-- Decrease the priority threshold for the org.jboss.varia category
+   <category name="org.jboss.varia">
+     <priority value="DEBUG"/>
+   </category>
+   -->
+
+   <!-- Show the evolution of the DataSource pool in the logs [inUse/Available/Max]
+   <category name="org.jboss.resource.connectionmanager.JBossManagedConnectionPool">
+     <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+   </category>
+   -->
+
+   <!--
+      | An example of enabling the custom TRACE level priority that is used
+      | by the JBoss internals to diagnose low level details. This example
+      | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
+      | subpackages. This will produce A LOT of logging output.
+   <category name="org.jboss.system">
+     <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+   </category>
+   <category name="org.jboss.ejb.plugins">
+     <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+   </category>
+   -->
+  
+   <!--
+       | Logs these events to SNMP:
+           - server starts/stops
+           - cluster evolution (node death/startup)
+           - When an EJB archive is deployed (and associated verified messages)
+           - When an EAR archive is deployed
+      	 
+   <category name="org.jboss.system.server.Server">
+     <priority value="INFO" />
+     <appender-ref ref="TRAP_LOG"/>
+   </category>
+  
+   <category name="org.jboss.ha.framework.interfaces.HAPartition.lifecycle">
+     <priority value="INFO" />
+     <appender-ref ref="TRAP_LOG"/>
+   </category>
+
+   <category name="org.jboss.deployment.MainDeployer">
+     <priority value="ERROR" />
+     <appender-ref ref="TRAP_LOG"/>
+   </category>
+   
+   <category name="org.jboss.ejb.EJBDeployer">
+     <priority value="INFO" />
+     <appender-ref ref="TRAP_LOG"/>
+   </category>
+   
+   <category name="org.jboss.deployment.EARDeployer">
+     <priority value="INFO" />
+     <appender-ref ref="TRAP_LOG"/>
+   </category>
+  
+   -->
+
+   <!-- ======================= -->
+   <!-- Setup the Root category -->
+   <!-- ======================= -->
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+      <appender-ref ref="FILE"/>
+   </root>
+
+   <!-- Clustering logging -->
+   <!-- Uncomment the following to redirect the org.jgroups and
+      org.jboss.ha categories to a cluster.log file.
+
+   <appender name="CLUSTER" class="org.jboss.logging.appender.RollingFileAppender">
+     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+     <param name="File" value="${jboss.server.log.dir}/cluster.log"/>
+     <param name="Append" value="false"/>
+     <param name="MaxFileSize" value="500KB"/>
+     <param name="MaxBackupIndex" value="1"/>
+
+     <layout class="org.apache.log4j.PatternLayout">
+       <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+     </layout>
+   </appender>
+   <category name="org.jgroups">
+     <priority value="DEBUG" />
+     <appender-ref ref="CLUSTER"/>
+   </category>
+   <category name="org.jboss.ha">
+     <priority value="DEBUG" />
+     <appender-ref ref="CLUSTER"/>
+   </category>
+   -->
+
+</log4j:configuration>

Added: trunk/cms/src/resources/test/pm-cache.xml
===================================================================
--- trunk/cms/src/resources/test/pm-cache.xml	2006-09-18 22:15:55 UTC (rev 5224)
+++ trunk/cms/src/resources/test/pm-cache.xml	2006-09-18 22:34:16 UTC (rev 5225)
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Sample TreeCache Service Configuration                               -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<server>
+    <!-- ==================================================================== -->
+    <!-- Defines TreeCache configuration                                      -->
+    <!-- ==================================================================== -->
+
+   <!-- TreeCache configuration used to cache CMS data -->
+   <mbean code="org.jboss.cache.TreeCache"
+           name="cms.pm.cache:service=TreeCache">
+   
+           <depends>jboss:service=Naming</depends>
+           <depends>jboss:service=TransactionManager</depends>
+           <depends>portal:service=Hibernate,type=CMS</depends>
+   
+           <!--
+           Configure the TransactionManager
+           -->
+           <attribute name="TransactionManagerLookupClass">org.jboss.cache.GenericTransactionManagerLookup</attribute>
+           
+           <!--
+		Node locking scheme:
+		OPTIMISTIC
+		PESSIMISTIC (default)
+		using the OPTIMISTIC scheme, the ISOLATION_LEVEL value is ignored
+	   -->
+	   <!--attribute name="NodeLockingScheme">OPTIMISTIC</attribute-->
+   
+           <!--
+               Isolation level : SERIALIZABLE
+                                 REPEATABLE_READ (default)
+                                 READ_COMMITTED
+                                 READ_UNCOMMITTED
+                                 NONE
+           -->
+           <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+           
+           	   
+   
+           <!--
+                Valid modes are LOCAL
+                                REPL_ASYNC
+                                REPL_SYNC
+                                INVALIDATION_ASYNC
+                                INVALIDATION_SYNC
+           -->
+           <attribute name="CacheMode">INVALIDATION_ASYNC</attribute>
+   
+           <!--
+           Just used for async repl: use a replication queue
+           -->
+           <attribute name="UseReplQueue">false</attribute>
+   
+           <!--
+               Replication interval for replication queue (in ms)
+           -->
+           <attribute name="ReplQueueInterval">0</attribute>
+   
+           <!--
+               Max number of elements which trigger replication
+           -->
+           <attribute name="ReplQueueMaxElements">0</attribute>
+   
+           <!-- Name of cluster. Needs to be the same for all clusters, in order
+                to find each other
+           -->
+           <attribute name="ClusterName">JCRPMCache</attribute>
+   
+           <!-- JGroups protocol stack properties. Can also be a URL,
+                e.g. file:/home/bela/default.xml
+              <attribute name="ClusterProperties"></attribute>
+           -->
+   
+           <attribute name="ClusterConfig">
+               <config>
+                   <!-- UDP: if you have a multihomed machine,
+                   set the bind_addr attribute to the appropriate NIC IP address -->
+                   <!-- UDP: On Windows machines, because of the media sense feature
+                    being broken with multicast (even after disabling media sense)
+                    set the loopback attribute to true -->
+                   <UDP mcast_addr="228.1.2.3" mcast_port="48866"
+                       ip_ttl="64" ip_mcast="true" 
+                       receive_on_all_interfaces="true"
+                       mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
+                       ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
+                       loopback="false"/>
+                   <PING timeout="2000" num_initial_members="3"
+                       up_thread="false" down_thread="false"/>
+                   <MERGE2 min_interval="10000" max_interval="20000"/>
+                   <!--        <FD shun="true" up_thread="true" down_thread="true" />-->
+                   <FD_SOCK/>
+                   <VERIFY_SUSPECT timeout="1500"
+                       up_thread="false" down_thread="false"/>
+                   <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
+                       max_xmit_size="8192" up_thread="false" down_thread="false"/>
+                   <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10"
+                       down_thread="false"/>
+                   <pbcast.STABLE desired_avg_gossip="20000"
+                       up_thread="false" down_thread="false"/>
+                   <FRAG frag_size="8192"
+                       down_thread="false" up_thread="false"/>
+                   <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
+                       shun="true" print_local_addr="true"/>
+                   <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
+               </config>
+           </attribute>
+   
+           <!--
+            Whether or not to fetch state on joining a cluster
+            NOTE this used to be called FetchStateOnStartup and has been renamed to be more descriptive.
+           -->
+           <attribute name="FetchInMemoryState">false</attribute>
+   
+           <!--
+               The max amount of time (in milliseconds) we wait until the
+               initial state (ie. the contents of the cache) are retrieved from
+               existing members in a clustered environment
+           -->
+           <attribute name="InitialStateRetrievalTimeout">20000</attribute>
+   
+           <!--
+               Number of milliseconds to wait until all responses for a
+               synchronous call have been received.
+           -->
+           <attribute name="SyncReplTimeout">20000</attribute>
+   
+           <!-- Max number of milliseconds to wait for a lock acquisition -->
+           <attribute name="LockAcquisitionTimeout">15000</attribute>
+   
+   
+           <!-- Name of the eviction policy class. -->
+           <attribute name="EvictionPolicyClass"></attribute>
+          
+          <!--
+             Indicate whether to use region based marshalling or not. Set this to true if you are running under a scoped
+             class loader, e.g., inside an application server. Default is "false".
+          -->
+           <attribute name="UseRegionBasedMarshalling">false</attribute>
+           
+           <!--
+           	Configuring the JDBCCacheLoader
+           -->           
+           <attribute name="CacheLoaderConfiguration">
+               <config>                
+                   <passivation>false</passivation>
+                   <preload></preload>
+                   <shared>false</shared>
+                   <cacheloader>
+                       <class>org.jboss.portal.cms.hibernate.state.PortalCMSCacheLoader</class>
+                       <properties></properties>
+                       <async>false</async>
+                       <fetchPersistentState>true</fetchPersistentState>
+                       <ignoreModifications>false</ignoreModifications>
+                   </cacheloader>
+               </config>
+           </attribute>
+    </mbean>
+</server>




More information about the jboss-svn-commits mailing list