[jboss-cvs] JBossAS SVN: r94211 - in projects/kernel/trunk/aop-mc-int/src/test: java/org/jboss/test/microcontainer/test and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Oct 1 06:18:31 EDT 2009
Author: alesj
Date: 2009-10-01 06:18:30 -0400 (Thu, 01 Oct 2009)
New Revision: 94211
Added:
projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/SimpleBeanWrapper.java
projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/InterceptedExistingTargetTestCase.java
projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InterceptedExistingTargetTestCase.xml
Modified:
projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/AspectMCAllTestSuite.java
Log:
Test existing bean interception.
Copied: projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/SimpleBeanWrapper.java (from rev 94204, projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/SimpleBeanImpl.java)
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/SimpleBeanWrapper.java (rev 0)
+++ projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/SimpleBeanWrapper.java 2009-10-01 10:18:30 UTC (rev 94211)
@@ -0,0 +1,45 @@
+/*
+ * 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.test.microcontainer.support;
+
+/**
+ * SimpleBeanWrapper.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SimpleBeanWrapper implements SimpleBean
+{
+ private SimpleBean delegate;
+
+ public SimpleBeanWrapper(SimpleBean delegate)
+ {
+ if (delegate == null)
+ throw new IllegalArgumentException("Null delegate");
+
+ this.delegate = delegate;
+ }
+
+ public void someMethod()
+ {
+ delegate.someMethod();
+ }
+}
\ No newline at end of file
Property changes on: projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/support/SimpleBeanWrapper.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/AspectMCAllTestSuite.java
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/AspectMCAllTestSuite.java 2009-10-01 10:02:28 UTC (rev 94210)
+++ projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/AspectMCAllTestSuite.java 2009-10-01 10:18:30 UTC (rev 94211)
@@ -29,6 +29,7 @@
* All Test Suite.
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @version $Revision$
*/
public class AspectMCAllTestSuite extends TestSuite
@@ -46,6 +47,7 @@
suite.addTest(BeanNoDefaultCtorUsingParamTestCase.suite());
suite.addTest(ConstructorInterceptorWithDependencyTestCase.suite());
suite.addTest(InterceptedTestCase.suite());
+ suite.addTest(InterceptedExistingTargetTestCase.suite());
suite.addTest(InterceptorWithAnnotationDependencyTestCase.suite());
suite.addTest(InterceptorWithDependencyTestCase.suite());
suite.addTest(InterceptorWithNestedAnnotationDependencyTestCase.suite());
Copied: projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/InterceptedExistingTargetTestCase.java (from rev 94204, projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/InterceptedTestCase.java)
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/InterceptedExistingTargetTestCase.java (rev 0)
+++ projects/kernel/trunk/aop-mc-int/src/test/java/org/jboss/test/microcontainer/test/InterceptedExistingTargetTestCase.java 2009-10-01 10:18:30 UTC (rev 94211)
@@ -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.test.microcontainer.test;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.test.aop.junit.AOPMicrocontainerTest;
+import org.jboss.test.microcontainer.support.CalledInterceptor;
+import org.jboss.test.microcontainer.support.SimpleBean;
+import org.jboss.test.microcontainer.support.SimpleBeanImpl;
+
+/**
+ * Test if existing target can also be intercepted.
+ */
+public class InterceptedExistingTargetTestCase extends AOPMicrocontainerTest
+{
+ public static Test suite()
+ {
+ return suite(InterceptedExistingTargetTestCase.class);
+ }
+
+ public InterceptedExistingTargetTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testIntercepted() throws Throwable
+ {
+ SimpleBean existing = new SimpleBeanImpl();
+
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("Intercepted", "org.jboss.test.microcontainer.support.SimpleBeanWrapper");
+ builder.addConstructorParameter(SimpleBean.class.getName(), existing);
+ deploy(builder.getBeanMetaData());
+
+ SimpleBean bean = (SimpleBean) getBean("Intercepted");
+ CalledInterceptor.intercepted = false;
+ bean.someMethod();
+ assertTrue("Should have invoked the CalledInterceptor", CalledInterceptor.intercepted);
+ }
+}
\ No newline at end of file
Copied: projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InterceptedExistingTargetTestCase.xml (from rev 94204, projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InterceptedTestCase.xml)
===================================================================
--- projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InterceptedExistingTargetTestCase.xml (rev 0)
+++ projects/kernel/trunk/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/test/InterceptedExistingTargetTestCase.xml 2009-10-01 10:18:30 UTC (rev 94211)
@@ -0,0 +1,15 @@
+<?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>
+
+ <interceptor xmlns="urn:jboss:aop-beans:1.0" name="InterceptedAdvice" class="org.jboss.test.microcontainer.support.CalledInterceptor"/>
+
+ <bind xmlns="urn:jboss:aop-beans:1.0" pointcut="execution(* $instanceof{org.jboss.test.microcontainer.support.SimpleBean}->*(..))">
+ <interceptor-ref name="InterceptedAdvice"/>
+ </bind>
+
+</deployment>
More information about the jboss-cvs-commits
mailing list