[jboss-cvs] JBossAS SVN: r59961 - in trunk/ejb3: src/main/org/jboss/annotation/ejb and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 23 17:49:59 EST 2007


Author: bdecoste
Date: 2007-01-23 17:49:58 -0500 (Tue, 23 Jan 2007)
New Revision: 59961

Added:
   trunk/ejb3/src/resources/test/servicexmbean/META-INF/jboss.xml
   trunk/ejb3/src/resources/test/servicexmbean/service-xmbean.xml
   trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/ServiceOne.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/ServiceOneDeploymentDescriptor.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/ServiceOneRemote.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/unit/ServiceUnitTestCase.java
Modified:
   trunk/ejb3/build-test.xml
   trunk/ejb3/build.xml
   trunk/ejb3/src/main/org/jboss/annotation/ejb/Service.java
   trunk/ejb3/src/main/org/jboss/annotation/ejb/ServiceImpl.java
   trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
   trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java
   trunk/ejb3/src/main/org/jboss/ejb3/metamodel/JBossDDObjectFactory.java
   trunk/ejb3/src/main/org/jboss/ejb3/metamodel/Service.java
   trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java
   trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceMBeanDelegate.java
   trunk/ejb3/src/resources/schema/jboss_5_0.xsd
Log:
implementation and tests for XMBean support for Service beans

Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml	2007-01-23 22:49:48 UTC (rev 59960)
+++ trunk/ejb3/build-test.xml	2007-01-23 22:49:58 UTC (rev 59961)
@@ -55,10 +55,10 @@
    <property file="local.properties"/>
 
    <!-- Cluster node0 defaults -->
-   <property name="node0" value="localhost" />
+   <property name="node0" value="${env.MYTESTIP_1}" />
    <property name="node0.http.url" value="http://${node0}:8080" />
    <property name="node0.jndi.url" value="jnp://${node0}:1099" />
-   <property name="node1" value="${hostname}" />
+   <property name="node1" value="${env.MYTESTIP_2}" />
    <property name="node1.http.url" value="http://${node1}:8080" />
    <property name="node1.jndi.url" value="jnp://${node1}:1099" />
 
@@ -2800,6 +2800,25 @@
       </jar>
    </target>
 
+   <target name="servicexmbean"
+      description="Builds all jar files."
+      depends="compile-classes">
+
+      <mkdir dir="${build.lib}"/>
+
+      <jar jarfile="${build.lib}/service-xmbean-test.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/ejb3/test/servicexmbean/*.class"/>
+         </fileset>
+         <fileset dir="${resources}/test/servicexmbean">
+            <include name="service-xmbean.xml"/>
+         </fileset>
+         <fileset dir="${resources}/test/servicexmbean">
+            <include name="META-INF/jboss.xml"/>
+         </fileset>
+      </jar>
+   </target>
+
    <target name="entitycallback"
       description="Builds all jar files."
       depends="compile-classes">
@@ -2923,7 +2942,7 @@
       </jar>
    </target>
    
-   <target name="jars" depends="arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader, 
+   <target name="jars" depends="servicexmbean, arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader, 
       circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ear, ejbthree440, 
       ejbthree454, ejbthree653, ejbthree670, ejbthree712, ejbthree751, aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, 
       securitydomain, enventry, 
@@ -3174,16 +3193,16 @@
          <lib dir="${module.output}/lib/embeddable/lib">
             <include name="*.jar"/>
          </lib>
-         <lib dir="${module.output}/lib/embeddable/conf/">
+         <!--lib dir="${module.output}/lib/embeddable/conf/">
             <include name="standalone.jar"/>
-         </lib>
+         </lib-->
          <lib dir="${build.lib}/embeddable/standalone">
             <include name="*.jar"/>
          </lib>
-         <classes dir="${module.output}/lib/embeddable/conf">
+         <!--classes dir="${module.output}/lib/embeddable/conf">
             <include name="*.xml"/>
             <include name="default.persistence.properties"/>
-         </classes>
+         </classes-->
          <fileset dir="${source.java}">
             <include name="EmbeddedEJB3.jsp"/>
          </fileset>
@@ -3600,6 +3619,9 @@
          <param name="test" value="service"/>
       </antcall>
       <antcall target="test" inheritRefs="true">
