[jboss-cvs] JBossAS SVN: r66234 - in projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers: managed/test and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 18 09:12:37 EDT 2007


Author: alesj
Date: 2007-10-18 09:12:37 -0400 (Thu, 18 Oct 2007)
New Revision: 66234

Added:
   projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/CustomName.java
   projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/CustomRuntimeComponentNameTransformer.java
   projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/RuntimeComponentMetaData.java
Modified:
   projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedDeploymentUnitTestCase.java
Log:
Test runtime component name on actual bean/service.

Added: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/CustomName.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/CustomName.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/CustomName.java	2007-10-18 13:12:37 UTC (rev 66234)
@@ -0,0 +1,49 @@
+/*
+* 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.deployers.deployer.support;
+
+import java.io.Serializable;
+
+import org.jboss.metatype.api.annotations.Generic;
+
+/**
+ * Custom runtime component name.
+ *
+ * @author Ales.Justin at jboss.org
+ */
+ at Generic
+public class CustomName implements Serializable
+{
+   private static final long serialVersionUID = 5544848873825306608L;
+
+   private String name;
+
+   public CustomName(String name)
+   {
+      this.name = name;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+}

Added: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/CustomRuntimeComponentNameTransformer.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/CustomRuntimeComponentNameTransformer.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/CustomRuntimeComponentNameTransformer.java	2007-10-18 13:12:37 UTC (rev 66234)
@@ -0,0 +1,42 @@
+/*
+* 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.deployers.deployer.support;
+
+import org.jboss.managed.plugins.factory.AbstractComponentNameTransformer;
+
+/**
+ * Custom runtime component name transformer.
+ *
+ * @author Ales.Justin at jboss.org
+ */
+public class CustomRuntimeComponentNameTransformer extends AbstractComponentNameTransformer<CustomName>
+{
+   public CustomRuntimeComponentNameTransformer()
+   {
+      super(CustomName.class);
+   }
+
+   protected Object doTransform(CustomName value)
+   {
+      return value.getName();
+   }
+}

Added: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/RuntimeComponentMetaData.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/RuntimeComponentMetaData.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/RuntimeComponentMetaData.java	2007-10-18 13:12:37 UTC (rev 66234)
@@ -0,0 +1,68 @@
+/*
+* 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.deployers.deployer.support;
+
+import java.io.Serializable;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ManagementRuntimeRef;
+
+/**
+ * Simple meta data.
+ *
+ * @author Ales.Justin at jboss.org
+ */
+ at ManagementObject(componentType = @ManagementComponent(type = "RuntimeType", subtype = "LocalTx"))
+public class RuntimeComponentMetaData implements Serializable
+{
+   private static final long serialVersionUID = 1L;
+
+   private String domain;
+   private CustomName customName;
+
+   @ManagementProperty(name="domain-name")
+   @ManagementObjectID(type="SecurityDomain")
+   public String getDomain()
+   {
+      return domain;
+   }
+
+   public void setDomain(String domain)
+   {
+      this.domain = domain;
+   }
+
+   @ManagementProperty(name="custom-name")
+   @ManagementRuntimeRef(transformer = CustomRuntimeComponentNameTransformer.class)
+   public CustomName getCustomName()
+   {
+      return customName;
+   }
+
+   public void setCustomName(CustomName customName)
+   {
+      this.customName = customName;
+   }
+}

Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedDeploymentUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedDeploymentUnitTestCase.java	2007-10-18 12:44:31 UTC (rev 66233)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedDeploymentUnitTestCase.java	2007-10-18 13:12:37 UTC (rev 66234)
@@ -54,6 +54,8 @@
 import org.jboss.test.deployers.deployer.support.TestServiceMetaData;
 import org.jboss.test.deployers.deployer.support.TestServiceMetaDataICF;
 import org.jboss.test.deployers.deployer.support.XADataSourceMetaData;
+import org.jboss.test.deployers.deployer.support.RuntimeComponentMetaData;
+import org.jboss.test.deployers.deployer.support.CustomName;
 import org.jboss.test.deployers.managed.support.MockProfileService;
 
 /**
@@ -131,12 +133,29 @@
       a1.addAttachment(TestServiceMetaData.class, localMBeans);
       ps.addDeployment(ctx1);
 
+      Deployment ctx2 = createSimpleDeployment("deployment2");
+      MutableAttachments a2 = (MutableAttachments)ctx2.getPredeterminedManagedObjects();
+
+      TestServiceMetaData localMBeans2 = new TestServiceMetaData();
+      localMBeans2.setCode(RuntimeComponentMetaData.class.getName());
+      ArrayList<TestServiceAttributeMetaData> localMBeanAttrs2 = new ArrayList<TestServiceAttributeMetaData>();
+      localMBeanAttrs2.add(new TestServiceAttributeMetaData("java:/jaas/domain2", "domain"));
+      CustomName customName = new CustomName("runtime-name-1");
+      localMBeanAttrs2.add(new TestServiceAttributeMetaData(customName, "customName"));
+      localMBeans2.setAttributes(localMBeanAttrs2);
+      a2.addAttachment(TestServiceMetaData.class, localMBeans2);
+      ps.addDeployment(ctx2);
+
       ps.process();
 
       ManagedObject mo = ps.getManagedObject("java:/jaas/domain1/SecurityDomain");
       assertNotNull(mo);
       assertEquals(localMBeans.getObjectName(), mo.getComponentName());
 
+      ManagedObject mo2 = ps.getManagedObject("java:/jaas/domain2/SecurityDomain");
+      assertNotNull(mo2);
+      assertEquals(customName.getName(), mo2.getComponentName());
+
       ManagedDeployment md = ps.getManagedDeployment("deployment1");
       assertNotNull(md);
       ManagedComponent mc = md.getComponent("java:/jaas/domain1");




More information about the jboss-cvs-commits mailing list