Skip to content

Commit

Permalink
GF Embedded CDI with EJB and JPA tests work.
Browse files Browse the repository at this point in the history
Moved test profiles to parent.
Added Derby JDBC driver to GlassFish Embedded
Signed-off-by:Ondro Mihalyi <mihalyi@omnifish.ee>
  • Loading branch information
OndroMih committed Sep 4, 2023
1 parent c539aad commit 516d656
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 155 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/security/roles
appserver/tests/appserv-tests/devtests/webservice/security/*.cer
appserver/tests/appserv-tests/devtests/webservice/security/*.jks

/appserver/tests/embedded/cdi_ejb_jpa/sun-appserv-samples/
/appserver/tests/embedded/cdi_ejb_jpa/derby.log

appserver/tests/appserv-tests/temppwd

opendj-*.zip
Expand Down
13 changes: 12 additions & 1 deletion appserver/extras/embedded/all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1581,13 +1581,24 @@
</dependency>

<!-- We cannot unpack dependency from zip file, so we need classes from the jar file -->
<!-- Do we need derbyshared and derbytools here? Not included now. -->
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>${derby.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbytools</artifactId>
<version>${derby.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyshared</artifactId>
<version>${derby.version}</version>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.glassfish.main.extras</groupId>
Expand Down
42 changes: 0 additions & 42 deletions appserver/tests/embedded/basic/lifecycle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,46 +31,4 @@
<groupId>org.glassfish.tests.embedded.basic</groupId>
<artifactId>lifecycle</artifactId>
<name>Test newGlassFish(), start(), stop(), dispose() lifecyle operations</name>
<profiles>
<profile>
<id>run-with-uber-jar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
</dependencies>
</profile>
<profile>
<id>run-with-shell-jar</id>
<activation>
<property>
<name>build</name>
<value>static-shell</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-static-shell</artifactId>
<version>${project.version}</version>
<scope>system</scope>
<systemPath>${env.S1AS_HOME}/lib/embedded/glassfish-embedded-static-shell.jar
</systemPath>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
42 changes: 0 additions & 42 deletions appserver/tests/embedded/cdi_basic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,46 +34,4 @@
<build>
<finalName>cdi_basic</finalName>
</build>
<profiles>
<profile>
<id>run-with-uber-jar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
</dependencies>
</profile>
<profile>
<id>run-with-shell-jar</id>
<activation>
<property>
<name>build</name>
<value>static-shell</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-static-shell</artifactId>
<version>${project.version}</version>
<scope>system</scope>
<systemPath>${env.S1AS_HOME}/lib/embedded/glassfish-embedded-static-shell.jar
</systemPath>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
73 changes: 8 additions & 65 deletions appserver/tests/embedded/cdi_ejb_jpa/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023 Contributors to the Eclipse Foundation.
Copyright (c) 2011, 2021 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
Expand All @@ -20,75 +21,17 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.glassfish.tests</groupId>
<artifactId>embedded</artifactId>
<version>7.0.9-SNAPSHOT</version>
</parent>

<groupId>org.glassfish.tests.embedded.basic</groupId>
<artifactId>cdi_ejb_jpa</artifactId>
<version>7.0.9-SNAPSHOT</version>
<name>CDI, EJB, JPA integration test</name>
<build>
<finalName>cdi_ejb_jpa</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<useSystemClassLoader>false</useSystemClassLoader>
<useManifestOnlyJar>false</useManifestOnlyJar>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>run-with-uber-jar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>run-with-shell-jar</id>
<activation>
<property>
<name>build</name>
<value>static-shell</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-static-shell</artifactId>
<version>${project.version}</version>
<scope>system</scope>
<systemPath>${env.S1AS_HOME}/lib/embedded/glassfish-embedded-static-shell.jar
</systemPath>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation.
* Copyright (c) 2011, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -16,16 +17,14 @@

package org.glassfish.tests.embedded.cdi_ejb_jpa;

import junit.framework.Assert;
import org.glassfish.embeddable.Deployer;
import org.glassfish.embeddable.GlassFish;
import org.glassfish.embeddable.GlassFishProperties;
import org.glassfish.embeddable.GlassFishRuntime;
import org.glassfish.embeddable.archive.ScatteredArchive;
import org.glassfish.embeddable.archive.ScatteredEnterpriseArchive;
import org.glassfish.embeddable.web.HttpListener;
import org.glassfish.embeddable.web.WebContainer;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.BufferedReader;
import java.io.File;
Expand All @@ -38,6 +37,7 @@
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import org.junit.jupiter.api.Assertions;

/**
* @author bhavanishankar@dev.java.net
Expand Down Expand Up @@ -65,7 +65,7 @@ public void test() throws Exception {
Deployer deployer = glassfish.getDeployer();
String appname = deployer.deploy(warURI);
System.out.println("Deployed [" + appname + "]");
Assert.assertEquals(appname, "cdi_ejb_jpa");
Assertions.assertEquals(appname, "cdi_ejb_jpa");

// Now create a http listener and access the app.
WebContainer webcontainer = glassfish.getService(WebContainer.class);
Expand Down Expand Up @@ -97,7 +97,7 @@ private void get(String urlStr, String result) throws Exception {
found = true;
}
}
Assert.assertTrue(found);
Assertions.assertTrue(found);
System.out.println("\n***** SUCCESS **** Found [" + result + "] in the response.*****\n");
}

Expand Down
44 changes: 44 additions & 0 deletions appserver/tests/embedded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,48 @@
<module>maven-plugin</module>
<module>web</module>
</modules>

<profiles>
<profile>
<id>run-with-uber-jar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
</dependencies>
</profile>
<profile>
<id>run-with-shell-jar</id>
<activation>
<property>
<name>build</name>
<value>static-shell</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-static-shell</artifactId>
<version>${project.version}</version>
<scope>system</scope>
<systemPath>${env.S1AS_HOME}/lib/embedded/glassfish-embedded-static-shell.jar
</systemPath>
</dependency>
</dependencies>
</profile>
</profiles>

</project>

0 comments on commit 516d656

Please sign in to comment.