[jboss-cvs] JBossAS SVN: r79297 - in projects/metadata/trunk/src: test/java/org/jboss/test/metadata and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 9 07:03:36 EDT 2008


Author: jeff.zhang
Date: 2008-10-09 07:03:35 -0400 (Thu, 09 Oct 2008)
New Revision: 79297

Added:
   projects/metadata/trunk/src/main/java/org/jboss/metadata/rar/spec/JCA15MetaData.java
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/rar/
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/rar/RA15EverythingUnitTestCase.java
   projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/rar/
   projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/rar/RA15Everything_testEverything.xml
Modified:
   projects/metadata/trunk/src/main/java/org/jboss/metadata/rar/spec/ConnectionDefinitionMetaData.java
   projects/metadata/trunk/src/main/java/org/jboss/metadata/rar/spec/ConnectorMetaData.java
Log:
[JBMETA-112] add JCA15Everything testcase

Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/rar/spec/ConnectionDefinitionMetaData.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/rar/spec/ConnectionDefinitionMetaData.java	2008-10-09 10:10:14 UTC (rev 79296)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/rar/spec/ConnectionDefinitionMetaData.java	2008-10-09 11:03:35 UTC (rev 79297)
@@ -71,6 +71,7 @@
     * 
     * @param managedConnectionFactoryClass the class name
     */
