Skip to content

Commit

Permalink
Merge pull request #24581 from OndroMih/ondromih-gf-embedded-maven-pl…
Browse files Browse the repository at this point in the history
…ugin-tests

Enable GF Embedded test suite - part 3 (GF Embedded Maven plugin)
  • Loading branch information
hs536 authored Sep 12, 2023
2 parents 45c4837 + f0e5fc6 commit 1d75153
Show file tree
Hide file tree
Showing 64 changed files with 1,148 additions and 1,501 deletions.
69 changes: 40 additions & 29 deletions appserver/tests/embedded/maven-plugin/applicationDispatcher/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) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -30,33 +31,43 @@
<packaging>war</packaging>
<name>Application Dispatcher Test (maven-plugin/applicationDispatcher)</name>

<build>
<plugins>
<plugin>
<groupId>org.glassfish.embedded</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<executions>
<execution>
<id>start</id>
<phase>integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>start-embedded</id>
<activation>
<property>
<name>!skipTests</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.glassfish.embedded</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
Expand All @@ -67,8 +78,8 @@
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
</dependencies>
</project>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -16,17 +17,12 @@

package org.glassfish.tests.applicationDispatcher;

import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.URL;
import java.net.URLConnection;

Expand All @@ -37,7 +33,7 @@ public class WebTest {

private String contextPath = "test";

@BeforeClass
@BeforeAll
public static void setup() throws IOException {
}

Expand Down Expand Up @@ -66,7 +62,7 @@ private static void goGet(String host, int port,
}
lineNum++;
}
Assert.assertTrue(count==EXPECTED_COUNT);
Assertions.assertTrue(count==EXPECTED_COUNT);
} catch(Exception e) {
e.printStackTrace();
throw e;
Expand Down
84 changes: 47 additions & 37 deletions appserver/tests/embedded/maven-plugin/dirListing/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) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -30,41 +31,50 @@
<packaging>war</packaging>
<name>Directory Listing Test (maven-plugin/dirListing)</name>

<build>
<plugins>
<plugin>
<groupId>org.glassfish.embedded</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<configuration>
<goalPrefix>glassfish</goalPrefix>
<app>target/dirListing.war</app>
<port>8080</port>
<name>test</name>
<contextRoot>test</contextRoot>
<serverID>embedded</serverID>
</configuration>
<executions>
<execution>
<id>start</id>
<phase>integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>start-embedded</id>
<activation>
<property>
<name>!skipTests</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.glassfish.embedded</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<configuration>
<app>target/dirListing.war</app>
<port>8080</port>
<name>test</name>
<contextRoot>test</contextRoot>
<serverID>embedded</serverID>
</configuration>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
Expand All @@ -75,8 +85,8 @@
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
</dependencies>
</project>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -16,17 +17,13 @@

package org.glassfish.tests.dirListing;

import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.URL;
import java.net.URLConnection;

Expand All @@ -37,7 +34,7 @@ public class WebTest {

private String contextPath = "test";

@BeforeClass
@BeforeAll
public static void setup() throws IOException {
}

Expand Down Expand Up @@ -65,7 +62,7 @@ private static void goGet(String host, int port,
}
lineNum++;
}
Assert.assertTrue(count==EXPECTED_COUNT);
Assertions.assertTrue(count==EXPECTED_COUNT);
} catch(Exception e) {
e.printStackTrace();
throw e;
Expand Down
69 changes: 40 additions & 29 deletions appserver/tests/embedded/maven-plugin/filterURIMapping/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) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -30,33 +31,43 @@
<packaging>war</packaging>
<name>Filter URI Mapping Test (maven-plugin/filterURIMapping)</name>

<build>
<plugins>
<plugin>
<groupId>org.glassfish.embedded</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<executions>
<execution>
<id>start</id>
<phase>integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>start-embedded</id>
<activation>
<property>
<name>!skipTests</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.glassfish.embedded</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
Expand All @@ -67,8 +78,8 @@
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
</dependencies>
</project>
Expand Down
Loading

0 comments on commit 1d75153

Please sign in to comment.