[jboss-cvs] JBossAS SVN: r84373 - in trunk/testsuite: src/main/org/jboss/test/aop and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Feb 18 06:15:05 EST 2009
Author: galder.zamarreno at jboss.com
Date: 2009-02-18 06:15:04 -0500 (Wed, 18 Feb 2009)
New Revision: 84373
Added:
trunk/testsuite/src/main/org/jboss/test/aop/mcjndi/
trunk/testsuite/src/main/org/jboss/test/aop/mcjndi/AnnotatedPojo.java
trunk/testsuite/src/main/org/jboss/test/aop/mcjndi/PojoInterface.java
trunk/testsuite/src/main/org/jboss/test/aop/mcjndi/XmlPojo.java
trunk/testsuite/src/main/org/jboss/test/aop/test/MicrocontainerJndiUnitTestCase.java
trunk/testsuite/src/resources/aop/mcjndi/
trunk/testsuite/src/resources/aop/mcjndi/META-INF/
trunk/testsuite/src/resources/aop/mcjndi/META-INF/jboss-beans.xml
Modified:
trunk/testsuite/imports/sections/aop.xml
Log:
[JBAS-6502] Added testcase that accesses a MC pojo annotated with @JndiBinding remotely via JNDI.
Modified: trunk/testsuite/imports/sections/aop.xml
===================================================================
--- trunk/testsuite/imports/sections/aop.xml 2009-02-18 11:07:49 UTC (rev 84372)
+++ trunk/testsuite/imports/sections/aop.xml 2009-02-18 11:15:04 UTC (rev 84373)
@@ -244,6 +244,16 @@
<include name="META-INF/dependency-jboss-beans.xml"/>
</fileset>
</jar>
+
+ <!-- Create jars for the aop-mc-integration test-->
+ <jar destfile="${build.lib}/aop-mc-jnditest.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/aop/mcjndi/*.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/aop/mcjndi">
+ <include name="META-INF/jboss-beans.xml"/>
+ </fileset>
+ </jar>
<!-- Create jars for the default annotation test -->
<jar destfile="${build.lib}/aop-mc-defaultannotationtest.jar">
Added: trunk/testsuite/src/main/org/jboss/test/aop/mcjndi/AnnotatedPojo.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/mcjndi/AnnotatedPojo.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/mcjndi/AnnotatedPojo.java 2009-02-18 11:15:04 UTC (rev 84373)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.mcjndi;
+
+import java.io.Serializable;
+
+import org.jboss.aop.microcontainer.aspects.jndi.JndiBinding;
+
+/**
+ * AnnotatedBean.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+ at JndiBinding(name=AnnotatedPojo.NAME)
+public class AnnotatedPojo implements PojoInterface, Serializable
+{
+ public final static String NAME = "pojo/AnnotatedBean";
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 2056976064273063180L;
+
+ private int i;
+
+ public int getProperty()
+ {
+ return i;
+ }
+
+ public void setProperty(int i)
+ {
+ this.i = i;
+ }
+
+ public String someAction()
+ {
+ return "JNDI-Annotated-" + i;
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/mcjndi/PojoInterface.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/mcjndi/PojoInterface.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/mcjndi/PojoInterface.java 2009-02-18 11:15:04 UTC (rev 84373)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.mcjndi;
+
+/**
+ * BeanInterface.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public interface PojoInterface
+{
+ void setProperty(int i);
+
+ int getProperty();
+
+ String someAction();
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/mcjndi/XmlPojo.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/mcjndi/XmlPojo.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/mcjndi/XmlPojo.java 2009-02-18 11:15:04 UTC (rev 84373)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.mcjndi;
+
+import java.io.Serializable;
+
+/**
+ * XmlBean.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class XmlPojo implements PojoInterface, Serializable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 2651949786173106166L;
+
+ private int i;
+
+ public int getProperty()
+ {
+ return i;
+ }
+
+ public void setProperty(int i)
+ {
+ this.i = i;
+ }
+
+ public String someAction()
+ {
+ return "JNDI-XML-" + i;
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/test/MicrocontainerJndiUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/MicrocontainerJndiUnitTestCase.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/MicrocontainerJndiUnitTestCase.java 2009-02-18 11:15:04 UTC (rev 84373)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.naming.Context;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.aop.mcjndi.AnnotatedPojo;
+import org.jboss.test.aop.mcjndi.PojoInterface;
+
+/**
+ * MicrocontainerJndiUnitTestCase.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class MicrocontainerJndiUnitTestCase extends JBossTestCase
+{
+ public MicrocontainerJndiUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testAnnotated() throws Exception
+ {
+ Context ctx = getInitialContext();
+ PojoInterface pojo = (PojoInterface)ctx.lookup(AnnotatedPojo.NAME);
+ pojo.setProperty(39);
+ assertEquals(39, pojo.getProperty());
+
+ Object ret = pojo.someAction();
+ assertEquals("JNDI-Annotated-39", ret);
+ }
+
+ public void testXml() throws Exception
+ {
+ Context ctx = getInitialContext();
+ PojoInterface pojo = (PojoInterface)ctx.lookup("pojo/XmlBean");
+ pojo.setProperty(49);
+ assertEquals(49, pojo.getProperty());
+
+ Object ret = pojo.someAction();
+ assertEquals("JNDI-XML-49", ret);
+ }
+
+ public static Test suite() throws Exception
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTest(new TestSuite(MicrocontainerJndiUnitTestCase.class));
+ AOPTestSetup setup = new AOPTestSetup(suite, "aop-mc-jnditest.jar");
+ return setup;
+ }
+}
Added: trunk/testsuite/src/resources/aop/mcjndi/META-INF/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/aop/mcjndi/META-INF/jboss-beans.xml (rev 0)
+++ trunk/testsuite/src/resources/aop/mcjndi/META-INF/jboss-beans.xml 2009-02-18 11:15:04 UTC (rev 84373)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <lifecycle-configure xmlns="urn:jboss:aop-beans:1.0"
+ name="DependencyAdvice"
+ class="org.jboss.aop.microcontainer.aspects.jndi.JndiLifecycleCallback"
+ classes="@org.jboss.aop.microcontainer.aspects.jndi.JndiBinding">
+ <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.jnp.interfaces.NamingContextFactory</value>
+ </entry>
+ <entry>
+ <key>java.naming.factory.url.pkgs</key>
+ <value>org.jboss.naming:org.jnp.interfaces</value>
+ </entry>
+ </map>
+ </property>
+ </lifecycle-configure>
+
+ <bean name="AnnotatedPojo" class="org.jboss.test.aop.mcjndi.AnnotatedPojo" />
+
+ <bean name="XmlPojo" class="org.jboss.test.aop.mcjndi.XmlPojo">
+ <annotation>@org.jboss.aop.microcontainer.aspects.jndi.JndiBinding(name="pojo/XmlBean")</annotation>
+ </bean>
+
+</deployment>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list