[jboss-cvs] JBossAS SVN: r82038 - trunk/connector/src/tests/org/jboss/tests/jca/managed.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Dec 4 05:58:13 EST 2008
Author: emuckenhuber
Date: 2008-12-04 05:58:12 -0500 (Thu, 04 Dec 2008)
New Revision: 82038
Modified:
trunk/connector/src/tests/org/jboss/tests/jca/managed/ManagedObjectTestCase.java
Log:
[JBAS-6218] fix the names in the testCase
Modified: trunk/connector/src/tests/org/jboss/tests/jca/managed/ManagedObjectTestCase.java
===================================================================
--- trunk/connector/src/tests/org/jboss/tests/jca/managed/ManagedObjectTestCase.java 2008-12-04 10:57:43 UTC (rev 82037)
+++ trunk/connector/src/tests/org/jboss/tests/jca/managed/ManagedObjectTestCase.java 2008-12-04 10:58:12 UTC (rev 82038)
@@ -21,26 +21,13 @@
*/
package org.jboss.tests.jca.managed;
-import java.beans.BeanInfo;
-import java.beans.ExceptionListener;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.beans.XMLEncoder;
-import java.io.ByteArrayOutputStream;
-import java.net.URL;
import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Marshaller;
-import javax.xml.namespace.QName;
-
import org.jboss.managed.api.DeploymentTemplateInfo;
import org.jboss.managed.api.ManagedObject;
import org.jboss.managed.api.ManagedProperty;
@@ -55,13 +42,11 @@
import org.jboss.metatype.api.values.SimpleValueSupport;
import org.jboss.resource.connectionmanager.JBossManagedConnectionPool;
import org.jboss.resource.deployers.management.LocalDSInstanceClassFactory;
+import org.jboss.resource.deployers.management.NoTxCFInstanceClassFactory;
import org.jboss.resource.deployers.management.TxInstanceClassFactory;
import org.jboss.resource.deployers.management.XADSInstanceClassFactory;
-import org.jboss.resource.metadata.mcf.DBMSMetaData;
import org.jboss.resource.metadata.mcf.DataSourceConnectionPropertyMetaData;
import org.jboss.resource.metadata.mcf.LocalDataSourceDeploymentMetaData;
-import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup;
-import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentMetaData;
import org.jboss.resource.metadata.mcf.NoTxDataSourceDeploymentMetaData;
import org.jboss.resource.metadata.mcf.SecurityMetaData;
import org.jboss.resource.metadata.mcf.TxConnectionFactoryDeploymentMetaData;
@@ -90,7 +75,7 @@
"idle-timeout-minutes",
"prefill",
"background-validation",
- "background-validation-minutes",
+ "background-validation-millis",
"validate-on-match",
"use-strict-min",
"statistics-formatter",
@@ -100,7 +85,9 @@
"security-domain",
"type-mapping",
"metadata",
- "no-tx-separate-pools"
+ "no-tx-separate-pools",
+ "allocation-retry",
+ "allocation-retry-wait-millis"
};
static final String[] ManagedConnectionFactoryDeploymentMetaData_NAMES = {
"jndi-name",
@@ -127,7 +114,8 @@
"metadata",
"no-tx-separate-pools",
"interleaving",
- "use-try-lock"
+ "allocation-retry",
+ "allocation-retry-wait-millis"
};
static final String[] DataSourceDeploymentMetaData_NAMES = {
@@ -145,7 +133,8 @@
"query-timeout",
"stale-connection-checker-class-name",
"url-delimiter",
- "url-selector-strategy-class-name"
+ "url-selector-strategy-class-name",
+ "use-try-lock"
};
static final String[] DataSourceDeploymentTemplate_NAMES = DataSourceDeploymentMetaData_NAMES;
@@ -192,6 +181,7 @@
{
enableTrace("org.jboss.managed.plugins.factory");
ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
+ mof.addInstanceClassFactory(new NoTxCFInstanceClassFactory());
ManagedObject mo = mof.createManagedObject(NoTxDataSourceDeploymentMetaData.class);
log.info(mo.getProperties());
// Validate the expected property names
@@ -201,7 +191,14 @@
expectedPropertyNames.addAll(Arrays.asList(NonXADataSourceDeploymentMetaData_NAMES));
Set<String> propertyNames = mo.getPropertyNames();
TreeSet<String> sortedPropertyNames = new TreeSet<String>(propertyNames);
- assertEquals(expectedPropertyNames, sortedPropertyNames);
+ if(expectedPropertyNames.equals(sortedPropertyNames) == false)
+ {
+ Set<String> missingNames = new TreeSet<String>();
+ Set<String> extraNames = new TreeSet<String>();
+ analyzeDiffs(expectedPropertyNames, sortedPropertyNames,
+ missingNames, extraNames);
+ fail("Extra properties: "+extraNames+", missing properties: "+missingNames);
+ }
}
public void testTxConnectionFactoryMetaData()
{
@@ -478,99 +475,6 @@
}
/**
- * Just a test to see what the java.beans.XMLEncoder output for the
- * local ds metadata looks like.
- */
- public void testJavaBeanXml()
- throws Exception
- {
- ManagedConnectionFactoryDeploymentGroup mcfs = initMCFDG();
-
- BeanInfo info = Introspector.getBeanInfo(mcfs.getClass());
- for(PropertyDescriptor pd : info.getPropertyDescriptors())
- System.out.println(pd.getName() + ", "+pd.getReadMethod());
-
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLEncoder oos = new XMLEncoder(baos);
- oos.setExceptionListener(new ExceptionListener()
- {
- public void exceptionThrown(Exception e)
- {
- e.printStackTrace();
- }
- });
- oos.writeObject(mcfs);
- oos.close();
-
- String s = new String(baos.toByteArray());
- System.out.println(s);
- }
- /**
- * Just a test to see what the jaxb output for the
- * local ds metadata looks like.
- */
- public void testJaxbMCFXml()
- throws Exception
- {
- ManagedConnectionFactoryDeploymentGroup mcfs = initMCFDG();
-
- JAXBContext ctx = JAXBContext.newInstance(ManagedConnectionFactoryDeploymentGroup.class);
- Marshaller marshaller = ctx.createMarshaller();
- marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
- QName mcfsName = new QName("datasources");
- JAXBElement<ManagedConnectionFactoryDeploymentGroup> root = new
- JAXBElement<ManagedConnectionFactoryDeploymentGroup>(mcfsName,
- ManagedConnectionFactoryDeploymentGroup.class, mcfs);
- marshaller.marshal(root, System.out);
- }
-
- private ManagedConnectionFactoryDeploymentGroup initMCFDG()
- throws Exception
- {
- ManagedConnectionFactoryDeploymentGroup mcfs = new ManagedConnectionFactoryDeploymentGroup();
- LocalDataSourceDeploymentMetaData lds = new LocalDataSourceDeploymentMetaData();
- lds.setBackgroundValidation(true);
- lds.setBackgroundValidationMillis(5000);
- lds.setBlockingTimeoutMilliSeconds(5000);
- lds.setCheckValidConnectionSQL("select something from somewhere");
- lds.setConnectionDefinition("conn def");
- lds.setConnectionUrl("jdbc:xyz:a=b");
- DataSourceConnectionPropertyMetaData cp1 = new DataSourceConnectionPropertyMetaData();
- cp1.setName("cp1-name");
- cp1.setValue("cp1-value");
- DataSourceConnectionPropertyMetaData cp2 = new DataSourceConnectionPropertyMetaData();
- cp2.setName("cp2-name");
- cp2.setValue("cp2-value");
- DataSourceConnectionPropertyMetaData[] cps = {
- cp1, cp2
- };
- lds.setDataSourceConnectionProperties(Arrays.asList(cps));
- lds.setDriverClass("org.jboss.jdbc.SomeDriver");
- lds.setExceptionSorterClassName("org.jboss.jdbc.SomeExceptionSorter");
- String[] depends = {"jboss:service=Naming", "jboss:service=Hypersonic,database=localDB"};
- lds.setDependsNames(Arrays.asList(depends));
- lds.setIdleTimeoutMinutes(15);
- lds.setInterleaving(false);
- lds.setMaxSize(100);
- lds.setMinSize(1);
- DBMSMetaData md = new DBMSMetaData();
- md.setTypeMapping("Hypersonic SQL");
- lds.setDBMSMetaData(md);
- lds.setNewConnectionSQL("run this on a new conn");
- lds.setPassWord("password");
- lds.setPrefill(true);
- lds.setPreparedStatementCacheSize(50);
- lds.setQueryTimeout(30000);
- lds.setUserName("user");
-
- ManagedConnectionFactoryDeploymentMetaData[] mds = {lds};
- mcfs.setDeployments(Arrays.asList(mds));
- mcfs.setUrl(new URL("file:/deploy/some-ds.xml"));
- return mcfs;
- }
-
- /**
* Build the missingNames, extraNames from the input expectedPropertyNames
* and sortedPropertyNames.
*
More information about the jboss-cvs-commits
mailing list