[jboss-cvs] JBossAS SVN: r93353 - in branches/Branch_5_x: system/src/main/org/jboss/system/server/profileservice/persistence and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Sep 10 07:23:31 EDT 2009


Author: emuckenhuber
Date: 2009-09-10 07:23:30 -0400 (Thu, 10 Sep 2009)
New Revision: 93353

Added:
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/AbstractDeployTestBase.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ConnectionFactoryUnitTestCase.java
Modified:
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/DefaultManagedObjectPersistencePlugin.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/component/ComponentMapper.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/BasicDeploymentRepository.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/StaticProfileFactory.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DataSourceUnitTestCase.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/PlatformMBeanUnitTestCase.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java
Log:
update testcases and port some missing changes.

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java	2009-09-10 11:06:05 UTC (rev 93352)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java	2009-09-10 11:23:30 UTC (rev 93353)
@@ -32,7 +32,6 @@
 import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.aop.joinpoint.InvocationResponse;
 import org.jboss.aspects.remoting.AOPRemotingInvocationHandler;
-import org.jboss.deployers.client.spi.IncompleteDeploymentException;
 import org.jboss.deployers.spi.management.deploy.DeploymentID;
 import org.jboss.deployers.spi.management.deploy.DeploymentManager;
 import org.jboss.logging.Logger;
@@ -290,29 +289,11 @@
          // Schedule start for the deployment
          deployments.add(start(name, deploymentRepository));
       }
-
-      try
-      {
       // Process
       deployer.process();
       // CheckComplete
       deployer.checkComplete(
             deployments.toArray(new String[deployments.size()]));
-      }
-      catch(IncompleteDeploymentException e)
-      {
-         Map<String, Throwable> errors = e.getIncompleteDeployments().getContextsInError();
-         Exception ex = e;
-         // TODO: how to handle multiple erorrs
-         if(errors.size() >= 1)
-         {
-            Throwable t = errors.values().iterator().next();
-            IncompleteDeploymentException ide = new IncompleteDeploymentException(e.getIncompleteDeployments());
-            ide.initCause(t);
-            ex = ide;
-         }
-         throw ex;
-      }
       
       log.info("End start, "+ deployments);
    }

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/DefaultManagedObjectPersistencePlugin.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/DefaultManagedObjectPersistencePlugin.java	2009-09-10 11:06:05 UTC (rev 93352)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/DefaultManagedObjectPersistencePlugin.java	2009-09-10 11:23:30 UTC (rev 93353)
@@ -51,7 +51,17 @@
    {
       return Object.class.getName();
    }
+
+   protected DefaultPersistenceDelegate getPersistenceDelegate()
+   {
+      return persistenceDelegate;
+   }
    
+   protected DefaultRecreationDelegate getRecreationDelegate()
+   {
+      return recreationDelegate;
+   }
+   
    public AbstractValuePersistence getValuePersistence()
    {
       return persistenceDelegate.getValuePersistence();

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/component/ComponentMapper.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/component/ComponentMapper.java	2009-09-10 11:06:05 UTC (rev 93352)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/component/ComponentMapper.java	2009-09-10 11:23:30 UTC (rev 93353)
@@ -25,6 +25,11 @@
 import org.jboss.system.server.profileservice.persistence.xml.PersistedComponent;
 
 /**
+ * The ComponentMapper maps a ManagedComponent to it's parent ManagedObject
+ * attachment. This is used to identify the ManagedComponents in their
+ * deployment descriptor, create the persistence information and
+ * restore them again.
+ * 
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/BasicDeploymentRepository.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/BasicDeploymentRepository.java	2009-09-10 11:06:05 UTC (rev 93352)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/BasicDeploymentRepository.java	2009-09-10 11:23:30 UTC (rev 93353)
@@ -278,8 +278,8 @@
          
          if(deleteFile && root != null)
          {
-            // Delete the file
-            if(root.delete() == false)
+            // Delete the file, fail if it can't be deleted and still exists
+            if(root.delete() == false && root.exists())
                throw new IOException("Failed to delete: " + root);
             
             cleanUpRoot(root);  

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/StaticProfileFactory.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/StaticProfileFactory.java	2009-09-10 11:06:05 UTC (rev 93352)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/StaticProfileFactory.java	2009-09-10 11:23:30 UTC (rev 93353)
@@ -196,10 +196,8 @@
       }
       // Create bootstrap profile meta data
       ProfileKey bootstrapKey = new ProfileKey(bootstrapName);
-      BasicProfileMetaData bootstrap = new FilteredProfileMetaData(
-            null, null, bootstrapName);
-      bootstrap.setSource(createSource(new URI[] { bootstrapURI }, false));
-      bootstrap.setSubprofiles(createSubProfileMetaData(subprofileNames));
+      ProfileMetaData bootstrap = createProfileMetaData(bootstrapName, false, 
+            new URI[] { bootstrapURI }, subprofileNames );
       addProfile(bootstrapKey, bootstrap);
       
       subprofileNames = createSubprofileNames(subprofileNames, bootstrapName);

Added: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/AbstractDeployTestBase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/AbstractDeployTestBase.java	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/AbstractDeployTestBase.java	2009-09-10 11:23:30 UTC (rev 93353)
@@ -0,0 +1,247 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, 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.test.deployers.test;
+
+import javax.naming.InitialContext;
+
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.deploy.DeploymentID;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
+import org.jboss.managed.api.DeploymentState;
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.profileservice.spi.DeploymentOption;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractDeployTestBase extends JBossTestCase
+{
+
+   /** A basic failing deployment. */
+   final static String FAILING_DEPLOYMENT = "deployers-failing-jboss-beans.xml";
+   /** A empty deployment, this will deploy ok. */
+   final static String EMTPY_DEPLOYMENT = "deployers-empty-jboss-beans.xml";
+   /** A simple nested deployment. */
+   final static String NESTED_DEPLOYMENT = "profileservice-datasource.ear";
+   
+   /** The deployers target profile. */
+   final static ProfileKey deployersKey = new ProfileKey("deployers");
+   
+   /** The deployment manager. */
+   private DeploymentManager deployMgr;
+   /** The management view. */
+   private ManagementView mgtView;
+   
+   public AbstractDeployTestBase(String name)
+   {
+      super(name);
+   }
+ 
+   void deployFailed(boolean isCopyContent) throws Exception
+   {
+      DeploymentProgress start = distributeAndStart(FAILING_DEPLOYMENT, isCopyContent);
+      assertFailed(start);
+      assertDeploymentState(start.getDeploymentID(), DeploymentState.FAILED);
+   }
+
+   void deployEmpty(boolean isCopyContent) throws Exception
+   {
+      DeploymentProgress start = distributeAndStart(EMTPY_DEPLOYMENT, isCopyContent);
+      assertComplete(start);
+      assertDeploymentState(start.getDeploymentID(), DeploymentState.STARTED);
+   }
+
+   DeploymentProgress distributeAndStart(String deploymentName, boolean copyContent) throws Exception
+   {
+      return distributeAndStart(deploymentName, copyContent, true);
+   }
+
+   DeploymentProgress distributeAndStart(String deploymentName, boolean copyContent, boolean checkStopped) throws Exception
+   {
+      // The deployment manager
+      DeploymentManager deployMgr = getDeploymentManager();
+
+      // Distribute
+      DeploymentProgress distribute = deployMgr.distribute(deploymentName,
+            getDeployURL(deploymentName), copyContent);
+      distribute.run();
+      // Distribute always has to complete
+      assertComplete(distribute);
+      // check if the app is stopped
+      if(checkStopped)
+         assertDeploymentState(distribute.getDeploymentID(), DeploymentState.STOPPED);
+
+      // Get the repository names
+      String[] uploadedNames = distribute.getDeploymentID().getRepositoryNames();
+      assertNotNull(uploadedNames);
+
+      // Start
+      DeploymentProgress start = deployMgr.start(uploadedNames);
+      start.run();
+      // Return the start deployment progress
+      return start;
+   }
+   
+   DeploymentProgress distributeAndStart(String deploymentName, DeploymentOption... options) throws Exception
+   {
+      // The deployment manager
+      DeploymentManager deployMgr = getDeploymentManager();
+
+      // Distribute
+      DeploymentProgress distribute = deployMgr.distribute(deploymentName,
+            getDeployURL(deploymentName), options);
+      distribute.run();
+      // Distribute always has to complete
+      assertComplete(distribute);
+      // check if the app is stopped
+      assertDeploymentState(distribute.getDeploymentID(), DeploymentState.STOPPED);
+
+      // Get the repository names
+      String[] uploadedNames = distribute.getDeploymentID().getRepositoryNames();
+      assertNotNull(uploadedNames);
+
+      // Start
+      DeploymentProgress start = deployMgr.start(uploadedNames);
+      start.run();
+      // Return the start deployment progress
+      return start;      
+   }
+
+   void redeployCheckComplete(String name) throws Exception
+   {
+      // The deployment manager
+      DeploymentManager deployMgr = getDeploymentManager();
+
+      // Redeploy
+      DeploymentProgress redeploy = deployMgr.redeploy(name);
+      redeploy.run();
+      assertComplete(redeploy);
+      assertDeploymentState(redeploy.getDeploymentID(), DeploymentState.STARTED);
+   }
+
+   void prepareCheckComplete(String name) throws Exception
+   {
+      // The deployment manager
+      DeploymentManager deployMgr = getDeploymentManager();
+
+      // Prepare
+      DeploymentProgress prepare = deployMgr.prepare(name);
+      prepare.run();
+      assertComplete(prepare);
+   }
+
+   void stopAndRemove(String[] names) throws Exception
+   {
+      // The deployment manager
+      DeploymentManager deployMgr = getDeploymentManager();
+
+      try
+      {
+         DeploymentProgress stop = deployMgr.stop(names);
+         stop.run();
+         assertComplete(stop);
+         assertDeploymentState(stop.getDeploymentID(), DeploymentState.STOPPED);
+      }
+      catch(Exception e)
+      {
+         log.debug("stopAndRemove Failed ", e);
+         throw e;
+      }
+      finally
+      {
+         DeploymentProgress remove = deployMgr.remove(names);
+         remove.run();
+         assertComplete(remove);
+
+         String name = remove.getDeploymentID().getNames()[0];
+         ManagementView mgtView = getManagementView();
+         try
+         {
+            mgtView.getDeployment(name);
+            fail("Did not see NoSuchDeploymentException");
+         }
+         catch(NoSuchDeploymentException ok)
+         {
+            //
+         }
+      }
+   }
+
+   void assertFailed(DeploymentProgress progress) throws Exception
+   {
+      assertFalse(progress.getDeploymentStatus().isCompleted());
+      assertTrue(progress.getDeploymentStatus().isFailed());
+   }
+
+   void assertDeploymentState(DeploymentID DtID, DeploymentState state) throws Exception
+   {
+      String name = DtID.getNames()[0];
+      ManagementView mgtView = getManagementView();
+      ManagedDeployment md = mgtView.getDeployment(name);
+      assertNotNull(name, md);
+      assertEquals("deployment: " + name, state, md.getDeploymentState());
+      log.debug(md.getSimpleName() + " " + md.getTypes());
+   }
+
+   void assertComplete(DeploymentProgress progress) throws Exception
+   {
+      if(progress.getDeploymentStatus().isFailed())
+      {
+         throw new RuntimeException("deployment failed.", progress.getDeploymentStatus().getFailure());
+      }
+      //
+      assertTrue(progress.getDeploymentStatus().isCompleted());
+   }
+
+   DeploymentManager getDeploymentManager() throws Exception
+   {
+      if(this.deployMgr == null)
+      {
+         this.deployMgr = getProfileService().getDeploymentManager();
+      }
+      return deployMgr;
+   }
+
+   ManagementView getManagementView() throws Exception
+   {
+      if(this.mgtView == null)
+      {
+         this.mgtView = getProfileService().getViewManager();
+      }
+      this.mgtView.load();
+      return this.mgtView;
+   }
+
+   ProfileService getProfileService() throws Exception
+   {
+      InitialContext ctx = getInitialContext();
+      return (ProfileService) ctx.lookup("ProfileService");
+   }
+   
+}
+

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java	2009-09-10 11:06:05 UTC (rev 93352)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java	2009-09-10 11:23:30 UTC (rev 93353)
@@ -24,13 +24,10 @@
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.InputStream;
+import java.net.URI;
 import java.util.Collection;
 
