[jboss-cvs] JBossAS SVN: r99466 - in projects/ejb3/trunk/nointerface/testsuite: src/test/java/org/jboss/ejb3/nointerface/integration/test and 13 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jan 15 08:10:53 EST 2010
Author: jaikiran
Date: 2010-01-15 08:10:52 -0500 (Fri, 15 Jan 2010)
New Revision: 99466
Added:
projects/ejb3/trunk/nointerface/testsuite/build-test.xml
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/DDBasedNoInterfaceViewSLSB.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/NamedBean.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/WrapperSLSB.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/unit/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/unit/DeploymentDescriptorBasedTestCase.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/Calculator.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/CalculatorBean.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/NoInterfaceCalculator.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/unit/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/unit/NoInterfaceBeanInjectionTestCase.java
projects/ejb3/trunk/nointerface/testsuite/src/test/resources/log4j.xml
projects/ejb3/trunk/nointerface/testsuite/src/test/resources/org/
projects/ejb3/trunk/nointerface/testsuite/src/test/resources/org/jboss/
projects/ejb3/trunk/nointerface/testsuite/src/test/resources/org/jboss/ejb3/
projects/ejb3/trunk/nointerface/testsuite/src/test/resources/org/jboss/ejb3/nointerface/
projects/ejb3/trunk/nointerface/testsuite/src/test/resources/org/jboss/ejb3/nointerface/integration/
projects/ejb3/trunk/nointerface/testsuite/src/test/resources/org/jboss/ejb3/nointerface/integration/test/
projects/ejb3/trunk/nointerface/testsuite/src/test/resources/org/jboss/ejb3/nointerface/integration/test/descriptor/
projects/ejb3/trunk/nointerface/testsuite/src/test/resources/org/jboss/ejb3/nointerface/integration/test/descriptor/META-INF/
projects/ejb3/trunk/nointerface/testsuite/src/test/resources/org/jboss/ejb3/nointerface/integration/test/descriptor/META-INF/ejb-jar.xml
Modified:
projects/ejb3/trunk/nointerface/testsuite/pom.xml
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/AbstractNoInterfaceTestCase.java
Log:
EJBTHREE-1986 Added tests for descriptor based nointerface deployments. Also modified/refactored some of the testsuite infrastructure
Added: projects/ejb3/trunk/nointerface/testsuite/build-test.xml
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/build-test.xml (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/build-test.xml 2010-01-15 13:10:52 UTC (rev 99466)
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="JBoss EJB3.1 no-interface testsuite setup" default="install-no-interface-package">
+
+ <property environment="env"/>
+ <!-- Enforce JBOSS_HOME -->
+ <fail unless="env.JBOSS_HOME" message="JBOSS_HOME not set"/>
+ <property name="JBOSS_HOME" value="${env.JBOSS_HOME}"/>
+
+ <property name="location.target" value="${basedir}/target"/>
+ <property name="location.dependencies" value="${location.target}/dependencies"/>
+ <property name="location.packagemanager" value="${location.dependencies}/package-manager"/>
+ <property name="location.packagemanager.zip.file" value="${location.packagemanager}/jboss-ejb3-package-manager-installer.zip"/>
+ <property name="location.nointerface.package" value="${location.dependencies}/package"/>
+ <property name="location.nointerface.package.file" value="${location.nointerface.package}/jboss-ejb3-nointerface-package.jar"/>
+ <property name="packagemanager.home" value="${location.packagemanager}/jboss-package-manager"/>
+
+ <path id="package.manager.classpath">
+ <fileset dir="${packagemanager.home}/lib" includes="**/*.jar"/>
+ </path>
+
+ <target name="install-no-interface-package" description="Install no-interface package into JBoss AS">
+ <!--Unzip the package manager installer -->
+ <antcall target="unzip-package-manager"/>
+
+ <!-- Setup package manager itself -->
+ <antcall target="setup-package-manager"/>
+
+ <!-- Install the no-interface package through the package manager -->
+ <java classname="org.jboss.ejb3.packagemanager.main.Main" classpathref="package.manager.classpath" fork="true">
+
+ <!-- package manager home -->
+ <arg value="-p"/>
+ <arg value="${packagemanager.home}"/>
+ <!-- JBoss Home -->
+ <arg value="-s"/>
+ <arg value="${JBOSS_HOME}"/>
+ <arg value="-u"/>
+ <arg value="${location.nointerface.package.file}"/>
+ </java>
+ </target>
+
+ <target name="unzip-package-manager">
+ <unzip dest="${location.packagemanager}" src="${location.packagemanager.zip.file}"/>
+ </target>
+
+ <target name="setup-package-manager">
+
+ <java classname="org.jboss.ejb3.packagemanager.main.Setup" classpathref="package.manager.classpath" fork="true">
+ <!-- package manager home -->
+ <arg value="-p"/>
+ <arg value="${packagemanager.home}"/>
+ <!-- Schema script -->
+ <arg value="-f"/>
+ <arg value="${packagemanager.home}/script/schema.sql"/>
+ </java>
+
+ </target>
+
+
+
+</project>
\ No newline at end of file
Modified: projects/ejb3/trunk/nointerface/testsuite/pom.xml
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/pom.xml 2010-01-15 13:06:41 UTC (rev 99465)
+++ projects/ejb3/trunk/nointerface/testsuite/pom.xml 2010-01-15 13:10:52 UTC (rev 99466)
@@ -108,10 +108,66 @@
</executions>
</plugin>
+ <!-- Setup the package manager and no-interface package so
+ that it can be installed later into the AS -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <!-- The package manager installer -->
+ <artifactItem>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-package-manager</artifactId>
+ <classifier>installer</classifier>
+ <type>zip</type>
+ <outputDirectory>${project.build.directory}/dependencies/package-manager</outputDirectory>
+ </artifactItem>
+ <!-- The no-interface package -->
+ <artifactItem>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-nointerface</artifactId>
+ <classifier>package</classifier>
+ <type>jar</type>
+ <outputDirectory>${project.build.directory}/dependencies/package</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <stripVersion>true</stripVersion>
+ <excludeTransitive>true</excludeTransitive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
- <!-- start the server in pre-integration-test phase -->
+ <!-- Install no-interface package in pre-integration-test phase
<plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>install-nointerface-package</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="build-test.xml" target="install-no-interface-package" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin> -->
+ <!-- After installing the no-interface package, now start the server in pre-integration-test phase -->
+ <plugin>
<groupId>org.jboss.maven.plugins.jbossas</groupId>
<artifactId>maven-jboss-as-control-plugin</artifactId>
<version>0.1.1</version>
@@ -199,15 +255,38 @@
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-server</artifactId>
<version>5.1.0.GA</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-as-int</artifactId>
+ <artifactId>jboss-ejb3_1</artifactId>
<scope>test</scope>
- <version>1.1.22</version>
+ <version>1.0.0</version>
+ <type>pom</type>
</dependency>
+ <!-- The package manager installer which we use to install the no-interface package
+ into AS -->
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-package-manager</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <scope>test</scope>
+ <classifier>installer</classifier>
+ <type>zip</type>
+ </dependency>
+
+ <!-- The no-interface package -->
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-nointerface</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <scope>test</scope>
+ <classifier>package</classifier>
+ </dependency>
+
+
</dependencies>
</project>
\ No newline at end of file
Modified: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/AbstractNoInterfaceTestCase.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/AbstractNoInterfaceTestCase.java 2010-01-15 13:06:41 UTC (rev 99465)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/AbstractNoInterfaceTestCase.java 2010-01-15 13:10:52 UTC (rev 99466)
@@ -42,6 +42,7 @@
import org.jboss.logging.Logger;
import org.jboss.shrinkwrap.api.Archives;
import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.jboss.shrinkwrap.api.importer.ExplodedImporter;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
/**
@@ -78,6 +79,11 @@
* The directory into which the deployments required by the tests will be placed
*/
protected static final File TEST_DEPLOYMENTS_FOLDER = new File(TARGET_DIRECTORY, "test-lib");
+
+ /**
+ * The <project>/src/test/resources folder
+ */
+ protected static final File TEST_SRC_RESOURCES = new File(BASEDIR, "src/test/resources");
static
{
@@ -150,6 +156,21 @@
{
JavaArchive jar = Archives.create(jarName, JavaArchive.class);
jar.addPackages(false, testArtifactPackages);
+ // also add any files from test/resources/<packagename>/*
+ for (Package testPackage : testArtifactPackages)
+ {
+ if (TEST_SRC_RESOURCES.exists())
+ {
+ //replace the "." with "/" in the packagename
+ String resourceRelativePath = testPackage.getName().replaceAll("\\.", "/");
+ File resourceAbsolutePath = new File(TEST_SRC_RESOURCES, resourceRelativePath);
+ if (resourceAbsolutePath.exists())
+ {
+ // add all files, folders, sub-folders under this location to the root of the archive
+ jar.as(ExplodedImporter.class).importDirectory(resourceAbsolutePath);
+ }
+ }
+ }
return writeToFileSystem(jar);
}
@@ -297,4 +318,6 @@
{
return this.ctx;
}
+
+
}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/DDBasedNoInterfaceViewSLSB.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/DDBasedNoInterfaceViewSLSB.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/DDBasedNoInterfaceViewSLSB.java 2010-01-15 13:10:52 UTC (rev 99466)
@@ -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.ejb3.nointerface.integration.test.descriptor;
+
+import javax.ejb.Stateless;
+
+/**
+ * DDBasedNoInterfaceViewSLSB
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateless
+public class DDBasedNoInterfaceViewSLSB
+{
+
+ /**
+ * A dummy method which returns the simple name of
+ * this class
+ * @return
+ */
+ public String getName()
+ {
+ return this.getClass().getSimpleName();
+ }
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/NamedBean.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/NamedBean.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/NamedBean.java 2010-01-15 13:10:52 UTC (rev 99466)
@@ -0,0 +1,34 @@
+/*
+* 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.ejb3.nointerface.integration.test.descriptor;
+
+/**
+ * NamedBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface NamedBean
+{
+
+ public String getName();
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/WrapperSLSB.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/WrapperSLSB.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/WrapperSLSB.java 2010-01-15 13:10:52 UTC (rev 99466)
@@ -0,0 +1,63 @@
+/*
+* 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.ejb3.nointerface.integration.test.descriptor;
+
+import javax.ejb.EJB;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+
+/**
+ * WrapperSLSB
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote (NamedBean.class)
+ at RemoteBinding (jndiBinding = WrapperSLSB.JNDI_NAME)
+public class WrapperSLSB implements NamedBean
+{
+ /**
+ * JNDI name
+ */
+ public static final String JNDI_NAME = "WrapperSLSBForDescriptorBasedNoInterfaceView";
+
+
+ @EJB
+ private DDBasedNoInterfaceViewSLSB noInterfaceViewSLSB;
+
+ /**
+ * Just delegates to the nointerface view bean
+ */
+ @Override
+ public String getName()
+ {
+ if (this.noInterfaceViewSLSB == null)
+ {
+ throw new RuntimeException("No-interface view bean " + DDBasedNoInterfaceViewSLSB.class
+ + " was *not* injected in " + this);
+ }
+ return this.noInterfaceViewSLSB.getName();
+ }
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/unit/DeploymentDescriptorBasedTestCase.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/unit/DeploymentDescriptorBasedTestCase.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/descriptor/unit/DeploymentDescriptorBasedTestCase.java 2010-01-15 13:10:52 UTC (rev 99466)
@@ -0,0 +1,91 @@
+/*
+* 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.ejb3.nointerface.integration.test.descriptor.unit;
+
+import java.net.URL;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.Assert;
+
+import org.jboss.ejb3.nointerface.integration.test.AbstractNoInterfaceTestCase;
+import org.jboss.ejb3.nointerface.integration.test.descriptor.DDBasedNoInterfaceViewSLSB;
+import org.jboss.ejb3.nointerface.integration.test.descriptor.NamedBean;
+import org.jboss.ejb3.nointerface.integration.test.descriptor.WrapperSLSB;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * DeploymentDescriptorBasedTestCase
+ *
+ * Tests the nointerface view for deployment descriptor based
+ * deployments
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class DeploymentDescriptorBasedTestCase extends AbstractNoInterfaceTestCase
+{
+
+ /**
+ * Test deployment which will be deployed to the AS
+ */
+ private URL deployment;
+
+ /**
+ *
+ * @return
+ * @throws Exception
+ */
+ @Before
+ public void before() throws Exception
+ {
+ String jarName = "dd-based-nointerface.jar";
+ deployment = buildSimpleJar(jarName, DDBasedNoInterfaceViewSLSB.class.getPackage());
+ this.redeploy(deployment);
+ }
+
+ @After
+ public void after() throws Exception
+ {
+ if (this.deployment != null)
+ {
+ this.undeploy(deployment);
+ }
+ }
+
+ @Test
+ public void testNoInterfaceViewDeployment() throws Exception
+ {
+ Context ctx = new InitialContext();
+ NamedBean wrapperSLSB = (NamedBean) ctx.lookup(WrapperSLSB.JNDI_NAME);
+
+ Assert.assertNotNull("lookup returned null for jndi name " + WrapperSLSB.JNDI_NAME, wrapperSLSB);
+
+ String nameOfNoInterfaceViewSLSB = wrapperSLSB.getName();
+ Assert.assertEquals("Incorrect name returned", DDBasedNoInterfaceViewSLSB.class.getSimpleName(), nameOfNoInterfaceViewSLSB);
+
+
+ }
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/Calculator.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/Calculator.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/Calculator.java 2010-01-15 13:10:52 UTC (rev 99466)
@@ -0,0 +1,35 @@
+/*
+* 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.ejb3.nointerface.integration.test.injection;
+
+/**
+ * Calculator
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface Calculator
+{
+
+ int add(int a, int b);
+
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/CalculatorBean.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/CalculatorBean.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/CalculatorBean.java 2010-01-15 13:10:52 UTC (rev 99466)
@@ -0,0 +1,60 @@
+/*
+* 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.ejb3.nointerface.integration.test.injection;
+
+import javax.ejb.EJB;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+
+/**
+ * CalculatorBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(Calculator.class)
+ at RemoteBinding(jndiBinding = CalculatorBean.REMOTE_JNDI_NAME)
+public class CalculatorBean implements Calculator
+{
+
+ public static final String REMOTE_JNDI_NAME = "DelegatingCalculatorBean";
+
+ @EJB
+ private NoInterfaceCalculator noInterfaceCalculator;
+
+ /**
+ * @see org.jboss.ejb3.nointerface.integration.test.injection.Calculator#add(int, int)
+ */
+ @Override
+ public int add(int a, int b)
+ {
+ if (this.noInterfaceCalculator == null)
+ {
+ throw new IllegalStateException("no-interface @EJB injection did not happen");
+ }
+ return this.noInterfaceCalculator.add(a, b);
+ }
+
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/NoInterfaceCalculator.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/NoInterfaceCalculator.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/NoInterfaceCalculator.java 2010-01-15 13:10:52 UTC (rev 99466)
@@ -0,0 +1,40 @@
+/*
+* 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.ejb3.nointerface.integration.test.injection;
+
+import javax.ejb.Stateless;
+
+/**
+ * NoInterfaceCalculator
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateless
+public class NoInterfaceCalculator
+{
+
+ public int add(int a, int b)
+ {
+ return a + b;
+ }
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/unit/NoInterfaceBeanInjectionTestCase.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/unit/NoInterfaceBeanInjectionTestCase.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/injection/unit/NoInterfaceBeanInjectionTestCase.java 2010-01-15 13:10:52 UTC (rev 99466)
@@ -0,0 +1,89 @@
+/*
+* 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.ejb3.nointerface.integration.test.injection.unit;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URL;
+
+import org.jboss.ejb3.nointerface.integration.test.AbstractNoInterfaceTestCase;
+import org.jboss.ejb3.nointerface.integration.test.injection.Calculator;
+import org.jboss.ejb3.nointerface.integration.test.injection.CalculatorBean;
+import org.jboss.logging.Logger;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * NoInterfaceBeanInjectionTestCase
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class NoInterfaceBeanInjectionTestCase extends AbstractNoInterfaceTestCase
+{
+
+ /**
+ * Logger
+ */
+ private static Logger logger = Logger.getLogger(NoInterfaceBeanInjectionTestCase.class);
+
+ private URL deployment;
+
+ /**
+ *
+ * @return
+ * @throws Exception
+ */
+ @Before
+ public void before() throws Exception
+ {
+ String jarName = NoInterfaceBeanInjectionTestCase.class.getSimpleName() + ".jar";
+ deployment = buildSimpleJar(jarName, CalculatorBean.class.getPackage());
+ this.redeploy(deployment);
+ }
+
+ @After
+ public void after() throws Exception
+ {
+ if (this.deployment != null)
+ {
+ this.undeploy(deployment);
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testNoInterfaceSLSBAccess() throws Exception
+ {
+ Calculator calculatorDelegatingBean = (Calculator) this.getInitialContext().lookup(CalculatorBean.REMOTE_JNDI_NAME);
+ int num1 = 5;
+ int num2 = 6;
+ int expectedResult = num1 + num2;
+ int result = calculatorDelegatingBean.add(num1, num2);
+ assertEquals("Unexpected result from calculator", expectedResult, result);
+ }
+
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/resources/log4j.xml
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/resources/log4j.xml (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/resources/log4j.xml 2010-01-15 13:10:52 UTC (rev 99466)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 68671 2008-01-08 10:04:25Z wolfc $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+ <param name="File" value="target/test.log"/>
+ <param name="Append" value="false"/>
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <!-- Rollover at the top of each hour
+ <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+ -->
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+ <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+ <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jboss">
+ <priority value="INFO"/>
+ </category>
+
+ <category name="org.jboss.ejb3">
+ <priority value="ALL"/>
+ </category>
+
+ <category name="org.jnp">
+ <priority value="INFO"/>
+ </category>
+
+ <category name="org.jboss.deployment">
+ <priority value="ALL"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/resources/org/jboss/ejb3/nointerface/integration/test/descriptor/META-INF/ejb-jar.xml
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/resources/org/jboss/ejb3/nointerface/integration/test/descriptor/META-INF/ejb-jar.xml (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/resources/org/jboss/ejb3/nointerface/integration/test/descriptor/META-INF/ejb-jar.xml 2010-01-15 13:10:52 UTC (rev 99466)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
+ version="3.1">
+ <enterprise-beans>
+ <session>
+ <ejb-name>DDBasedNoInterfaceViewSLSB</ejb-name>
+ <local-bean/>
+ <ejb-class>org.jboss.ejb3.nointerface.integration.test.descriptor.DDBasedNoInterfaceViewSLSB</ejb-class>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list