+         <param name="test" value="servicexmbean"/>
+      </antcall>
+      <antcall target="test" inheritRefs="true">
          <param name="test" value="stateful"/>
       </antcall>
       <!--antcall target="test" inheritRefs="true">
@@ -3868,7 +3890,7 @@
       <antcall target="tests-clustering-startup"/>
       <antcall target="tests-clustering-wait"/>
 
-      <antcall target="test-clustered-entity"/>
+      <!--antcall target="test-clustered-entity"/-->
       <antcall target="test-cluster-session"/>
 
       <!--
@@ -4028,7 +4050,7 @@
 
    <target name="tests-clustering-wait" unless="${tests.clustering.skip.startup}">
       <echo message="Waiting for nodes to start..."/>
-      <waitfor maxwait="120" maxwaitunit="second"
+      <waitfor maxwait="240" maxwaitunit="second"
          checkevery="5" checkeveryunit="second" timeoutproperty="cluster.timeout">
          <and>
             <http url="${node0.http.url}"/>

Modified: trunk/ejb3/build.xml
===================================================================
--- trunk/ejb3/build.xml	2007-01-23 22:49:48 UTC (rev 59960)
+++ trunk/ejb3/build.xml	2007-01-23 22:49:58 UTC (rev 59961)
@@ -100,7 +100,7 @@
          <path refid="jboss.jbossws.classpath"/>
          <path refid="jboss.jbossxb.classpath"/>
          <path refid="jacorb.jacorb.classpath"/>
-
+         <path refid="dom4j.dom4j.classpath"/>
          <!-- FIXME: temporary for EJBTHREE-485 -->
          <path refid="cglib.classpath"/>
       </path>
@@ -126,6 +126,7 @@
          <path refid="jboss.cluster.classpath"/>
          <path refid="jboss.system.classpath"/>
          <path refid="jboss.systemjmx.classpath"/>
+         <path refid="jboss.mbeans.classpath"/>
          <path refid="jboss.naming.classpath"/>
          <path refid="jboss.transaction.classpath"/>
          <path refid="jboss.security.classpath"/>

Modified: trunk/ejb3/src/main/org/jboss/annotation/ejb/Service.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/annotation/ejb/Service.java	2007-01-23 22:49:48 UTC (rev 59960)
+++ trunk/ejb3/src/main/org/jboss/annotation/ejb/Service.java	2007-01-23 22:49:58 UTC (rev 59961)
@@ -38,4 +38,5 @@
 {
    String objectName() default "";
    String name() default "";
+   String xmbean() default "";
 }