-import javax.naming.InitialContext;
-
 import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.deployers.spi.management.deploy.DeploymentID;
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
 import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
 import org.jboss.managed.api.ComponentType;
 import org.jboss.managed.api.DeploymentState;
@@ -41,8 +38,8 @@
 import org.jboss.profileservice.spi.DeploymentOption;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
 import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.test.JBossTestCase;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
 
 /**
  * Basic DeploymentManager test.
@@ -50,24 +47,12 @@
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public class DeploymentManagerUnitTestCase extends JBossTestCase
+public class DeploymentManagerUnitTestCase extends AbstractDeployTestBase
 {
-   /** A basic failing deployment. */
-   final static String FAILING_DEPLOYMENT = "deployers-failing-jboss-beans.xml";
-   /** A empty deployment, this will deploy ok. */
-   final static String EMTPY_DEPLOYMENT = "deployers-empty-jboss-beans.xml";
-   /** A simple nested deployment. */
-   final static String NESTED_DEPLOYMENT = "profileservice-datasource.ear";
-   /** A deployment picked up by the HDScanner. */
-   final static String HD_DEPLOYMENT = "hd-jboss-beans.xml";
 
-   /** The deployers target profile. */
-   final static ProfileKey deployersKey = new ProfileKey("deployers");
-
-   /** The deployment manager. */
-   private DeploymentManager deployMgr;
-   private ManagementView mgtView;
-
+   /** A deployment picked up by the HDScanner. */
+   private final static String HD_DEPLOYMENT = "hd-jboss-beans.xml";
+   
    public DeploymentManagerUnitTestCase(String name)
    {
       super(name);
@@ -189,7 +174,7 @@
          distributeAndStart(NESTED_DEPLOYMENT,
                new DeploymentOption[] { DeploymentOption.Explode});
 
-         // Test fail if exsits
+         // Test fail if exists
          DeploymentProgress override = getDeploymentManager().distribute(NESTED_DEPLOYMENT,
                getDeployURL(NESTED_DEPLOYMENT),
                new DeploymentOption[] { DeploymentOption.FailIfExists});
@@ -238,6 +223,38 @@
    }
 
    /**
+    * Test some conflicts when deleting a file manually.
+    * This distributes a deployment into the deployers folder,
+    * where we don't perform HDScanning. We delete the file
+    * manually and then try to remove this file with the 
+    * DeploymentManager.
+    * 
+    * @throws Exception
+    */
+   public void testRemoveConflict() throws Exception
+   {
+      getDeploymentManager().loadProfile(deployersKey);
+      try
+      {
+         DeploymentProgress start = distributeAndStart(NESTED_DEPLOYMENT, true, false);
+         String deployed = start.getDeploymentID().getRepositoryNames()[0];
+         
+         // Delete the file manually
+         VFS.init();
+         VirtualFile f = VFS.getRoot(new URI(deployed));
+         assertTrue(deployed, f.exists());
+         assertTrue("deleted " + deployed, f.delete());
+         
+         stopAndRemove(new String[] { NESTED_DEPLOYMENT });
+      }
+      finally
+      {
+         // Make sure that we release the profile
+         getDeploymentManager().releaseProfile();
+      }
+   }
+   
+   /**
     * Test the hd deployment. This deployment will get copied
     * to the deploy folder after the server is started. This
     * deployment needs to get picked up by the HDScanner and
@@ -259,7 +276,7 @@
       // Manually copy the deployment
       File output = copyFile(new File(homeDir, "deploy/"), HD_DEPLOYMENT);
       // Wait for HDScanner
-      Thread.sleep(10000);
+      Thread.sleep(8000);
       
       // Reload mgtView
       mgtView = getManagementView();
@@ -269,7 +286,7 @@
 
       output.delete();
       // Wait for HDScanner
-      Thread.sleep(10000);
+      Thread.sleep(8000);
       try
       {
          getManagementView().getDeployment(HD_DEPLOYMENT);
@@ -310,186 +327,5 @@
       }
       return output;
    }
-   
-   void deployFailed(boolean isCopyContent) throws Exception
-   {
-      DeploymentProgress start = distributeAndStart(FAILING_DEPLOYMENT, isCopyContent);
-      assertFailed(start);
-      assertDeploymentState(start.getDeploymentID(), DeploymentState.FAILED);
-   }
 
-   void deployEmpty(boolean isCopyContent) throws Exception
-   {
-      DeploymentProgress start = distributeAndStart(EMTPY_DEPLOYMENT, isCopyContent);
-      assertComplete(start);
-      assertDeploymentState(start.getDeploymentID(), DeploymentState.STARTED);
-   }
-
-   DeploymentProgress distributeAndStart(String deploymentName, boolean copyContent) throws Exception
-   {
-      return distributeAndStart(deploymentName, copyContent, true);
-   }
-
-   DeploymentProgress distributeAndStart(String deploymentName, boolean copyContent, boolean checkStopped) throws Exception
-   {
-      // The deployment manager
-      DeploymentManager deployMgr = getDeploymentManager();
-
-      // Distribute
-      DeploymentProgress distribute = deployMgr.distribute(deploymentName,
-            getDeployURL(deploymentName), copyContent);
-      distribute.run();
-      // Distribute always has to complete
-      assertComplete(distribute);
-      // check if the app is stopped
-      if(checkStopped)
-         assertDeploymentState(distribute.getDeploymentID(), DeploymentState.STOPPED);
-
-      // Get the repository names
-      String[] uploadedNames = distribute.getDeploymentID().getRepositoryNames();
-      assertNotNull(uploadedNames);
-
-      // Start
-      DeploymentProgress start = deployMgr.start(uploadedNames);
-      start.run();
-      // Return the start deployment progress
-      return start;
-   }
-   
-   DeploymentProgress distributeAndStart(String deploymentName, DeploymentOption... options) throws Exception
-   {
-      // The deployment manager
-      DeploymentManager deployMgr = getDeploymentManager();
-
-      // Distribute
-      DeploymentProgress distribute = deployMgr.distribute(deploymentName,
-            getDeployURL(deploymentName), options);
-      distribute.run();
-      // Distribute always has to complete
-      assertComplete(distribute);
-      // check if the app is stopped
-      assertDeploymentState(distribute.getDeploymentID(), DeploymentState.STOPPED);
-
-      // Get the repository names
-      String[] uploadedNames = distribute.getDeploymentID().getRepositoryNames();
-      assertNotNull(uploadedNames);
-
-      // Start
-      DeploymentProgress start = deployMgr.start(uploadedNames);
-      start.run();
-      // Return the start deployment progress
-      return start;      
-   }
-
-   void redeployCheckComplete(String name) throws Exception
-   {
-      // The deployment manager
-      DeploymentManager deployMgr = getDeploymentManager();
-
-      // Redeploy
-      DeploymentProgress redeploy = deployMgr.redeploy(name);
-      redeploy.run();
-      assertComplete(redeploy);
-      assertDeploymentState(redeploy.getDeploymentID(), DeploymentState.STARTED);
-   }
-
-   void prepareCheckComplete(String name) throws Exception
-   {
-      // The deployment manager
-      DeploymentManager deployMgr = getDeploymentManager();
-
-      // Prepare
-      DeploymentProgress prepare = deployMgr.prepare(name);
-      prepare.run();
-      assertComplete(prepare);
-   }
-
-   void stopAndRemove(String[] names) throws Exception
-   {
-      // The deployment manager
-      DeploymentManager deployMgr = getDeploymentManager();
-
-      try
-      {
-         DeploymentProgress stop = deployMgr.stop(names);
-         stop.run();
-         assertComplete(stop);
-         assertDeploymentState(stop.getDeploymentID(), DeploymentState.STOPPED);
-      }
-      catch(Exception e)
-      {
-         log.debug("stopAndRemove Failed ", e);
-         throw e;
-      }
-      finally
-      {
-         DeploymentProgress remove = deployMgr.remove(names);
-         remove.run();
-         assertComplete(remove);
-
-         String name = remove.getDeploymentID().getNames()[0];
-         ManagementView mgtView = getManagementView();
-         try
-         {
-            mgtView.getDeployment(name);
-            fail("Did not see NoSuchDeploymentException");
-         }
-         catch(NoSuchDeploymentException ok)
-         {
-            //
-         }
-      }
-   }
-
-   void assertFailed(DeploymentProgress progress) throws Exception
-   {
-      assertFalse(progress.getDeploymentStatus().isCompleted());
-      assertTrue(progress.getDeploymentStatus().isFailed());
-   }
-
-   void assertDeploymentState(DeploymentID DtID, DeploymentState state) throws Exception
-   {
-      String name = DtID.getNames()[0];
-      ManagementView mgtView = getManagementView();
-      ManagedDeployment md = mgtView.getDeployment(name);
-      assertNotNull(name, md);
-      assertEquals("deployment: " + name, state, md.getDeploymentState());
-      log.debug(md.getSimpleName() + " " + md.getTypes());
-   }
-
-   void assertComplete(DeploymentProgress progress) throws Exception
-   {
-      if(progress.getDeploymentStatus().isFailed())
-      {
-         throw new RuntimeException("deployment failed.", progress.getDeploymentStatus().getFailure());
-      }
-      //
-      assertTrue(progress.getDeploymentStatus().isCompleted());
-   }
-
-   DeploymentManager getDeploymentManager() throws Exception
-   {
-      if(this.deployMgr == null)
-      {
-         this.deployMgr = getProfileService().getDeploymentManager();
-      }
-      return deployMgr;
-   }
-
-   ManagementView getManagementView() throws Exception
-   {
-      if(this.mgtView == null)
-      {
-         this.mgtView = getProfileService().getViewManager();
-      }
-      this.mgtView.load();
-      return this.mgtView;
-   }
-
-   ProfileService getProfileService() throws Exception
-   {
-      InitialContext ctx = getInitialContext();
-      return (ProfileService) ctx.lookup("ProfileService");
-   }
-
 }

Added: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ConnectionFactoryUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ConnectionFactoryUnitTestCase.java	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ConnectionFactoryUnitTestCase.java	2009-09-10 11:23:30 UTC (rev 93353)
@@ -0,0 +1,523 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.test.profileservice.test;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.management.KnownComponentTypes;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.DeploymentTemplateInfo;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.types.MapCompositeMetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.MapCompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
+
+/** Test of using ProfileService
+
+ @author Scott.Stark at jboss.org
+ @version $Revision: 93155 $
+ */
+public class ConnectionFactoryUnitTestCase extends AbstractProfileServiceTest
+{
+   
+   /**
+    * We need to define the order in which tests runs
+    * @return
+    * @throws Exception
+    */
+   public static Test suite() throws Exception
+   {
+      TestSuite suite = new TestSuite();
+
+      // DataSource
+      suite.addTest(new ConnectionFactoryUnitTestCase("testAddDataSource"));
+      suite.addTest(new ConnectionFactoryUnitTestCase("testRemoveDataSource"));
+      suite.addTest(new ConnectionFactoryUnitTestCase("testAddXADataSource"));
+      suite.addTest(new ConnectionFactoryUnitTestCase("testRemoveXADataSource"));
+      suite.addTest(new ConnectionFactoryUnitTestCase("testAddTxConnectionFactory"));
+      suite.addTest(new ConnectionFactoryUnitTestCase("testRemoveTxConnectionFactory"));
+      suite.addTest(new ConnectionFactoryUnitTestCase("testAddTxXAConnectionFactory"));
+      suite.addTest(new ConnectionFactoryUnitTestCase("testRemoveTxXAConnectionFactory"));
+      suite.addTest(new ConnectionFactoryUnitTestCase("testAddNoTxConnectionFactory"));
+      suite.addTest(new ConnectionFactoryUnitTestCase("testRemoveNoTxConnectionFactory"));
+      suite.addTest(new ConnectionFactoryUnitTestCase("testAddNoTxDataSource"));
+      suite.addTest(new ConnectionFactoryUnitTestCase("testRemoveNoTxDataSource"));
+
+      return suite;
+   }
+
+   public ConnectionFactoryUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * Test adding a new hsql DataSource deployment (JBAS-4671)
+    * @throws Exception
+    */
+   public void testAddDataSource() throws Exception
+   {
+      String jndiName = "TestLocalTxDs";
+      Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
+      addNonXaDsProperties(propValues, jndiName, "jboss-local-jdbc.rar", "javax.sql.DataSource");
+      createComponentTest("LocalTxDataSourceTemplate", propValues, "testLocalTxDs",
+         KnownComponentTypes.DataSourceTypes.LocalTx.getType(), jndiName);
+   }
+
+   public void testRemoveDataSource()
+      throws Exception
+   {
+      removeDeployment("testLocalTxDs-ds.xml");
+   }
+
+   /**
+    * Test adding a new hsql DataSource deployment
+    * @throws Exception
+    */
+   public void testAddXADataSource() throws Exception
+   {
+      String jndiName = "TestXaDs";
+      Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
+
+      addCommonDsProperties(propValues, jndiName, "jboss-xa-jdbc.rar", "javax.sql.DataSource");
+
+      propValues.put("xa-datasource-class", SimpleValueSupport.wrap("org.hsqldb.jdbcDriver"));
+      propValues.put("xa-resource-timeout", SimpleValueSupport.wrap(new Integer(256)));
+      propValues.put("interleaving", SimpleValueSupport.wrap(true));
+
+      HashMap<String, String> xaPropValues = new HashMap<String, String>();
+      xaPropValues.put("URL", "jdbc:hsqldb");
+      xaPropValues.put("User", "sa");
+      xaPropValues.put("Password", "");
+
+      //MetaValue metaValue = getMetaValueFactory().create(xaPropValues, getMapType());
+      MetaValue metaValue = this.compositeValueMap(xaPropValues);
+      propValues.put("xa-datasource-properties", metaValue);
+
+      createComponentTest("XADataSourceTemplate", propValues, "testXaDs",
+         KnownComponentTypes.DataSourceTypes.XA.getType(), jndiName);
+ 
+      // Query the interleaving 
+      ManagementView mgtView = getManagementView();
+      ComponentType type = KnownComponentTypes.DataSourceTypes.XA.getType();
+      ManagedComponent txcf = mgtView.getComponent(jndiName, type);
+      assertNotNull(txcf);
+      ManagedProperty interleaving = txcf.getProperty("interleaving");
+      assertNotNull("interleaving", interleaving);
+      MetaValue interleavingMV = interleaving.getValue();
+      assertNotNull("interleaving.value", interleavingMV);
+      assertEquals("interleaving.value is true", SimpleValueSupport.wrap(Boolean.TRUE), interleavingMV);
+   }
+
+   /**
+    * removes the XADataSource created in the testAddXADataSource
+    * @throws Exception
+    */
+   public void testRemoveXADataSource()
+      throws Exception
+   {
+      removeDeployment("testXaDs-ds.xml");
+   }
+
+   /**
+    * Test adding a new tx-connection-factory deployment
+    * @throws Exception
+    */
+   public void testAddTxConnectionFactory() throws Exception
+   {
+      String jndiName = "TestTxCf";
+      Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
+
+      addCommonCfProperties(propValues, jndiName, "jms-ra.rar", "org.jboss.resource.adapter.jms.JmsConnectionFactory");
+
+      Map<String, String> xaProps = new HashMap<String, String>();
+      xaProps.put("SessionDefaultType", "javax.jms.Topic");
+      xaProps.put("SessionDefaultType.type", "java.lang.String");
+      xaProps.put("JmsProviderAdapterJNDI", "java:/DefaultJMSProvider");
+      xaProps.put("JmsProviderAdapterJNDI.type", "java.lang.String");
+      MetaValue metaValue = this.compositeValueMap(xaProps);
+
+      propValues.put("config-property", metaValue);
+
+      propValues.put("xa-transaction", SimpleValueSupport.wrap(Boolean.FALSE));
+      propValues.put("xa-resource-timeout", SimpleValueSupport.wrap(new Integer(256)));
+
+      // todo: how to set the specific domain?
+      //ApplicationManagedSecurityMetaData secDomain = new ApplicationManagedSecurityMetaData();
+      //props.get("security-domain").setValue(secDomain);
+
+      createComponentTest("TxConnectionFactoryTemplate", propValues, "testTxCf",
+         new ComponentType("ConnectionFactory", "Tx"), jndiName);
+      // Query the interleaving 
+      ManagementView mgtView = getManagementView();
+      ComponentType type = new ComponentType("ConnectionFactory", "Tx");
+      ManagedComponent txcf = mgtView.getComponent(jndiName, type);
+      assertNotNull(txcf);
+      ManagedProperty interleaving = txcf.getProperty("interleaving");
+      assertNotNull("interleaving", interleaving);
+      MetaValue interleavingMV = interleaving.getValue();
+      assertNotNull("interleaving.value", interleavingMV);
+      
+   }
+
+   /**
+    * removes the tx-connection-factory created in the testAddTxConnectionFactory
+    * @throws Exception
+    */
+   public void testRemoveTxConnectionFactory()
+      throws Exception
+   {
+      removeDeployment("testTxCf-ds.xml");
+   }
+
+   /**
+    * Test adding a new tx-connection-factory deployment with xa enabled
+    * @throws Exception
+    */
+   public void testAddTxXAConnectionFactory() throws Exception
+   {
+      String jndiName = "TestTxCf";
+      Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
+
+      addCommonCfProperties(propValues, jndiName, "jms-ra.rar", "org.jboss.resource.adapter.jms.JmsConnectionFactory");
+
+      Map<String, String> xaProps = new HashMap<String, String>();
+      xaProps.put("SessionDefaultType", "javax.jms.Topic");
+      xaProps.put("SessionDefaultType.type", "java.lang.String");
+      xaProps.put("JmsProviderAdapterJNDI", "java:/DefaultJMSProvider");
+      xaProps.put("JmsProviderAdapterJNDI.type", "java.lang.String");
+      MetaValue metaValue = this.compositeValueMap(xaProps);
+
+      propValues.put("config-property", metaValue);
+
+      propValues.put("xa-transaction", SimpleValueSupport.wrap(Boolean.TRUE));
+      propValues.put("xa-resource-timeout", SimpleValueSupport.wrap(new Integer(256)));
+      propValues.put("interleaving", SimpleValueSupport.wrap(Boolean.TRUE));
+
+      // todo: how to set the specific domain?
+      //ApplicationManagedSecurityMetaData secDomain = new ApplicationManagedSecurityMetaData();
+      //props.get("security-domain").setValue(secDomain);
+
+      createComponentTest("TxConnectionFactoryTemplate", propValues, "testTxXACf",
+         new ComponentType("ConnectionFactory", "Tx"), jndiName);
+      // Query the interleaving 
+      ManagementView mgtView = getManagementView();
+      ComponentType type = new ComponentType("ConnectionFactory", "Tx");
+      ManagedComponent txcf = mgtView.getComponent(jndiName, type);
+      assertNotNull(txcf);
+      ManagedProperty interleaving = txcf.getProperty("interleaving");
+      assertNotNull("interleaving", interleaving);
+      MetaValue interleavingMV = interleaving.getValue();
+      assertNotNull("interleaving.value", interleavingMV);
+      assertEquals(SimpleValueSupport.wrap(Boolean.TRUE), interleavingMV);
+   }
+
+   /**
+    * removes the tx-connection-factory created in the testAddXAConnectionFactory
+    * @throws Exception
+    */
+   public void testRemoveTxXAConnectionFactory()
+      throws Exception
+   {
+      removeDeployment("testTxXACf-ds.xml");
+   }
+
+   /**
+    * Test adding a new no-tx-datasource deployment (JBAS-4671)
+    * @throws Exception
+    */
+   public void testAddNoTxDataSource() throws Exception
+   {
+      String jndiName = "TestNoTxDs";
+      Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
+      addNonXaDsProperties(propValues, jndiName, "jboss-local-jdbc.rar", "javax.sql.DataSource");
+      createComponentTest("NoTxDataSourceTemplate", propValues, "testNoTxDs", KnownComponentTypes.DataSourceTypes.NoTx.getType(), jndiName);
+   }
+
+   public void testRemoveNoTxDataSource()
+      throws Exception
+   {
+      removeDeployment("testNoTxDs-ds.xml");
+   }
+
+   /**
+    * Test adding a new no-tx-connection-factory deployment
+    * @throws Exception
+    */
+   public void testAddNoTxConnectionFactory() throws Exception
+   {
+      String jndiName = "TestNoTxCf";
+      Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
+
+      addCommonCfProperties(propValues, jndiName, "jms-ra.rar", "org.jboss.resource.adapter.jms.JmsConnectionFactory");
+
+      Map<String, String> xaProps = new HashMap<String, String>();
+      xaProps.put("SessionDefaultType", "javax.jms.Topic");
+      xaProps.put("SessionDefaultType.type", "java.lang.String");
+      xaProps.put("JmsProviderAdapterJNDI", "java:/DefaultJMSProvider");
+      xaProps.put("JmsProviderAdapterJNDI.type", "java.lang.String");
+      MetaValue metaValue = this.compositeValueMap(xaProps);
+      propValues.put("config-property", metaValue);
+
+      propValues.put("config-property", 
+            new MapCompositeValueSupport(new HashMap<String, MetaValue>(),
+                  new MapCompositeMetaType(SimpleMetaType.STRING)));
+      // todo: how to set the specific domain?
+      //ApplicationManagedSecurityMetaData secDomain = new ApplicationManagedSecurityMetaData();
+      //props.get("security-domain").setValue(secDomain);
+
+      ComponentType compType = new ComponentType("ConnectionFactory", "NoTx");
+      createComponentTest("NoTxConnectionFactoryTemplate", propValues, "testNoTxCf", compType, jndiName);
+
+      // Validate the config-property
+      ManagementView mgtView = getManagementView();
+      ManagedComponent dsMC = getManagedComponent(mgtView, compType, jndiName);
+      ManagedProperty configProperty = dsMC.getProperty("config-property");
+      assertNotNull(configProperty);
+      MetaValue value = configProperty.getValue();
+      assertTrue("MapCompositeMetaType", value.getMetaType() instanceof MapCompositeMetaType);
+      
+      MapCompositeValueSupport cValue = (MapCompositeValueSupport) value;
+      cValue.put("testKey", new SimpleValueSupport(SimpleMetaType.STRING, "testValue"));
+      
+      mgtView.updateComponent(dsMC);
+
+      mgtView = getManagementView();
+      dsMC = getManagedComponent(mgtView, compType, jndiName);
+      configProperty = dsMC.getProperty("config-property");
+      assertNotNull(configProperty);
+      cValue = (MapCompositeValueSupport) configProperty.getValue();
+      assertNotNull(cValue.get("testKey"));
+   }
+
+   /**
+    * removes the tx-connection-factory created in the testAddTxConnectionFactory
+    * @throws Exception
+    */
+   public void testRemoveNoTxConnectionFactory()
+      throws Exception
+   {
+      removeDeployment("testNoTxCf-ds.xml");
+   }
+
+
+   /**
+    * Validate that there is only 1 DefaultDS ManagedComponent
+    * @throws Exception
+    */
+   public void testJTAComponentCount()
+      throws Exception
+   {
+      ManagementView mgtView = getManagementView();
+      ComponentType type = new ComponentType("MCBean", "JTA");
+      Set<ManagedComponent> comps = mgtView.getComponentsForType(type);
+      int count = comps.size();
+      assertEquals("There is 1 MCBean:JTA ManagedComponent", 1, 1);
+      ManagedComponent comp = comps.iterator().next();
+      Map<String, ManagedProperty> props = comp.getProperties();
+      for(ManagedProperty prop : props.values())
+      {
+         log.info(prop+", : "+prop.getValue());
+      }
+   }
+
+   // Private and protected
+
+   private void addNonXaDsProperties(Map<String, MetaValue> propValues,
+                                     String jndiName,
+                                     String rarName,
+                                     String conDef)
+   {
+      addCommonDsProperties(propValues, jndiName, rarName, conDef);
+
+      propValues.put("transaction-isolation", SimpleValueSupport.wrap("TRANSACTION_SERIALIZABLE"));
+      propValues.put("user-name", SimpleValueSupport.wrap("sa"));
+      propValues.put("password", SimpleValueSupport.wrap(""));
+
+      // non xa ds
+      propValues.put("driver-class", SimpleValueSupport.wrap("org.hsqldb.jdbcDriver"));
+      propValues.put("connection-url", SimpleValueSupport.wrap("jdbc:hsqldb:."));
+      // A metadata type with a null type-mapping, JBAS-6215
+      MutableCompositeMetaType metadataType = new MutableCompositeMetaType("org.jboss.resource.metadata.mcf.DBMSMetaData", "metadata type");
+      metadataType.addItem("typeMapping", "The jdbc type mapping", SimpleMetaType.STRING);
+      HashMap<String, MetaValue> items = new HashMap<String, MetaValue>();
+      items.put("typeMapping", null);
+      CompositeValueSupport metadata = new CompositeValueSupport(metadataType, items);
+      propValues.put("metadata", metadata);
+
+      // todo: connection-properties
+   }
+
+   private void addCommonDsProperties(Map<String, MetaValue> propValues,
+                                              String jndiName,
+                                              String rarName,
+                                              String conDef)
+   {
+      addCommonCfProperties(propValues, jndiName, rarName, conDef);
+      propValues.put("new-connection-sql", SimpleValueSupport.wrap("CALL ABS(2.0)"));
+      propValues.put("check-valid-connection-sql", SimpleValueSupport.wrap("CALL ABS(1.0)"));
+      propValues.put("valid-connection-checker-class-name", SimpleValueSupport.wrap("org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker"));
+      propValues.put("exception-sorter-class-name", SimpleValueSupport.wrap("org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter"));
+      propValues.put("stale-connection-checker-class-name", SimpleValueSupport.wrap("org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker"));
+      propValues.put("track-statements", SimpleValueSupport.wrap(""));
+      propValues.put("prepared-statement-cache-size", SimpleValueSupport.wrap(12));
+      propValues.put("share-prepared-statements", SimpleValueSupport.wrap(Boolean.TRUE));
+      propValues.put("set-tx-query-timeout", SimpleValueSupport.wrap(Boolean.TRUE));
+      propValues.put("query-timeout", SimpleValueSupport.wrap(new Integer(100)));
+      propValues.put("url-delimiter", SimpleValueSupport.wrap("+"));
+      propValues.put("url-selector-strategy-class-name", SimpleValueSupport.wrap("org.jboss.test.jca.support.MyURLSelector"));
+      propValues.put("use-try-lock", SimpleValueSupport.wrap(new Long(5000)));
+   }
+
+   private void addCommonCfProperties(Map<String, MetaValue> propValues,
+                                    String jndiName,
+                                    String rarName,
+                                    String conDef)
+   {
+      propValues.put("jndi-name", SimpleValueSupport.wrap(jndiName));
+      propValues.put("rar-name", SimpleValueSupport.wrap(rarName));
+      propValues.put("use-java-context", SimpleValueSupport.wrap(Boolean.TRUE));
+      propValues.put("connection-definition", SimpleValueSupport.wrap(conDef));
+      //propValues.put("jmx-invoker-name", SimpleValueSupport.wrap("jboss:service=invoker,type=jrmp"));
+      propValues.put("min-pool-size", SimpleValueSupport.wrap(new Integer(0)));
+      propValues.put("max-pool-size", SimpleValueSupport.wrap(new Integer(11)));
+      propValues.put("blocking-timeout-millis", SimpleValueSupport.wrap(new Long(15000)));
+      propValues.put("idle-timeout-minutes", SimpleValueSupport.wrap(new Integer(111)));
+      propValues.put("prefill", SimpleValueSupport.wrap(Boolean.TRUE));
+      propValues.put("background-validation", SimpleValueSupport.wrap(Boolean.TRUE));
+      propValues.put("background-validation-millis", SimpleValueSupport.wrap(new Long(5000)));
+      propValues.put("validate-on-match", SimpleValueSupport.wrap(Boolean.FALSE));
+      propValues.put("use-strict-min", SimpleValueSupport.wrap(Boolean.TRUE));
+      propValues.put("no-tx-separate-pools", SimpleValueSupport.wrap(Boolean.TRUE));
+      propValues.put("statistics-formatter", SimpleValueSupport.wrap("org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter"));
+      propValues.put("isSameRM-override-value", SimpleValueSupport.wrap(Boolean.FALSE));
+      propValues.put("type-mapping", SimpleValueSupport.wrap("Hypersonic SQL"));
+      // todo: config-property
+      // todo: security-domain
+      // todo: depends
+      // todo: metadata
+      // todo: local-transaction
+   }
+
+   protected void createComponentTest(String templateName,
+                                    Map<String, MetaValue> propValues,
+                                    String deploymentName,
+                                    ComponentType componentType, String componentName)
+      throws Exception
+   {
+      ManagementView mgtView = getManagementView();
+      DeploymentTemplateInfo dsInfo = mgtView.getTemplate(templateName);
+      assertNotNull("template " + templateName + " found", dsInfo);
+      Map<String, ManagedProperty> props = dsInfo.getProperties();
+
+      for(String propName : propValues.keySet())
+      {
+         ManagedProperty prop = props.get(propName);
+         // If the property does not exist on the template we don't set it
+         if(prop == null)
+            continue;
+         
+         log.debug("template property before: "+prop.getName()+","+prop.getValue());
+         assertNotNull("property " + propName + " found in template " + templateName, prop);
+         prop.setValue(propValues.get(propName));
+         log.debug("template property after: "+prop.getName()+","+prop.getValue());
+      }
+      
+      // Assert map composite
+      if(dsInfo.getProperties().get("config-property") != null)
+         assertTrue(dsInfo.getProperties().get("config-property").getMetaType() instanceof MapCompositeMetaType);
+      
+      mgtView.applyTemplate(deploymentName, dsInfo);
+
+      // reload the view
+      activeView = null;
+      mgtView = getManagementView();
+      ManagedComponent dsMC = getManagedComponent(mgtView, componentType, componentName);
+      assertNotNull(dsMC);
+
+      Set<String> mcPropNames = new HashSet<String>(dsMC.getPropertyNames());
+      for(String propName : propValues.keySet())
+      {
+         ManagedProperty prop = dsMC.getProperty(propName);
+         log.debug("Checking: "+propName);
+         assertNotNull(propName, prop);
+         Object propValue = prop.getValue();
+         Object expectedValue = propValues.get(propName);
+         if(propValue instanceof MetaValue)
+         {
+            if (prop.getMetaType().isComposite())
+            {
+               // TODO / FIXME - compare composites
+               log.warn("Not checking composite: "+propValue);
+            }
+            else
+            {
+               // Compare the MetaValues
+               assertEquals(prop.getName(), expectedValue, propValue);
+            }
+         }
+         else if(propValue != null)
+         {
+            fail(prop.getName()+" is not a MetaValue: "+propValue);
+         }
+
+         mcPropNames.remove(propName);
+      }
+
+      if(!mcPropNames.isEmpty())
+      {
+         log.warn(getName() + "> untested properties: " + mcPropNames);
+         for(String propName : mcPropNames)
+         {
+            ManagedProperty prop = dsMC.getProperty(propName);
+            log.info(prop);
+         }
+      }
+   }
+
+   public MapCompositeValueSupport compositeValueMap(Map<String,String> map)
+   {
+      // TODO: update MetaValueFactory for MapCompositeMetaType
+      // MetaValue metaValue = getMetaValueFactory().create(xaPropValues, getMapType());
+      MapCompositeValueSupport metaValue = new MapCompositeValueSupport(SimpleMetaType.STRING);
+      for(String key : map.keySet())
+      {
+         MetaValue value = SimpleValueSupport.wrap(map.get(key));
+         metaValue.put(key, value);
+      }
+
+      return metaValue;
+   }
+
+}

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DataSourceUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DataSourceUnitTestCase.java	2009-09-10 11:06:05 UTC (rev 93352)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DataSourceUnitTestCase.java	2009-09-10 11:23:30 UTC (rev 93353)
@@ -21,23 +21,13 @@
  */
 package org.jboss.test.profileservice.test;
 
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.jboss.deployers.spi.management.KnownComponentTypes;
 import org.jboss.deployers.spi.management.ManagementView;
 import org.jboss.managed.api.ComponentType;
 import org.jboss.managed.api.DeploymentTemplateInfo;
 import org.jboss.managed.api.ManagedComponent;
 import org.jboss.managed.api.ManagedProperty;
