[jboss-cvs] JBossAS SVN: r64999 - in trunk/connector/src: tests and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 31 18:42:22 EDT 2007


Author: scott.stark at jboss.org
Date: 2007-08-31 18:42:22 -0400 (Fri, 31 Aug 2007)
New Revision: 64999

Added:
   trunk/connector/src/tests/
   trunk/connector/src/tests/org/
   trunk/connector/src/tests/org/jboss/
   trunk/connector/src/tests/org/jboss/tests/
   trunk/connector/src/tests/org/jboss/tests/jca/
   trunk/connector/src/tests/org/jboss/tests/jca/managed/
   trunk/connector/src/tests/org/jboss/tests/jca/managed/ManagedObjectTestCase.java
Log:
Tests of the jca managed objects

Added: trunk/connector/src/tests/org/jboss/tests/jca/managed/ManagedObjectTestCase.java
===================================================================
--- trunk/connector/src/tests/org/jboss/tests/jca/managed/ManagedObjectTestCase.java	                        (rev 0)
+++ trunk/connector/src/tests/org/jboss/tests/jca/managed/ManagedObjectTestCase.java	2007-08-31 22:42:22 UTC (rev 64999)
@@ -0,0 +1,168 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * 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.tests.jca.managed;
+
+import java.util.Arrays;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.resource.connectionmanager.JBossManagedConnectionPool;
+import org.jboss.resource.metadata.mcf.LocalDataSourceDeploymentMetaData;
+import org.jboss.resource.metadata.mcf.NoTxDataSourceDeploymentMetaData;
+import org.jboss.resource.metadata.mcf.XADataSourceDeploymentMetaData;
+import org.jboss.system.deployers.managed.ServiceMetaDataICF;
+import org.jboss.system.metadata.ServiceMetaData;
+import org.jboss.test.BaseTestCase;
+
+/**
+ * Tests that validate tat the expected ManagedObjects are created from
+ * the jca metadata.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ManagedObjectTestCase extends BaseTestCase
+{
+   static final String[] ManagedConnectionFactoryDeploymentMetaData_NAMES = {
+      "jndi-name",
+      "rar-name",
+      "use-java-context",
+      "connection-definition",
+      "connection-property",
+      "jmx-invoker-name",
+      "min-pool-size",
+      "max-pool-size",
+      "blocking-timeout-millis",
+      "idle-timeout-minutes",
+      "prefill",
+      "background-validation",
+      "background-validation-minutes",
+      "valid-connection-checker-class-name",
+      "validate-on-match",
+      "use-strict-min",
+      "statistics-formatter",
+      "isSameRM-override-value",
+      "track-connection-by-tx",
+      "config-property",
+      "security-domain",
+      "type-mapping",
+      "local-transaction"
+   };
+   static final String[] DataSourceDeploymentMetaData_NAMES = {
+      "transaction-isolation",
+      "user-name",
+      "password",
+      "new-connection-sql",
+      "check-valid-connection-sql",
+      "exception-sorter-class-name",
+      "track-statements",
+      "prepared-statement-cache-size",
+      "share-prepared-statements",
+      "set-tx-query-timeout",
+      "query-timeout"
+   };
+   static final String[] NonXADataSourceDeploymentMetaData_NAMES = {
+      "driver-class",
+      "connection-url"
+   };
+   static final String[] XADataSourceDeploymentMetaData_NAMES = {
+      "xa-datasource-class",
+      "xa-resource-timeout"
+   };
+   static final String[] JBossManagedConnectionPool_NAMES = {
+      "availableConnectionCount",
+      "connectionCount",
+      "connectionCreatedCount",
+      "connectionDestroyedCount",
+      "inUseConnectionCount",
+      "maxConnectionsInUseCount",
+      "maxSize",
+      "minSize"
+   };
+
+   public ManagedObjectTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testNoTxDataSourceDeploymentMetaData()
+   {
+      enableTrace("org.jboss.managed.plugins.factory");
+      ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
+      ManagedObject mo = mof.createManagedObject(NoTxDataSourceDeploymentMetaData.class);
+      // Validate the expected property names
+      Set<String> expectedPropertyNames = new TreeSet<String>();
+      expectedPropertyNames.addAll(Arrays.asList(ManagedConnectionFactoryDeploymentMetaData_NAMES));
+      expectedPropertyNames.addAll(Arrays.asList(DataSourceDeploymentMetaData_NAMES));
+      expectedPropertyNames.addAll(Arrays.asList(NonXADataSourceDeploymentMetaData_NAMES));
+      Set<String> propertyNames = mo.getPropertyNames();
+      TreeSet<String> sortedPropertyNames = new TreeSet<String>(propertyNames);
+      assertEquals(expectedPropertyNames, sortedPropertyNames);
+   }
+   public void testLocalDataSourceDeploymentMetaData()
+   {
+      enableTrace("org.jboss.managed.plugins.factory");
+      ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
+      ManagedObject mo = mof.createManagedObject(LocalDataSourceDeploymentMetaData.class);
+      // Validate the expected property names
+      Set<String> expectedPropertyNames = new TreeSet<String>();
+      expectedPropertyNames.addAll(Arrays.asList(ManagedConnectionFactoryDeploymentMetaData_NAMES));
+      expectedPropertyNames.addAll(Arrays.asList(DataSourceDeploymentMetaData_NAMES));
+      expectedPropertyNames.addAll(Arrays.asList(NonXADataSourceDeploymentMetaData_NAMES));
+      Set<String> propertyNames = mo.getPropertyNames();
+      TreeSet<String> sortedPropertyNames = new TreeSet<String>(propertyNames);
+      assertEquals(expectedPropertyNames, sortedPropertyNames);
+   }
+   public void testXADataSourceDeploymentMetaData()
+   {
+      enableTrace("org.jboss.managed.plugins.factory");
+      ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
+      ManagedObject mo = mof.createManagedObject(XADataSourceDeploymentMetaData.class);
+      // Validate the expected property names
+      Set<String> expectedPropertyNames = new TreeSet<String>();
+      expectedPropertyNames.addAll(Arrays.asList(ManagedConnectionFactoryDeploymentMetaData_NAMES));
+      expectedPropertyNames.addAll(Arrays.asList(DataSourceDeploymentMetaData_NAMES));
+      expectedPropertyNames.addAll(Arrays.asList(XADataSourceDeploymentMetaData_NAMES));
+      Set<String> propertyNames = mo.getPropertyNames();
+      TreeSet<String> sortedPropertyNames = new TreeSet<String>(propertyNames);
+      assertEquals(expectedPropertyNames, sortedPropertyNames);
+   }
+
+   public void testJBossManagedConnectionPool()
+   {
+      enableTrace("org.jboss.managed.plugins.factory");
+      ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
+      ServiceMetaDataICF icf = new ServiceMetaDataICF();
+      mof.setInstanceClassFactory(ServiceMetaData.class, icf);
+      ServiceMetaData smd = new ServiceMetaData();
+      smd.setCode(JBossManagedConnectionPool.class.getName());
+      ManagedObject mo = mof.initManagedObject(smd, null, null);
+      // Validate the expected property names
+      Set<String> expectedPropertyNames = new TreeSet<String>();
+      expectedPropertyNames.addAll(Arrays.asList(JBossManagedConnectionPool_NAMES));
+      Set<String> propertyNames = mo.getPropertyNames();
+      TreeSet<String> sortedPropertyNames = new TreeSet<String>(propertyNames);
+      assertEquals(expectedPropertyNames, sortedPropertyNames);      
+   }
+}


Property changes on: trunk/connector/src/tests/org/jboss/tests/jca/managed/ManagedObjectTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list