[jboss-cvs] JBossAS SVN: r111131 - in projects/jboss-jca/trunk: common/src/test/java/org/jboss/jca/common/metadata/merge and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Apr 8 09:15:28 EDT 2011


Author: maeste
Date: 2011-04-08 09:15:27 -0400 (Fri, 08 Apr 2011)
New Revision: 111131

Added:
   projects/jboss-jca/trunk/common/src/test/resources/merger/ironjacamar-merging-connectiondefinition-noclassname.xml
   projects/jboss-jca/trunk/core/junitvmwatcher3195784243567941423.properties
Modified:
   projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/Merger.java
   projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/merge/MergerTestCase.java
   projects/jboss-jca/trunk/common/src/test/resources/merger/ironjacamar-ignoring-not-matching-connectiondefinition.xml
   projects/jboss-jca/trunk/common/src/test/resources/merger/ironjacamar-merging-connectiondefinition.xml
Log:
 fixing NPE

Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/Merger.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/Merger.java	2011-04-08 12:21:01 UTC (rev 111130)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/merge/Merger.java	2011-04-08 13:15:27 UTC (rev 111131)
@@ -206,7 +206,7 @@
                ConnectionDefinition newConDef = conDef;
                if (ij.getConnectionDefinitions() != null)
                {
-                  if (ij.getConnectionDefinitions().size() == 1)
+                  if (ij.getConnectionDefinitions().size() == 1 && ij.getConnectionDefinitions().get(0).isEnabled())
                   {
                      newConDef = mergeConDef(ij.getConnectionDefinitions().get(0), newConDef);
                   }

Modified: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/merge/MergerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/merge/MergerTestCase.java	2011-04-08 12:21:01 UTC (rev 111130)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/merge/MergerTestCase.java	2011-04-08 13:15:27 UTC (rev 111131)
@@ -662,6 +662,80 @@
    }
 
    /**
+    * shouldIgnorePropertyInIronJacamarAndNotInConnector
+    * @throws Exception in case of error
+    */
+   @SuppressWarnings("unchecked")
+   @Test
+   public void shouldMergeSingleConnectionDefinitionAlsoWithoutClassname() throws Exception
+   {
+      FileInputStream is = null;
+      try
+      {
+         //given
+         File xmlFile = new File(Thread.currentThread().getContextClassLoader()
+            .getResource("merger/connector-merging-connectiondefinition.xml").toURI());
+         is = new FileInputStream(xmlFile);
+         RaParser parser = new RaParser();
+         Connector connector = parser.parse(is);
+         is.close();
+         xmlFile = new File(Thread.currentThread().getContextClassLoader()
+            .getResource("merger/ironjacamar-merging-connectiondefinition-noclassname.xml").toURI());
+         is = new FileInputStream(xmlFile);
+         IronJacamarParser raparser = new IronJacamarParser();
+         IronJacamar ij = raparser.parse(is);
+
+         assertThat(connector, notNullValue());
+         assertThat(ij, notNullValue());
+         assertThat(((ResourceAdapter1516) connector.getResourceadapter()).getOutboundResourceadapter()
+            .getConnectionDefinitions().size(), is(1));
+
+         //when
+         Merger mf = new Merger();
+         Connector merged = mf.mergeConnectorWithCommonIronJacamar(ij, connector);
+         //then
+         ConfigProperty exConf1 = new ConfigPropertyImpl(null, new XsdString("LogConfigFile", null),
+                                                         new XsdString("java.lang.String", null),
+                                                         new XsdString("ASAP_SAP_1_0.xml", null), null);
+         ConfigProperty exConf2 = new ConfigPropertyImpl(null, new XsdString("RootLogContext", null),
+                                                         new XsdString("java.lang.String", null),
+                                                         new XsdString("ASAP_SAP_1_0", null), null);
+         ConfigProperty exConf3 = new ConfigPropertyImpl(null, new XsdString("LogLevel", null),
+                                                         new XsdString("java.lang.String", null),
+                                                         new XsdString("WARN", null), null);
+         //         ConfigProperty exConf4 = new ConfigPropertyImpl(null, new XsdString("UserName", null),
+         //                                                         new XsdString("java.lang.String", null),
+         //                                                         new XsdString("aaa", null), null);
+         //         ConfigProperty exConf5 = new ConfigPropertyImpl(null, new XsdString("Password", null),
+         //                                                         new XsdString("java.lang.String", null),
+         //                                                         new XsdString("bbb", null), null);
+
+         assertThat(merged, notNullValue());
+         assertThat(connector.getResourceadapter().getConfigProperties().size(), is(1));
+         assertThat(merged.getEisType(), equalTo(connector.getEisType()));
+         assertThat(merged.getVersion(), equalTo(connector.getVersion()));
+         assertThat(((ResourceAdapter1516) merged.getResourceadapter()).getResourceadapterClass(),
+            equalTo(((ResourceAdapter1516) connector.getResourceadapter()).getResourceadapterClass()));
+         assertThat(((ResourceAdapter1516) merged.getResourceadapter()).getOutboundResourceadapter(),
+            is(((ResourceAdapter1516) connector.getResourceadapter()).getOutboundResourceadapter()));
+         assertThat(((ResourceAdapter1516) merged.getResourceadapter()).getOutboundResourceadapter()
+            .getConnectionDefinitions().size(), is(1));
+         List<ConfigProperty> conDefProps = (List<ConfigProperty>) ((ResourceAdapter1516) merged.getResourceadapter())
+            .getOutboundResourceadapter().getConnectionDefinitions().get(0).getConfigProperties();
+         assertThat(conDefProps.size(), is(3));
+         assertThat(conDefProps, hasItems(exConf1, exConf2, exConf3)); //, exConf4, exConf5));
+         assertThat(((ResourceAdapter1516) merged.getResourceadapter()).getInboundResourceadapter(),
+            equalTo(((ResourceAdapter1516) connector.getResourceadapter()).getInboundResourceadapter()));
+      }
+      finally
+      {
+         if (is != null)
+            is.close();
+      }
+
+   }
+
+   /**
     * shouldMergeMultipleConnectionDefinitions
     * @throws Exception in case of error
     */