+   @XmlElement(name="managedconnectionfactory-class")
    public void setManagedConnectionFactoryClass(String managedConnectionFactoryClass)
    {
       this.managedConnectionFactoryClass = managedConnectionFactoryClass;

Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/rar/spec/ConnectorMetaData.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/rar/spec/ConnectorMetaData.java	2008-10-09 10:10:14 UTC (rev 79296)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/rar/spec/ConnectorMetaData.java	2008-10-09 11:03:35 UTC (rev 79297)
@@ -53,9 +53,6 @@
    /** The resource adapter version */
    private String raVersion;
 
-   /** The resource adapter class */
-   private String raClass;
-
    /** The license */
    private LicenseMetaData lmd;
    
@@ -195,26 +192,6 @@
    }
 
    /**
-    * Get the resource adapter class
-    * 
-    * @return the resource adapter class
-    */
-   public String getRAClass()
-   {
-      return raClass;
-   }
-
-   /**
-    * Set the resource adapter class
-    * 
-    * @param raClass the resource adapter class
-    */
-   public void setRAClass(String raClass)
-   {
-      this.raClass = raClass;
-   }
-
-   /**
     * Get the license
     * 
     * @return the license
@@ -251,7 +228,6 @@
       buffer.append(" vendorName=").append(vendorName);
       buffer.append(" eisType=").append(eisType);
       buffer.append(" resourceAdapterVersion=").append(raVersion);
-      buffer.append(" resourceAdapterClass=").append(raClass);
       buffer.append(" license=").append(lmd);
       //buffer.append(" properties=").append(getProperties());
       //buffer.append(" descriptions=").append(descriptions.values());

Added: projects/metadata/trunk/src/main/java/org/jboss/metadata/rar/spec/JCA15MetaData.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/rar/spec/JCA15MetaData.java	                        (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/rar/spec/JCA15MetaData.java	2008-10-09 11:03:35 UTC (rev 79297)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.metadata.rar.spec;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.jboss.metadata.javaee.spec.JavaEEMetaDataConstants;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * JCA 1.5 meta data
+ *
+ * @author Jeff Zhang
+ * @version $Revision: $
+ */
+ at XmlRootElement(name="connector", namespace=JavaEEMetaDataConstants.J2EE_NS)
+ at JBossXmlSchema(
+      xmlns={@XmlNs(namespaceURI = JavaEEMetaDataConstants.J2EE_NS, prefix = "jee")},
+      ignoreUnresolvedFieldOrClass=false,
+      namespace=JavaEEMetaDataConstants.J2EE_NS,
+      elementFormDefault=XmlNsForm.QUALIFIED,
+      normalizeSpace=true)
+public class JCA15MetaData extends ConnectorMetaData {
+   private static final long serialVersionUID = 1;
+}

Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/rar/RA15EverythingUnitTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/rar/RA15EverythingUnitTestCase.java	                        (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/rar/RA15EverythingUnitTestCase.java	2008-10-09 11:03:35 UTC (rev 79297)
@@ -0,0 +1,135 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.metadata.rar;
+
+import java.util.List;
+
+import org.jboss.metadata.rar.spec.AdminObjectMetaData;
+import org.jboss.metadata.rar.spec.ConnectionDefinitionMetaData;
+import org.jboss.metadata.rar.spec.ConnectorMetaData;
+import org.jboss.metadata.rar.spec.InboundRaMetaData;
+import org.jboss.metadata.rar.spec.JCA15MetaData;
+import org.jboss.metadata.rar.spec.MessageListenerMetaData;
+import org.jboss.metadata.rar.spec.OutboundRaMetaData;
+import org.jboss.metadata.rar.spec.ResourceAdapterMetaData;
+import org.jboss.metadata.rar.spec.TransactionSupportMetaData;
+import org.jboss.test.metadata.javaee.AbstractJavaEEEverythingTest;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+/**
+ * Test ResourceAdapter ra.xml metadata.
+ *
+ * @author Jeff Zhang
+ * @version $Revision:$
+ */
+public class RA15EverythingUnitTestCase extends AbstractJavaEEEverythingTest {
+
+   public static SchemaBindingResolver initResolver()
+   {
+      DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+      resolver.addClassBindingForLocation("connector_1_5.xsd", JCA15MetaData.class);
+      return resolver;
+   }
+
+   public RA15EverythingUnitTestCase(String name) {
+      super(name);
+   }
+   
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      enableTrace("org.jboss.xb");
+   }
+
+   public void testEverything() throws Exception
+   {
+      ConnectorMetaData connector = unmarshal();
+      assertNotNull(connector);
+      assertEverything(connector);
+   }
+   
+   protected ConnectorMetaData unmarshal() throws Exception
+   {
+      return unmarshal(ConnectorMetaData.class);
+   }
+   
+   protected void assertEverything(ConnectorMetaData connector) throws Exception
+   {
+      assertDescriptionGroup("connector", connector.getDescriptionGroup());
+      assertGeneralInfo(connector);
+      assertRA(connector.getRa());
+   }
+
+   private void assertGeneralInfo(ConnectorMetaData connector) 
+   {
+      assertNotNull(connector.getVendorName());
+      assertNotNull(connector.getEISType());
+      assertEquals(connector.getRAVersion(), "5.0");
+      assertNotNull(connector.getLicense());
+      assertTrue(connector.getLicense().getRequired());
+   }
+
+   private void assertRA(ResourceAdapterMetaData ra) {
+      assertNotNull(ra.getRaClass());
+      assertNotNull(ra.getConfigProperty());
+      assertEquals(ra.getConfigProperty().size(), 1);
+      assertEquals(ra.getConfigProperty().get(0).getValue(), "DEBUG");
+      assertOutboundAdapter(ra.getOutboundRa());
+      assertInoundAdapter(ra.getInboundRa());
+      assertAdminObject(ra.getAdminObjects());
+      assertNotNull(ra.getSecurityPermissions());
+      assertEquals(ra.getSecurityPermissions().get(0).getSecurityPermissionSpec(), "sa");
+   }
+   
+   private void assertOutboundAdapter(OutboundRaMetaData outboundRa) {
+      assertNotNull(outboundRa.getConDefs());
+      ConnectionDefinitionMetaData conDef = outboundRa.getConDefs().get(0);
+      assertTrue(conDef.getManagedConnectionFactoryClass().endsWith("JmsManagedConnectionFactory"));
+      assertEquals(conDef.getConfigProps().size(), 7);
+      assertTrue(conDef.getConnectionFactoryInterfaceClass().endsWith("JmsConnectionFactory"));
+      assertTrue(conDef.getConnectionFactoryImplementationClass().endsWith("JmsConnectionFactoryImpl"));
+      assertTrue(conDef.getConnectionInterfaceClass().endsWith("Session"));
+      assertTrue(conDef.getConnectionImplementationClass().endsWith("JmsSession"));
+      assertEquals(outboundRa.getTransSupport(), TransactionSupportMetaData.XATransaction);
+      assertNotNull(outboundRa.getAuthMechanisms());
+      assertFalse(outboundRa.isReAuthSupport());
+
+   }
+
+   private void assertInoundAdapter(InboundRaMetaData inboundRa) {
+      assertNotNull(inboundRa.getMessageAdapter());
+      assertNotNull(inboundRa.getMessageAdapter().getMessageListeners());
+      MessageListenerMetaData msgListener = inboundRa.getMessageAdapter().getMessageListeners().get(0);
+      assertNotNull(msgListener);
+      assertTrue(msgListener.getType().endsWith("MessageListener"));
+      assertTrue(msgListener.getActivationSpecType().getAsClass().endsWith("JmsActivationSpec"));
+      assertNotNull(msgListener.getActivationSpecType().getRequiredConfigProps());
+      assertFalse(msgListener.getActivationSpecType().getRequiredConfigProps().isEmpty());
+   }
+
+   private void assertAdminObject(List<AdminObjectMetaData> adminObjects) {
+      assertEquals(adminObjects.size(), 1);
+      assertTrue(adminObjects.get(0).getAdminObjectInterfaceClass().endsWith("TestInterface"));
+      
+   }
+
+}

