Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save scottmarlow/03e5332e37bf3e9b97b18b72f34a048c to your computer and use it in GitHub Desktop.
Save scottmarlow/03e5332e37bf3e9b97b18b72f34a048c to your computer and use it in GitHub Desktop.
[INFO] Running tck.conversion.rewrite.AddArqDeploymentTest
looking for existing copy of jakarta-jakartaeetck-10.0.2.zip in folder /tmp/legacytck
looking for existing extracted jakarta-jakartaeetck-10.0.2.zip in folder /tmp/legacytck
already downloaded jakarta-jakartaeetck-10.0.2.zip
Locate the TCK archive that contains the test for package com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics
locateTargetPackageFolder will look inside of jakartaeetck for findTCKDistArchive = argsemantics
looking inside of argsemantics for the archive that contains a test client for package com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.843 s <<< FAILURE! -- in tck.conversion.rewrite.AddArqDeploymentTest
[ERROR] tck.conversion.rewrite.AddArqDeploymentTest.addDeploymentMethod -- Time elapsed: 1.831 s <<< ERROR!
java.lang.IllegalStateException:
AST contains missing or invalid type information
MethodInvocation->Block->MethodDeclaration->Block->ClassDeclaration->CompilationUnit
/*~~(MethodInvocation type is missing or malformed)~~>*/ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20Callee.class)
MethodInvocation->Block->MethodDeclaration->Block->ClassDeclaration->CompilationUnit
/*~~(MethodInvocation type is missing or malformed)~~>*/ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeEJB.class)
MethodInvocation->Block->MethodDeclaration->Block->ClassDeclaration->CompilationUnit
/*~~(MethodInvocation type is missing or malformed)~~>*/ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeHome.class)
MethodInvocation->Block->MethodDeclaration->Block->ClassDeclaration->CompilationUnit
/*~~(MethodInvocation type is missing or malformed)~~>*/ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeLocal.class)
MethodInvocation->Block->MethodDeclaration->Block->ClassDeclaration->CompilationUnit
/*~~(MethodInvocation type is missing or malformed)~~>*/ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeLocalHome.class)
MethodInvocation->Block->MethodDeclaration->Block->ClassDeclaration->CompilationUnit
/*~~(MethodInvocation type is missing or malformed)~~>*/ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.CMP20Wrapper.class)
at org.openrewrite.java.Assertions.assertValidTypes(Assertions.java:92)
at org.openrewrite.java.Assertions.validateTypes(Assertions.java:62)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:466)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:132)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:127)
at tck.conversion.rewrite.AddArqDeploymentTest.addDeploymentMethod(AddArqDeploymentTest.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
[INFO] Running tck.conversion.rewrite.ConvertTestNameTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.802 s -- in tck.conversion.rewrite.ConvertTestNameTest
[INFO] Running tck.conversion.rewrite.JavaTestToArqTest
Locate the TCK archive that contains the test for package com.sun.ts.tests.assembly.altDD
locateTargetPackageFolder will look inside of jakartaeetck for findTCKDistArchive = altDD
looking inside of altDD for the archive that contains a test client for package com.sun.ts.tests.assembly.altDD
Locate the TCK archive that contains the test for package com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics
locateTargetPackageFolder will look inside of jakartaeetck for findTCKDistArchive = argsemantics
looking inside of argsemantics for the archive that contains a test client for package com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics
[ERROR] Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 1.010 s <<< FAILURE! -- in tck.conversion.rewrite.JavaTestToArqTest
[ERROR] tck.conversion.rewrite.JavaTestToArqTest.testAppClientEar -- Time elapsed: 0.524 s <<< FAILURE!
org.opentest4j.AssertionFailedError:
[Unexpected result in "Client.java":
diff --git a/Client.java b/Client.java
index f07f2f5..18a816c 100644
--- a/Client.java
+++ b/Client.java
@@ -28,11 +28,13 @@
JavaArchive assembly_altDD_client_jar = ShrinkWrap.create(JavaArchive.class, "assembly_altDD_client_jar");
assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.Client.class);
assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBean.class);
+ assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBeanHome.class);
ear.addAsModule(assembly_altDD_client_jar);
JavaArchive assembly_altDD_ejb_jar = ShrinkWrap.create(JavaArchive.class, "assembly_altDD_ejb_jar");
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBean.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBeanEJB.class);
+ assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBeanHome.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.util.shared.ejbref.common.ReferencedBeanCode.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatelessWrapper.class);
ear.addAsModule(assembly_altDD_ejb_jar);
@@ -200,7 +202,6 @@
logErr("[Client] Caught exception: " + e);
throw new Fault("Alternative DD test failed!" + e, e);
}
-
}
public void cleanup() {
]
expected:
"// package com.sun.ts.tests.assembly.altDD;
package com.sun.ts.tests.assembly.altDD;
import java.util.Properties;
import com.sun.javatest.Status;
import com.sun.ts.lib.harness.EETest;
import com.sun.ts.lib.util.TSNamingContext;
import com.sun.ts.lib.util.TestUtil;
import com.sun.ts.tests.assembly.altDD.PainterBean;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@Disabled
public class Client extends EETest {
@Deployment(testable = false)
public static Archive<?> deployment() {
final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "assembly_altDD.ear");
// Add ear submodules
JavaArchive assembly_altDD_client_jar = ShrinkWrap.create(JavaArchive.class, "assembly_altDD_client_jar");
assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.Client.class);
assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBean.class);
ear.addAsModule(assembly_altDD_client_jar);
JavaArchive assembly_altDD_ejb_jar = ShrinkWrap.create(JavaArchive.class, "assembly_altDD_ejb_jar");
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBean.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBeanEJB.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.util.shared.ejbref.common.ReferencedBeanCode.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatelessWrapper.class);
ear.addAsModule(assembly_altDD_ejb_jar);
return ear;
}
private static final String prefix = "java:comp/env/";
private static final String entryLookup = prefix + "myCountry";
private static final String beanLookup = prefix + "ejb/myPainter";
/* Expected values for bean name */
private static final String entryNameRef = "France";
private static final String beanNameRef = "Gaughin";
private Properties props = null;
private TSNamingContext nctx = null;
public static void main(String[] args) {
com.sun.ts.tests.assembly.altDD.Client theTests = new com.sun.ts.tests.assembly.altDD.Client();
Status s = theTests.run(args, System.out, System.err);
s.exit();
}
/*
* @class.setup_props: org.omg.CORBA.ORBClass; java.naming.factory.initial;
*/
public void setup(String[] args, Properties props) throws Fault {
try {
this.props = props;
logTrace("[Client] Getting Naming Context...");
nctx = new TSNamingContext();
logTrace("[Client] Setup completed!");
} catch (Exception e) {
logErr("[Client] Failed to obtain Naming Context:" + e);
throw new Fault("[Client] Setup failed:" + e, e);
}
}
/**
* @testName: testAppClient
*
* @assertion_ids: JavaEE:SPEC:10260
*
* @test_Strategy: Package an application containing:
*
* - An application client jar file including its own DD: DD2.
* DD2 declares one String environment entry, named
* 'myCountry' whose value is 'Spain'.
*
* - An alternate DD: DD4. DD4 is almost identical to DD2.
* Nevertheless it changes the value for the 'myCountry'
* environment entry: the new value is 'France'.
*
* - An application DD including the application client module
* and using an alt-dd element to define DD4 as an alternate
* DD for the application client.
*
* We check that:
*
* - We can deploy the application.
*
* - The application client can lookup the 'ejb/myCountry'
* environment entry.
*
* - The runtime value is 'France', validating the use of DD4
* at deployment time.
*/
@Test
public void testAppClient() throws Fault {
String entryValue;
boolean pass = false;
try {
logTrace("[Client] Looking up " + entryLookup);
entryValue = (String) nctx.lookup(entryLookup);
pass = entryValue.equals(entryNameRef);
if (!pass) {
logErr("[Client] Expected " + entryLookup + " name to be "
+ entryNameRef + ", not " + entryValue);
throw new Fault("Alternative DD test failed!");
}
} catch (Exception e) {
logErr("[Client] Caught exception: " + e);
throw new Fault("Alternative DD test failed!" + e, e);
}
}
/**
* @testName: testEJB
*
* @assertion_ids: JavaEE:SPEC:255
*
* @test_Strategy: Package an application containing:
*
* - An ejb-jar file including its own DD: DD1. This ejb-jar
* contains 2 beans sharing the same Home and Remote
* interfaces. According to DD1:
*
* . The two ejb-name's are Bean1 and Bean2.
*
* . Bean1 declares a String environment entry named myName
* whose value is 'Dali '
*
* . Bean2 declares a String environment entry named myName
* whose value is 'Picasso'
*
* - An application client jar file including its own DD: DD2.
* DD2 declares one EJB reference using ejb-ref-name
* 'ejb/myPainter' and an ejb-link element targeting Bean1.
*
* - An alternate DD: DD3. DD3 is almost identical to DD1.
* Nevertheless it changes the values for the myName
* environment entries: Bean1 is 'Gaughin' and Bean2 is
* 'Matisse'.
*
* - An application DD including the EJB jar module and the
* application jar module, but also using an alt-dd element to
* define DD3 as an alternate DD for the ejb-jar.
*
* We check that:
*
* - We can deploy the application.
*
* - The application client can lookup 'ejb/myPainter' and
* create a Bean instance.
*
* - The client can call a business method on that instance
* that return the value of the myName environment entry in
* the bean environment.
*
* - The returned value is 'Matisse', validating the use of
* DD3 at deployment time.
*/
@Test
public void testEJB() throws Fault {
PainterBean bean = null;
String nameValue;
boolean pass = false;
try {
logTrace("[Client] Looking up " + beanLookup);
bean = (PainterBean) nctx.lookup(beanLookup, PainterBean.class);
bean.createNamingContext();
bean.initLogging(props);
logTrace("[Client] Checking referenced EJB...");
nameValue = bean.whoAreYou();
pass = nameValue.equals(beanNameRef);
if (!pass) {
logErr("[Client] Expected " + beanLookup + " name to be " + beanNameRef
+ ", not " + nameValue);
throw new Fault("Alternative DD test failed!");
}
} catch (Exception e) {
logErr("[Client] Caught exception: " + e);
throw new Fault("Alternative DD test failed!" + e, e);
}
}
public void cleanup() {
logTrace("[Client] Cleanup.");
}
}"
but was:
"// package com.sun.ts.tests.assembly.altDD;
package com.sun.ts.tests.assembly.altDD;
import java.util.Properties;
import com.sun.javatest.Status;
import com.sun.ts.lib.harness.EETest;
import com.sun.ts.lib.util.TSNamingContext;
import com.sun.ts.lib.util.TestUtil;
import com.sun.ts.tests.assembly.altDD.PainterBean;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@Disabled
public class Client extends EETest {
@Deployment(testable = false)
public static Archive<?> deployment() {
final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "assembly_altDD.ear");
// Add ear submodules
JavaArchive assembly_altDD_client_jar = ShrinkWrap.create(JavaArchive.class, "assembly_altDD_client_jar");
assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.Client.class);
assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBean.class);
assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBeanHome.class);
ear.addAsModule(assembly_altDD_client_jar);
JavaArchive assembly_altDD_ejb_jar = ShrinkWrap.create(JavaArchive.class, "assembly_altDD_ejb_jar");
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBean.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBeanEJB.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBeanHome.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.util.shared.ejbref.common.ReferencedBeanCode.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatelessWrapper.class);
ear.addAsModule(assembly_altDD_ejb_jar);
return ear;
}
private static final String prefix = "java:comp/env/";
private static final String entryLookup = prefix + "myCountry";
private static final String beanLookup = prefix + "ejb/myPainter";
/* Expected values for bean name */
private static final String entryNameRef = "France";
private static final String beanNameRef = "Gaughin";
private Properties props = null;
private TSNamingContext nctx = null;
public static void main(String[] args) {
com.sun.ts.tests.assembly.altDD.Client theTests = new com.sun.ts.tests.assembly.altDD.Client();
Status s = theTests.run(args, System.out, System.err);
s.exit();
}
/*
* @class.setup_props: org.omg.CORBA.ORBClass; java.naming.factory.initial;
*/
public void setup(String[] args, Properties props) throws Fault {
try {
this.props = props;
logTrace("[Client] Getting Naming Context...");
nctx = new TSNamingContext();
logTrace("[Client] Setup completed!");
} catch (Exception e) {
logErr("[Client] Failed to obtain Naming Context:" + e);
throw new Fault("[Client] Setup failed:" + e, e);
}
}
/**
* @testName: testAppClient
*
* @assertion_ids: JavaEE:SPEC:10260
*
* @test_Strategy: Package an application containing:
*
* - An application client jar file including its own DD: DD2.
* DD2 declares one String environment entry, named
* 'myCountry' whose value is 'Spain'.
*
* - An alternate DD: DD4. DD4 is almost identical to DD2.
* Nevertheless it changes the value for the 'myCountry'
* environment entry: the new value is 'France'.
*
* - An application DD including the application client module
* and using an alt-dd element to define DD4 as an alternate
* DD for the application client.
*
* We check that:
*
* - We can deploy the application.
*
* - The application client can lookup the 'ejb/myCountry'
* environment entry.
*
* - The runtime value is 'France', validating the use of DD4
* at deployment time.
*/
@Test
public void testAppClient() throws Fault {
String entryValue;
boolean pass = false;
try {
logTrace("[Client] Looking up " + entryLookup);
entryValue = (String) nctx.lookup(entryLookup);
pass = entryValue.equals(entryNameRef);
if (!pass) {
logErr("[Client] Expected " + entryLookup + " name to be "
+ entryNameRef + ", not " + entryValue);
throw new Fault("Alternative DD test failed!");
}
} catch (Exception e) {
logErr("[Client] Caught exception: " + e);
throw new Fault("Alternative DD test failed!" + e, e);
}
}
/**
* @testName: testEJB
*
* @assertion_ids: JavaEE:SPEC:255
*
* @test_Strategy: Package an application containing:
*
* - An ejb-jar file including its own DD: DD1. This ejb-jar
* contains 2 beans sharing the same Home and Remote
* interfaces. According to DD1:
*
* . The two ejb-name's are Bean1 and Bean2.
*
* . Bean1 declares a String environment entry named myName
* whose value is 'Dali '
*
* . Bean2 declares a String environment entry named myName
* whose value is 'Picasso'
*
* - An application client jar file including its own DD: DD2.
* DD2 declares one EJB reference using ejb-ref-name
* 'ejb/myPainter' and an ejb-link element targeting Bean1.
*
* - An alternate DD: DD3. DD3 is almost identical to DD1.
* Nevertheless it changes the values for the myName
* environment entries: Bean1 is 'Gaughin' and Bean2 is
* 'Matisse'.
*
* - An application DD including the EJB jar module and the
* application jar module, but also using an alt-dd element to
* define DD3 as an alternate DD for the ejb-jar.
*
* We check that:
*
* - We can deploy the application.
*
* - The application client can lookup 'ejb/myPainter' and
* create a Bean instance.
*
* - The client can call a business method on that instance
* that return the value of the myName environment entry in
* the bean environment.
*
* - The returned value is 'Matisse', validating the use of
* DD3 at deployment time.
*/
@Test
public void testEJB() throws Fault {
PainterBean bean = null;
String nameValue;
boolean pass = false;
try {
logTrace("[Client] Looking up " + beanLookup);
bean = (PainterBean) nctx.lookup(beanLookup, PainterBean.class);
bean.createNamingContext();
bean.initLogging(props);
logTrace("[Client] Checking referenced EJB...");
nameValue = bean.whoAreYou();
pass = nameValue.equals(beanNameRef);
if (!pass) {
logErr("[Client] Expected " + beanLookup + " name to be " + beanNameRef
+ ", not " + nameValue);
throw new Fault("Alternative DD test failed!");
}
} catch (Exception e) {
logErr("[Client] Caught exception: " + e);
throw new Fault("Alternative DD test failed!" + e, e);
}
}
public void cleanup() {
logTrace("[Client] Cleanup.");
}
}"
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at org.openrewrite.test.RewriteTest.assertContentEquals(RewriteTest.java:566)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:465)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:132)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:127)
at tck.conversion.rewrite.JavaTestToArqTest.runTestFromSource(JavaTestToArqTest.java:71)
at tck.conversion.rewrite.JavaTestToArqTest.testAppClientEar(JavaTestToArqTest.java:42)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
[ERROR] tck.conversion.rewrite.JavaTestToArqTest.testLargeCase -- Time elapsed: 0.485 s <<< FAILURE!
org.opentest4j.AssertionFailedError:
[Unexpected result in "name.java":
diff --git a/name.java b/name.java
index b3dca59..b29f365 100644
--- a/name.java
+++ b/name.java
@@ -43,12 +43,18 @@
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBean.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanEJB.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanHome.class);
+ ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20Callee.class);
+ ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeEJB.class);
+ ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeHome.class);
+ ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeLocal.class);
+ ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeLocalHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.SimpleArgument.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCallee.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeEJB.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeLocal.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeLocalHome.class);
+ ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.CMP20Wrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatefulWrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatelessWrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.testlogic.ejb.bb.argsemantics.TestLogic.class);
@@ -130,6 +136,7 @@
* strategy but the Caller call a business method on the
* Callee remote interface.
*/
+ @Test
public void testStatefulRemote() throws Fault {
boolean pass;
@@ -190,6 +197,7 @@
* Same strategy but the Caller call a business method on the
* Callee local interface.
*/
+ @Test
public void testStatefulLocal() throws Fault {
boolean pass;
@@ -233,6 +241,7 @@
* 'testStatefulLocal') on the Callee bean defining a local
* and a remote client view.
*/
+ @Test
public void testStatefulBoth() throws Fault {
boolean pass;
]
expected:
"//package com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics;
package com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics;
import java.util.Properties;
import com.sun.javatest.Status;
import com.sun.ts.lib.harness.EETest;
import com.sun.ts.lib.util.TSNamingContext;
import com.sun.ts.lib.util.TestUtil;
import com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBean;
import com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanHome;
import com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.Client;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* An example of a larger conversion test. This is read in as a source file by the
* JavaTestToArqTest#testLargeCase() method so that it can be updated easily
* and syntax checked. The class name and package are replaced by the testLargeCase method.
*/
@Disabled
public class LargeCase extends EETest {
@Deployment(testable = false)
public static Archive<?> deployment() {
final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "ejb_bb_ssl_argsemantics.ear");
// Add ear submodules
JavaArchive ejb_bb_ssl_argsemantics_client_jar = ShrinkWrap.create(JavaArchive.class, "ejb_bb_ssl_argsemantics_client_jar");
ejb_bb_ssl_argsemantics_client_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBean.class);
ejb_bb_ssl_argsemantics_client_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanHome.class);
ejb_bb_ssl_argsemantics_client_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.Client.class);
ear.addAsModule(ejb_bb_ssl_argsemantics_client_jar);
JavaArchive ejb_bb_ssl_argsemantics_ejb_jar = ShrinkWrap.create(JavaArchive.class, "ejb_bb_ssl_argsemantics_ejb_jar");
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBean.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanEJB.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.SimpleArgument.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCallee.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeEJB.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeLocal.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeLocalHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatefulWrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatelessWrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.testlogic.ejb.bb.argsemantics.TestLogic.class);
ear.addAsModule(ejb_bb_ssl_argsemantics_ejb_jar);
return ear;
}
private static final String testName = "SessionBeanTest";
private static final String beanLookup = "java:comp/env/ejb/Caller";
private CallerBean bean = null;
private CallerBeanHome beanHome = null;
private Properties props = null;
private TSNamingContext nctx = null;
public static void main(String[] args) {
Client theTests = new Client();
Status s = theTests.run(args, System.out, System.err);
s.exit();
}
/**
* @class.setup_props: org.omg.CORBA.ORBClass; java.naming.factory.initial;
* generateSQL;
*/
public void setup(String[] args, Properties props) throws Fault {
try {
logMsg("[Client] setup()");
this.props = props;
logTrace("[Client] Getting Naming Context...");
nctx = new TSNamingContext();
logTrace("[Client] Looking up " + beanLookup);
beanHome = (CallerBeanHome) nctx.lookup(beanLookup, CallerBeanHome.class);
logTrace("[Client] Create EJB instance...");
bean = (CallerBean) beanHome.create();
} catch (Exception e) {
throw new Fault("Setup failed:", e);
}
}
/**
* @testName: testStatefulRemote
*
* @assertion_ids: EJB:SPEC:906
*
* @test_Strategy:
*
* This is applicable to : - a Session Stateful Callee bean
* defining a remote client view only (No local view). - a
* Stateless Caller bean, Calling this Callee Bean home or
* remote interface.
*
* We package in the same ejb-jar: - a Session Stateful Callee
* bean defining a remote client view only (No local view). -
* a Stateless Caller bean
*
* Remote Home arg semantics verification:
*
* - We set a non-remote object 'arg' (of type SimpleArgument)
* to an initial value. This SimpleArgument class is just a
* data structure holding an int.
*
* - The Caller bean calls the Callee Home create(...) method,
* passing this 'arg' object as an argument.
*
* - The Callee create(..) method modifies the value of the
* argument (should be a copy of 'arg')
*
* - When we return from the create method, the Caller check
* that the argument value is still set to the initial value.
*
* Remote interface arg semantics verif/loication: Same
* strategy but the Caller call a business method on the
* Callee remote interface.
*/
public void testStatefulRemote() throws Fault {
boolean pass;
try {
pass = bean.testStatefulRemote(props);
} catch (Exception e) {
throw new Fault("testStatefulRemote failed", e);
} finally {
if (null != bean) {
try {
bean.cleanUpBean();
bean.remove();
} catch (Exception e) {
TestUtil.logErr("[Client] Ignoring Exception on " + "bean remove", e);
}
}
}
if (!pass) {
throw new Fault("testStatefulRemote failed");
}
}
/**
* @testName: testStatefulLocal
*
* @assertion_ids: EJB:SPEC:907.2; EJB:SPEC:1
*
* @test_Strategy: This is applicable to : - a Session Stateful Callee bean
* defining a local client view only (No remote view).
*
* - a Stateless Caller bean, Calling this Callee Bean local
* home or local interface.
*
* We package in the same ejb-jar: - a Session Stateful Callee
* bean defining a local client view only (No remote view). -
* a Stateless Caller bean
*
* Local Home arg semantics verification:
*
* - We set a non-remote object 'arg' (of type SimpleArgument)
* to an initial value. This SimpleArgument class is just a
* data structure holding an int.
*
* - The Caller bean calls the Callee local home create(...)
* method, passing this 'arg' object as an argument.
*
* - The Callee create(..) method modifies the value of the
* argument (should be a reference to original 'arg')
*
* - When we return from the create method, the Caller check
* that the argument value is not set to the initial value,
* and reflect the changes made by the Callee.
*
* Local interface arg semantics verification:
*
* Same strategy but the Caller call a business method on the
* Callee local interface.
*/
public void testStatefulLocal() throws Fault {
boolean pass;
try {
pass = bean.testStatefulLocal(props);
} catch (Exception e) {
throw new Fault("testStatefulLocal failed", e);
} finally {
if (null != bean) {
try {
bean.cleanUpBean();
bean.remove();
} catch (Exception e) {
TestUtil.logErr("[Client] Ignoring Exception on " + "bean remove", e);
}
}
}
if (!pass) {
throw new Fault("testStatefulLocal failed");
}
}
/**
* @testName: testStatefulBoth
*
* @assertion_ids: EJB:SPEC:906; EJB:SPEC:907; EJB:SPEC:907.2
*
*
* @test_Strategy: This is applicable to :
*
* - a Session Stateful Callee bean defining a remote AND a
* local client view.
*
* - a Stateless Caller bean, Calling this Callee Bean home,
* local home, remote, or local interface.
*
* The test strategy is a cumulated version of the two
* previous tests ('testStatefulRemote' and
* 'testStatefulLocal') on the Callee bean defining a local
* and a remote client view.
*/
public void testStatefulBoth() throws Fault {
boolean pass;
try {
pass = bean.testStatefulBoth(props);
} catch (Exception e) {
throw new Fault("testStatefulBoth failed", e);
} finally {
if (null != bean) {
try {
bean.cleanUpBean();
bean.remove();
} catch (Exception e) {
TestUtil.logErr("[Client] Ignoring Exception on " + "bean remove", e);
}
}
}
if (!pass) {
throw new Fault("testStatefulBoth failed");
}
}
public void cleanup() throws Fault {
logMsg("[Client] cleanup()");
}
}"
but was:
"//package com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics;
package com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics;
import java.util.Properties;
import com.sun.javatest.Status;
import com.sun.ts.lib.harness.EETest;
import com.sun.ts.lib.util.TSNamingContext;
import com.sun.ts.lib.util.TestUtil;
import com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBean;
import com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanHome;
import com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.Client;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* An example of a larger conversion test. This is read in as a source file by the
* JavaTestToArqTest#testLargeCase() method so that it can be updated easily
* and syntax checked. The class name and package are replaced by the testLargeCase method.
*/
@Disabled
public class LargeCase extends EETest {
@Deployment(testable = false)
public static Archive<?> deployment() {
final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "ejb_bb_ssl_argsemantics.ear");
// Add ear submodules
JavaArchive ejb_bb_ssl_argsemantics_client_jar = ShrinkWrap.create(JavaArchive.class, "ejb_bb_ssl_argsemantics_client_jar");
ejb_bb_ssl_argsemantics_client_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBean.class);
ejb_bb_ssl_argsemantics_client_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanHome.class);
ejb_bb_ssl_argsemantics_client_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.Client.class);
ear.addAsModule(ejb_bb_ssl_argsemantics_client_jar);
JavaArchive ejb_bb_ssl_argsemantics_ejb_jar = ShrinkWrap.create(JavaArchive.class, "ejb_bb_ssl_argsemantics_ejb_jar");
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBean.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanEJB.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20Callee.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeEJB.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeLocal.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeLocalHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.SimpleArgument.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCallee.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeEJB.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeLocal.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeLocalHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.CMP20Wrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatefulWrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatelessWrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.testlogic.ejb.bb.argsemantics.TestLogic.class);
ear.addAsModule(ejb_bb_ssl_argsemantics_ejb_jar);
return ear;
}
private static final String testName = "SessionBeanTest";
private static final String beanLookup = "java:comp/env/ejb/Caller";
private CallerBean bean = null;
private CallerBeanHome beanHome = null;
private Properties props = null;
private TSNamingContext nctx = null;
public static void main(String[] args) {
Client theTests = new Client();
Status s = theTests.run(args, System.out, System.err);
s.exit();
}
/**
* @class.setup_props: org.omg.CORBA.ORBClass; java.naming.factory.initial;
* generateSQL;
*/
public void setup(String[] args, Properties props) throws Fault {
try {
logMsg("[Client] setup()");
this.props = props;
logTrace("[Client] Getting Naming Context...");
nctx = new TSNamingContext();
logTrace("[Client] Looking up " + beanLookup);
beanHome = (CallerBeanHome) nctx.lookup(beanLookup, CallerBeanHome.class);
logTrace("[Client] Create EJB instance...");
bean = (CallerBean) beanHome.create();
} catch (Exception e) {
throw new Fault("Setup failed:", e);
}
}
/**
* @testName: testStatefulRemote
*
* @assertion_ids: EJB:SPEC:906
*
* @test_Strategy:
*
* This is applicable to : - a Session Stateful Callee bean
* defining a remote client view only (No local view). - a
* Stateless Caller bean, Calling this Callee Bean home or
* remote interface.
*
* We package in the same ejb-jar: - a Session Stateful Callee
* bean defining a remote client view only (No local view). -
* a Stateless Caller bean
*
* Remote Home arg semantics verification:
*
* - We set a non-remote object 'arg' (of type SimpleArgument)
* to an initial value. This SimpleArgument class is just a
* data structure holding an int.
*
* - The Caller bean calls the Callee Home create(...) method,
* passing this 'arg' object as an argument.
*
* - The Callee create(..) method modifies the value of the
* argument (should be a copy of 'arg')
*
* - When we return from the create method, the Caller check
* that the argument value is still set to the initial value.
*
* Remote interface arg semantics verif/loication: Same
* strategy but the Caller call a business method on the
* Callee remote interface.
*/
@Test
public void testStatefulRemote() throws Fault {
boolean pass;
try {
pass = bean.testStatefulRemote(props);
} catch (Exception e) {
throw new Fault("testStatefulRemote failed", e);
} finally {
if (null != bean) {
try {
bean.cleanUpBean();
bean.remove();
} catch (Exception e) {
TestUtil.logErr("[Client] Ignoring Exception on " + "bean remove", e);
}
}
}
if (!pass) {
throw new Fault("testStatefulRemote failed");
}
}
/**
* @testName: testStatefulLocal
*
* @assertion_ids: EJB:SPEC:907.2; EJB:SPEC:1
*
* @test_Strategy: This is applicable to : - a Session Stateful Callee bean
* defining a local client view only (No remote view).
*
* - a Stateless Caller bean, Calling this Callee Bean local
* home or local interface.
*
* We package in the same ejb-jar: - a Session Stateful Callee
* bean defining a local client view only (No remote view). -
* a Stateless Caller bean
*
* Local Home arg semantics verification:
*
* - We set a non-remote object 'arg' (of type SimpleArgument)
* to an initial value. This SimpleArgument class is just a
* data structure holding an int.
*
* - The Caller bean calls the Callee local home create(...)
* method, passing this 'arg' object as an argument.
*
* - The Callee create(..) method modifies the value of the
* argument (should be a reference to original 'arg')
*
* - When we return from the create method, the Caller check
* that the argument value is not set to the initial value,
* and reflect the changes made by the Callee.
*
* Local interface arg semantics verification:
*
* Same strategy but the Caller call a business method on the
* Callee local interface.
*/
@Test
public void testStatefulLocal() throws Fault {
boolean pass;
try {
pass = bean.testStatefulLocal(props);
} catch (Exception e) {
throw new Fault("testStatefulLocal failed", e);
} finally {
if (null != bean) {
try {
bean.cleanUpBean();
bean.remove();
} catch (Exception e) {
TestUtil.logErr("[Client] Ignoring Exception on " + "bean remove", e);
}
}
}
if (!pass) {
throw new Fault("testStatefulLocal failed");
}
}
/**
* @testName: testStatefulBoth
*
* @assertion_ids: EJB:SPEC:906; EJB:SPEC:907; EJB:SPEC:907.2
*
*
* @test_Strategy: This is applicable to :
*
* - a Session Stateful Callee bean defining a remote AND a
* local client view.
*
* - a Stateless Caller bean, Calling this Callee Bean home,
* local home, remote, or local interface.
*
* The test strategy is a cumulated version of the two
* previous tests ('testStatefulRemote' and
* 'testStatefulLocal') on the Callee bean defining a local
* and a remote client view.
*/
@Test
public void testStatefulBoth() throws Fault {
boolean pass;
try {
pass = bean.testStatefulBoth(props);
} catch (Exception e) {
throw new Fault("testStatefulBoth failed", e);
} finally {
if (null != bean) {
try {
bean.cleanUpBean();
bean.remove();
} catch (Exception e) {
TestUtil.logErr("[Client] Ignoring Exception on " + "bean remove", e);
}
}
}
if (!pass) {
throw new Fault("testStatefulBoth failed");
}
}
public void cleanup() throws Fault {
logMsg("[Client] cleanup()");
}
}"
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at org.openrewrite.test.RewriteTest.assertContentEquals(RewriteTest.java:566)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:465)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:132)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:127)
at tck.conversion.rewrite.JavaTestToArqTest.runTestFromSource(JavaTestToArqTest.java:71)
at tck.conversion.rewrite.JavaTestToArqTest.testLargeCase(JavaTestToArqTest.java:56)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] JavaTestToArqTest.testAppClientEar:42->runTestFromSource:71 [Unexpected result in "Client.java":
diff --git a/Client.java b/Client.java
index f07f2f5..18a816c 100644
--- a/Client.java
+++ b/Client.java
@@ -28,11 +28,13 @@
JavaArchive assembly_altDD_client_jar = ShrinkWrap.create(JavaArchive.class, "assembly_altDD_client_jar");
assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.Client.class);
assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBean.class);
+ assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBeanHome.class);
ear.addAsModule(assembly_altDD_client_jar);
JavaArchive assembly_altDD_ejb_jar = ShrinkWrap.create(JavaArchive.class, "assembly_altDD_ejb_jar");
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBean.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBeanEJB.class);
+ assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBeanHome.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.util.shared.ejbref.common.ReferencedBeanCode.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatelessWrapper.class);
ear.addAsModule(assembly_altDD_ejb_jar);
@@ -200,7 +202,6 @@
logErr("[Client] Caught exception: " + e);
throw new Fault("Alternative DD test failed!" + e, e);
}
-
}
public void cleanup() {
]
expected:
"// package com.sun.ts.tests.assembly.altDD;
package com.sun.ts.tests.assembly.altDD;
import java.util.Properties;
import com.sun.javatest.Status;
import com.sun.ts.lib.harness.EETest;
import com.sun.ts.lib.util.TSNamingContext;
import com.sun.ts.lib.util.TestUtil;
import com.sun.ts.tests.assembly.altDD.PainterBean;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@Disabled
public class Client extends EETest {
@Deployment(testable = false)
public static Archive<?> deployment() {
final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "assembly_altDD.ear");
// Add ear submodules
JavaArchive assembly_altDD_client_jar = ShrinkWrap.create(JavaArchive.class, "assembly_altDD_client_jar");
assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.Client.class);
assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBean.class);
ear.addAsModule(assembly_altDD_client_jar);
JavaArchive assembly_altDD_ejb_jar = ShrinkWrap.create(JavaArchive.class, "assembly_altDD_ejb_jar");
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBean.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBeanEJB.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.util.shared.ejbref.common.ReferencedBeanCode.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatelessWrapper.class);
ear.addAsModule(assembly_altDD_ejb_jar);
return ear;
}
private static final String prefix = "java:comp/env/";
private static final String entryLookup = prefix + "myCountry";
private static final String beanLookup = prefix + "ejb/myPainter";
/* Expected values for bean name */
private static final String entryNameRef = "France";
private static final String beanNameRef = "Gaughin";
private Properties props = null;
private TSNamingContext nctx = null;
public static void main(String[] args) {
com.sun.ts.tests.assembly.altDD.Client theTests = new com.sun.ts.tests.assembly.altDD.Client();
Status s = theTests.run(args, System.out, System.err);
s.exit();
}
/*
* @class.setup_props: org.omg.CORBA.ORBClass; java.naming.factory.initial;
*/
public void setup(String[] args, Properties props) throws Fault {
try {
this.props = props;
logTrace("[Client] Getting Naming Context...");
nctx = new TSNamingContext();
logTrace("[Client] Setup completed!");
} catch (Exception e) {
logErr("[Client] Failed to obtain Naming Context:" + e);
throw new Fault("[Client] Setup failed:" + e, e);
}
}
/**
* @testName: testAppClient
*
* @assertion_ids: JavaEE:SPEC:10260
*
* @test_Strategy: Package an application containing:
*
* - An application client jar file including its own DD: DD2.
* DD2 declares one String environment entry, named
* 'myCountry' whose value is 'Spain'.
*
* - An alternate DD: DD4. DD4 is almost identical to DD2.
* Nevertheless it changes the value for the 'myCountry'
* environment entry: the new value is 'France'.
*
* - An application DD including the application client module
* and using an alt-dd element to define DD4 as an alternate
* DD for the application client.
*
* We check that:
*
* - We can deploy the application.
*
* - The application client can lookup the 'ejb/myCountry'
* environment entry.
*
* - The runtime value is 'France', validating the use of DD4
* at deployment time.
*/
@Test
public void testAppClient() throws Fault {
String entryValue;
boolean pass = false;
try {
logTrace("[Client] Looking up " + entryLookup);
entryValue = (String) nctx.lookup(entryLookup);
pass = entryValue.equals(entryNameRef);
if (!pass) {
logErr("[Client] Expected " + entryLookup + " name to be "
+ entryNameRef + ", not " + entryValue);
throw new Fault("Alternative DD test failed!");
}
} catch (Exception e) {
logErr("[Client] Caught exception: " + e);
throw new Fault("Alternative DD test failed!" + e, e);
}
}
/**
* @testName: testEJB
*
* @assertion_ids: JavaEE:SPEC:255
*
* @test_Strategy: Package an application containing:
*
* - An ejb-jar file including its own DD: DD1. This ejb-jar
* contains 2 beans sharing the same Home and Remote
* interfaces. According to DD1:
*
* . The two ejb-name's are Bean1 and Bean2.
*
* . Bean1 declares a String environment entry named myName
* whose value is 'Dali '
*
* . Bean2 declares a String environment entry named myName
* whose value is 'Picasso'
*
* - An application client jar file including its own DD: DD2.
* DD2 declares one EJB reference using ejb-ref-name
* 'ejb/myPainter' and an ejb-link element targeting Bean1.
*
* - An alternate DD: DD3. DD3 is almost identical to DD1.
* Nevertheless it changes the values for the myName
* environment entries: Bean1 is 'Gaughin' and Bean2 is
* 'Matisse'.
*
* - An application DD including the EJB jar module and the
* application jar module, but also using an alt-dd element to
* define DD3 as an alternate DD for the ejb-jar.
*
* We check that:
*
* - We can deploy the application.
*
* - The application client can lookup 'ejb/myPainter' and
* create a Bean instance.
*
* - The client can call a business method on that instance
* that return the value of the myName environment entry in
* the bean environment.
*
* - The returned value is 'Matisse', validating the use of
* DD3 at deployment time.
*/
@Test
public void testEJB() throws Fault {
PainterBean bean = null;
String nameValue;
boolean pass = false;
try {
logTrace("[Client] Looking up " + beanLookup);
bean = (PainterBean) nctx.lookup(beanLookup, PainterBean.class);
bean.createNamingContext();
bean.initLogging(props);
logTrace("[Client] Checking referenced EJB...");
nameValue = bean.whoAreYou();
pass = nameValue.equals(beanNameRef);
if (!pass) {
logErr("[Client] Expected " + beanLookup + " name to be " + beanNameRef
+ ", not " + nameValue);
throw new Fault("Alternative DD test failed!");
}
} catch (Exception e) {
logErr("[Client] Caught exception: " + e);
throw new Fault("Alternative DD test failed!" + e, e);
}
}
public void cleanup() {
logTrace("[Client] Cleanup.");
}
}"
but was:
"// package com.sun.ts.tests.assembly.altDD;
package com.sun.ts.tests.assembly.altDD;
import java.util.Properties;
import com.sun.javatest.Status;
import com.sun.ts.lib.harness.EETest;
import com.sun.ts.lib.util.TSNamingContext;
import com.sun.ts.lib.util.TestUtil;
import com.sun.ts.tests.assembly.altDD.PainterBean;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@Disabled
public class Client extends EETest {
@Deployment(testable = false)
public static Archive<?> deployment() {
final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "assembly_altDD.ear");
// Add ear submodules
JavaArchive assembly_altDD_client_jar = ShrinkWrap.create(JavaArchive.class, "assembly_altDD_client_jar");
assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.Client.class);
assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBean.class);
assembly_altDD_client_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBeanHome.class);
ear.addAsModule(assembly_altDD_client_jar);
JavaArchive assembly_altDD_ejb_jar = ShrinkWrap.create(JavaArchive.class, "assembly_altDD_ejb_jar");
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBean.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBeanEJB.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.altDD.PainterBeanHome.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.assembly.util.shared.ejbref.common.ReferencedBeanCode.class);
assembly_altDD_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatelessWrapper.class);
ear.addAsModule(assembly_altDD_ejb_jar);
return ear;
}
private static final String prefix = "java:comp/env/";
private static final String entryLookup = prefix + "myCountry";
private static final String beanLookup = prefix + "ejb/myPainter";
/* Expected values for bean name */
private static final String entryNameRef = "France";
private static final String beanNameRef = "Gaughin";
private Properties props = null;
private TSNamingContext nctx = null;
public static void main(String[] args) {
com.sun.ts.tests.assembly.altDD.Client theTests = new com.sun.ts.tests.assembly.altDD.Client();
Status s = theTests.run(args, System.out, System.err);
s.exit();
}
/*
* @class.setup_props: org.omg.CORBA.ORBClass; java.naming.factory.initial;
*/
public void setup(String[] args, Properties props) throws Fault {
try {
this.props = props;
logTrace("[Client] Getting Naming Context...");
nctx = new TSNamingContext();
logTrace("[Client] Setup completed!");
} catch (Exception e) {
logErr("[Client] Failed to obtain Naming Context:" + e);
throw new Fault("[Client] Setup failed:" + e, e);
}
}
/**
* @testName: testAppClient
*
* @assertion_ids: JavaEE:SPEC:10260
*
* @test_Strategy: Package an application containing:
*
* - An application client jar file including its own DD: DD2.
* DD2 declares one String environment entry, named
* 'myCountry' whose value is 'Spain'.
*
* - An alternate DD: DD4. DD4 is almost identical to DD2.
* Nevertheless it changes the value for the 'myCountry'
* environment entry: the new value is 'France'.
*
* - An application DD including the application client module
* and using an alt-dd element to define DD4 as an alternate
* DD for the application client.
*
* We check that:
*
* - We can deploy the application.
*
* - The application client can lookup the 'ejb/myCountry'
* environment entry.
*
* - The runtime value is 'France', validating the use of DD4
* at deployment time.
*/
@Test
public void testAppClient() throws Fault {
String entryValue;
boolean pass = false;
try {
logTrace("[Client] Looking up " + entryLookup);
entryValue = (String) nctx.lookup(entryLookup);
pass = entryValue.equals(entryNameRef);
if (!pass) {
logErr("[Client] Expected " + entryLookup + " name to be "
+ entryNameRef + ", not " + entryValue);
throw new Fault("Alternative DD test failed!");
}
} catch (Exception e) {
logErr("[Client] Caught exception: " + e);
throw new Fault("Alternative DD test failed!" + e, e);
}
}
/**
* @testName: testEJB
*
* @assertion_ids: JavaEE:SPEC:255
*
* @test_Strategy: Package an application containing:
*
* - An ejb-jar file including its own DD: DD1. This ejb-jar
* contains 2 beans sharing the same Home and Remote
* interfaces. According to DD1:
*
* . The two ejb-name's are Bean1 and Bean2.
*
* . Bean1 declares a String environment entry named myName
* whose value is 'Dali '
*
* . Bean2 declares a String environment entry named myName
* whose value is 'Picasso'
*
* - An application client jar file including its own DD: DD2.
* DD2 declares one EJB reference using ejb-ref-name
* 'ejb/myPainter' and an ejb-link element targeting Bean1.
*
* - An alternate DD: DD3. DD3 is almost identical to DD1.
* Nevertheless it changes the values for the myName
* environment entries: Bean1 is 'Gaughin' and Bean2 is
* 'Matisse'.
*
* - An application DD including the EJB jar module and the
* application jar module, but also using an alt-dd element to
* define DD3 as an alternate DD for the ejb-jar.
*
* We check that:
*
* - We can deploy the application.
*
* - The application client can lookup 'ejb/myPainter' and
* create a Bean instance.
*
* - The client can call a business method on that instance
* that return the value of the myName environment entry in
* the bean environment.
*
* - The returned value is 'Matisse', validating the use of
* DD3 at deployment time.
*/
@Test
public void testEJB() throws Fault {
PainterBean bean = null;
String nameValue;
boolean pass = false;
try {
logTrace("[Client] Looking up " + beanLookup);
bean = (PainterBean) nctx.lookup(beanLookup, PainterBean.class);
bean.createNamingContext();
bean.initLogging(props);
logTrace("[Client] Checking referenced EJB...");
nameValue = bean.whoAreYou();
pass = nameValue.equals(beanNameRef);
if (!pass) {
logErr("[Client] Expected " + beanLookup + " name to be " + beanNameRef
+ ", not " + nameValue);
throw new Fault("Alternative DD test failed!");
}
} catch (Exception e) {
logErr("[Client] Caught exception: " + e);
throw new Fault("Alternative DD test failed!" + e, e);
}
}
public void cleanup() {
logTrace("[Client] Cleanup.");
}
}"
[ERROR] JavaTestToArqTest.testLargeCase:56->runTestFromSource:71 [Unexpected result in "name.java":
diff --git a/name.java b/name.java
index b3dca59..b29f365 100644
--- a/name.java
+++ b/name.java
@@ -43,12 +43,18 @@
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBean.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanEJB.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanHome.class);
+ ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20Callee.class);
+ ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeEJB.class);
+ ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeHome.class);
+ ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeLocal.class);
+ ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeLocalHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.SimpleArgument.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCallee.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeEJB.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeLocal.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeLocalHome.class);
+ ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.CMP20Wrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatefulWrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatelessWrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.testlogic.ejb.bb.argsemantics.TestLogic.class);
@@ -130,6 +136,7 @@
* strategy but the Caller call a business method on the
* Callee remote interface.
*/
+ @Test
public void testStatefulRemote() throws Fault {
boolean pass;
@@ -190,6 +197,7 @@
* Same strategy but the Caller call a business method on the
* Callee local interface.
*/
+ @Test
public void testStatefulLocal() throws Fault {
boolean pass;
@@ -233,6 +241,7 @@
* 'testStatefulLocal') on the Callee bean defining a local
* and a remote client view.
*/
+ @Test
public void testStatefulBoth() throws Fault {
boolean pass;
]
expected:
"//package com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics;
package com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics;
import java.util.Properties;
import com.sun.javatest.Status;
import com.sun.ts.lib.harness.EETest;
import com.sun.ts.lib.util.TSNamingContext;
import com.sun.ts.lib.util.TestUtil;
import com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBean;
import com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanHome;
import com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.Client;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* An example of a larger conversion test. This is read in as a source file by the
* JavaTestToArqTest#testLargeCase() method so that it can be updated easily
* and syntax checked. The class name and package are replaced by the testLargeCase method.
*/
@Disabled
public class LargeCase extends EETest {
@Deployment(testable = false)
public static Archive<?> deployment() {
final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "ejb_bb_ssl_argsemantics.ear");
// Add ear submodules
JavaArchive ejb_bb_ssl_argsemantics_client_jar = ShrinkWrap.create(JavaArchive.class, "ejb_bb_ssl_argsemantics_client_jar");
ejb_bb_ssl_argsemantics_client_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBean.class);
ejb_bb_ssl_argsemantics_client_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanHome.class);
ejb_bb_ssl_argsemantics_client_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.Client.class);
ear.addAsModule(ejb_bb_ssl_argsemantics_client_jar);
JavaArchive ejb_bb_ssl_argsemantics_ejb_jar = ShrinkWrap.create(JavaArchive.class, "ejb_bb_ssl_argsemantics_ejb_jar");
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBean.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanEJB.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.SimpleArgument.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCallee.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeEJB.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeLocal.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeLocalHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatefulWrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatelessWrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.testlogic.ejb.bb.argsemantics.TestLogic.class);
ear.addAsModule(ejb_bb_ssl_argsemantics_ejb_jar);
return ear;
}
private static final String testName = "SessionBeanTest";
private static final String beanLookup = "java:comp/env/ejb/Caller";
private CallerBean bean = null;
private CallerBeanHome beanHome = null;
private Properties props = null;
private TSNamingContext nctx = null;
public static void main(String[] args) {
Client theTests = new Client();
Status s = theTests.run(args, System.out, System.err);
s.exit();
}
/**
* @class.setup_props: org.omg.CORBA.ORBClass; java.naming.factory.initial;
* generateSQL;
*/
public void setup(String[] args, Properties props) throws Fault {
try {
logMsg("[Client] setup()");
this.props = props;
logTrace("[Client] Getting Naming Context...");
nctx = new TSNamingContext();
logTrace("[Client] Looking up " + beanLookup);
beanHome = (CallerBeanHome) nctx.lookup(beanLookup, CallerBeanHome.class);
logTrace("[Client] Create EJB instance...");
bean = (CallerBean) beanHome.create();
} catch (Exception e) {
throw new Fault("Setup failed:", e);
}
}
/**
* @testName: testStatefulRemote
*
* @assertion_ids: EJB:SPEC:906
*
* @test_Strategy:
*
* This is applicable to : - a Session Stateful Callee bean
* defining a remote client view only (No local view). - a
* Stateless Caller bean, Calling this Callee Bean home or
* remote interface.
*
* We package in the same ejb-jar: - a Session Stateful Callee
* bean defining a remote client view only (No local view). -
* a Stateless Caller bean
*
* Remote Home arg semantics verification:
*
* - We set a non-remote object 'arg' (of type SimpleArgument)
* to an initial value. This SimpleArgument class is just a
* data structure holding an int.
*
* - The Caller bean calls the Callee Home create(...) method,
* passing this 'arg' object as an argument.
*
* - The Callee create(..) method modifies the value of the
* argument (should be a copy of 'arg')
*
* - When we return from the create method, the Caller check
* that the argument value is still set to the initial value.
*
* Remote interface arg semantics verif/loication: Same
* strategy but the Caller call a business method on the
* Callee remote interface.
*/
public void testStatefulRemote() throws Fault {
boolean pass;
try {
pass = bean.testStatefulRemote(props);
} catch (Exception e) {
throw new Fault("testStatefulRemote failed", e);
} finally {
if (null != bean) {
try {
bean.cleanUpBean();
bean.remove();
} catch (Exception e) {
TestUtil.logErr("[Client] Ignoring Exception on " + "bean remove", e);
}
}
}
if (!pass) {
throw new Fault("testStatefulRemote failed");
}
}
/**
* @testName: testStatefulLocal
*
* @assertion_ids: EJB:SPEC:907.2; EJB:SPEC:1
*
* @test_Strategy: This is applicable to : - a Session Stateful Callee bean
* defining a local client view only (No remote view).
*
* - a Stateless Caller bean, Calling this Callee Bean local
* home or local interface.
*
* We package in the same ejb-jar: - a Session Stateful Callee
* bean defining a local client view only (No remote view). -
* a Stateless Caller bean
*
* Local Home arg semantics verification:
*
* - We set a non-remote object 'arg' (of type SimpleArgument)
* to an initial value. This SimpleArgument class is just a
* data structure holding an int.
*
* - The Caller bean calls the Callee local home create(...)
* method, passing this 'arg' object as an argument.
*
* - The Callee create(..) method modifies the value of the
* argument (should be a reference to original 'arg')
*
* - When we return from the create method, the Caller check
* that the argument value is not set to the initial value,
* and reflect the changes made by the Callee.
*
* Local interface arg semantics verification:
*
* Same strategy but the Caller call a business method on the
* Callee local interface.
*/
public void testStatefulLocal() throws Fault {
boolean pass;
try {
pass = bean.testStatefulLocal(props);
} catch (Exception e) {
throw new Fault("testStatefulLocal failed", e);
} finally {
if (null != bean) {
try {
bean.cleanUpBean();
bean.remove();
} catch (Exception e) {
TestUtil.logErr("[Client] Ignoring Exception on " + "bean remove", e);
}
}
}
if (!pass) {
throw new Fault("testStatefulLocal failed");
}
}
/**
* @testName: testStatefulBoth
*
* @assertion_ids: EJB:SPEC:906; EJB:SPEC:907; EJB:SPEC:907.2
*
*
* @test_Strategy: This is applicable to :
*
* - a Session Stateful Callee bean defining a remote AND a
* local client view.
*
* - a Stateless Caller bean, Calling this Callee Bean home,
* local home, remote, or local interface.
*
* The test strategy is a cumulated version of the two
* previous tests ('testStatefulRemote' and
* 'testStatefulLocal') on the Callee bean defining a local
* and a remote client view.
*/
public void testStatefulBoth() throws Fault {
boolean pass;
try {
pass = bean.testStatefulBoth(props);
} catch (Exception e) {
throw new Fault("testStatefulBoth failed", e);
} finally {
if (null != bean) {
try {
bean.cleanUpBean();
bean.remove();
} catch (Exception e) {
TestUtil.logErr("[Client] Ignoring Exception on " + "bean remove", e);
}
}
}
if (!pass) {
throw new Fault("testStatefulBoth failed");
}
}
public void cleanup() throws Fault {
logMsg("[Client] cleanup()");
}
}"
but was:
"//package com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics;
package com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics;
import java.util.Properties;
import com.sun.javatest.Status;
import com.sun.ts.lib.harness.EETest;
import com.sun.ts.lib.util.TSNamingContext;
import com.sun.ts.lib.util.TestUtil;
import com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBean;
import com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanHome;
import com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.Client;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* An example of a larger conversion test. This is read in as a source file by the
* JavaTestToArqTest#testLargeCase() method so that it can be updated easily
* and syntax checked. The class name and package are replaced by the testLargeCase method.
*/
@Disabled
public class LargeCase extends EETest {
@Deployment(testable = false)
public static Archive<?> deployment() {
final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "ejb_bb_ssl_argsemantics.ear");
// Add ear submodules
JavaArchive ejb_bb_ssl_argsemantics_client_jar = ShrinkWrap.create(JavaArchive.class, "ejb_bb_ssl_argsemantics_client_jar");
ejb_bb_ssl_argsemantics_client_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBean.class);
ejb_bb_ssl_argsemantics_client_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanHome.class);
ejb_bb_ssl_argsemantics_client_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.Client.class);
ear.addAsModule(ejb_bb_ssl_argsemantics_client_jar);
JavaArchive ejb_bb_ssl_argsemantics_ejb_jar = ShrinkWrap.create(JavaArchive.class, "ejb_bb_ssl_argsemantics_ejb_jar");
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBean.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanEJB.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.ejb.ee.bb.session.stateless.argsemantics.CallerBeanHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20Callee.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeEJB.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeLocal.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeLocalHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.SimpleArgument.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCallee.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeEJB.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeLocal.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.StatefulCalleeLocalHome.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.CMP20Wrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatefulWrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.StatelessWrapper.class);
ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.testlogic.ejb.bb.argsemantics.TestLogic.class);
ear.addAsModule(ejb_bb_ssl_argsemantics_ejb_jar);
return ear;
}
private static final String testName = "SessionBeanTest";
private static final String beanLookup = "java:comp/env/ejb/Caller";
private CallerBean bean = null;
private CallerBeanHome beanHome = null;
private Properties props = null;
private TSNamingContext nctx = null;
public static void main(String[] args) {
Client theTests = new Client();
Status s = theTests.run(args, System.out, System.err);
s.exit();
}
/**
* @class.setup_props: org.omg.CORBA.ORBClass; java.naming.factory.initial;
* generateSQL;
*/
public void setup(String[] args, Properties props) throws Fault {
try {
logMsg("[Client] setup()");
this.props = props;
logTrace("[Client] Getting Naming Context...");
nctx = new TSNamingContext();
logTrace("[Client] Looking up " + beanLookup);
beanHome = (CallerBeanHome) nctx.lookup(beanLookup, CallerBeanHome.class);
logTrace("[Client] Create EJB instance...");
bean = (CallerBean) beanHome.create();
} catch (Exception e) {
throw new Fault("Setup failed:", e);
}
}
/**
* @testName: testStatefulRemote
*
* @assertion_ids: EJB:SPEC:906
*
* @test_Strategy:
*
* This is applicable to : - a Session Stateful Callee bean
* defining a remote client view only (No local view). - a
* Stateless Caller bean, Calling this Callee Bean home or
* remote interface.
*
* We package in the same ejb-jar: - a Session Stateful Callee
* bean defining a remote client view only (No local view). -
* a Stateless Caller bean
*
* Remote Home arg semantics verification:
*
* - We set a non-remote object 'arg' (of type SimpleArgument)
* to an initial value. This SimpleArgument class is just a
* data structure holding an int.
*
* - The Caller bean calls the Callee Home create(...) method,
* passing this 'arg' object as an argument.
*
* - The Callee create(..) method modifies the value of the
* argument (should be a copy of 'arg')
*
* - When we return from the create method, the Caller check
* that the argument value is still set to the initial value.
*
* Remote interface arg semantics verif/loication: Same
* strategy but the Caller call a business method on the
* Callee remote interface.
*/
@Test
public void testStatefulRemote() throws Fault {
boolean pass;
try {
pass = bean.testStatefulRemote(props);
} catch (Exception e) {
throw new Fault("testStatefulRemote failed", e);
} finally {
if (null != bean) {
try {
bean.cleanUpBean();
bean.remove();
} catch (Exception e) {
TestUtil.logErr("[Client] Ignoring Exception on " + "bean remove", e);
}
}
}
if (!pass) {
throw new Fault("testStatefulRemote failed");
}
}
/**
* @testName: testStatefulLocal
*
* @assertion_ids: EJB:SPEC:907.2; EJB:SPEC:1
*
* @test_Strategy: This is applicable to : - a Session Stateful Callee bean
* defining a local client view only (No remote view).
*
* - a Stateless Caller bean, Calling this Callee Bean local
* home or local interface.
*
* We package in the same ejb-jar: - a Session Stateful Callee
* bean defining a local client view only (No remote view). -
* a Stateless Caller bean
*
* Local Home arg semantics verification:
*
* - We set a non-remote object 'arg' (of type SimpleArgument)
* to an initial value. This SimpleArgument class is just a
* data structure holding an int.
*
* - The Caller bean calls the Callee local home create(...)
* method, passing this 'arg' object as an argument.
*
* - The Callee create(..) method modifies the value of the
* argument (should be a reference to original 'arg')
*
* - When we return from the create method, the Caller check
* that the argument value is not set to the initial value,
* and reflect the changes made by the Callee.
*
* Local interface arg semantics verification:
*
* Same strategy but the Caller call a business method on the
* Callee local interface.
*/
@Test
public void testStatefulLocal() throws Fault {
boolean pass;
try {
pass = bean.testStatefulLocal(props);
} catch (Exception e) {
throw new Fault("testStatefulLocal failed", e);
} finally {
if (null != bean) {
try {
bean.cleanUpBean();
bean.remove();
} catch (Exception e) {
TestUtil.logErr("[Client] Ignoring Exception on " + "bean remove", e);
}
}
}
if (!pass) {
throw new Fault("testStatefulLocal failed");
}
}
/**
* @testName: testStatefulBoth
*
* @assertion_ids: EJB:SPEC:906; EJB:SPEC:907; EJB:SPEC:907.2
*
*
* @test_Strategy: This is applicable to :
*
* - a Session Stateful Callee bean defining a remote AND a
* local client view.
*
* - a Stateless Caller bean, Calling this Callee Bean home,
* local home, remote, or local interface.
*
* The test strategy is a cumulated version of the two
* previous tests ('testStatefulRemote' and
* 'testStatefulLocal') on the Callee bean defining a local
* and a remote client view.
*/
@Test
public void testStatefulBoth() throws Fault {
boolean pass;
try {
pass = bean.testStatefulBoth(props);
} catch (Exception e) {
throw new Fault("testStatefulBoth failed", e);
} finally {
if (null != bean) {
try {
bean.cleanUpBean();
bean.remove();
} catch (Exception e) {
TestUtil.logErr("[Client] Ignoring Exception on " + "bean remove", e);
}
}
}
if (!pass) {
throw new Fault("testStatefulBoth failed");
}
}
public void cleanup() throws Fault {
logMsg("[Client] cleanup()");
}
}"
[ERROR] Errors:
[ERROR] AddArqDeploymentTest.addDeploymentMethod:43 » IllegalState AST contains missing or invalid type information
MethodInvocation->Block->MethodDeclaration->Block->ClassDeclaration->CompilationUnit
/*~~(MethodInvocation type is missing or malformed)~~>*/ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20Callee.class)
MethodInvocation->Block->MethodDeclaration->Block->ClassDeclaration->CompilationUnit
/*~~(MethodInvocation type is missing or malformed)~~>*/ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeEJB.class)
MethodInvocation->Block->MethodDeclaration->Block->ClassDeclaration->CompilationUnit
/*~~(MethodInvocation type is missing or malformed)~~>*/ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeHome.class)
MethodInvocation->Block->MethodDeclaration->Block->ClassDeclaration->CompilationUnit
/*~~(MethodInvocation type is missing or malformed)~~>*/ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeLocal.class)
MethodInvocation->Block->MethodDeclaration->Block->ClassDeclaration->CompilationUnit
/*~~(MethodInvocation type is missing or malformed)~~>*/ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.calleebeans.CMP20CalleeLocalHome.class)
MethodInvocation->Block->MethodDeclaration->Block->ClassDeclaration->CompilationUnit
/*~~(MethodInvocation type is missing or malformed)~~>*/ejb_bb_ssl_argsemantics_ejb_jar.addClass(com.sun.ts.tests.common.ejb.wrappers.CMP20Wrapper.class)
[INFO]
[ERROR] Tests run: 5, Failures: 2, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.584 s
[INFO] Finished at: 2024-07-16T09:56:19-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.1.2:test (default-test) on project tck-rewrite-tools: There are test failures.
[ERROR]
[ERROR] Please refer to /home/smarlow/tck/jakartaee-tck-tools/tools/tck-rewrite/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment