[jboss-cvs] JBossAS SVN: r78207 - in projects/jboss-man/trunk/managed/src: main/java/org/jboss/managed/spi/factory and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Sep 8 16:39:38 EDT 2008


Author: scott.stark at jboss.org
Date: 2008-09-08 16:39:38 -0400 (Mon, 08 Sep 2008)
New Revision: 78207

Added:
   projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/CustomName.java
   projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/CustomRuntimeComponentNameTransformer.java
   projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRef.java
   projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRefICF.java
   projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/ManagementRuntimeRefUnitTestCase.java
Modified:
   projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java
   projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java
   projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java
   projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java
   projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java
Log:
JBMAN-2, Restore @ManagementRuntimeRef default ICF behavior

Modified: projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java	2008-09-08 20:35:26 UTC (rev 78206)
+++ projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java	2008-09-08 20:39:38 UTC (rev 78207)
@@ -276,7 +276,7 @@
          throw new IllegalArgumentException("Null class");
 
       ManagedObject result = createSkeletonManagedObject(clazz);
-      ManagedObjectPopulator<Serializable> populator = getPopulator(clazz);
+      ManagedObjectPopulator<T> populator = getPopulator(clazz);
       populator.createObject(result, clazz);
       
       return result;
@@ -291,7 +291,7 @@
 
       Class<? extends Serializable> clazz = object.getClass();
       InstanceClassFactory icf = getInstanceClassFactory(clazz);
-      Class<? extends Serializable> moClass;
+      Class<Serializable> moClass;
       try
       {
          moClass = icf.getManagedObjectClass(object);
@@ -766,12 +766,12 @@
     * @return the populator
     */
    @SuppressWarnings("unchecked")
-   protected ManagedObjectPopulator<Serializable> getPopulator(Class<?> clazz)
+   protected <X extends Serializable> ManagedObjectPopulator<X> getPopulator(Class<X> clazz)
    {
       ManagedObjectBuilder builder = getBuilder(clazz);
       if (builder instanceof ManagedObjectPopulator)
          return (ManagedObjectPopulator) builder;
-      ManagedObjectPopulator<Serializable> mop = (ManagedObjectPopulator<Serializable>) defaultManagedObjectPopulator;
+      ManagedObjectPopulator<X> mop = (ManagedObjectPopulator<X>) defaultManagedObjectPopulator;
       return mop;
    }
 

Modified: projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java	2008-09-08 20:35:26 UTC (rev 78206)
+++ projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/factory/AbstractManagedObjectPopulator.java	2008-09-08 20:39:38 UTC (rev 78207)
@@ -102,7 +102,7 @@
       this.instanceFactories = instanceFactories;
    }
 
-   public void createObject(ManagedObject managedObject, Class<? extends Serializable> clazz)
+   public void createObject(ManagedObject managedObject, Class<T> clazz)
    {
       if (managedObject == null)
          throw new IllegalArgumentException("Null managed object");
@@ -111,11 +111,11 @@
          throw new IllegalStateException("Unable to create object " + managedObject.getClass().getName());
       
       ManagedObjectImpl managedObjectImpl = (ManagedObjectImpl) managedObject;
-      Serializable object = createUnderlyingObject(managedObjectImpl, clazz);
+      T object = createUnderlyingObject(managedObjectImpl, clazz);
       populateManagedObject(managedObject, object);
    }
 
