Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor assembly module tests #1546

Merged
merged 6 commits into from
Nov 8, 2024
Merged

Conversation

alwin-joseph
Copy link
Contributor

@alwin-joseph alwin-joseph commented Sep 30, 2024

Fixes Issue
#1477

Describe the change

  • Refactor the assembly module tests and created glassfish runner

@alwin-joseph
Copy link
Contributor Author

TSNamingContext lookup issue:

I was getting javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or in an application resource file: java.naming.factory.initial

When I added glassfish-naming.jar in the classpath I am getting below:

javax.naming.CommunicationException: Lookup failed. [Root exception is java.lang.NullPointerException: Cannot invoke "com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(org.glassfish.api.naming.SimpleJndiName, com.sun.enterprise.naming.impl.SerialContext)" because "com.sun.enterprise.naming.impl.JavaURLContext.namingManager" is null

Hi @dmatej Would you know if setting java.naming.factory.initial(I tried setting it to com.sun.enterprise.naming.impl.SerialInitContextFactory, it did not help) or any other property would help fix this issue with glassfish.

cc @gurunrao

@scottmarlow
Copy link
Contributor

scottmarlow commented Oct 16, 2024

This sounds like OmniFish-EE/arquillian-container-glassfish#4 to me.

The symptoms are any test that involves Jakarta EE Application Client deployment trying to call an EJB bean but only the EJB client classes are expected to reside in the Application Client, the EJB bean implementation is expected to only be available via the GlassFish Platform implementation (server).

The cause is that the GlassFish server is not started and the test EAR is also not copied to the GlassFish server. I tried to hack around this by pre-starting the GF server but we really need proper support for starting the GlassFish Application Client and Server (as well as copy EAR deployment to both).

@starksm64
Copy link
Contributor

This is a different issue. @alwin-joseph you need to synch your fork with the current main branch as with the following changes:

starksm@Scotts-Mac-Studio assembly % git diff
diff --git a/assembly/pom.xml b/assembly/pom.xml
index 121e9bb3c..96d6fb281 100644
--- a/assembly/pom.xml
+++ b/assembly/pom.xml
@@ -36,7 +36,7 @@
         <arquillian.junit>1.9.1.Final</arquillian.junit>
         <jakarta.platform.version>11.0.0-M2</jakarta.platform.version>
         <junit.jupiter.version>5.10.2</junit.jupiter.version>
-        <version.jakarta.tck.arquillian>1.0.0-M17</version.jakarta.tck.arquillian>
+        <version.jakarta.tck.arquillian>${project.version}</version.jakarta.tck.arquillian>
     </properties>
 
     <dependencyManagement>
diff --git a/assembly/src/main/java/com/sun/ts/tests/assembly/standalone/jar/Client.java b/assembly/src/main/java/com/sun/ts/tests/assembly/standalone/jar/Client.java
index 5780ce862..4f517f2f7 100644
--- a/assembly/src/main/java/com/sun/ts/tests/assembly/standalone/jar/Client.java
+++ b/assembly/src/main/java/com/sun/ts/tests/assembly/standalone/jar/Client.java
@@ -145,6 +145,8 @@ public class Client extends EETest {
         com.sun.ts.tests.assembly.standalone.jar.TestBeanEJB.class,
         com.sun.ts.tests.common.ejb.wrappers.Stateless3xWrapper.class,
         com.sun.ts.lib.util.RemoteLoggingInitException.class,
+        com.sun.ts.lib.util.TestReportInfo.class,
+        com.sun.ts.lib.util.TestUtil.class,
         com.sun.ts.tests.assembly.standalone.jar.Client.class);
     // The application-client.xml descriptor
     URL resURL = Client.class.getResource("assembly_standalone_jar_component_ejb.xml");
diff --git a/glassfish-runner/assembly-tck/jakartaeetck/logging.properties b/glassfish-runner/assembly-tck/jakartaeetck/logging.properties
index 6f201caab..fa36e044e 100644
--- a/glassfish-runner/assembly-tck/jakartaeetck/logging.properties
+++ b/glassfish-runner/assembly-tck/jakartaeetck/logging.properties
@@ -8,7 +8,7 @@ handlers=java.util.logging.FileHandler,java.util.logging.ConsoleHandler
 
 #Concurrency logger - By default log everything for concurrency loggers
 org.glassfish.level=ALL
-com.sun.level=ALL
+com.sun.level=FINEST
 jakarta.enterprise.level=ALL
 
 #Formatting for the simple formatter
diff --git a/glassfish-runner/assembly-tck/pom.xml b/glassfish-runner/assembly-tck/pom.xml
index c95ff051d..785e974c2 100644
--- a/glassfish-runner/assembly-tck/pom.xml
+++ b/glassfish-runner/assembly-tck/pom.xml
@@ -40,7 +40,7 @@
         <junit.jupiter.version>5.10.2</junit.jupiter.version>
         <tck.artifactId>assembly-tck</tck.artifactId>
         <tck.version>11.0.0-SNAPSHOT</tck.version>
-        <ts.home>/jakartaeetck</ts.home>
+        <ts.home>./jakartaeetck</ts.home>
         <version.jakarta.tck>11.0.0-SNAPSHOT</version.jakarta.tck>
         <version.jakarta.tck.arquillian>1.0.0-M17</version.jakarta.tck.arquillian>
     </properties>
@@ -224,6 +224,12 @@
     </dependencies>
 
     <build>
+        <testResources>
+            <testResource>
+                <filtering>true</filtering>
+                <directory>src/test/resources</directory>
+            </testResource>
+        </testResources>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -411,7 +417,8 @@
                                 <!-- <additionalClasspathElement>${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/gf-client.jar</additionalClasspathElement> -->
                             </additionalClasspathElements>
                             <includes>
-                                <include>com/sun/ts/tests/assembly/altDD/Client.java</include>
+                                <include>com/sun/ts/tests/assembly/standalone/jar/Client.java</include>
+                                <!--
                                 <include>com/sun/ts/tests/assembly/classpath/appclient/Client.java</include>
                                 <include>com/sun/ts/tests/assembly/classpath/ejb/Client.java</include>
                                 <include>com/sun/ts/tests/assembly/compat/cocktail/compat9_10/Client.java</include>
@@ -420,6 +427,7 @@
                                 <include>com/sun/ts/tests/assembly/compat/standalone/war/compat9_10/Client.java</include>
                                 <include>com/sun/ts/tests/assembly/standalone/jar/Client.java</include>
                                 <include>com/sun/ts/tests/assembly/standalone/war/Client.java</include>
+                                -->
                             </includes>
                             <dependenciesToScan>jakarta.tck:${tck.artifactId}</dependenciesToScan>
                             <systemPropertyVariables>
diff --git a/glassfish-runner/assembly-tck/src/test/resources/appclient-arquillian.xml b/glassfish-runner/assembly-tck/src/test/resources/appclient-arquillian.xml
index 393c4b9dd..6e83dbc42 100644
--- a/glassfish-runner/assembly-tck/src/test/resources/appclient-arquillian.xml
+++ b/glassfish-runner/assembly-tck/src/test/resources/appclient-arquillian.xml
@@ -46,6 +46,7 @@
                 -DwebServerHost.2=localhost \
                 -DwebServerPort.2=8080 \
                 -Ddeliverable.class=com.sun.ts.lib.deliverable.cts.CTSDeliverable \
+                -Djava.util.logging.config.file=jakartaeetck/logging.properties \
                 -jar \
                 ${clientEarDir}/${clientAppArchive}
             </property>
@@ -53,7 +54,7 @@
             <!-- Pass ENV vars here -->
             <!-- <property name="clientEnvString">PATH=${env.PATH};LD_LIBRARY_PATH=${glassfish.home}/lib;AS_DEBUG=true;
                 APPCPATH=${glassfish.home}/glassfish/lib/arquillian-protocol-lib.jar:${glassfish.home}/glassfish/lib/tck-porting-lib.jar:target/appclient/lib/arquillian-core.jar:target/appclient/lib/arquillian-junit5.jar:${glassfish.home}/glassfish/modules/security.jar</property> -->
-            <property name="clientEnvString">PATH=${env.PATH};LD_LIBRARY_PATH=${glassfish.home}/lib;AS_DEBUG=true;
+            <property name="clientEnvString">AS_JAVA=${env.JAVA_HOME};PATH=${env.PATH};LD_LIBRARY_PATH=${glassfish.home}/lib;AS_DEBUG=true;
                 APPCPATH=target/lib/arquillian-protocol-lib.jar:target/lib/tck-porting-lib.jar:target/appclient/lib/arquillian-core.jar:target/appclient/lib/arquillian-junit5.jar:${glassfish.home}/glassfish/modules/security.jar:${glassfish.home}/glassfish/lib/gf-client.jar</property>
             <property name="clientDir">${project.basedir}</property>
             <property name="workDir">/tmp</property>

I'm seeing CNFE errors due to missing changes in other modules in the platform-tck.

@alwin-joseph alwin-joseph marked this pull request as ready for review November 8, 2024 14:51
@alwin-joseph
Copy link
Contributor Author

Merging this now to address the test failures separately.

@alwin-joseph alwin-joseph merged commit df92605 into jakartaee:main Nov 8, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants