[jboss-cvs] JBossAS SVN: r97222 - in projects/ejb3/trunk/nointerface: testsuite and 16 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Dec 1 07:18:11 EST 2009
Author: jaikiran
Date: 2009-12-01 07:18:10 -0500 (Tue, 01 Dec 2009)
New Revision: 97222
Added:
projects/ejb3/trunk/nointerface/testsuite/
projects/ejb3/trunk/nointerface/testsuite/pom.xml
projects/ejb3/trunk/nointerface/testsuite/src/
projects/ejb3/trunk/nointerface/testsuite/src/main/
projects/ejb3/trunk/nointerface/testsuite/src/main/java/
projects/ejb3/trunk/nointerface/testsuite/src/main/resources/
projects/ejb3/trunk/nointerface/testsuite/src/test/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/
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/common/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/AbstractSimpleBase.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/ChildBean.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/CounterNoInterfaceSFSBean.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSFSBRemote.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSFSBean.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSLSBRemote.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSLSBean.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/Echo.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/SLSBMarkedWithLocalBean.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/SimpleNoInterfaceSFSB.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/SimpleNoInterfaceSLSBean.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/deployment/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/deployment/unit/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/deployment/unit/SimpleNoInterfaceDeploymentTestCase.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/equality/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/equality/EqualityCheckerBean.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/equality/EqualityCheckerBeanRemote.java
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/equality/unit/
projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/equality/unit/NoInterfaceBeanEqualityTestCase.java
projects/ejb3/trunk/nointerface/testsuite/src/test/resources/
projects/ejb3/trunk/nointerface/testsuite/src/test/resources/jndi.properties
Log:
EJBTHREE-1727 A testsuite component for integration testing the nointerface module
Added: projects/ejb3/trunk/nointerface/testsuite/pom.xml
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/pom.xml (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/pom.xml 2009-12-01 12:18:10 UTC (rev 97222)
@@ -0,0 +1,107 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+
+ <parent>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-build</artifactId>
+ <version>1.0.8</version>
+ <relativePath>../../build/pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-nointerface-testsuite</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <build>
+ <plugins>
+ <!-- Enforce JDK6 -->
+ <plugin>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>enforce-jdk6</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireJavaVersion>
+ <version>1.6</version>
+ </requireJavaVersion>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Use the correct "javac" -->
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <executable>${JAVA_HOME}/bin/javac</executable>
+ </configuration>
+ </plugin>
+
+
+ </plugins>
+ </build>
+
+ <dependencies>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap</groupId>
+ <artifactId>shrinkwrap-impl-base</artifactId>
+ <version>1.0.0-alpha-2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-api</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.naming</groupId>
+ <artifactId>jnpserver</artifactId>
+ <version>5.0.3.GA</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-system-jmx</artifactId>
+ <scope>test</scope>
+ <version>5.1.0.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-server</artifactId>
+ <version>5.1.0.GA</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-as-int</artifactId>
+ <scope>test</scope>
+ <version>1.1.22</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
\ No newline at end of file
Added: 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 (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/AbstractNoInterfaceTestCase.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -0,0 +1,300 @@
+/*
+* 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;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+/**
+ * AbstractNoInterfaceTestCase
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public abstract class AbstractNoInterfaceTestCase
+{
+
+ private final static String DEPLOYER_NAME = "jboss.system:service=MainDeployer";
+
+ protected MBeanServerConnection server;
+
+ private Context ctx;
+
+ /**
+ * Logger
+ */
+ private static Logger logger = Logger.getLogger(AbstractNoInterfaceTestCase.class);
+
+ /**
+ * basedir (set through Maven)
+ */
+ protected static final File BASEDIR = new File(System.getProperty("basedir"));
+
+ /**
+ * Target directory
+ */
+ protected static final File TARGET_DIRECTORY = new File(BASEDIR, "target");
+
+ /**
+ * 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");
+
+ static
+ {
+ if (!TEST_DEPLOYMENTS_FOLDER.exists())
+ {
+ TEST_DEPLOYMENTS_FOLDER.mkdir();
+ }
+ }
+
+ /**
+ * @param name
+ */
+ public AbstractNoInterfaceTestCase()
+ {
+ try
+ {
+ this.ctx = new InitialContext();
+ }
+ catch (NamingException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Returns the URL to the {@code resourceName}. The resource is looked
+ * under {@code klass}'s package name. For example, if the
+ * klass is org.jboss.ejb3.nointerface.integration.test.simple.unit.BasicTestCase and the
+ * resource name is ejb-jar.xml, then this method looks for ejb-jar.xml under
+ * org/jboss/ejb3/nointerface/integration/test/simple/unit in the classpath.
+ *
+ * This method returns null if the resource was not found in the classpath
+ * @param klass The Class under whose package the resources are searched for
+ * @param resourceName The name of the resource
+ * @return Returns the URL to the resource or NULL if not found in classpath
+ */
+ protected static URL getResource(Class<?> klass, String resourceName)
+ {
+ String resourceDir = klass.getPackage().getName().toString() + ".";
+ resourceDir = resourceDir.replace('.', '/');
+ String resourcePath = resourceDir + resourceName;
+ return klass.getClassLoader().getResource(resourcePath);
+ }
+
+ /**
+ * Returns the URLs to the {@code resources}. The resources are looked
+ * under {@code klass}'s package name. For example, if the
+ * klass is org.jboss.ejb3.nointerface.integration.test.simple.unit.BasicTestCase and the
+ * resource name is ejb-jar.xml, then this method looks for ejb-jar.xml under
+ * org/jboss/ejb3/nointerface/integration/test/simple/unit in the classpath.
+ *
+ * Note: The list returned by the method could contain null elements if the
+ * corresponding resource wasn't found in the classpath.
+ *
+ * @param klass The Class under whose package the resources are searched for
+ * @param resources The name of the resources
+ * @return Returns a list of resource URLs
+ */
+ protected static List<URL> getResources(Class<?> klass, String... resources)
+ {
+ List<URL> urls = new ArrayList<URL>();
+ for (String resource : resources)
+ {
+ urls.add(getResource(klass, resource));
+ }
+ return urls;
+ }
+
+ protected static URL buildSimpleJar(String jarName, Package... testArtifactPackages) throws IOException
+ {
+ JavaArchive jar = Archives.create(jarName, JavaArchive.class);
+ jar.addPackages(false, testArtifactPackages);
+ return writeToFileSystem(jar);
+ }
+
+ protected static URL writeToFileSystem(JavaArchive javaArchive) throws IOException
+ {
+ InputStream inputStream = javaArchive.as(ZipExporter.class).exportZip();
+ String jarFileName = javaArchive.getName();
+ logger.debug("Writing out jar " + jarFileName + " : " + javaArchive.toString(true));
+ File jarFile = new File(TEST_DEPLOYMENTS_FOLDER, jarFileName);
+ FileOutputStream fos = new FileOutputStream(jarFile);
+ BufferedOutputStream bos = null;
+ BufferedInputStream bis = null;
+ try
+ {
+ bos = new BufferedOutputStream(fos);
+ bis = new BufferedInputStream(inputStream);
+ byte[] content = new byte[4096];
+ int length;
+ while ((length = bis.read(content)) != -1)
+ {
+ bos.write(content, 0, length);
+ }
+ bos.flush();
+ }
+ finally
+ {
+ if (bos != null)
+ {
+ bos.close();
+ }
+ if (bis != null)
+ {
+ bis.close();
+ }
+ }
+ return jarFile.toURI().toURL();
+ }
+
+ /**
+ * invoke wraps an invoke call to the mbean server in a lot of exception
+ * unwrapping.
+ *
+ * @param name ObjectName of the mbean to be called
+ * @param method mbean method to be called
+ * @param args Object[] of arguments for the mbean method.
+ * @param sig String[] of types for the mbean methods parameters.
+ * @return Object returned by mbean method invocation.
+ * @exception Exception Description of Exception
+ */
+ protected Object invoke(ObjectName name, String method, Object[] args, String[] sig) throws Exception
+ {
+ return invoke(getServer(), name, method, args, sig);
+ }
+
+ protected Object invoke(MBeanServerConnection server, ObjectName name, String method, Object[] args, String[] sig)
+ throws Exception
+ {
+ try
+ {
+ this.logger.debug("Invoking " + name.getCanonicalName() + " method=" + method);
+ if (args != null)
+ this.logger.debug("args=" + Arrays.asList(args));
+ return server.invoke(name, method, args, sig);
+ }
+ catch (javax.management.MBeanException e)
+ {
+ logger.error("MbeanException", e.getTargetException());
+ throw e.getTargetException();
+ }
+ catch (javax.management.ReflectionException e)
+ {
+ logger.error("ReflectionException", e.getTargetException());
+ throw e.getTargetException();
+ }
+ catch (javax.management.RuntimeOperationsException e)
+ {
+ logger.error("RuntimeOperationsException", e.getTargetException());
+ throw e.getTargetException();
+ }
+ catch (javax.management.RuntimeMBeanException e)
+ {
+ logger.error("RuntimeMbeanException", e.getTargetException());
+ throw e.getTargetException();
+ }
+ catch (javax.management.RuntimeErrorException e)
+ {
+ logger.error("RuntimeErrorException", e.getTargetError());
+ throw e.getTargetError();
+ }
+ }
+
+ /**
+ * Deploy a package with the main deployer. The supplied name is
+ * interpreted as a url, or as a filename in jbosstest.deploy.lib or output/lib.
+ *
+ * @param name filename/url of package to deploy.
+ * @exception Exception Description of Exception
+ */
+ public void deploy(URL deployURL) throws Exception
+ {
+ invoke(getDeployerName(), "deploy", new Object[]
+ {deployURL}, new String[]
+ {"java.net.URL"});
+ }
+
+ public void redeploy(URL deployURL) throws Exception
+ {
+ invoke(getDeployerName(), "redeploy", new Object[]
+ {deployURL}, new String[]
+ {"java.net.URL"});
+ }
+
+ private ObjectName getDeployerName() throws MalformedObjectNameException
+ {
+ return new ObjectName(DEPLOYER_NAME);
+ }
+
+ /**
+ * Gets the Server attribute of the JBossTestCase object
+ *
+ * @return The Server value
+ * @throws Exception for any error
+ */
+ protected MBeanServerConnection getServer() throws Exception
+ {
+ if (server == null)
+ {
+ String adaptorName = System.getProperty("jbosstest.server.name", "jmx/invoker/RMIAdaptor");
+ server = (MBeanServerConnection) new InitialContext().lookup(adaptorName);
+ }
+ return server;
+ }
+
+ public void undeploy(URL deployURL) throws Exception
+ {
+
+ Object[] args =
+ {deployURL};
+ String[] sig =
+ {"java.net.URL"};
+ invoke(getDeployerName(), "undeploy", args, sig);
+ }
+
+ protected Context getInitialContext()
+ {
+ return this.ctx;
+ }
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/AbstractSimpleBase.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/AbstractSimpleBase.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/AbstractSimpleBase.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -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.ejb3.nointerface.integration.test.common;
+
+/**
+ * AbstractSimpleBase
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public abstract class AbstractSimpleBase
+{
+
+ public String echo(String msg)
+ {
+ return msg;
+ }
+
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/ChildBean.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/ChildBean.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/ChildBean.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -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.ejb3.nointerface.integration.test.common;
+
+import javax.ejb.Stateless;
+
+
+/**
+ * ChildBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateless
+public class ChildBean extends AbstractSimpleBase
+{
+
+ public static final String JNDI_NAME = ChildBean.class.getSimpleName() + "/no-interface";
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/CounterNoInterfaceSFSBean.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/CounterNoInterfaceSFSBean.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/CounterNoInterfaceSFSBean.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -0,0 +1,49 @@
+/*
+* 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.common;
+
+import javax.ejb.Stateful;
+
+/**
+ * CounterNoInterfaceBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateful
+public class CounterNoInterfaceSFSBean
+{
+
+ public static final String JNDI_NAME = CounterNoInterfaceSFSBean.class.getSimpleName() + "/no-interface";
+
+ private int count = 0;
+
+ public void incrementCount()
+ {
+ this.count++;
+ }
+
+ public int getCount()
+ {
+ return this.count;
+ }
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSFSBRemote.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSFSBRemote.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSFSBRemote.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -0,0 +1,36 @@
+/*
+* 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.common;
+
+/**
+ * DelegatingSFSBRemote
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface DelegatingSFSBRemote
+{
+
+ void incrementCount();
+
+ int getCount();
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSFSBean.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSFSBean.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSFSBean.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -0,0 +1,70 @@
+/*
+* 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.common;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+/**
+ * DelegatingSFSBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateful
+ at Remote (DelegatingSFSBRemote.class)
+public class DelegatingSFSBean implements DelegatingSFSBRemote
+{
+
+ private CounterNoInterfaceSFSBean counterTrackingBean;
+
+ @PostConstruct
+ public void onConstruct() throws Exception
+ {
+ Context ctx = new InitialContext();
+ this.counterTrackingBean = (CounterNoInterfaceSFSBean) ctx.lookup(CounterNoInterfaceSFSBean.JNDI_NAME);
+ }
+
+ /**
+ * @see org.jboss.ejb3.nointerface.integration.test.common.DelegatingSFSBRemote#getCount()
+ */
+ @Override
+ public int getCount()
+ {
+ return this.counterTrackingBean.getCount();
+ }
+
+ /**
+ * @see org.jboss.ejb3.nointerface.integration.test.common.DelegatingSFSBRemote#incrementCount()
+ */
+ @Override
+ public void incrementCount()
+ {
+ this.counterTrackingBean.incrementCount();
+
+ }
+
+
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSLSBRemote.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSLSBRemote.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSLSBRemote.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -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.common;
+
+/**
+ * DelegatingBeanRemote
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface DelegatingSLSBRemote
+{
+
+ String echoFromSimpleNoInterfaceBean(String msg);
+
+ String echoFromBeanMarkedWithLocalBean(String msg);
+
+ String echoFromNoInterfaceBeanWithInheritance(String msg);
+
+
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSLSBean.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSLSBean.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/DelegatingSLSBean.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -0,0 +1,100 @@
+/*
+* 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.common;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+/**
+ * DelegatingBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(DelegatingSLSBRemote.class)
+public class DelegatingSLSBean implements DelegatingSLSBRemote
+{
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.nointerface.integration.test.deployment.DelegatingSLSBRemote#echoFromBeanMarkedWithLocalBean(java.lang.String)
+ */
+ @Override
+ public String echoFromBeanMarkedWithLocalBean(String msg)
+ {
+ // lookup nointerface bean
+ Context ctx;
+ try
+ {
+ ctx = new InitialContext();
+ SLSBMarkedWithLocalBean bean = (SLSBMarkedWithLocalBean) ctx.lookup(SLSBMarkedWithLocalBean.JNDI_NAME);
+ return bean.echo(msg);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.nointerface.integration.test.deployment.DelegatingSLSBRemote#echoFromNoInterfaceBeanWithInheritance(java.lang.String)
+ */
+ @Override
+ public String echoFromNoInterfaceBeanWithInheritance(String msg)
+ {
+ // lookup nointerface bean
+ Context ctx;
+ try
+ {
+ ctx = new InitialContext();
+ SLSBMarkedWithLocalBean bean = (SLSBMarkedWithLocalBean) ctx.lookup(ChildBean.JNDI_NAME);
+ return bean.echo(msg);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ejb3.nointerface.integration.test.deployment.DelegatingSLSBRemote#echoFromSimpleNoInterfaceBean(java.lang.String)
+ */
+ @Override
+ public String echoFromSimpleNoInterfaceBean(String msg)
+ {
+ // lookup nointerface bean
+ Context ctx;
+ try
+ {
+ ctx = new InitialContext();
+ SimpleNoInterfaceSLSBean bean = (SimpleNoInterfaceSLSBean) ctx.lookup(SimpleNoInterfaceSLSBean.JNDI_NAME);
+ return bean.echo(msg);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/Echo.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/Echo.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/Echo.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -0,0 +1,33 @@
+/*
+* 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.common;
+
+/**
+ * Echo
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface Echo
+{
+ String echo(String msg);
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/SLSBMarkedWithLocalBean.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/SLSBMarkedWithLocalBean.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/SLSBMarkedWithLocalBean.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -0,0 +1,52 @@
+/*
+* 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.common;
+
+import javax.ejb.LocalBean;
+import javax.ejb.Stateless;
+
+/**
+ * SLSBMarkedWithLocalBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateless
+ at LocalBean
+public class SLSBMarkedWithLocalBean implements Echo
+{
+
+ /**
+ * JNDI name
+ */
+ public static final String JNDI_NAME = SLSBMarkedWithLocalBean.class.getSimpleName() + "/no-interface";
+
+ /**
+ * @see org.jboss.ejb3.nointerface.integration.test.common.Echo#echo(java.lang.String)
+ */
+ @Override
+ public String echo(String msg)
+ {
+ return msg;
+ }
+
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/SimpleNoInterfaceSFSB.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/SimpleNoInterfaceSFSB.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/SimpleNoInterfaceSFSB.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -0,0 +1,49 @@
+/*
+* 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.common;
+
+import javax.ejb.Stateful;
+
+/**
+ * SimpleNoInterfaceSFSB
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateful
+public class SimpleNoInterfaceSFSB
+{
+
+ public static final String JNDI_NAME = SimpleNoInterfaceSFSB.class.getSimpleName() + "/no-interface";
+
+ private int state;
+
+ int getState()
+ {
+ return this.state;
+ }
+
+ void setState(int state)
+ {
+ this.state = state;
+ }
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/SimpleNoInterfaceSLSBean.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/SimpleNoInterfaceSLSBean.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/common/SimpleNoInterfaceSLSBean.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -0,0 +1,42 @@
+/*
+* 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.common;
+
+import javax.ejb.Stateless;
+
+/**
+ * SimpleNoInterfaceBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateless
+public class SimpleNoInterfaceSLSBean
+{
+
+ public static final String JNDI_NAME = SimpleNoInterfaceSLSBean.class.getSimpleName() + "/no-interface";
+
+ public String echo(String msg)
+ {
+ return msg;
+ }
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/deployment/unit/SimpleNoInterfaceDeploymentTestCase.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/deployment/unit/SimpleNoInterfaceDeploymentTestCase.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/deployment/unit/SimpleNoInterfaceDeploymentTestCase.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -0,0 +1,122 @@
+/*
+* 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.deployment.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.common.DelegatingSFSBRemote;
+import org.jboss.ejb3.nointerface.integration.test.common.DelegatingSFSBean;
+import org.jboss.ejb3.nointerface.integration.test.common.DelegatingSLSBRemote;
+import org.jboss.ejb3.nointerface.integration.test.common.DelegatingSLSBean;
+import org.jboss.ejb3.nointerface.integration.test.common.SimpleNoInterfaceSLSBean;
+import org.jboss.logging.Logger;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * SimpleNoInterfaceDeploymentTestCase
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SimpleNoInterfaceDeploymentTestCase extends AbstractNoInterfaceTestCase
+{
+
+ /**
+ * Logger
+ */
+ private static Logger logger = Logger.getLogger(SimpleNoInterfaceDeploymentTestCase.class);
+
+ private URL deployment;
+
+ /**
+ *
+ * @return
+ * @throws Exception
+ */
+ @Before
+ public void before() throws Exception
+ {
+ String jarName = "simple-nointerface-beans.jar";
+ deployment = buildSimpleJar(jarName, SimpleNoInterfaceSLSBean.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
+ {
+ DelegatingSLSBRemote delegateBean = (DelegatingSLSBRemote) this.getInitialContext().lookup(
+ DelegatingSLSBean.class.getSimpleName() + "/remote");
+ String msg = "Some message!";
+ assertEquals("Unexpected message returned by bean", msg, delegateBean.echoFromSimpleNoInterfaceBean(msg));
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testNoInterfaceSFSBAccess() throws Exception
+ {
+ DelegatingSFSBRemote delegateSFSBean = (DelegatingSFSBRemote) this.getInitialContext().lookup(
+ DelegatingSFSBean.class.getSimpleName() + "/remote");
+
+ assertEquals("Initial count returned by the bean isn't zero", 0, delegateSFSBean.getCount());
+ // increment once
+ delegateSFSBean.incrementCount();
+ assertEquals("Bean returned unexpected count", 1, delegateSFSBean.getCount());
+ int prevCount = delegateSFSBean.getCount();
+ // increment n number of times
+ final int NUM_TIMES = 8;
+ for (int i = 0; i < NUM_TIMES; i++)
+ {
+ delegateSFSBean.incrementCount();
+ }
+ assertEquals("Bean returned unexpected count", prevCount + NUM_TIMES, delegateSFSBean.getCount());
+ }
+
+ @Test
+ public void testLocalBeanWithInterfaces() throws Exception
+ {
+ DelegatingSLSBRemote delegateBean = (DelegatingSLSBRemote) this.getInitialContext().lookup(
+ DelegatingSLSBean.class.getSimpleName() + "/remote");
+ String msg = "Some other message!";
+ assertEquals("Unexpected message returned by bean", msg, delegateBean.echoFromBeanMarkedWithLocalBean(msg));
+ }
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/equality/EqualityCheckerBean.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/equality/EqualityCheckerBean.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/equality/EqualityCheckerBean.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -0,0 +1,102 @@
+/*
+* 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.equality;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+/**
+ * EqualityCheckerBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote (EqualityCheckerBeanRemote.class)
+public class EqualityCheckerBean implements EqualityCheckerBeanRemote
+{
+
+ private Context ctx;
+
+ @PostConstruct
+ public void onConstruct() throws Exception
+ {
+ this.ctx = new InitialContext();
+ }
+
+ /**
+ * @see org.jboss.ejb3.nointerface.integration.test.equality.EqualityCheckerBeanRemote#checkEqualityOnDifferentJndiObjects(java.lang.String, java.lang.String)
+ */
+ @Override
+ public boolean checkEqualityOnDifferentJndiObjects(String beanOneJndiName, String beanTwoJndiName)
+ {
+ try
+ {
+ Object beanOne = this.ctx.lookup(beanOneJndiName);
+ Object beanTwo = this.ctx.lookup(beanTwoJndiName);
+ return beanOne.equals(beanTwo);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * @see org.jboss.ejb3.nointerface.integration.test.equality.EqualityCheckerBeanRemote#checkEqualityOnMultipleInstances(java.lang.String)
+ */
+ @Override
+ public boolean checkEqualityOnMultipleInstances(String jndiName)
+ {
+ try
+ {
+ Object instanceOne = this.ctx.lookup(jndiName);
+ Object instanceTwo = this.ctx.lookup(jndiName);
+ return instanceOne.equals(instanceTwo);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * @see org.jboss.ejb3.nointerface.integration.test.equality.EqualityCheckerBeanRemote#checkEqualityOnSameInstance(java.lang.String)
+ */
+ @Override
+ public boolean checkEqualityOnSameInstance(String jndiName)
+ {
+ try
+ {
+ Object instanceOne = this.ctx.lookup(jndiName);
+ return instanceOne.equals(instanceOne);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/equality/EqualityCheckerBeanRemote.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/equality/EqualityCheckerBeanRemote.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/equality/EqualityCheckerBeanRemote.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -0,0 +1,39 @@
+/*
+* 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.equality;
+
+/**
+ * DelegateSLSBRemote
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface EqualityCheckerBeanRemote
+{
+
+ boolean checkEqualityOnSameInstance(String jndiName);
+
+ boolean checkEqualityOnMultipleInstances(String jndiName);
+
+ boolean checkEqualityOnDifferentJndiObjects(String beanOneJndiName, String beanTwoJndiName);
+
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/equality/unit/NoInterfaceBeanEqualityTestCase.java
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/equality/unit/NoInterfaceBeanEqualityTestCase.java (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/java/org/jboss/ejb3/nointerface/integration/test/equality/unit/NoInterfaceBeanEqualityTestCase.java 2009-12-01 12:18:10 UTC (rev 97222)
@@ -0,0 +1,135 @@
+/*
+* 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.equality.unit;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.ejb3.nointerface.integration.test.AbstractNoInterfaceTestCase;
+import org.jboss.ejb3.nointerface.integration.test.common.ChildBean;
+import org.jboss.ejb3.nointerface.integration.test.common.CounterNoInterfaceSFSBean;
+import org.jboss.ejb3.nointerface.integration.test.common.SLSBMarkedWithLocalBean;
+import org.jboss.ejb3.nointerface.integration.test.common.SimpleNoInterfaceSFSB;
+import org.jboss.ejb3.nointerface.integration.test.common.SimpleNoInterfaceSLSBean;
+import org.jboss.ejb3.nointerface.integration.test.equality.EqualityCheckerBean;
+import org.jboss.ejb3.nointerface.integration.test.equality.EqualityCheckerBeanRemote;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * EqualityTestCase
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class NoInterfaceBeanEqualityTestCase 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 = "nointerface-bean-equality.jar";
+ deployment = buildSimpleJar(jarName, SimpleNoInterfaceSLSBean.class.getPackage(), EqualityCheckerBeanRemote.class
+ .getPackage());
+ this.redeploy(deployment);
+ }
+
+ @After
+ public void after() throws Exception
+ {
+ if (this.deployment != null)
+ {
+ this.undeploy(deployment);
+ }
+ }
+
+ @Test
+ public void testNoInterfaceSLSBEquality() throws Exception
+ {
+ EqualityCheckerBeanRemote delegateBean = (EqualityCheckerBeanRemote) this.getInitialContext().lookup(
+ EqualityCheckerBean.class.getSimpleName() + "/remote");
+
+ boolean areDifferentNoInterfaceSLSBEqual = delegateBean.checkEqualityOnDifferentJndiObjects(
+ SimpleNoInterfaceSLSBean.JNDI_NAME, SLSBMarkedWithLocalBean.JNDI_NAME);
+ assertFalse("Different nointerface SLSB type were considered equal", areDifferentNoInterfaceSLSBEqual);
+
+ boolean areMultipleInstancesOfSameNoInterfaceSLSBEqual = delegateBean
+ .checkEqualityOnMultipleInstances(ChildBean.JNDI_NAME);
+ assertTrue("Multiple instances of same nointerface SLSB type were *not* considered equal ",
+ areMultipleInstancesOfSameNoInterfaceSLSBEqual);
+
+ boolean isSameInstanceOfNoInterfaceSLSBEqual = delegateBean
+ .checkEqualityOnSameInstance(SimpleNoInterfaceSLSBean.JNDI_NAME);
+ assertTrue("Same instance of a nointerface SLSB was *not* considered equal to itself ",
+ isSameInstanceOfNoInterfaceSLSBEqual);
+
+ }
+
+ @Test
+ public void testNoInterfaceSFSBEquality() throws Exception
+ {
+ EqualityCheckerBeanRemote delegateBean = (EqualityCheckerBeanRemote) this.getInitialContext().lookup(
+ EqualityCheckerBean.class.getSimpleName() + "/remote");
+
+ boolean areDifferentNoInterfaceSFSBEqual = delegateBean.checkEqualityOnDifferentJndiObjects(
+ SimpleNoInterfaceSFSB.JNDI_NAME, CounterNoInterfaceSFSBean.JNDI_NAME);
+ assertFalse("Different nointerface SFSB type were considered equal", areDifferentNoInterfaceSFSBEqual);
+
+ boolean areMultipleInstancesOfSameNoInterfaceSFSBEqual = delegateBean
+ .checkEqualityOnMultipleInstances(CounterNoInterfaceSFSBean.JNDI_NAME);
+ assertFalse("Multiple instances of same nointerface SFSB type were considered equal ",
+ areMultipleInstancesOfSameNoInterfaceSFSBEqual);
+
+ boolean isSameInstanceOfNoInterfaceSFSBEqual = delegateBean
+ .checkEqualityOnSameInstance(SimpleNoInterfaceSFSB.JNDI_NAME);
+ assertTrue("Same instance of a nointerface SFSB was *not* considered equal to itself ",
+ isSameInstanceOfNoInterfaceSFSBEqual);
+
+ }
+
+
+ @Test
+ public void testNoInterfaceEqualityBetweenSFSBAndSLSB() throws Exception
+ {
+
+ EqualityCheckerBeanRemote delegateBean = (EqualityCheckerBeanRemote) this.getInitialContext().lookup(
+ EqualityCheckerBean.class.getSimpleName() + "/remote");
+
+ boolean isSFSBEqualToSLSB = delegateBean.checkEqualityOnDifferentJndiObjects(SimpleNoInterfaceSLSBean.JNDI_NAME,
+ SimpleNoInterfaceSFSB.JNDI_NAME);
+ assertFalse("An instance of a nointerface SFSB was considered equal to an instance of nointerface SLSB bean",
+ isSFSBEqualToSLSB);
+ }
+}
Added: projects/ejb3/trunk/nointerface/testsuite/src/test/resources/jndi.properties
===================================================================
--- projects/ejb3/trunk/nointerface/testsuite/src/test/resources/jndi.properties (rev 0)
+++ projects/ejb3/trunk/nointerface/testsuite/src/test/resources/jndi.properties 2009-12-01 12:18:10 UTC (rev 97222)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=jnp://localhost:1099
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list