-   public void populateManagedObject(ManagedObject managedObject, Serializable object)
+   public void populateManagedObject(ManagedObject managedObject, T object)
    {
       if (managedObject instanceof ManagedObjectImpl == false)
          throw new IllegalStateException("Unable to populate managed object " + managedObject.getClass().getName());
@@ -133,7 +133,7 @@
     * @return the InstanceClassFactory
     */
    @SuppressWarnings("unchecked")
-   public <T extends Serializable> InstanceClassFactory<T> getInstanceClassFactory(Class<T> clazz)
+   public <X extends Serializable> InstanceClassFactory<X> getInstanceClassFactory(Class<X> clazz)
    {
       synchronized (instanceFactories)
       {
@@ -141,7 +141,7 @@
          if (factory != null)
             return factory;
       }
-      InstanceClassFactory<T> factory = (InstanceClassFactory<T>) defaultInstanceFactory;
+      InstanceClassFactory<X> factory = (InstanceClassFactory<X>) defaultInstanceFactory;
       return factory;
    }
 
@@ -152,13 +152,13 @@
     * @param clazz the class
     * @return the object
     */
-   protected Serializable createUnderlyingObject(ManagedObjectImpl managedObject, Class<? extends Serializable> clazz)
+   protected T createUnderlyingObject(ManagedObjectImpl managedObject, Class<T> clazz)
    {
       BeanInfo beanInfo = configuration.getBeanInfo(clazz);
       try
       {
          Object result = beanInfo.newInstance();
-         return Serializable.class.cast(result);
+         return clazz.cast(result);
       }
       catch (Throwable t)
       {
@@ -173,7 +173,7 @@
     * @param object the object
     */
    @SuppressWarnings("unchecked")
-   protected void populateValues(ManagedObjectImpl managedObject, Serializable object)
+   protected void populateValues(ManagedObjectImpl managedObject, T object)
    {
       InstanceClassFactory icf = getInstanceClassFactory(object.getClass());
       Class moClass;
@@ -228,6 +228,11 @@
             if (runtimeRef != null)
             {
                componentName = icf.getComponentName(beanInfo, property, object, value);
+               if(componentName == null && defaultInstanceFactory != null)
+               {
+                  InstanceClassFactory dicf = defaultInstanceFactory;
+                  componentName = dicf.getComponentName(beanInfo, property, object, value);
+               }
             }
          }
       }

Modified: projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java	2008-09-08 20:35:26 UTC (rev 78206)
+++ projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/spi/factory/ManagedObjectPopulator.java	2008-09-08 20:39:38 UTC (rev 78207)
@@ -40,7 +40,7 @@
     * @param managedObject the managed object
     * @param clazz the class
     */
-   void createObject(ManagedObject managedObject, Class<? extends Serializable> clazz);
+   void createObject(ManagedObject managedObject, Class<T> clazz);
 
    /**
     * Populate the managed object

Added: projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/CustomName.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/CustomName.java	                        (rev 0)
+++ projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/CustomName.java	2008-09-08 20:39:38 UTC (rev 78207)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.support.amof;
+
+import java.io.Serializable;
+
+import org.jboss.metatype.api.annotations.Generic;
+
+/**
+ * Custom runtime component name.
+ *
+ * @author Ales.Justin at jboss.org
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+ at Generic
+public class CustomName implements Serializable
+{
+   private static final long serialVersionUID = 1;
+
+   private String name;
+
+   public CustomName(String name)
+   {
+      this.name = name;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+}
+

Added: projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/CustomRuntimeComponentNameTransformer.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/CustomRuntimeComponentNameTransformer.java	                        (rev 0)
+++ projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/CustomRuntimeComponentNameTransformer.java	2008-09-08 20:39:38 UTC (rev 78207)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.support.amof;
+
+import org.jboss.managed.plugins.factory.AbstractComponentNameTransformer;
+
+/**
+ * Custom runtime component name transformer.
+ *
+ * @author Ales.Justin at jboss.org
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class CustomRuntimeComponentNameTransformer extends AbstractComponentNameTransformer<CustomName>
+{
+   public CustomRuntimeComponentNameTransformer()
+   {
+      super(CustomName.class);
+   }
+
+   protected Object doTransform(CustomName value)
+   {
+      return value.getName();
+   }
+}

Added: projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRef.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRef.java	                        (rev 0)
+++ projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRef.java	2008-09-08 20:39:38 UTC (rev 78207)
@@ -0,0 +1,53 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, 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.managed.factory.support.amof;
+
+import java.io.Serializable;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ManagementRuntimeRef;
+
+/**
+ * A ManagementObject with a ManagementRuntimeRef
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+ at ManagementObject
+public class ManagementObjectWithRuntimeRef implements Serializable
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = -1L;
+   private CustomName refName;
+
+   @ManagementRuntimeRef(transformer=CustomRuntimeComponentNameTransformer.class)
+   @ManagementProperty(description="A property referencing a runtime object")
+   public CustomName getRefName()
+   {
+      return refName;
+   }
+   public void setRefName(CustomName refName)
+   {
+      this.refName = refName;
+   }
+}

Added: projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRefICF.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRefICF.java	                        (rev 0)
+++ projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/ManagementObjectWithRuntimeRefICF.java	2008-09-08 20:39:38 UTC (rev 78207)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.test.managed.factory.support.amof;
+
+import java.io.Serializable;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class ManagementObjectWithRuntimeRefICF
+   implements InstanceClassFactory<ManagementObjectWithRuntimeRef>
+{
+   /** The meta value factory */
+   private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance(); 
+
+   @SuppressWarnings("unchecked")
+   public Class<? extends Serializable> getManagedObjectClass(ManagementObjectWithRuntimeRef instance)
+      throws ClassNotFoundException
+   {
+      return instance.getClass();
+   }
+
+   protected String getPropertyName(ManagedProperty property)
+   {
+      // First look to the mapped name
+      String name = property.getMappedName();
+      if (name == null)
+         property.getName();
+      return name;
+   }
+
+   public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property, ManagementObjectWithRuntimeRef instance)
+   {
+      String name = getPropertyName(property);
+      PropertyInfo propertyInfo = beanInfo.getProperty(name);
+      Object value = null;
+      try
+      {
+         value = propertyInfo.get(instance);
+      }
+      catch(Throwable e)
+      {
+         throw new RuntimeException("Failed to get property: "+name, e);
+      }
+      return metaValueFactory.create(value, propertyInfo.getType());
+   }
+
+   public void setValue(BeanInfo beanInfo, ManagedProperty property, ManagementObjectWithRuntimeRef object, MetaValue value)
+   {
+      String name = getPropertyName(property);
+      PropertyInfo propertyInfo = beanInfo.getProperty(name);
+      Object ovalue = metaValueFactory.unwrap(value, propertyInfo.getType());
+      try
+      {
+         propertyInfo.set(object, ovalue);
+      }
+      catch(Throwable e)
+      {
+         throw new RuntimeException("Failed to set property: "+name, e);
+      }
+   }
+
+   public Object getComponentName(BeanInfo beanInfo, ManagedProperty property, ManagementObjectWithRuntimeRef object, MetaValue value)
+   {
+      return null;
+   }
+}

