[jboss-cvs] JBossAS SVN: r58350 - in projects/microcontainer/trunk/aop-mc-int/src: resources/tests/org/jboss/test/microcontainer/test tests/org/jboss/test/microcontainer/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 14 13:24:07 EST 2006


Author: scott.stark at jboss.org
Date: 2006-11-14 13:24:04 -0500 (Tue, 14 Nov 2006)
New Revision: 58350

Added:
   projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/JndiLifecycleTestCase.xml
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/JndiLifeCycleTestCase.java
Log:
Add a aop:lifecycle version if the JndiBinding aspect

Added: projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/JndiLifecycleTestCase.xml
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/JndiLifecycleTestCase.xml	2006-11-14 17:54:51 UTC (rev 58349)
+++ projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/JndiLifecycleTestCase.xml	2006-11-14 18:24:04 UTC (rev 58350)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="MBeanServer" class="java.lang.Object">
+      <constructor factoryClass="javax.management.MBeanServerFactory" factoryMethod="createMBeanServer"/>
+   </bean>
+
+   <bean name="Repository" class="org.jboss.metadata.plugins.repository.basic.BasicMetaDataRepository"/>
+
+   <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+      <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+   </bean>
+
+   <aop:lifecycle xmlns:aop="urn:jboss:aop-beans:1.0"
+      name="DependencyAdvice"
+      class="org.jboss.aop.microcontainer.aspects.jndi.JndiIntroduction"
+      classes="@org.jboss.aop.microcontainer.aspects.jndi.JndiBinding"
+      pointcut="execution(* @org.jboss.aop.microcontainer.aspects.jndi.JndiBinding->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))">
+      <property name="env">
+         <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+            <entry><key>java.naming.factory.initial</key><value>org.jboss.test.microcontainer.support.jndi.MockInitialContextFactory</value></entry>
+         </map>
+      </property>
+   </aop:lifecycle>
+
+   
+   <bean name="Bean" class="org.jboss.test.microcontainer.support.jndi.SimpleBean">
+      <annotation>@org.jboss.aop.microcontainer.aspects.jndi.JndiBinding(name="beans/SimpleBean0", aliases={"beans/XmlAnnotatedSimpleBean0"})</annotation>
+      <property name="prop1">bean0.prop1</property>
+   </bean>
+   
+   <bean name="AnnotatedBean" class="org.jboss.test.microcontainer.support.jndi.SimpleBeanAnnotatedImpl">
+      <property name="prop1">bean1.prop1</property>
+   </bean>
+</deployment>


Property changes on: projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/JndiLifecycleTestCase.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/JndiLifeCycleTestCase.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/JndiLifeCycleTestCase.java	2006-11-14 17:54:51 UTC (rev 58349)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/JndiLifeCycleTestCase.java	2006-11-14 18:24:04 UTC (rev 58350)
@@ -0,0 +1,50 @@
+package org.jboss.test.microcontainer.test;
+
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.jboss.aop.microcontainer.junit.AOPMicrocontainerTest;
+import org.jboss.test.microcontainer.support.jndi.SimpleBean;
+import org.jboss.test.microcontainer.support.jndi.SimpleBeanAnnotatedImpl;
+
+public class JndiLifeCycleTestCase extends AOPMicrocontainerTest
+{
+
+   public JndiLifeCycleTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(JndiLifeCycleTestCase.class);
+   }
+
+   /**
+    * Validate that the 
+    * @throws Exception
+    */
+   public void testJndi() throws Exception
+   {
+      super.enableTrace("org.jboss");
+      Properties env = new Properties();
+      env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.test.microcontainer.support.jndi.MockInitialContextFactory");
+      InitialContext ctx = new InitialContext(env);
+
+      SimpleBean bean0 = (SimpleBean) ctx.lookup("beans/SimpleBean0");
+      assertNotNull(bean0);
+      assertEquals("bean0.prop1", bean0.getProp1());
+      SimpleBean alias0 = (SimpleBean) ctx.lookup("beans/XmlAnnotatedSimpleBean0");
+      assertNotNull(alias0);
+      assertEquals("bean0.prop1", alias0.getProp1());
+      SimpleBeanAnnotatedImpl bean1 = (SimpleBeanAnnotatedImpl) ctx.lookup("beans/SimpleBean1");
+      assertEquals("bean1.prop1", bean1.getProp1());
+      SimpleBean alias1 = (SimpleBean) ctx.lookup("beans/AnnotatedSimpleBean1");
+      assertNotNull(alias1);
+      assertEquals("bean1.prop1", alias1.getProp1());
+   }
+}


Property changes on: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/JndiLifeCycleTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jboss-cvs-commits mailing list