-import org.jboss.metatype.api.types.MapCompositeMetaType;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
 import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.metatype.api.values.SimpleValue;
 import org.jboss.metatype.api.values.SimpleValueSupport;

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java	2009-09-10 11:06:05 UTC (rev 93352)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java	2009-09-10 11:23:30 UTC (rev 93353)
@@ -27,7 +27,6 @@
 
 import javax.naming.InitialContext;
 
-import org.jboss.deployers.client.spi.IncompleteDeploymentException;
 import org.jboss.deployers.spi.management.ManagementView;
 import org.jboss.deployers.spi.management.deploy.DeploymentManager;
 import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
@@ -223,24 +222,6 @@
       testDeployment(name, "sar", null);
    }
 
-   /**
-    * Test that a valid exception is seen
-    * @throws Exception
-    */
-   public void testSarCNFEDeployment() throws Exception
-   {
-      String name = "testCNFE-service.xml";
-      try
-      {
-         testDeployment(name, "sar", null);
-      }
-      catch(IncompleteDeploymentException e)
-      {
-         Throwable cause = e.getCause();
-         assertTrue("Failure caused by CNFE", cause instanceof ClassNotFoundException);
-      }
-   }
-
    private interface ManagedDeploymentTester
    {
       void testManagedDeployment() throws Exception;

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/PlatformMBeanUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/PlatformMBeanUnitTestCase.java	2009-09-10 11:06:05 UTC (rev 93352)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/PlatformMBeanUnitTestCase.java	2009-09-10 11:23:30 UTC (rev 93353)
@@ -204,7 +204,9 @@
       MemoryUsage nonHeapMemoryUsageMU = ManagementFactoryUtils.unwrapMemoryUsage(nonHeapMemoryUsageMV);
       assertTrue(nonHeapMemoryUsageMU.getInit() >= 0);
       assertTrue(nonHeapMemoryUsageMU.getUsed() >= 1000);
-      assertTrue(nonHeapMemoryUsageMU.getMax() >= nonHeapMemoryUsageMU.getCommitted());
+      // Ignore undefined nonHeap max memory, seen with IBM JDK 6 
+      if(nonHeapMemoryUsageMU.getMax() != -1)
+    	  assertTrue(nonHeapMemoryUsageMU.getMax() >= nonHeapMemoryUsageMU.getCommitted());
       assertTrue(nonHeapMemoryUsageMU.getCommitted() >=  nonHeapMemoryUsageMU.getUsed());
       // objectPendingFinalizationCount
       ManagedProperty objectPendingFinalizationCount = props.get("objectPendingFinalizationCount");

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2009-09-10 11:06:05 UTC (rev 93352)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2009-09-10 11:23:30 UTC (rev 93353)
@@ -34,7 +34,6 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.jboss.deployers.spi.management.KnownComponentTypes;
 import org.jboss.deployers.spi.management.KnownDeploymentTypes;
 import org.jboss.deployers.spi.management.ManagementView;
 import org.jboss.deployers.spi.management.deploy.DeploymentManager;
@@ -49,13 +48,9 @@
 import org.jboss.metatype.api.types.CompositeMetaType;
 import org.jboss.metatype.api.types.MapCompositeMetaType;
 import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
 import org.jboss.metatype.api.values.CompositeValue;
-import org.jboss.metatype.api.values.CompositeValueSupport;
-import org.jboss.metatype.api.values.MapCompositeValueSupport;
 import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
 import org.jboss.profileservice.spi.NoSuchProfileException;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.ProfileService;
@@ -95,18 +90,6 @@
       suite.addTest(new ProfileServiceUnitTestCase("testUpdateDefaultDS"));
       suite.addTest(new ProfileServiceUnitTestCase("testDefaultDSOps"));
       suite.addTest(new ProfileServiceUnitTestCase("testDefaultDSStats"));
-      suite.addTest(new ProfileServiceUnitTestCase("testAddDataSource"));
-      suite.addTest(new ProfileServiceUnitTestCase("testRemoveDataSource"));
-      suite.addTest(new ProfileServiceUnitTestCase("testAddXADataSource"));
-      suite.addTest(new ProfileServiceUnitTestCase("testRemoveXADataSource"));
-      suite.addTest(new ProfileServiceUnitTestCase("testAddTxConnectionFactory"));
-      suite.addTest(new ProfileServiceUnitTestCase("testRemoveTxConnectionFactory"));
-      suite.addTest(new ProfileServiceUnitTestCase("testAddTxXAConnectionFactory"));
-      suite.addTest(new ProfileServiceUnitTestCase("testRemoveTxXAConnectionFactory"));
-      suite.addTest(new ProfileServiceUnitTestCase("testAddNoTxConnectionFactory"));
-      suite.addTest(new ProfileServiceUnitTestCase("testRemoveNoTxConnectionFactory"));
-      suite.addTest(new ProfileServiceUnitTestCase("testAddNoTxDataSource"));
-      suite.addTest(new ProfileServiceUnitTestCase("testRemoveNoTxDataSource"));
 
       return suite;
    }