Modified: projects/jboss-jca/trunk/common/src/test/resources/merger/ironjacamar-ignoring-not-matching-connectiondefinition.xml
===================================================================
--- projects/jboss-jca/trunk/common/src/test/resources/merger/ironjacamar-ignoring-not-matching-connectiondefinition.xml	2011-04-08 12:21:01 UTC (rev 111130)
+++ projects/jboss-jca/trunk/common/src/test/resources/merger/ironjacamar-ignoring-not-matching-connectiondefinition.xml	2011-04-08 13:15:27 UTC (rev 111131)
@@ -33,5 +33,36 @@
         <idle-timeout-minutes>15</idle-timeout-minutes>
       </timeout>
     </connection-definition>
+    <connection-definition class-name="nonMatchingName2"
+      enabled="true" jndi-name="aSAPXcess" pool-name="aSAPXcess">
+      <config-property name="LogConfigFile">ASAP_SAP_1_0.xml</config-property>
+      <config-property name="RootLogContext">ASAP_SAP_1_0</config-property>
+      <config-property name="LogLevel">WARN</config-property>
+      <config-property name="MessageBundleBase">ASAP_SAP_1_0</config-property>
+      <config-property name="LanguageCode">en</config-property>
+      <config-property name="CountryCode">US</config-property>
+      <config-property name="UserName"></config-property>
+      <config-property name="Password"></config-property>
+      <config-property name="ClientNumber"></config-property>
+      <config-property name="ServerName"></config-property>
+      <config-property name="SystemNumber"></config-property>
+      <config-property name="GatewayServerName"></config-property>
+      <config-property name="GatewayServiceNumber"></config-property>
+      <config-property name="SystemName"></config-property>
+      <config-property name="MessageServerName"></config-property>
+      <config-property name="GroupName"></config-property>
+      <config-property name="ConnectionURL"></config-property>
+      <pool>
+        <min-pool-size>0</min-pool-size>
+        <max-pool-size>64</max-pool-size>
+      </pool>
+      <security>
+        <application />
+      </security>
+      <timeout>
+        <blocking-timeout-millis>5000</blocking-timeout-millis>
+        <idle-timeout-minutes>15</idle-timeout-minutes>
+      </timeout>
+    </connection-definition>
   </connection-definitions>
 </ironjacamar>
