[jboss-cvs] JBossAS SVN: r79475 - in projects/microcontainer/trunk/aop-mc-int/src/test: java/org/jboss/test/microcontainer/beans/test and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 14 13:18:32 EDT 2008
Author: kabir.khan at jboss.com
Date: 2008-10-14 13:18:31 -0400 (Tue, 14 Oct 2008)
New Revision: 79475
Added:
projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/AnnotationWithValue.java
projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/AnnotationWithValueAspect.java
projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementAopTestCase.java
projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementBeansTestCase.java
projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementDeploymentTestCase.java
projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementTest.java
projects/microcontainer/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementAopTestCase.xml
projects/microcontainer/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementBeansTestCase.xml
projects/microcontainer/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementDeploymentTestCase.xml
Log:
Test that properties are replaced in annotations
Added: projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/AnnotationWithValue.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/AnnotationWithValue.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/AnnotationWithValue.java 2008-10-14 17:18:31 UTC (rev 79475)
@@ -0,0 +1,32 @@
+/*
+* 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.test.microcontainer.beans;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public @interface AnnotationWithValue
+{
+ int integer();
+}
Added: projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/AnnotationWithValueAspect.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/AnnotationWithValueAspect.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/AnnotationWithValueAspect.java 2008-10-14 17:18:31 UTC (rev 79475)
@@ -0,0 +1,40 @@
+/*
+* 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.test.microcontainer.beans;
+
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class AnnotationWithValueAspect
+{
+ public static AnnotationWithValue value;
+
+ public Object advice(Invocation inv) throws Throwable
+ {
+ value = (AnnotationWithValue)inv.resolveClassAnnotation(AnnotationWithValue.class);
+ return inv.invokeNext();
+ }
+}
Added: projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementAopTestCase.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementAopTestCase.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementAopTestCase.java 2008-10-14 17:18:31 UTC (rev 79475)
@@ -0,0 +1,43 @@
+/*
+* 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.microcontainer.beans.test;
+
+import junit.framework.Test;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class AnnotationOverridePropertyReplacementAopTestCase extends AnnotationOverridePropertyReplacementTest
+{
+ public static Test suite()
+ {
+ return suite(AnnotationOverridePropertyReplacementAopTestCase.class);
+ }
+
+ public AnnotationOverridePropertyReplacementAopTestCase(String test)
+ {
+ super(test);
+ }
+}
Added: projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementBeansTestCase.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementBeansTestCase.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementBeansTestCase.java 2008-10-14 17:18:31 UTC (rev 79475)
@@ -0,0 +1,43 @@
+/*
+* 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.microcontainer.beans.test;
+
+import junit.framework.Test;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class AnnotationOverridePropertyReplacementBeansTestCase extends AnnotationOverridePropertyReplacementTest
+{
+ public static Test suite()
+ {
+ return suite(AnnotationOverridePropertyReplacementBeansTestCase.class);
+ }
+
+ public AnnotationOverridePropertyReplacementBeansTestCase(String test)
+ {
+ super(test);
+ }
+}
Added: projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementDeploymentTestCase.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementDeploymentTestCase.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementDeploymentTestCase.java 2008-10-14 17:18:31 UTC (rev 79475)
@@ -0,0 +1,43 @@
+/*
+* 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.microcontainer.beans.test;
+
+import junit.framework.Test;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class AnnotationOverridePropertyReplacementDeploymentTestCase extends AnnotationOverridePropertyReplacementTest
+{
+ public static Test suite()
+ {
+ return suite(AnnotationOverridePropertyReplacementDeploymentTestCase.class);
+ }
+
+ public AnnotationOverridePropertyReplacementDeploymentTestCase(String test)
+ {
+ super(test);
+ }
+}
Added: projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementTest.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementTest.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementTest.java 2008-10-14 17:18:31 UTC (rev 79475)
@@ -0,0 +1,64 @@
+/*
+* 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.test.microcontainer.beans.test;
+
+import org.jboss.test.AbstractTestDelegate;
+import org.jboss.test.aop.junit.AOPMicrocontainerTest;
+import org.jboss.test.aop.junit.AOPMicrocontainerTestDelegate;
+import org.jboss.test.microcontainer.beans.AnnotationWithValueAspect;
+import org.jboss.test.microcontainer.beans.POJO;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class AnnotationOverridePropertyReplacementTest extends AOPMicrocontainerTest
+{
+ public AnnotationOverridePropertyReplacementTest(String name)
+ {
+ // FIXME AnnotationOverridePropertyReplacementTest constructor
+ super(name);
+ }
+
+ public static AbstractTestDelegate getDelegate(Class<?> clazz) throws Exception
+ {
+ //Run this test without security since we need to set system properties
+ System.setProperty("integer", "100");
+ AOPMicrocontainerTestDelegate delegate = new AOPMicrocontainerTestDelegate(clazz);
+ return delegate;
+ }
+
+ public void testPropertyReplacement()
+ {
+ AnnotationWithValueAspect.value = null;
+ POJO pojo = (POJO)getBean("Bean");
+ pojo.method(2);
+ assertNull(AnnotationWithValueAspect.value);
+
+ pojo.method();
+ assertNotNull(AnnotationWithValueAspect.value);
+ assertEquals(100, AnnotationWithValueAspect.value.integer());
+ }
+
+
+}
Added: projects/microcontainer/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementAopTestCase.xml
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementAopTestCase.xml (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementAopTestCase.xml 2008-10-14 17:18:31 UTC (rev 79475)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<aop xmlns="urn:jboss:aop-beans:1.0">
+
+ <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+ <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+ </bean>
+
+ <annotation expr="class(org.jboss.test.microcontainer.beans.POJO)" invisible="false">
+ @org.jboss.test.microcontainer.beans.AnnotationWithValue(integer=${integer})
+ </annotation>
+
+ <aspect class="org.jboss.test.microcontainer.beans.AnnotationWithValueAspect"/>
+
+ <bind pointcut="execution(* @org.jboss.test.microcontainer.beans.AnnotationWithValue->*())">
+ <advice aspect="org.jboss.test.microcontainer.beans.AnnotationWithValueAspect" name="advice"/>
+ </bind>
+
+ <bean name="Bean" class="org.jboss.test.microcontainer.beans.POJO"/>
+
+</aop>
Added: projects/microcontainer/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementBeansTestCase.xml
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementBeansTestCase.xml (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementBeansTestCase.xml 2008-10-14 17:18:31 UTC (rev 79475)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+ <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+ </bean>
+
+ <bean name="ClassAnnotationOverride" class="org.jboss.aop.microcontainer.beans.AnnotationOverride">
+ <property name="manager"><inject bean="AspectManager"/></property>
+ <property name="expr">class(org.jboss.test.microcontainer.beans.POJO)</property>
+ <property name="annotation">@org.jboss.test.microcontainer.beans.AnnotationWithValue(integer=${integer})</property>
+ <property name="invisible">false</property>
+ </bean>
+
+ <beanfactory name="Factory$org.jboss.test.microcontainer.beans.AnnotationWithValueAspect" class="org.jboss.test.microcontainer.beans.AnnotationWithValueAspect"/>
+
+ <bean name="org.jboss.test.microcontainer.beans.AnnotationWithValueAspect" class="org.jboss.aop.microcontainer.beans.Aspect">
+ <property name="advice"><inject bean="Factory$org.jboss.test.microcontainer.beans.AnnotationWithValueAspect"/></property>
+ <property name="manager"><inject bean="AspectManager"/></property>
+ <property name="name">org.jboss.test.microcontainer.beans.AnnotationWithValueAspect</property>
+ </bean>
+
+ <bean name="AnnotationWithValueAspectBinding" class="org.jboss.aop.microcontainer.beans.AspectBinding">
+ <property name="pointcut">execution(* @org.jboss.test.microcontainer.beans.AnnotationWithValue->*())</property>
+ <property name="manager"><inject bean="AspectManager"/></property>
+ <property name="advices">
+ <list>
+ <bean name="AnnotationWithValueAspectBinding$1" class="org.jboss.aop.microcontainer.beans.InterceptorEntry">
+ <property name="manager"><inject bean="AspectManager"/></property>
+ <property name="aspect"><inject bean="org.jboss.test.microcontainer.beans.AnnotationWithValueAspect"/></property>
+ <property name="aspectMethod">advice</property>
+ <property name="binding"><inject bean="AnnotationWithValueAspectBinding" state="Instantiated"/></property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+
+ <bean name="Bean" class="org.jboss.test.microcontainer.beans.POJO"/>
+
+</deployment>
Added: projects/microcontainer/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementDeploymentTestCase.xml
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementDeploymentTestCase.xml (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/test/AnnotationOverridePropertyReplacementDeploymentTestCase.xml 2008-10-14 17:18:31 UTC (rev 79475)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+ <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+ </bean>
+
+ <annotation xmlns="urn:jboss:aop-beans:1.0" expr="class(org.jboss.test.microcontainer.beans.POJO)" invisible="false">
+ @org.jboss.test.microcontainer.beans.AnnotationWithValue(integer=${integer})
+ </annotation>
+
+ <aspect xmlns="urn:jboss:aop-beans:1.0" class="org.jboss.test.microcontainer.beans.AnnotationWithValueAspect"/>
+
+ <bind xmlns="urn:jboss:aop-beans:1.0" pointcut="execution(* @org.jboss.test.microcontainer.beans.AnnotationWithValue->*())">
+ <advice aspect="org.jboss.test.microcontainer.beans.AnnotationWithValueAspect" name="advice"/>
+ </bind>
+
+ <bean name="Bean" class="org.jboss.test.microcontainer.beans.POJO"/>
+
+</deployment>
More information about the jboss-cvs-commits
mailing list