@@ -510,6 +493,19 @@
    }
 
    /**
+    * Validate that the XADataSourceTemplate ManagedPropertys are values are of type MetaValue
+    * @throws Exception
+    */
+   public void testXADataSourceTemplateTemplatePropertiesAreMetaValues()
+      throws Exception
+   {
+      ManagementView mgtView = getManagementView();
+      DeploymentTemplateInfo dsInfo = mgtView.getTemplate("XADataSourceTemplate");
+      Map<String,ManagedProperty> props = dsInfo.getProperties();
+      validatePropertyMetaValues(props);
+   }
+   
+   /**
     * Validate that there is only 1 DefaultDS ManagedComponent
     * @throws Exception
     */
@@ -650,258 +646,8 @@
       assertTrue("result is a MetaValue", result instanceof MetaValue);
    }
 
-   /**
-    * Test adding a new hsql DataSource deployment (JBAS-4671)
-    * @throws Exception
-    */
-   public void testAddDataSource() throws Exception
-   {
-      String jndiName = "TestLocalTxDs";
-      Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
-      addNonXaDsProperties(propValues, jndiName, "jboss-local-jdbc.rar", "javax.sql.DataSource");
-      createComponentTest("LocalTxDataSourceTemplate", propValues, "testLocalTxDs",
-         KnownComponentTypes.DataSourceTypes.LocalTx.getType(), jndiName);
-   }
 