\ No newline at end of file

Copied: projects/jboss-jca/trunk/common/src/test/resources/merger/ironjacamar-merging-connectiondefinition-noclassname.xml (from rev 111130, projects/jboss-jca/trunk/common/src/test/resources/merger/ironjacamar-ignoring-not-matching-connectiondefinition.xml)
===================================================================
--- projects/jboss-jca/trunk/common/src/test/resources/merger/ironjacamar-merging-connectiondefinition-noclassname.xml	                        (rev 0)
+++ projects/jboss-jca/trunk/common/src/test/resources/merger/ironjacamar-merging-connectiondefinition-noclassname.xml	2011-04-08 13:15:27 UTC (rev 111131)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ironjacamar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../main/resources/schema/ironjacamar_1_0.xsd">
+  <transaction-support>NoTransaction</transaction-support>
+  <connection-definitions>
+    <connection-definition 
+      enabled="true" jndi-name="aSAPXcess" pool-name="aSAPXcess">
+      <config-property name="LogConfigFile">ASAP_SAP_1_0.xml</config-property>
+      <config-property name="RootLogContext">ASAP_SAP_1_0</config-property>
+      <config-property name="LogLevel">WARN</config-property>
+      <config-property name="MessageBundleBase">ASAP_SAP_1_0</config-property>
+      <config-property name="LanguageCode">en</config-property>
+      <config-property name="CountryCode">US</config-property>
+      <config-property name="UserName"></config-property>
+      <config-property name="Password"></config-property>
+      <config-property name="ClientNumber"></config-property>
+      <config-property name="ServerName"></config-property>
+      <config-property name="SystemNumber"></config-property>
+      <config-property name="GatewayServerName"></config-property>
+      <config-property name="GatewayServiceNumber"></config-property>
+      <config-property name="SystemName"></config-property>
+      <config-property name="MessageServerName"></config-property>
+      <config-property name="GroupName"></config-property>
+      <config-property name="ConnectionURL"></config-property>
+      <pool>
+        <min-pool-size>0</min-pool-size>
+        <max-pool-size>64</max-pool-size>
+      </pool>
+      <security>
+        <application />
+      </security>
+      <timeout>
+        <blocking-timeout-millis>5000</blocking-timeout-millis>
+        <idle-timeout-minutes>15</idle-timeout-minutes>
+      </timeout>
+    </connection-definition>
+  </connection-definitions>
+</ironjacamar>
\ No newline at end of file

Modified: projects/jboss-jca/trunk/common/src/test/resources/merger/ironjacamar-merging-connectiondefinition.xml
===================================================================
--- projects/jboss-jca/trunk/common/src/test/resources/merger/ironjacamar-merging-connectiondefinition.xml	2011-04-08 12:21:01 UTC (rev 111130)
+++ projects/jboss-jca/trunk/common/src/test/resources/merger/ironjacamar-merging-connectiondefinition.xml	2011-04-08 13:15:27 UTC (rev 111131)
@@ -2,8 +2,8 @@
 <ironjacamar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../main/resources/schema/ironjacamar_1_0.xsd">
   <transaction-support>NoTransaction</transaction-support>
   <connection-definitions>
-    <connection-definition class-name="org.jboss.jca.test.deployers.spec.rars.ra16inoutjbossra.TestManagedConnectionFactory"
-      enabled="true" jndi-name="aSAPXcess" pool-name="aSAPXcess">
+    <connection-definition 
+      enabled="true" jndi-name="aSAPXcess" pool-name="aSAPXcess" class-name="org.jboss.jca.test.deployers.spec.rars.ra16inoutjbossra.TestManagedConnectionFactory">
       <config-property name="LogConfigFile">ASAP_SAP_1_0.xml</config-property>
       <config-property name="RootLogContext">ASAP_SAP_1_0</config-property>
       <config-property name="LogLevel">WARN</config-property>

Added: projects/jboss-jca/trunk/core/junitvmwatcher3195784243567941423.properties
===================================================================


More information about the jboss-cvs-commits mailing list