Modified: projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java	2008-09-08 20:35:26 UTC (rev 78206)
+++ projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/support/amof/TestMOP.java	2008-09-08 20:39:38 UTC (rev 78207)
@@ -52,7 +52,7 @@
    }
 
    public void createObject(ManagedObject managedObject,
-         Class<? extends Serializable> clazz)
+         Class<Serializable> clazz)
    {
       createObjectCalled = true;
       super.createObject(managedObject, clazz);

Modified: projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java	2008-09-08 20:35:26 UTC (rev 78206)
+++ projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java	2008-09-08 20:39:38 UTC (rev 78207)
@@ -37,8 +37,12 @@
 import org.jboss.metatype.api.values.GenericValue;
 import org.jboss.metatype.api.values.SimpleValueSupport;
 import org.jboss.test.managed.factory.AbstractManagedObjectFactoryTest;
+import org.jboss.test.managed.factory.support.ManagementObjectChangedName;
 import org.jboss.test.managed.factory.support.ManagementPropertySimpleManaged;
 import org.jboss.test.managed.factory.support.Simple;
+import org.jboss.test.managed.factory.support.amof.CustomName;
+import org.jboss.test.managed.factory.support.amof.ManagementObjectWithRuntimeRef;
+import org.jboss.test.managed.factory.support.amof.ManagementObjectWithRuntimeRefICF;
 import org.jboss.test.managed.factory.support.amof.TestICF;
 import org.jboss.test.managed.factory.support.amof.TestMOP;
 import org.jboss.test.managed.factory.support.amof.TestSimpleICF;
@@ -168,6 +172,23 @@
    }
 
    /**
+    * Test the transformer value of the ManagementRuntimeRef annotation when
+    * there is a custom ICF
+    */
+   public void testTransformer()
+   {
+      AbstractManagedObjectFactory mof = new AbstractManagedObjectFactory();
+      mof.setInstanceClassFactory(ManagementObjectWithRuntimeRef.class, new ManagementObjectWithRuntimeRefICF());
+      testMOF = mof;
+
+      ManagementObjectWithRuntimeRef mowref = new ManagementObjectWithRuntimeRef();
+      mowref.setRefName(new CustomName("jboss:test=testTransformer"));
+      ManagedObject managedObject = initManagedObject(mowref);
+      createManagedObject(ManagementObjectChangedName.class);
+      assertEquals("jboss:test=testTransformer", managedObject.getComponentName());
+   }
+
+   /**
     * Override to allow test specific ManagedObjectFactory
     */
    @Override

Added: projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/ManagementRuntimeRefUnitTestCase.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/ManagementRuntimeRefUnitTestCase.java	                        (rev 0)
+++ projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/ManagementRuntimeRefUnitTestCase.java	2008-09-08 20:39:38 UTC (rev 78207)
@@ -0,0 +1,72 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, 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.managed.factory.test;
+
+import junit.framework.Test;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.test.managed.factory.AbstractManagedObjectFactoryTest;
+import org.jboss.test.managed.factory.support.ManagementObjectChangedName;
+import org.jboss.test.managed.factory.support.amof.CustomName;
+import org.jboss.test.managed.factory.support.amof.ManagementObjectWithRuntimeRef;
+
+/**
+ * Tests of the ManagementRuntimeRef annotation
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+public class ManagementRuntimeRefUnitTestCase extends AbstractManagedObjectFactoryTest
+{
+   /**
+    * Create a testsuite for this test
+    * 
+    * @return the testsuite
+    */
+   public static Test suite()
+   {
+      return suite(ManagementRuntimeRefUnitTestCase.class);
+   }
+
+   /**
+    * Create a new ManagementObjectUnitTestCase.
+    * 
+    * @param name the test name
+    */
+   public ManagementRuntimeRefUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   /**
+    * Test the transformer value of the annotation
+    */
+   public void testTransformer()
+   {
+      ManagementObjectWithRuntimeRef mowref = new ManagementObjectWithRuntimeRef();
+      mowref.setRefName(new CustomName("jboss:test=testTransformer"));
+      ManagedObject managedObject = initManagedObject(mowref);
+      createManagedObject(ManagementObjectChangedName.class);
+      assertEquals("jboss:test=testTransformer", managedObject.getComponentName());
+   }
+
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list