-   public void testRemoveDataSource()
-      throws Exception
-   {
-      removeDeployment("testLocalTxDs-ds.xml");
-   }
-
    /**
-    * Validate that the XADataSourceTemplate ManagedPropertys are values are of type MetaValue
-    * @throws Exception
-    */
-   public void testXADataSourceTemplateTemplatePropertiesAreMetaValues()
-      throws Exception
-   {
-      ManagementView mgtView = getManagementView();
-      DeploymentTemplateInfo dsInfo = mgtView.getTemplate("XADataSourceTemplate");
-      Map<String,ManagedProperty> props = dsInfo.getProperties();
-      validatePropertyMetaValues(props);
-   }
-   /**
-    * Test adding a new hsql DataSource deployment
-    * @throws Exception
-    */
-   public void testAddXADataSource() throws Exception
-   {
-      String jndiName = "TestXaDs";
-      Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
-
-      addCommonDsProperties(propValues, jndiName, "jboss-xa-jdbc.rar", "javax.sql.DataSource");
-
-      propValues.put("xa-datasource-class", SimpleValueSupport.wrap("org.hsqldb.jdbcDriver"));
-      propValues.put("xa-resource-timeout", SimpleValueSupport.wrap(new Integer(256)));
-      propValues.put("interleaving", SimpleValueSupport.wrap(true));
-
-      HashMap<String, String> xaPropValues = new HashMap<String, String>();
-      xaPropValues.put("URL", "jdbc:hsqldb");
-      xaPropValues.put("User", "sa");
-      xaPropValues.put("Password", "");
-
-      //MetaValue metaValue = getMetaValueFactory().create(xaPropValues, getMapType());
-      MetaValue metaValue = this.compositeValueMap(xaPropValues);
-      propValues.put("xa-datasource-properties", metaValue);
-
-      createComponentTest("XADataSourceTemplate", propValues, "testXaDs",
-         KnownComponentTypes.DataSourceTypes.XA.getType(), jndiName);
-   }
-
-   /**
-    * removes the XADataSource created in the testAddXADataSource
-    * @throws Exception
-    */
-   public void testRemoveXADataSource()
-      throws Exception
-   {
-      removeDeployment("testXaDs-ds.xml");
-   }
-
-   /**
-    * Test adding a new tx-connection-factory deployment
-    * @throws Exception
-    */
-   public void testAddTxConnectionFactory() throws Exception
-   {
-      String jndiName = "TestTxCf";
-      Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
-
-      addCommonCfProperties(propValues, jndiName, "jms-ra.rar", "org.jboss.resource.adapter.jms.JmsConnectionFactory");
-
-      Map<String, String> xaProps = new HashMap<String, String>();
-      xaProps.put("SessionDefaultType", "javax.jms.Topic");
-      xaProps.put("SessionDefaultType.type", "java.lang.String");
-      xaProps.put("JmsProviderAdapterJNDI", "java:/DefaultJMSProvider");
-      xaProps.put("JmsProviderAdapterJNDI.type", "java.lang.String");
-      MetaValue metaValue = this.compositeValueMap(xaProps);
-
-      propValues.put("config-property", metaValue);
-
-      propValues.put("xa-transaction", SimpleValueSupport.wrap(Boolean.FALSE));
-      propValues.put("xa-resource-timeout", SimpleValueSupport.wrap(new Integer(256)));
-
-      // todo: how to set the specific domain?
-      //ApplicationManagedSecurityMetaData secDomain = new ApplicationManagedSecurityMetaData();
-      //props.get("security-domain").setValue(secDomain);
-
-      createComponentTest("TxConnectionFactoryTemplate", propValues, "testTxCf",
-         new ComponentType("ConnectionFactory", "Tx"), jndiName);
-      // Query the interleaving 
-      ManagementView mgtView = getManagementView();
-      ComponentType type = new ComponentType("ConnectionFactory", "Tx");
-      ManagedComponent txcf = mgtView.getComponent(jndiName, type);
-      assertNotNull(txcf);
-      ManagedProperty interleaving = txcf.getProperty("interleaving");
-      assertNotNull("interleaving", interleaving);
-      MetaValue interleavingMV = interleaving.getValue();
-      assertNotNull("interleaving.value", interleavingMV);
-      
-   }
-
-   /**
-    * removes the tx-connection-factory created in the testAddTxConnectionFactory
-    * @throws Exception
-    */
-   public void testRemoveTxConnectionFactory()
-      throws Exception
-   {
-      removeDeployment("testTxCf-ds.xml");
-   }
-
-   /**
-    * Test adding a new tx-connection-factory deployment with xa enabled
-    * @throws Exception
-    */
-   public void testAddTxXAConnectionFactory() throws Exception
-   {
-      String jndiName = "TestTxCf";
-      Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
-
-      addCommonCfProperties(propValues, jndiName, "jms-ra.rar", "org.jboss.resource.adapter.jms.JmsConnectionFactory");
-
-      Map<String, String> xaProps = new HashMap<String, String>();
-      xaProps.put("SessionDefaultType", "javax.jms.Topic");
-      xaProps.put("SessionDefaultType.type", "java.lang.String");
-      xaProps.put("JmsProviderAdapterJNDI", "java:/DefaultJMSProvider");
-      xaProps.put("JmsProviderAdapterJNDI.type", "java.lang.String");
-      MetaValue metaValue = this.compositeValueMap(xaProps);
-
-      propValues.put("config-property", metaValue);
-
-      propValues.put("xa-transaction", SimpleValueSupport.wrap(Boolean.TRUE));
-      propValues.put("xa-resource-timeout", SimpleValueSupport.wrap(new Integer(256)));
-      propValues.put("interleaving", SimpleValueSupport.wrap(Boolean.TRUE));
-
-      // todo: how to set the specific domain?
-      //ApplicationManagedSecurityMetaData secDomain = new ApplicationManagedSecurityMetaData();
-      //props.get("security-domain").setValue(secDomain);
-
-      createComponentTest("TxConnectionFactoryTemplate", propValues, "testTxXACf",
-         new ComponentType("ConnectionFactory", "Tx"), jndiName);
-      // Query the interleaving 
-      ManagementView mgtView = getManagementView();
-      ComponentType type = new ComponentType("ConnectionFactory", "Tx");
-      ManagedComponent txcf = mgtView.getComponent(jndiName, type);
-      assertNotNull(txcf);
-      ManagedProperty interleaving = txcf.getProperty("interleaving");
-      assertNotNull("interleaving", interleaving);
-      MetaValue interleavingMV = interleaving.getValue();
-      assertNotNull("interleaving.value", interleavingMV);
-      assertEquals(SimpleValueSupport.wrap(Boolean.TRUE), interleavingMV);
-   }
-
-   /**
-    * removes the tx-connection-factory created in the testAddXAConnectionFactory
-    * @throws Exception
-    */
-   public void testRemoveTxXAConnectionFactory()
-      throws Exception
-   {
-      removeDeployment("testTxXACf-ds.xml");
-   }
-
-   /**
-    * Test adding a new no-tx-datasource deployment (JBAS-4671)
-    * @throws Exception
-    */
-   public void testAddNoTxDataSource() throws Exception
-   {
-      String jndiName = "TestNoTxDs";
-      Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
-      addNonXaDsProperties(propValues, jndiName, "jboss-local-jdbc.rar", "javax.sql.DataSource");
-      createComponentTest("NoTxDataSourceTemplate", propValues, "testNoTxDs", KnownComponentTypes.DataSourceTypes.NoTx.getType(), jndiName);
-   }
-
-   public void testRemoveNoTxDataSource()
-      throws Exception
-   {
-      removeDeployment("testNoTxDs-ds.xml");
-   }
-
-   /**
-    * Test adding a new no-tx-connection-factory deployment
-    * @throws Exception
-    */
-   public void testAddNoTxConnectionFactory() throws Exception
-   {
-      String jndiName = "TestNoTxCf";
-      Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
-
-      addCommonCfProperties(propValues, jndiName, "jms-ra.rar", "org.jboss.resource.adapter.jms.JmsConnectionFactory");
-
-      Map<String, String> xaProps = new HashMap<String, String>();
-      xaProps.put("SessionDefaultType", "javax.jms.Topic");
-      xaProps.put("SessionDefaultType.type", "java.lang.String");
-      xaProps.put("JmsProviderAdapterJNDI", "java:/DefaultJMSProvider");
-      xaProps.put("JmsProviderAdapterJNDI.type", "java.lang.String");
-      MetaValue metaValue = this.compositeValueMap(xaProps);
-      propValues.put("config-property", metaValue);
-
-      propValues.put("config-property", 
-            new MapCompositeValueSupport(new HashMap<String, MetaValue>(),
-                  new MapCompositeMetaType(SimpleMetaType.STRING)));
-      // todo: how to set the specific domain?
-      //ApplicationManagedSecurityMetaData secDomain = new ApplicationManagedSecurityMetaData();
-      //props.get("security-domain").setValue(secDomain);
-
-      ComponentType compType = new ComponentType("ConnectionFactory", "NoTx");
-      createComponentTest("NoTxConnectionFactoryTemplate", propValues, "testNoTxCf", compType, jndiName);
-
-      // Validate the config-property
-      ManagementView mgtView = getManagementView();
-      ManagedComponent dsMC = getManagedComponent(mgtView, compType, jndiName);
-      ManagedProperty configProperty = dsMC.getProperty("config-property");
-      assertNotNull(configProperty);
-      MetaValue value = configProperty.getValue();
-      assertTrue("MapCompositeMetaType", value.getMetaType() instanceof MapCompositeMetaType);
-      
-      MapCompositeValueSupport cValue = (MapCompositeValueSupport) value;
-      cValue.put("testKey", new SimpleValueSupport(SimpleMetaType.STRING, "testValue"));
-      
-      mgtView.updateComponent(dsMC);
-
-      mgtView = getManagementView();
-      dsMC = getManagedComponent(mgtView, compType, jndiName);
-      configProperty = dsMC.getProperty("config-property");
-      assertNotNull(configProperty);
-      cValue = (MapCompositeValueSupport) configProperty.getValue();
-      assertNotNull(cValue.get("testKey"));
-   }
-
-   /**
-    * removes the tx-connection-factory created in the testAddTxConnectionFactory
-    * @throws Exception
-    */
-   public void testRemoveNoTxConnectionFactory()
-      throws Exception
-   {
-      removeDeployment("testNoTxCf-ds.xml");
-   }
-
-
-   /**
     * Validate that there is only 1 DefaultDS ManagedComponent
     * @throws Exception
     */
