Merge pull request #23375 from arjantijms/23371_weld_default_package
23371 weld default package
diff --git a/appserver/tests/appserv-tests/devtests/cdi/implicit/build.xml b/appserver/tests/appserv-tests/devtests/cdi/implicit/build.xml
index 8860d2f..10bd76e 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/implicit/build.xml
+++ b/appserver/tests/appserv-tests/devtests/cdi/implicit/build.xml
@@ -31,78 +31,77 @@
&commonRun;
&reporting;
- <property name="implicit-target" value="all"/>
+ <property name="implicit-target" value="all" />
- <taskdef resource="net/sf/antcontrib/antcontrib.properties">
- <classpath>
- <pathelement location="${env.APS_HOME}/devtests/cdi/lib/ant-contrib-1.0b3.jar"/>
- </classpath>
- </taskdef>
+ <taskdef resource="net/sf/antcontrib/antcontrib.properties">
+ <classpath>
+ <pathelement location="${env.APS_HOME}/devtests/cdi/lib/ant-contrib-1.0b3.jar" />
+ </classpath>
+ </taskdef>
- <target name="run-test">
- <antcall target="implicit">
- <param name="implicit-target" value="run-test"/>
- </antcall>
- </target>
+ <target name="run-test">
+ <antcall target="implicit">
+ <param name="implicit-target" value="run-test" />
+ </antcall>
+ </target>
- <target name="all">
- <antcall target="implicit">
- <param name="implicit-target" value="all"/>
- </antcall>
- </target>
+ <target name="all">
+ <antcall target="implicit">
+ <param name="implicit-target" value="all" />
+ </antcall>
+ </target>
- <target name="clean">
- <antcall target="implicit">
- <param name="implicit-target" value="clean"/>
- </antcall>
- </target>
+ <target name="clean">
+ <antcall target="implicit">
+ <param name="implicit-target" value="clean" />
+ </antcall>
+ </target>
- <target name="build">
- <antcall target="implicit">
- <param name="implicit-target" value="build"/>
- </antcall>
- </target>
+ <target name="build">
+ <antcall target="implicit">
+ <param name="implicit-target" value="build" />
+ </antcall>
+ </target>
- <target name="setup">
- <antcall target="implicit">
- <param name="implicit-target" value="setup"/>
- </antcall>
- </target>
+ <target name="setup">
+ <antcall target="implicit">
+ <param name="implicit-target" value="setup" />
+ </antcall>
+ </target>
- <target name="deploy">
- <antcall target="implicit">
- <param name="implicit-target" value="deploy"/>
- </antcall>
- </target>
+ <target name="deploy">
+ <antcall target="implicit">
+ <param name="implicit-target" value="deploy" />
+ </antcall>
+ </target>
- <target name="undeploy">
- <antcall target="implicit">
- <param name="implicit-target" value="undeploy"/>
- </antcall>
- </target>
+ <target name="undeploy">
+ <antcall target="implicit">
+ <param name="implicit-target" value="undeploy" />
+ </antcall>
+ </target>
- <target name="unsetup">
- <antcall target="implicit">
- <param name="implicit-target" value="unsetup"/>
- </antcall>
- </target>
+ <target name="unsetup">
+ <antcall target="implicit">
+ <param name="implicit-target" value="unsetup" />
+ </antcall>
+ </target>
- <target name="run">
- <antcall target="implicit">
- <param name="implicit-target" value="run"/>
- </antcall>
- </target>
+ <target name="run">
+ <antcall target="implicit">
+ <param name="implicit-target" value="run" />
+ </antcall>
+ </target>
- <target name="implicit">
- <record name="implicit.output" action="start" />
- <ant dir="simple-ejb-cdi" target="${implicit-target}"/>
- <ant dir="deployment-option" target="${implicit-target}"/>
- <!--ant dir="bean-discovery-mode-none" target="${implicit-target}"/-->
- <record name="implicit.output" action="stop" />
- </target>
+ <target name="implicit">
+ <record name="implicit.output" action="start" />
+ <ant dir="simple-ejb-cdi" target="${implicit-target}" />
+ <ant dir="deployment-option" target="${implicit-target}" />
+ <record name="implicit.output" action="stop" />
+ </target>
- <target name="usage">
- <echo> Usage:
+ <target name="usage">
+ <echo> Usage:
ant all (Executes all the smoke tests)
ant clean (cleans all the smoke tests)
ant build (builds all the smoke tests)
@@ -112,5 +111,5 @@
ant undeploy (undeploys all the smoke apps)
ant unsetup (unsets all resources for smoke tests)
</echo>
- </target>
+ </target>
</project>
diff --git a/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/build.xml b/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/build.xml
index 2b950fc..3f84529 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/build.xml
+++ b/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/build.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
- Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2010, 2021 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
@@ -18,9 +18,9 @@
-->
<!DOCTYPE project [
-<!ENTITY commonSetup SYSTEM "./../../../../config/properties.xml">
-<!ENTITY commonBuild SYSTEM "./../../../../config/common.xml">
-<!ENTITY testproperties SYSTEM "./build.properties">
+ <!ENTITY commonSetup SYSTEM "./../../../../config/properties.xml">
+ <!ENTITY commonBuild SYSTEM "./../../../../config/common.xml">
+ <!ENTITY testproperties SYSTEM "./build.properties">
]>
<project name="simple-ejb-cdi" default="usage" basedir=".">
@@ -31,45 +31,43 @@
<target name="all" depends="build,deploy,run,undeploy"/>
- <target name="clean" depends="init-common">
- <antcall target="clean-common"/>
- <delete file="client/Client.java"/>
- </target>
+ <target name="clean" depends="init-common">
+ <antcall target="clean-common"/>
+ <delete file="client/Client.java"/>
+ </target>
- <target name="compile" depends="clean">
- <copy file="client/Client.java.token" tofile="client/Client.java"/>
- <replace file="client/Client.java" token="@ORB_PORT@" value="${orb.port}"/>
+ <target name="compile" depends="clean">
+ <copy file="client/Client.java.token" tofile="client/Client.java"/>
+ <replace file="client/Client.java" token="@ORB_PORT@" value="${orb.port}"/>
- <antcall target="compile-common">
- <param name="src" value="ejb"/>
- </antcall>
- <antcall target="compile-common">
- <param name="src" value="client"/>
- </antcall>
- </target>
+ <antcall target="compile-common">
+ <param name="src" value="ejb"/>
+ </antcall>
+ <antcall target="compile-common">
+ <param name="src" value="client"/>
+ </antcall>
+ </target>
- <target name="build" depends="compile">
- <antcall target="build-ear-common">
- <param name="ejbjar.classes"
- value="**/Sless*.class, **/ImplicitTestBean.class"/>
- <param name="appclientjar.classes"
- value="**/Client.class,**/Sless.class"/>
- </antcall>
- </target>
+ <target name="build" depends="compile">
+ <antcall target="build-ear-common">
+ <param name="ejbjar.classes" value="**/Sless*.class, **/Foo*.class, **/ImplicitTestBean.class"/>
+ <param name="appclientjar.classes" value="**/Client.class, **/Foo*.class, **/Sless.class"/>
+ </antcall>
+ </target>
- <target name="deploy" depends="init-common">
- <antcall target="deploy-common"/>
- </target>
+ <target name="deploy" depends="init-common">
+ <antcall target="deploy-common"/>
+ </target>
- <target name="run" depends="init-common">
- <antcall target="runclient-common"/>
- </target>
+ <target name="run" depends="init-common">
+ <antcall target="runclient-common"/>
+ </target>
- <target name="undeploy" depends="init-common">
- <antcall target="undeploy-common"/>
- </target>
+ <target name="undeploy" depends="init-common">
+ <antcall target="undeploy-common"/>
+ </target>
- <target name="usage">
- <antcall target="usage-common"/>
- </target>
+ <target name="usage">
+ <antcall target="usage-common"/>
+ </target>
</project>
diff --git a/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/client/Client.java b/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/client/Client.java
index f96b043..c266aa3 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/client/Client.java
+++ b/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/client/Client.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -13,7 +13,7 @@
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
-
+import test.*;
import java.io.*;
import java.util.*;
import jakarta.ejb.EJB;
@@ -22,77 +22,72 @@
public class Client {
- private static SimpleReporterAdapter stat =
- new SimpleReporterAdapter("appserv-tests");
+ private static SimpleReporterAdapter stat = new SimpleReporterAdapter("appserv-tests");
- public static void main (String[] args) {
-
+ public static void main(String[] args) {
stat.addDescription("simple-ejb-implicit-cdi");
Client client = new Client(args);
client.doTest();
stat.printSummary("simple-ejb-implicit-cdi");
}
- public Client (String[] args) {
+ public Client(String[] args) {
}
- private static @EJB(mappedName="Sless") Sless sless;
+ @EJB(mappedName = "test.Foo#test.Foo")
+ private static Foo sless;
//
// NOTE: Token 3700 will be replaced in @EJB annotations below
// with the value of the port from config.properties during the build
//
- private static @EJB(mappedName="corbaname:iiop:localhost:3700#Sless") Sless sless2;
+ @EJB(mappedName = "corbaname:iiop:localhost:3700#test.Foo")
+ private static Foo sless2;
- private static @EJB(mappedName="corbaname:iiop:localhost:3700#java:global/simple-ejb-implicit-cdiApp/simple-ejb-implicit-cdi-ejb/SlessEJB!Sless") Sless sless3;
-
+ @EJB(mappedName = "corbaname:iiop:localhost:3700#java:global/simple-ejb-implicit-cdiApp/simple-ejb-implicit-cdi-ejb/SlessEJB!test.Foo")
+ private static Foo sless3;
public void doTest() {
try {
-
System.out.println("Creating InitialContext()");
- InitialContext ic = new InitialContext();
- org.omg.CORBA.ORB orb = (org.omg.CORBA.ORB) ic.lookup("java:comp/ORB");
- Sless sless = (Sless) ic.lookup("Sless");
+ InitialContext initialContext = new InitialContext();
+ org.omg.CORBA.ORB orb = (org.omg.CORBA.ORB) initialContext.lookup("java:comp/ORB");
+ Foo sless = (Foo) initialContext.lookup("test.Foo#test.Foo");
- String response = null;
-
- response = sless.hello();
+ String response = sless.hello();
testResponse("invoking stateless", response);
- response = sless2.hello();
+ response = sless2.hello();
testResponse("invoking stateless2", response);
System.out.println("ensuring that sless1 and sless2 are not equal");
- if( !sless.equals(sless2) ) {
- stat.addStatus("ensuring that sless1 and sless2 are not equal" , stat.FAIL);
- throw new Exception("invalid equality checks on same " +
- "sless session beans");
+ if (!sless.equals(sless2)) {
+ stat.addStatus("ensuring that sless1 and sless2 are not equal", stat.FAIL);
+ throw new Exception("invalid equality checks on same " + "sless session beans");
}
-
- response = sless3.hello();
+ response = sless3.hello();
testResponse("invoking stateless3", response);
System.out.println("test complete");
stat.addStatus("local main", stat.PASS);
- } catch(Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
- stat.addStatus("local main" , stat.FAIL);
+ stat.addStatus("local main", stat.FAIL);
}
- return;
+ return;
}
- private void testResponse(String testDescription, String response){
- if(response.equals("hello"))
+ private void testResponse(String testDescription, String response) {
+ if (response.equals("hello")) {
stat.addStatus(testDescription, stat.PASS);
- else
+ } else {
stat.addStatus(testDescription, stat.FAIL);
+ }
}
}
-
diff --git a/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/client/Client.java.token b/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/client/Client.java.token
index 8fd82c4..143a26e 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/client/Client.java.token
+++ b/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/client/Client.java.token
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -13,8 +13,7 @@
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
-
-
+import test.*;
import java.io.*;
import java.util.*;
import jakarta.ejb.EJB;
@@ -23,77 +22,72 @@
public class Client {
- private static SimpleReporterAdapter stat =
- new SimpleReporterAdapter("appserv-tests");
+ private static SimpleReporterAdapter stat = new SimpleReporterAdapter("appserv-tests");
- public static void main (String[] args) {
-
+ public static void main(String[] args) {
stat.addDescription("simple-ejb-implicit-cdi");
Client client = new Client(args);
client.doTest();
stat.printSummary("simple-ejb-implicit-cdi");
}
- public Client (String[] args) {
+ public Client(String[] args) {
}
- private static @EJB(mappedName="Sless") Sless sless;
+ @EJB(mappedName = "test.Foo#test.Foo")
+ private static Foo sless;
//
// NOTE: Token @ORB_PORT@ will be replaced in @EJB annotations below
// with the value of the port from config.properties during the build
//
- private static @EJB(mappedName="corbaname:iiop:localhost:@ORB_PORT@#Sless") Sless sless2;
+ @EJB(mappedName = "corbaname:iiop:localhost:@ORB_PORT@#test.Foo")
+ private static Foo sless2;
- private static @EJB(mappedName="corbaname:iiop:localhost:@ORB_PORT@#java:global/simple-ejb-implicit-cdiApp/simple-ejb-implicit-cdi-ejb/SlessEJB!Sless") Sless sless3;
-
+ @EJB(mappedName = "corbaname:iiop:localhost:@ORB_PORT@#java:global/simple-ejb-implicit-cdiApp/simple-ejb-implicit-cdi-ejb/SlessEJB!test.Foo")
+ private static Foo sless3;
public void doTest() {
try {
-
System.out.println("Creating InitialContext()");
- InitialContext ic = new InitialContext();
- org.omg.CORBA.ORB orb = (org.omg.CORBA.ORB) ic.lookup("java:comp/ORB");
- Sless sless = (Sless) ic.lookup("Sless");
+ InitialContext initialContext = new InitialContext();
+ org.omg.CORBA.ORB orb = (org.omg.CORBA.ORB) initialContext.lookup("java:comp/ORB");
+ Foo sless = (Foo) initialContext.lookup("test.Foo#test.Foo");
- String response = null;
-
- response = sless.hello();
+ String response = sless.hello();
testResponse("invoking stateless", response);
- response = sless2.hello();
+ response = sless2.hello();
testResponse("invoking stateless2", response);
System.out.println("ensuring that sless1 and sless2 are not equal");
- if( !sless.equals(sless2) ) {
- stat.addStatus("ensuring that sless1 and sless2 are not equal" , stat.FAIL);
- throw new Exception("invalid equality checks on same " +
- "sless session beans");
+ if (!sless.equals(sless2)) {
+ stat.addStatus("ensuring that sless1 and sless2 are not equal", stat.FAIL);
+ throw new Exception("invalid equality checks on same " + "sless session beans");
}
-
- response = sless3.hello();
+ response = sless3.hello();
testResponse("invoking stateless3", response);
System.out.println("test complete");
stat.addStatus("local main", stat.PASS);
- } catch(Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
- stat.addStatus("local main" , stat.FAIL);
+ stat.addStatus("local main", stat.FAIL);
}
- return;
+ return;
}
- private void testResponse(String testDescription, String response){
- if(response.equals("hello"))
+ private void testResponse(String testDescription, String response) {
+ if (response.equals("hello")) {
stat.addStatus(testDescription, stat.PASS);
- else
+ } else {
stat.addStatus(testDescription, stat.FAIL);
+ }
}
}
-
diff --git a/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/Sless.java b/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/test/Foo.java
similarity index 84%
rename from appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/Sless.java
rename to appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/test/Foo.java
index be2b008..5fccb85 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/Sless.java
+++ b/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/test/Foo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -13,10 +13,11 @@
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
+package test;
import jakarta.ejb.Remote;
@Remote
-public interface Sless {
- public String hello();
+public interface Foo {
+ String hello();
}
diff --git a/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/ImplicitTestBean.java b/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/test/ImplicitTestBean.java
similarity index 97%
rename from appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/ImplicitTestBean.java
rename to appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/test/ImplicitTestBean.java
index f337062..7fb9a74 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/ImplicitTestBean.java
+++ b/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/test/ImplicitTestBean.java
@@ -14,6 +14,8 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
+package test;
+
import jakarta.enterprise.context.RequestScoped;
//Simple TestBean to test CDI.
diff --git a/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/SlessEJB.java b/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/test/SlessEJB.java
similarity index 77%
rename from appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/SlessEJB.java
rename to appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/test/SlessEJB.java
index 7d598f4..a00c717 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/SlessEJB.java
+++ b/appserver/tests/appserv-tests/devtests/cdi/implicit/simple-ejb-cdi/ejb/test/SlessEJB.java
@@ -14,19 +14,27 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
+package test;
+
import jakarta.ejb.Stateless;
import jakarta.inject.Inject;
+import test.ImplicitTestBean;
+
@Stateless
-public class SlessEJB implements Sless {
+public class SlessEJB implements Foo {
- @Inject ImplicitTestBean tb; //Field Injection
+ @Inject
+ ImplicitTestBean testBean; // Field Injection
public String hello() {
System.out.println("In SlessEJB:hello()");
- if (tb != null) return "hello";
- else return null;
+ if (testBean != null) {
+ return "hello";
+ }
+
+ return null;
}
}
diff --git a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/client/Client.java b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/client/Client.java
new file mode 100644
index 0000000..76ed354
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/client/Client.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2008, 2020 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package com.sun.s1asdev.cdi.ejb.hello.session.client;
+
+import java.io.*;
+import java.util.*;
+import jakarta.ejb.EJB;
+import javax.naming.InitialContext;
+import com.sun.s1asdev.cdi.ejb.hello.session.*;
+import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
+
+public class Client {
+
+ private static SimpleReporterAdapter stat = new SimpleReporterAdapter("appserv-tests");
+
+ public static void main(String[] args) {
+ stat.addDescription("simple-ejb-cdi");
+ Client client = new Client(args);
+ client.doTest();
+ stat.printSummary("simple-ejb-cdi");
+ }
+
+ public Client(String[] args) {
+ }
+
+ private static @EJB Sful sful;
+
+ private static @EJB(mappedName = "com.sun.s1asdev.cdi.ejb.hello.session.Sless") Sless sless;
+
+ //
+ // NOTE: Token 3700 will be replaced in @EJB annotations below
+ // with the value of the port from config.properties during the build
+ //
+ private static @EJB(mappedName = "corbaname:iiop:localhost:3700#com.sun.s1asdev.cdi.ejb.hello.session.Sless") Sless sless2;
+
+ private static @EJB(mappedName = "corbaname:iiop:localhost:3700#java:global/simple-ejb-cdiApp/simple-ejb-cdi-ejb/SlessEJB!com.sun.s1asdev.cdi.ejb.hello.session.Sless") Sless sless3;
+
+ private static @EJB(mappedName = "corbaname:iiop:localhost:3700#java:global/simple-ejb-cdiApp/simple-ejb-cdi-ejb/SlessEJB") Sless sless4;
+
+ public void doTest() {
+
+ try {
+
+ System.out.println("Creating InitialContext()");
+ InitialContext ic = new InitialContext();
+ org.omg.CORBA.ORB orb = (org.omg.CORBA.ORB) ic.lookup("java:comp/ORB");
+ Sful sful = (Sful) ic.lookup("com.sun.s1asdev.cdi.ejb.hello.session.Sful");
+ Sless sless = (Sless) ic.lookup("com.sun.s1asdev.cdi.ejb.hello.session.Sless");
+
+ String response = null;
+
+ response = sful.hello();
+ testResponse("invoking stateful", response);
+
+ response = sless.hello();
+ testResponse("invoking stateless", response);
+
+ response = sless2.hello();
+ testResponse("invoking stateless2", response);
+
+ System.out.println("ensuring that sless1 and sless2 are not equal");
+ if (!sless.equals(sless2)) {
+ stat.addStatus("ensuring that sless1 and sless2 are not equal", stat.FAIL);
+ throw new Exception("invalid equality checks on same " + "sless session beans");
+ }
+
+ response = sless3.hello();
+ testResponse("invoking stateless3", response);
+ response = sless4.hello();
+ testResponse("invoking stateless4", response);
+
+ System.out.println("test complete");
+
+ stat.addStatus("local main", stat.PASS);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ stat.addStatus("local main", stat.FAIL);
+ }
+
+ return;
+ }
+
+ private void testResponse(String testDescription, String response) {
+ if (response.equals("hello"))
+ stat.addStatus(testDescription, stat.PASS);
+ else
+ stat.addStatus(testDescription, stat.FAIL);
+ }
+
+}