Modified: trunk/ejb3/src/main/org/jboss/annotation/ejb/ServiceImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/annotation/ejb/ServiceImpl.java	2007-01-23 22:49:48 UTC (rev 59960)
+++ trunk/ejb3/src/main/org/jboss/annotation/ejb/ServiceImpl.java	2007-01-23 22:49:58 UTC (rev 59961)
@@ -32,6 +32,7 @@
 {
    private String objectName = "";
    private String name = "";
+   private String xmbean = "";
    
    public ServiceImpl(Service service)
    {
@@ -67,6 +68,16 @@
       return name;
    }
    
+   public void setXMBean(String xmbean)
+   {
+      this.xmbean = xmbean;
+   }
+   
+   public String xmbean()
+   {
+      return xmbean;
+   }
+   
    public Class<? extends Annotation> annotationType()
    {
       return null;

Modified: trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java	2007-01-23 22:49:48 UTC (rev 59960)
+++ trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java	2007-01-23 22:49:58 UTC (rev 59961)
@@ -166,9 +166,7 @@
       this.deployment = deployment;
       this.beanClassName = beanClassName;
       this.classloader = cl;
-      
-      log.info("!!! new EJBContainer " + ejbName);
-      
+         
       super.setChainOverridingForInheritedMethods( true );
       
       try

Modified: trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java	2007-01-23 22:49:48 UTC (rev 59960)
+++ trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java	2007-01-23 22:49:58 UTC (rev 59961)
@@ -330,6 +330,8 @@
             annotation.setObjectName(service.getObjectName());
          if (service.getEjbName() != null)
             annotation.setName(service.getEjbName());
+         if (service.getXMBean() != null)
+            annotation.setXMBean(service.getXMBean());
          addClassAnnotation(container, Service.class, annotation);
       }
 

Modified: trunk/ejb3/src/main/org/jboss/ejb3/metamodel/JBossDDObjectFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/metamodel/JBossDDObjectFactory.java	2007-01-23 22:49:48 UTC (rev 59960)
+++ trunk/ejb3/src/main/org/jboss/ejb3/metamodel/JBossDDObjectFactory.java	2007-01-23 22:49:58 UTC (rev 59961)
@@ -802,6 +802,10 @@
       {
          service.setEjbClass(getValue(localName, value));
       }
+      if (localName.equals("xmbean"))
+      {
+         service.setXMBean(getValue(localName, value));
+      }
       else if (localName.equals("local"))
       {
          service.setLocal(getValue(localName, value));

Modified: trunk/ejb3/src/main/org/jboss/ejb3/metamodel/Service.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/metamodel/Service.java	2007-01-23 22:49:48 UTC (rev 59960)
+++ trunk/ejb3/src/main/org/jboss/ejb3/metamodel/Service.java	2007-01-23 22:49:58 UTC (rev 59961)
@@ -33,6 +33,7 @@
    
    private String management = null;
    private String objectName = null;
+   private String xmbean = null;
    
    public String getManagement()
    {
@@ -44,6 +45,16 @@
       this.management = management;
    }
    
+   public String getXMBean()
+   {
+      return xmbean;
+   }
+   
+   public void setXMBean(String xmbean)
+   {
+      this.xmbean = xmbean;
+   }
+   
    public String getObjectName()
    {
       return objectName;

Modified: trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java	2007-01-23 22:49:48 UTC (rev 59960)
+++ trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java	2007-01-23 22:49:58 UTC (rev 59961)
@@ -508,10 +508,29 @@
 
             delegate = new ServiceMBeanDelegate(mbeanServer, this, intf, delegateObjectName);
 
-            Object securityDomainAnnotation = resolveAnnotation(org.jboss.annotation.security.SecurityDomain.class);
-
             getDeployment().getKernelAbstraction().installMBean(delegateObjectName, getDependencyPolicy(), delegate);
          }
+         else
+         {
+            Service service = (Service)resolveAnnotation(Service.class);
+            if (service.xmbean().length() > 0)
+            {
+               if (mbeanServer == null)
+                  mbeanServer = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
+
+               if (mbeanServer == null)
+                  throw new RuntimeException(ejbName + "is defined as an XMBean, but the MBeanServer has not been initialized for it");
+
+               String objname = service.objectName();
+               delegateObjectName = (objname == null || objname.equals("")) ?
+                               new ObjectName(getObjectName().getCanonicalName() + ",type=ManagementInterface") : new ObjectName(service.objectName());
+
+               delegate = new ServiceMBeanDelegate(mbeanServer, this, service.xmbean(), delegateObjectName);
+
+               getDeployment().getKernelAbstraction().installMBean(delegateObjectName, getDependencyPolicy(), delegate);
+            }
+         }
+         
       }
       catch (Exception e)
       {

Modified: trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceMBeanDelegate.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceMBeanDelegate.java	2007-01-23 22:49:48 UTC (rev 59960)
+++ trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceMBeanDelegate.java	2007-01-23 22:49:58 UTC (rev 59961)
@@ -28,6 +28,7 @@
 import javax.management.Attribute;
 import javax.management.AttributeList;
 import javax.management.AttributeNotFoundException;
+import javax.management.Descriptor;
 import javax.management.DynamicMBean;
 import javax.management.InstanceNotFoundException;
 import javax.management.InvalidAttributeValueException;
@@ -41,15 +42,20 @@
 import javax.management.ReflectionException;
 import javax.management.StandardMBean;
 import javax.management.NotCompliantMBeanException;
+import javax.management.modelmbean.DescriptorSupport;
 
+import org.jboss.mx.modelmbean.XMBean;
+import org.jboss.mx.modelmbean.XMBeanConstants;
+
 import org.jboss.logging.Logger;
 import org.jboss.util.Classes;
 
+
 /**
  * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
  * @version $Revision$
  */
-public class ServiceMBeanDelegate implements DynamicMBean
+public class ServiceMBeanDelegate implements DynamicMBean, XMBeanConstants
 {
    private static final Logger log = Logger.getLogger(ServiceMBeanDelegate.class);
    
@@ -81,7 +87,33 @@
       }
       mbeanInfo = mbean.getMBeanInfo();
    }
+   
+   public ServiceMBeanDelegate(MBeanServer server, ServiceContainer container, String xmbean, ObjectName on)
+   {
+      this.container = container;
+      this.server = server;
+      serviceOn = on;
+      XMBean mbean = null;
+      try
+      {
+         Descriptor descriptor = new DescriptorSupport();
+         descriptor.setField(RESOURCE_REFERENCE, container.getSingleton());
+         descriptor.setField(RESOURCE_TYPE, xmbean);
+         descriptor.setField(SAX_PARSER, "org.apache.crimson.parser.XMLReaderImpl");
 
+         mbean = new XMBean(descriptor, DESCRIPTOR);
+      }
+      catch (NotCompliantMBeanException e)
+      {
+         throw new RuntimeException(e);
+      }
+      catch (javax.management.MBeanException e)
+      {
+         throw new RuntimeException(e);
+      }
+      mbeanInfo = mbean.getMetaData();
+   }
+
    public ObjectName getObjectName()
    {
       return serviceOn;

Modified: trunk/ejb3/src/resources/schema/jboss_5_0.xsd
===================================================================
(Binary files differ)

Added: trunk/ejb3/src/resources/test/servicexmbean/META-INF/jboss.xml
===================================================================
--- trunk/ejb3/src/resources/test/servicexmbean/META-INF/jboss.xml	                        (rev 0)
+++ trunk/ejb3/src/resources/test/servicexmbean/META-INF/jboss.xml	2007-01-23 22:49:58 UTC (rev 59961)
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<jboss
+        xmlns="http://java.sun.com/xml/ns/javaee"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                            http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
+        version="3.0">
+   <enterprise-beans>
+      <service>
+         <ejb-name>ServiceOneDeploymentDescriptor</ejb-name>
+         <ejb-class>org.jboss.ejb3.test.servicexmbean.ServiceOneDeploymentDescriptor</ejb-class>
+         <object-name>jboss.ejb3.test:service=ServiceOneDeploymentDescriptor</object-name>
+         <remote>org.jboss.ejb3.test.servicexmbean.ServiceOneRemote</remote>
+         <xmbean>resource:service-xmbean.xml</xmbean>
+         <jndi-name>ServiceOneDeploymentDescriptor/remote</jndi-name>
+      </service>
+   </enterprise-beans>
+</jboss>

Added: trunk/ejb3/src/resources/test/servicexmbean/service-xmbean.xml
===================================================================
--- trunk/ejb3/src/resources/test/servicexmbean/service-xmbean.xml	                        (rev 0)
+++ trunk/ejb3/src/resources/test/servicexmbean/service-xmbean.xml	2007-01-23 22:49:58 UTC (rev 59961)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mbean PUBLIC
+        "-//JBoss//DTD JBOSS XMBEAN 1.0//EN"
+        "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_0.dtd">
+<mbean>
+
+    <description>EJB3 Service XMBean Example</description>
+    
+    <class>org.jboss.ejb3.test.servicexmbean.ServiceOne</class>
+   
+    <!-- Constructors -->
+    <constructor>
+        <description>The default constructor</description>
+        <name>ServiceOne</name>
+    </constructor>
+
+    <!-- Attributes -->
+    
+    <attribute access="read-write" getMethod="getStringAttribute" setMethod="setStringAttribute">
+        <description>Test attribute</description>
+        <name>StringAttribute</name>
+        <type>java.lang.String</type>
+    </attribute>
+
+    <!-- Operations -->
+    <operation>
+        <description>Resets</description>
+        <name>testOperation</name>
+        <return-type>java.lang.Void</return-type>
+    </operation>
+</mbean>
+

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/ServiceOne.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/ServiceOne.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/ServiceOne.java	2007-01-23 22:49:58 UTC (rev 59961)
@@ -0,0 +1,59 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, 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.ejb3.test.servicexmbean;
+
+import javax.ejb.Remote;
+
+import org.jboss.annotation.ejb.Service;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Service(objectName="jboss.ejb3.test:service=ServiceOne", xmbean="resource:service-xmbean.xml")
+ at Remote(ServiceOneRemote.class)
+public class ServiceOne implements ServiceOneRemote
+{
+   String stringAttribute = "";
+   
+   public ServiceOne()
+   {
+   }
+   
+   public void remoteMethod()
+   {
+   }
+   
+   public void testOperation()
+   {
+      stringAttribute = "reset";
+   }
+
+   public String getStringAttribute()
+   {
+      return stringAttribute;
+   }
+
+   public void setStringAttribute(String stringAttribute)
+   {
+      this.stringAttribute = stringAttribute;
+   }
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/ServiceOneDeploymentDescriptor.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/ServiceOneDeploymentDescriptor.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/ServiceOneDeploymentDescriptor.java	2007-01-23 22:49:58 UTC (rev 59961)
@@ -0,0 +1,57 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, 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.ejb3.test.servicexmbean;
+
+import javax.ejb.Remote;
+
+import org.jboss.annotation.ejb.Service;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public class ServiceOneDeploymentDescriptor implements ServiceOneRemote
+{
+   String stringAttribute = "";
+   
+   public ServiceOneDeploymentDescriptor()
+   {
+   }
+   
+   public void remoteMethod()
+   {
+   }
+   
+   public void testOperation()
+   {
+      stringAttribute = "reset";
+   }
+
+   public String getStringAttribute()
+   {
+      return stringAttribute;
+   }
+
+   public void setStringAttribute(String stringAttribute)
+   {
+      this.stringAttribute = stringAttribute;
+   }
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/ServiceOneRemote.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/ServiceOneRemote.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/ServiceOneRemote.java	2007-01-23 22:49:58 UTC (rev 59961)
@@ -0,0 +1,30 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, 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.ejb3.test.servicexmbean;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface ServiceOneRemote
+{
+   void remoteMethod();
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/unit/ServiceUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/unit/ServiceUnitTestCase.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/servicexmbean/unit/ServiceUnitTestCase.java	2007-01-23 22:49:58 UTC (rev 59961)
@@ -0,0 +1,91 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, 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.ejb3.test.servicexmbean.unit;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import org.jboss.ejb3.test.service.ServiceOneRemote;
+import org.jboss.ejb3.test.service.ServiceSevenRemote;
+import org.jboss.ejb3.test.service.ServiceSixRemote;
+import org.jboss.ejb3.test.service.ServiceTwoRemote;
+import org.jboss.ejb3.test.service.SessionRemote;
+import org.jboss.logging.Logger;
+import org.jboss.security.SecurityAssociation;
+import org.jboss.security.SimplePrincipal;
+import org.jboss.test.JBossTestCase;
+import junit.framework.Test;
+
+/**
+ * Sample client for the jboss container.
+ *
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Id: ServiceUnitTestCase.java 57005 2006-09-20 13:10:12Z wolfc $
+ */
+
+public class ServiceUnitTestCase
+extends JBossTestCase
+{
+   private static final Logger log = Logger.getLogger(ServiceUnitTestCase.class);
+
+   static boolean deployed = false;
+   static int test = 0;
+
+   public ServiceUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testXMBean() throws Exception
+   {
+      MBeanServerConnection server = getServer();
+      ObjectName service = new ObjectName("jboss.ejb3.test:service=ServiceOne");
+      server.setAttribute(service, new Attribute("StringAttribute", "test value"));
+      String stringAttribute = (String)server.getAttribute(service, "StringAttribute");
+      assertEquals("test value", stringAttribute);
+      server.invoke(service, "testOperation", new Object[0], new String[0]);
+      stringAttribute = (String)server.getAttribute(service, "StringAttribute");
+      assertEquals("reset", stringAttribute);
+   }
+   
+   public void testXMBeanDeploymentDescriptor() throws Exception
+   {
+      MBeanServerConnection server = getServer();
+      ObjectName service = new ObjectName("jboss.ejb3.test:service=ServiceOneDeploymentDescriptor");
+      server.setAttribute(service, new Attribute("StringAttribute", "test value"));
+      String stringAttribute = (String)server.getAttribute(service, "StringAttribute");
+      assertEquals("test value", stringAttribute);
+      server.invoke(service, "testOperation", new Object[0], new String[0]);
+      stringAttribute = (String)server.getAttribute(service, "StringAttribute");
+      assertEquals("reset", stringAttribute);
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(ServiceUnitTestCase.class, "service-xmbean-test.jar");
+   }
+
+}




More information about the jboss-cvs-commits mailing list