Added: projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/rar/RA15Everything_testEverything.xml
===================================================================
--- projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/rar/RA15Everything_testEverything.xml	                        (rev 0)
+++ projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/rar/RA15Everything_testEverything.xml	2008-10-09 11:03:35 UTC (rev 79297)
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id: ra.xml 76819 2008-08-08 11:04:20Z jesper.pedersen $ -->
+
+<connector xmlns="http://java.sun.com/xml/ns/j2ee"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+           http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
+           version="1.5">
+
+
+   <!-- description group -->
+   <description>en-connector-desc</description>
+   <description xml:lang="fr">fr-connector-desc</description>
+   <description xml:lang="de">de-connector-desc</description>
+   <display-name>en-connector-disp</display-name>
+   <display-name xml:lang="fr">fr-connector-disp</display-name>
+   <display-name xml:lang="de">de-connector-disp</display-name>
+   <icon id="en-connector-icon-id">
+      <small-icon>en-connector-small-icon</small-icon>
+      <large-icon>en-connector-large-icon</large-icon>
+   </icon>
+   <icon xml:lang="fr" id="fr-connector-icon-id">
+      <small-icon>fr-connector-small-icon</small-icon>
+      <large-icon>fr-connector-large-icon</large-icon>
+   </icon>
+   <icon xml:lang="de" id="de-connector-icon-id">
+      <small-icon>de-connector-small-icon</small-icon>
+      <large-icon>de-connector-large-icon</large-icon>
+   </icon>
+
+   <vendor-name>Red Hat Middleware LLC</vendor-name>
+   <eis-type>JMS 1.1 Server</eis-type>
+   <resourceadapter-version>5.0</resourceadapter-version>
+
+   <license>
+      <description>
+ JBoss, Home of Professional Open Source.
+ Copyright 2006, 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.
+      </description>
+      <license-required>true</license-required>
+   </license>
+
+   <resourceadapter>
+      <resourceadapter-class>org.jboss.resource.adapter.jms.JmsResourceAdapter</resourceadapter-class>
+
+      <config-property>
+         <description>Log level</description>
+         <config-property-name>logLevel</config-property-name>
+         <config-property-type>java.lang.String</config-property-type>
+         <config-property-value>DEBUG</config-property-value>
+      </config-property>
+      
+      <outbound-resourceadapter>
+         <connection-definition>
+            <managedconnectionfactory-class>org.jboss.resource.adapter.jms.JmsManagedConnectionFactory</managedconnectionfactory-class>
+            <config-property>
+              <description>The jndi name of the provider of connection factories</description>
+              <config-property-name>JmsProviderAdapterJNDI</config-property-name>
+              <config-property-type>java.lang.String</config-property-type>
+              <config-property-value>java:DefaultJMSProvider</config-property-value>
+            </config-property>
+            <config-property>
+               <description>The default session type</description>
+               <config-property-name>SessionDefaultType</config-property-name>
+               <config-property-type>java.lang.String</config-property-type>
+               <config-property-value>javax.jms.Topic</config-property-value>
+            </config-property>
+            <config-property>
+              <description>The user name used to login to the jms server</description>
+              <config-property-name>UserName</config-property-name>
+              <config-property-type>java.lang.String</config-property-type>
+              <config-property-value></config-property-value>
+            </config-property>
+            <config-property>
+              <description>The password used to login to the jms server</description>
+              <config-property-name>Password</config-property-name>
+             <config-property-type>java.lang.String</config-property-type>
+             <config-property-value></config-property-value>
+            </config-property>
+            <config-property>
+              <description>The client id for this connection factory</description>
+              <config-property-name>ClientID</config-property-name>
+             <config-property-type>java.lang.String</config-property-type>
+             <config-property-value></config-property-value>
+            </config-property>
+            <config-property>
+              <config-property-name>Strict</config-property-name>
+               <config-property-type>java.lang.Boolean</config-property-type>
+               <config-property-value>true</config-property-value>
+            </config-property>
+            <config-property>
+               <description>Maximum wait for a lock</description>
+               <config-property-name>UseTryLock</config-property-name>
+               <config-property-type>java.lang.Integer</config-property-type>
+            </config-property>
+            <connectionfactory-interface>org.jboss.resource.adapter.jms.JmsConnectionFactory</connectionfactory-interface>
+            <connectionfactory-impl-class>org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl</connectionfactory-impl-class>
+            <connection-interface>javax.jms.Session</connection-interface>
+            <connection-impl-class>org.jboss.resource.adapter.jms.JmsSession</connection-impl-class>
+         </connection-definition>
+         <transaction-support>XATransaction</transaction-support>
+         <authentication-mechanism>
+            <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
+            <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
+         </authentication-mechanism>
+         <reauthentication-support>false</reauthentication-support>
+      </outbound-resourceadapter>
+
+      <inbound-resourceadapter>
+         <messageadapter>        
+            <messagelistener>
+               <messagelistener-type>javax.jms.MessageListener</messagelistener-type>
+               <activationspec>
+                  <activationspec-class>org.jboss.resource.adapter.jms.inflow.JmsActivationSpec</activationspec-class>
+                  <required-config-property>
+                      <config-property-name>destination</config-property-name>
+                  </required-config-property>
+               </activationspec>
+            </messagelistener>
+         </messageadapter>
+      </inbound-resourceadapter>
+      
+      <adminobject>
+         <adminobject-interface>org.jboss.test.jca.adminobject.TestInterface</adminobject-interface>
+         <adminobject-class>org.jboss.test.jca.adminobject.TestImplementation</adminobject-class>
+         <config-property>
+            <config-property-name>StringProperty</config-property-name>
+            <config-property-type>java.lang.String</config-property-type>
+         </config-property>
+         <config-property>
+            <config-property-name>IntegerProperty</config-property-name>
+            <config-property-type>java.lang.Integer</config-property-type>
+         </config-property>
+      </adminobject>
+      <security-permission>
+         <description></description>
+         <security-permission-spec>sa</security-permission-spec>
+      </security-permission>
+   </resourceadapter>
+</connector>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list