@@ -923,82 +669,6 @@
 
    // Private and protected
 
-   private void addNonXaDsProperties(Map<String, MetaValue> propValues,
-                                     String jndiName,
-                                     String rarName,
-                                     String conDef)
-   {
-      addCommonDsProperties(propValues, jndiName, rarName, conDef);
-
-      propValues.put("transaction-isolation", SimpleValueSupport.wrap("TRANSACTION_SERIALIZABLE"));
-      propValues.put("user-name", SimpleValueSupport.wrap("sa"));
-      propValues.put("password", SimpleValueSupport.wrap(""));
-
-      // non xa ds
-      propValues.put("driver-class", SimpleValueSupport.wrap("org.hsqldb.jdbcDriver"));
-      propValues.put("connection-url", SimpleValueSupport.wrap("jdbc:hsqldb:."));
-      // A metadata type with a null type-mapping, JBAS-6215
-      MutableCompositeMetaType metadataType = new MutableCompositeMetaType("org.jboss.resource.metadata.mcf.DBMSMetaData", "metadata type");
-      metadataType.addItem("typeMapping", "The jdbc type mapping", SimpleMetaType.STRING);
-      HashMap<String, MetaValue> items = new HashMap<String, MetaValue>();
-      items.put("typeMapping", null);
-      CompositeValueSupport metadata = new CompositeValueSupport(metadataType, items);
-      propValues.put("metadata", metadata);
-
-      // todo: connection-properties
-   }
-
-   private void addCommonDsProperties(Map<String, MetaValue> propValues,
-                                              String jndiName,
-                                              String rarName,
-                                              String conDef)
-   {
-      addCommonCfProperties(propValues, jndiName, rarName, conDef);
-      propValues.put("new-connection-sql", SimpleValueSupport.wrap("CALL ABS(2.0)"));
-      propValues.put("check-valid-connection-sql", SimpleValueSupport.wrap("CALL ABS(1.0)"));
-      propValues.put("valid-connection-checker-class-name", SimpleValueSupport.wrap("org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker"));
-      propValues.put("exception-sorter-class-name", SimpleValueSupport.wrap("org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter"));
-      propValues.put("stale-connection-checker-class-name", SimpleValueSupport.wrap("org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker"));
-      propValues.put("track-statements", SimpleValueSupport.wrap(""));
-      propValues.put("prepared-statement-cache-size", SimpleValueSupport.wrap(12));
-      propValues.put("share-prepared-statements", SimpleValueSupport.wrap(Boolean.TRUE));
-      propValues.put("set-tx-query-timeout", SimpleValueSupport.wrap(Boolean.TRUE));
-      propValues.put("query-timeout", SimpleValueSupport.wrap(new Integer(100)));
-      propValues.put("url-delimiter", SimpleValueSupport.wrap("+"));
-      propValues.put("url-selector-strategy-class-name", SimpleValueSupport.wrap("org.jboss.test.jca.support.MyURLSelector"));
-      propValues.put("use-try-lock", SimpleValueSupport.wrap(new Long(5000)));
-   }
-
-   private void addCommonCfProperties(Map<String, MetaValue> propValues,
-                                    String jndiName,
-                                    String rarName,
-                                    String conDef)
-   {
-      propValues.put("jndi-name", SimpleValueSupport.wrap(jndiName));
-      propValues.put("rar-name", SimpleValueSupport.wrap(rarName));
-      propValues.put("use-java-context", SimpleValueSupport.wrap(Boolean.TRUE));
-      propValues.put("connection-definition", SimpleValueSupport.wrap(conDef));
-      //propValues.put("jmx-invoker-name", SimpleValueSupport.wrap("jboss:service=invoker,type=jrmp"));
-      propValues.put("min-pool-size", SimpleValueSupport.wrap(new Integer(0)));
-      propValues.put("max-pool-size", SimpleValueSupport.wrap(new Integer(11)));
-      propValues.put("blocking-timeout-millis", SimpleValueSupport.wrap(new Long(15000)));
-      propValues.put("idle-timeout-minutes", SimpleValueSupport.wrap(new Integer(111)));
-      propValues.put("prefill", SimpleValueSupport.wrap(Boolean.TRUE));
-      propValues.put("background-validation", SimpleValueSupport.wrap(Boolean.TRUE));
-      propValues.put("background-validation-millis", SimpleValueSupport.wrap(new Long(5000)));
-      propValues.put("validate-on-match", SimpleValueSupport.wrap(Boolean.FALSE));
-      propValues.put("use-strict-min", SimpleValueSupport.wrap(Boolean.TRUE));
-      propValues.put("no-tx-separate-pools", SimpleValueSupport.wrap(Boolean.TRUE));
-      propValues.put("statistics-formatter", SimpleValueSupport.wrap("org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter"));
-      propValues.put("isSameRM-override-value", SimpleValueSupport.wrap(Boolean.FALSE));
-      propValues.put("type-mapping", SimpleValueSupport.wrap("Hypersonic SQL"));
-      // todo: config-property
-      // todo: security-domain
-      // todo: depends
-      // todo: metadata
-      // todo: local-transaction
-   }
-
    protected void createComponentTest(String templateName,
                                     Map<String, MetaValue> propValues,
                                     String deploymentName,
@@ -1075,20 +745,6 @@
       }
    }
 
