[jboss-cvs] JBossAS SVN: r78831 - in trunk/testsuite: imports/sections and 9 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Sep 24 12:00:43 EDT 2008
Author: kabir.khan at jboss.com
Date: 2008-09-24 12:00:43 -0400 (Wed, 24 Sep 2008)
New Revision: 78831
Added:
trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/
trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/GlobalDependency.java
trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedDependency.java
trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedIgnoredTester.java
trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedIgnoredTesterMBean.java
trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedInterceptor.java
trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedTester.java
trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedTesterInterface.java
trunk/testsuite/src/main/org/jboss/test/aop/test/NotWovenScopedDependencyUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedDependencyTest.java
trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedWovenDependencyTestCase.java
trunk/testsuite/src/resources/aop/scopeddependency/
trunk/testsuite/src/resources/aop/scopeddependency/global/
trunk/testsuite/src/resources/aop/scopeddependency/global/META-INF/
trunk/testsuite/src/resources/aop/scopeddependency/global/META-INF/jboss-beans.xml
trunk/testsuite/src/resources/aop/scopeddependency/scoped/
trunk/testsuite/src/resources/aop/scopeddependency/scoped/META-INF/
trunk/testsuite/src/resources/aop/scopeddependency/scoped/META-INF/jboss-beans.xml
trunk/testsuite/src/resources/aop/scopeddependency/scoped/META-INF/jboss-service.xml
Modified:
trunk/testsuite/build.xml
trunk/testsuite/imports/sections/aop.xml
trunk/testsuite/src/main/org/jboss/test/aop/test/AOPClassLoaderHookTestSetup.java
Log:
[JBAS-5987] Add tests for scoped aspects with dependencies. Disable them for now
Modified: trunk/testsuite/build.xml
===================================================================
--- trunk/testsuite/build.xml 2008-09-24 15:53:58 UTC (rev 78830)
+++ trunk/testsuite/build.xml 2008-09-24 16:00:43 UTC (rev 78831)
@@ -886,9 +886,13 @@
<patternset id="aop-with-classloader.excludes">
<!-- Needs to be started either with the bootclasspath or -javaagent classloader hooks -->
<exclude name="org/jboss/test/aop/test/Scoped*.class"/>
+ <!-- TODO enable to complete JBAS-5987 -->
+ <exclude name="org/jboss/test/aop/test/*DependencyTestCase.class"/>
</patternset>
<patternset id="aop-with-classloader.includes">
<include name="org/jboss/test/aop/test/Scoped*TestCase.class"/>
+ <!-- TODO enable to complete JBAS-5987 -->
+ <exclude name="org/jboss/test/aop/test/*DependencyTestCase.class"/>
</patternset>
<!-- The union of the excludes -->
Modified: trunk/testsuite/imports/sections/aop.xml
===================================================================
--- trunk/testsuite/imports/sections/aop.xml 2008-09-24 15:53:58 UTC (rev 78830)
+++ trunk/testsuite/imports/sections/aop.xml 2008-09-24 16:00:43 UTC (rev 78831)
@@ -716,6 +716,24 @@
</aopc>
-->
+ <!-- Create jars for the scopeddependency tests -->
+ <jar destfile="${build.lib}/aop-scopeddependency-global.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/aop/scopeddependency/GlobalDependency.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/aop/scopeddependency/global">
+ <include name="**/*.xml"/>
+ </fileset>
+ </jar>
+ <jar destfile="${build.lib}/aop-scopeddependency-scoped.sar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/aop/scopeddependency/Scoped*.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/aop/scopeddependency/scoped">
+ <include name="**/*.xml"/>
+ </fileset>
+ </jar>
+
</target>
<target name="compile-aop-annotatations" unless="HAVE_JDK_1.5">
<taskdef name="annotationc" classname="org.jboss.aop.ant.AnnotationC"
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/GlobalDependency.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/GlobalDependency.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/GlobalDependency.java 2008-09-24 16:00:43 UTC (rev 78831)
@@ -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.aop.scopeddependency;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class GlobalDependency
+{
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedDependency.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedDependency.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedDependency.java 2008-09-24 16:00:43 UTC (rev 78831)
@@ -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.aop.scopeddependency;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ScopedDependency
+{
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedIgnoredTester.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedIgnoredTester.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedIgnoredTester.java 2008-09-24 16:00:43 UTC (rev 78831)
@@ -0,0 +1,37 @@
+/*
+* 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.aop.scopeddependency;
+
+/**
+ * This is just here to have something in jboss-service.xml to apply the loader-repository
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ScopedIgnoredTester implements ScopedIgnoredTesterMBean
+{
+
+ public void test()
+ {
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedIgnoredTesterMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedIgnoredTesterMBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedIgnoredTesterMBean.java 2008-09-24 16:00:43 UTC (rev 78831)
@@ -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.aop.scopeddependency;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ScopedIgnoredTesterMBean
+{
+ void test();
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedInterceptor.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedInterceptor.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedInterceptor.java 2008-09-24 16:00:43 UTC (rev 78831)
@@ -0,0 +1,112 @@
+/*
+* 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.aop.scopeddependency;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.MethodInvocation;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ScopedInterceptor implements Interceptor
+{
+ private GlobalDependency globalDependency;
+
+ private ScopedDependency scopedDependency;
+
+ private static GlobalDependency global;
+
+ private static ScopedDependency scoped;
+
+ private static String lastMethod;
+
+ public GlobalDependency getGlobalDependency()
+ {
+ return globalDependency;
+ }
+
+ public void setGlobalDependency(GlobalDependency globalDependency)
+ {
+ this.globalDependency = globalDependency;
+ }
+
+ public ScopedDependency getScopedDependency()
+ {
+ return scopedDependency;
+ }
+
+ public void setScopedDependency(ScopedDependency scopedDependency)
+ {
+ this.scopedDependency = scopedDependency;
+ }
+
+ public static GlobalDependency getGlobal()
+ {
+ return global;
+ }
+
+ public static ScopedDependency getScoped()
+ {
+ return scoped;
+ }
+
+ public static String getLastMethod()
+ {
+ return lastMethod;
+ }
+
+ public static void reset()
+ {
+ global = null;
+ scoped = null;
+ }
+
+ public String getName()
+ {
+ return this.getClass().getName();
+ }
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ global = globalDependency;
+ scoped = scopedDependency;
+ if (invocation instanceof MethodInvocation)
+ {
+ lastMethod = ((MethodInvocation)invocation).getMethod().getName();
+ }
+ if (invocation.getAdvisor().getManager().getClass() == AspectManager.class)
+ {
+ throw new Exception("Not scoped domain");
+ }
+ Object target = invocation.getTargetObject();
+ if (target instanceof ScopedTester)
+ {
+ ((ScopedTester)target).invoked = "true";
+ }
+
+ return invocation.invokeNext();
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedTester.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedTester.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedTester.java 2008-09-24 16:00:43 UTC (rev 78831)
@@ -0,0 +1,63 @@
+/*
+* 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.aop.scopeddependency;
+
+import org.jboss.aop.microcontainer.aspects.jmx.JMX;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at JMX(exposedInterface=ScopedTesterInterface.class, name="jboss.aop:name=ScopedTester")
+public class ScopedTester implements ScopedTesterInterface
+{
+ int property;
+ String invoked;
+
+ public int getProperty()
+ {
+ checkIntercepted("getProperty");
+ return property;
+ }
+
+ public void setProperty(int i)
+ {
+ checkIntercepted("setProperty");
+ property = i;
+ }
+
+ public String someAction()
+ {
+ checkIntercepted("someAction");
+ return invoked;
+ }
+
+ private void checkIntercepted(String lastMethod)
+ {
+ System.out.println("Called " + lastMethod);
+ if (!lastMethod.equals(ScopedInterceptor.getLastMethod()))
+ {
+ throw new RuntimeException("No interception");
+ }
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedTesterInterface.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedTesterInterface.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/scopeddependency/ScopedTesterInterface.java 2008-09-24 16:00:43 UTC (rev 78831)
@@ -0,0 +1,35 @@
+/*
+* 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.aop.scopeddependency;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ScopedTesterInterface
+{
+ void setProperty(int i);
+ int getProperty();
+
+ String someAction();
+}
Modified: trunk/testsuite/src/main/org/jboss/test/aop/test/AOPClassLoaderHookTestSetup.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/AOPClassLoaderHookTestSetup.java 2008-09-24 15:53:58 UTC (rev 78830)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/AOPClassLoaderHookTestSetup.java 2008-09-24 16:00:43 UTC (rev 78831)
@@ -43,6 +43,11 @@
SetupHook hook;
// Create an initializer for the test suite
+ public AOPClassLoaderHookTestSetup(TestSuite suite) throws Exception
+ {
+ super(suite);
+ }
+
public AOPClassLoaderHookTestSetup(TestSuite suite, String jar) throws Exception
{
super(suite);
@@ -67,10 +72,13 @@
}
try
{
- for (int i = 0 ; i < jars.length ; i++)
+ if (jars != null)
{
- String jar = jars[i].trim();
- redeploy(jar);
+ for (int i = 0 ; i < jars.length ; i++)
+ {
+ String jar = jars[i].trim();
+ redeploy(jar);
+ }
}
}
catch(Exception e)
@@ -95,17 +103,20 @@
protected void tearDown() throws Exception
{
Exception undeployException = null;
- for (int i = jars.length -1 ; i >= 0 ; i--)
+ if (jars != null)
{
- try
+ for (int i = jars.length -1 ; i >= 0 ; i--)
{
- String jar = jars[i].trim();
- undeploy(jar);
+ try
+ {
+ String jar = jars[i].trim();
+ undeploy(jar);
+ }
+ catch(Exception e)
+ {
+ undeployException = e;
+ }
}
- catch(Exception e)
- {
- undeployException = e;
- }
}
ObjectName aspectManager = new ObjectName(ASPECT_MANAGER_NAME);
Attribute enableTransformer = new Attribute("EnableLoadtimeWeaving", Boolean.FALSE);
Added: trunk/testsuite/src/main/org/jboss/test/aop/test/NotWovenScopedDependencyUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/NotWovenScopedDependencyUnitTestCase.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/NotWovenScopedDependencyUnitTestCase.java 2008-09-24 16:00:43 UTC (rev 78831)
@@ -0,0 +1,38 @@
+/*
+ * 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.aop.test;
+
+/**
+ * Run the ScopedDependencyTests without weaving
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class NotWovenScopedDependencyUnitTestCase
+ extends ScopedDependencyTest
+{
+
+ public NotWovenScopedDependencyUnitTestCase(String name)
+ {
+ super(name);
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedDependencyTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedDependencyTest.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedDependencyTest.java 2008-09-24 16:00:43 UTC (rev 78831)
@@ -0,0 +1,110 @@
+/*
+* 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.aop.test;
+
+import javax.management.Attribute;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import org.jboss.test.JBossTestCase;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ScopedDependencyTest extends JBossTestCase
+{
+
+ public ScopedDependencyTest(String name)
+ {
+ super(name);
+ }
+
+ public void testBeanWithDependencyFromAspect() throws Exception
+ {
+ //Do this twice since there was a problem with redeployment
+ doTestDeployDependencies();
+ }
+
+ public void testRedeployedBeanWithDependencyFromAspect() throws Exception
+ {
+ //Do this twice since there was a problem with redeployment
+ doTestDeployDependencies();
+ }
+
+ private void doTestDeployDependencies() throws Exception
+ {
+ try
+ {
+ deploy("aop-scopeddependency-scoped.sar");
+ }
+ catch(Exception expected)
+ {
+ //Since the dependencies are not there, we get an exception...
+ }
+
+ try
+ {
+ MBeanServerConnection server = getServer();
+ ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester");
+ try
+ {
+ server.getMBeanInfo(testerName);
+ fail(testerName + " should not have been found");
+ }
+ catch (InstanceNotFoundException expected)
+ {
+ }
+
+ deploy("aop-scopeddependency-global.jar");
+ try
+ {
+ server.setAttribute(testerName, new Attribute("Property", 42));
+ assertEquals(42, server.getAttribute(testerName, "Property"));
+ String ret = (String)server.invoke(testerName, "someAction", new Object[0], new String[0]);
+ assertNotNull(ret);
+ assertEquals("true", ret);
+ }
+ finally
+ {
+ undeploy("aop-scopeddependency-global.jar");
+ }
+
+ try
+ {
+ server.getMBeanInfo(testerName);
+ fail(testerName + " should not have been found");
+ }
+ catch (InstanceNotFoundException expected)
+ {
+ }
+
+ }
+ finally
+ {
+ undeploy("aop-scopeddependency-scoped.sar");
+ }
+ }
+
+}
\ No newline at end of file
Added: trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedWovenDependencyTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedWovenDependencyTestCase.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedWovenDependencyTestCase.java 2008-09-24 16:00:43 UTC (rev 78831)
@@ -0,0 +1,50 @@
+/*
+* 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.aop.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Run the ScopedDependencyTests with weaving
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ScopedWovenDependencyTestCase extends ScopedDependencyTest
+{
+
+ public ScopedWovenDependencyTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite() throws Exception
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTest(new TestSuite(ScopedWovenDependencyTestCase.class));
+
+ AOPClassLoaderHookTestSetup setup = new AOPClassLoaderHookTestSetup(suite);
+ return setup;
+ }
+
+}
Added: trunk/testsuite/src/resources/aop/scopeddependency/global/META-INF/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/aop/scopeddependency/global/META-INF/jboss-beans.xml (rev 0)
+++ trunk/testsuite/src/resources/aop/scopeddependency/global/META-INF/jboss-beans.xml 2008-09-24 16:00:43 UTC (rev 78831)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="GlobalDependency" class="org.jboss.test.aop.scopeddependency.GlobalDependency"/>
+
+</deployment>
Added: trunk/testsuite/src/resources/aop/scopeddependency/scoped/META-INF/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/aop/scopeddependency/scoped/META-INF/jboss-beans.xml (rev 0)
+++ trunk/testsuite/src/resources/aop/scopeddependency/scoped/META-INF/jboss-beans.xml 2008-09-24 16:00:43 UTC (rev 78831)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="ScopedDependency" class="org.jboss.test.aop.scopeddependency.ScopedDependency"/>
+
+ <interceptor xmlns="urn:jboss:aop-beans:1.0"
+ name="ScopedInterceptor"
+ class="org.jboss.test.aop.scopeddependency.ScopedInterceptor">
+ <property name="globalDependency"><inject bean="GlobalDependency"/></property>
+ <property name="scopedDependency"><inject bean="ScopedDependency"/></property>
+ </interceptor>
+
+ <bind xmlns="urn:jboss:aop-beans:1.0"
+ pointcut="execution(* org.jboss.test.aop.scopeddependency.ScopedTester->*(..))">
+ <interceptor-ref name="ScopedInterceptor"/>
+ </bind>
+
+ <bean name="ScopedTester" class="org.jboss.test.aop.scopeddependency.ScopedTester"/>
+
+</deployment>
Added: trunk/testsuite/src/resources/aop/scopeddependency/scoped/META-INF/jboss-service.xml
===================================================================
--- trunk/testsuite/src/resources/aop/scopeddependency/scoped/META-INF/jboss-service.xml (rev 0)
+++ trunk/testsuite/src/resources/aop/scopeddependency/scoped/META-INF/jboss-service.xml 2008-09-24 16:00:43 UTC (rev 78831)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <loader-repository>
+ aop.loading:loader=scopeddependency
+ <loader-repository-config>java2ParentDelegation=true</loader-repository-config>
+ </loader-repository>
+ <mbean code="org.jboss.test.aop.scopeddependency.ScopedIgnoredTester" name="jboss.aop:name=Ignored">
+ </mbean>
+</server>
More information about the jboss-cvs-commits
mailing list