-   public MapCompositeValueSupport compositeValueMap(Map<String,String> map)
-   {
-      // TODO: update MetaValueFactory for MapCompositeMetaType
-      // MetaValue metaValue = getMetaValueFactory().create(xaPropValues, getMapType());
-      MapCompositeValueSupport metaValue = new MapCompositeValueSupport(SimpleMetaType.STRING);
-      for(String key : map.keySet())
-      {
-         MetaValue value = SimpleValueSupport.wrap(map.get(key));
-         metaValue.put(key, value);
-      }
-
-      return metaValue;
-   }
-
    protected void validatePropertyMetaValues(Map<String, ManagedProperty> props)
    {
       HashMap<String, Object> invalidValues = new HashMap<String, Object>();

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java	2009-09-10 11:06:05 UTC (rev 93352)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java	2009-09-10 11:23:30 UTC (rev 93353)
@@ -320,7 +320,7 @@
       // verify that the component has the expected managed properties.
       Map<String, ManagedProperty> properties = component.getProperties();
       assertNotNull(properties);
-      assertEquals("Unexpected number of properties", 14, properties.size());
+      assertEquals("Unexpected number of properties", 20, properties.size());
       assertTrue("Missing expected property: securityDomain", properties.containsKey("securityDomain"));
       assertTrue("Missing expected property: state", properties.containsKey("state"));
       // keystore and truststore configuration properties.




More information about the jboss-cvs-commits mailing list