Skip to content

Move EE test resources to jetty-core/jetty-ee/jetty-ee-test-resources #13154

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

Merged
merged 24 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
25769f1
Move EE test resources to jetty-core/jetty-ee/jetty-ee-test-resources
gregw May 19, 2025
7c9f2e0
Move EE test resources to jetty-core/jetty-ee/jetty-ee-test-resources
gregw May 19, 2025
8057f45
Merge branch 'jetty-12.1.x' into fix/jetty-12.1.x/testEeResources
gregw May 19, 2025
f8b4537
Merge remote-tracking branch 'origin/jetty-12.1.x' into fix/jetty-12.…
gregw May 20, 2025
8aceb5b
Move EE test resources to jetty-core/jetty-ee/jetty-ee-test-resources
gregw May 20, 2025
d557a8b
yet another WTF JPMS
gregw May 21, 2025
5a3e4c0
Merge branch 'jetty-12.1.x' into fix/jetty-12.1.x/testEeResources
gregw May 21, 2025
4af0964
Fix test resource
gregw May 22, 2025
dd68bda
Fix test resource
gregw May 22, 2025
2e0fdba
Support Path from jar:file: better
gregw May 23, 2025
5deb23f
Fix module name
gregw May 23, 2025
22d0caf
Fix module name
gregw May 23, 2025
6081bb7
Merge remote-tracking branch 'origin/jetty-12.1.x' into fix/jetty-12.…
gregw May 25, 2025
db962e9
Fix OSGi name
gregw May 25, 2025
692f7d3
Fix classloader dump test
gregw May 25, 2025
42057c7
Merge branch 'jetty-12.1.x' into fix/jetty-12.1.x/testEeResources
gregw May 25, 2025
2f97aaf
updates from review
gregw May 29, 2025
a6aa00d
Merge branch 'jetty-12.1.x' into fix/jetty-12.1.x/testEeResources
joakime May 29, 2025
d559f8e
Fixing merge 12.1.x into fix/jetty-12.1.x/testEeResources
joakime May 29, 2025
0e83bcd
Merge remote-tracking branch 'origin/jetty-12.1.x' into fix/jetty-12.…
joakime May 29, 2025
f8a7a43
Restore jetty-ee-test-resources dep in jetty-ee8-servlet accidentally…
joakime May 29, 2025
829443b
EE9 doesn't use common test resources
gregw May 29, 2025
73d5611
Fixed merge error
gregw May 30, 2025
cd1f2f2
Merge remote-tracking branch 'origin/jetty-12.1.x' into fix/jetty-12.…
gregw May 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build/scripts/applyEE11ToEE10.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

git diff origin/jetty-12.1.x -- jetty-ee11 | sed -e 's/ee11/ee10/g' -e 's/EE11/EE10/g' | git apply
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this script in git?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same reason the opposite direction scripts (ee10 to ee11) exist in git.
This isn't a new concept.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whenever merging 12.0.x forward to 12.1.x, the other script has been used to move changes from ee10 to ee11. Now that we are increasingly doing changes directly to ee11, it is good to have the ability to merge the other direction

10 changes: 5 additions & 5 deletions jetty-core/jetty-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@
<artifactId>jetty-deploy</artifactId>
<version>12.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-ee</artifactId>
<version>12.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-ethereum</artifactId>
Expand Down Expand Up @@ -175,6 +170,11 @@
<artifactId>jetty-core-demo-handler</artifactId>
<version>12.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee</groupId>
<artifactId>jetty-ee-webapp</artifactId>
<version>12.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.fcgi</groupId>
<artifactId>jetty-fcgi-client</artifactId>
Expand Down
17 changes: 17 additions & 0 deletions jetty-core/jetty-ee/jetty-ee-test-resources/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.eclipse.jetty.ee</groupId>
<artifactId>jetty-ee</artifactId>
<version>12.1.0-SNAPSHOT</version>
</parent>
<artifactId>jetty-ee-test-resources</artifactId>
<name>Core :: EE Common :: Test Resources</name>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,8 @@
// ========================================================================
//

public class Foo implements java.io.Serializable
module org.eclipse.jetty.ee.test.resources
{
int myI = 0;

public Foo()
{
}

public void setI(int i)
{
myI = i;
}

public int getI()
{
return myI;
}

public boolean equals(Object o)
{
return ((Foo)o).getI() == myI;
}
requires transitive org.eclipse.jetty.util;
exports org.eclipse.jetty.ee.test.resources;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
//
// ========================================================================
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//

package org.eclipse.jetty.ee.test.resources;

import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.FileSystem;
import java.nio.file.FileSystemNotFoundException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Map;

public class TestEEResources
{
public static final String CONTEXT_RESOURCES = "/contextResources";

public static URL getResource(String name)
{
return TestEEResources.class.getResource(name);
}

public static InputStream getResourceAsStream(String name)
{
return TestEEResources.class.getResourceAsStream(name);
}

public static Path getResourceAsPath(String name)
{
URL url = TestEEResources.class.getResource(name);
if (url == null)
return null;
try
{
URI uri = url.toURI();
// Handle resources from JAR
if ("jar".equals(uri.getScheme()))
{
try
{
FileSystem fileSystem;
try
{
fileSystem = FileSystems.getFileSystem(uri);
}
catch (FileSystemNotFoundException e)
{
// Since this is for testing, this file system is never closed and lives as longs as the JVM.
fileSystem = FileSystems.newFileSystem(uri, Map.of());
}
String fullPath = uri.toString();
String resourcePath = fullPath.substring(fullPath.indexOf("!/") + 2);
return fileSystem.getPath(resourcePath).toAbsolutePath();
}
catch (IOException e)
{
throw new RuntimeException("Failed to access JAR resource", e);
}
}
return Paths.get(uri);
}
catch (URISyntaxException e)
{
throw new RuntimeException(e);
}
}

public static Path getResourceAsPathDir(String name)
{
Path path = getResourceAsPath(name);
assert path == null || Files.isDirectory(path);
return path;
}
}
60 changes: 60 additions & 0 deletions jetty-core/jetty-ee/jetty-ee-webapp/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty.ee</groupId>
<artifactId>jetty-ee</artifactId>
<version>12.1.0-SNAPSHOT</version>
</parent>
<artifactId>jetty-ee-webapp</artifactId>
<name>Core :: EE Common :: Webapp</name>

<properties>
<bundle-symbolic-name>${project.groupId}.webapp</bundle-symbolic-name>
<spotbugs.onlyAnalyze>org.eclipse.jetty.ee.webapp.*</spotbugs.onlyAnalyze>
</properties>

<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>jetty-test-multipart</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>@{argLine} ${jetty.surefire.argLine} --add-reads org.eclipse.jetty.ee.webapp=org.eclipse.jetty.logging</argLine>
<excludes>
<!-- This class modifies internal JVM statics, and causes problems in parallel testing -->
<exclude>org.eclipse.jetty.ee.webapp.WebAppClassLoaderUrlStreamTest</exclude>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn;t work using @Isolated?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same thing that exists in 12.0.x, in the same technique.

https://github.com/jetty/jetty.project/blob/jetty-12.0.x/jetty-ee10/jetty-ee10-webapp/pom.xml#L99-L101

Can this be improved? Sure, does it need to be fixed here, now, and in this PR? no.

</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://jetty.org/configure_10_0.dtd">

<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call class="org.eclipse.jetty.ee.WebAppClassLoading" name="addProtectedClasses">
<Call class="org.eclipse.jetty.ee.webapp.WebAppClassLoading" name="addProtectedClasses">
<Arg><Ref refid="Server"/></Arg>
<Arg>
<Call class="org.eclipse.jetty.util.StringUtil" name="csvSplit">
Expand All @@ -11,7 +11,7 @@
</Arg>
</Call>

<Call class="org.eclipse.jetty.ee.WebAppClassLoading" name="addHiddenClasses">
<Call class="org.eclipse.jetty.ee.webapp.WebAppClassLoading" name="addHiddenClasses">
<Arg><Ref refid="Server"/></Arg>
<Arg>
<Call class="org.eclipse.jetty.util.StringUtil" name="csvSplit">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This module provide common configuration of Java Servlet web applications over a
etc/jetty-ee-webapp.xml

[lib]
lib/jetty-ee-${jetty.version}.jar
lib/jetty-ee-webapp-${jetty.version}.jar

[ini-template]
# tag::ini-template[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
// ========================================================================
//

module org.eclipse.jetty.ee
module org.eclipse.jetty.ee.webapp
{
requires org.slf4j;

requires transitive org.eclipse.jetty.util;
requires transitive org.eclipse.jetty.server;
requires java.instrument;

exports org.eclipse.jetty.ee;
exports org.eclipse.jetty.ee.webapp;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// ========================================================================
//

package org.eclipse.jetty.ee;
package org.eclipse.jetty.ee.webapp;

import java.io.IOException;
import java.net.URL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// ========================================================================
//

package org.eclipse.jetty.ee;
package org.eclipse.jetty.ee.webapp;

import java.io.IOException;
import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// ========================================================================
//

package org.eclipse.jetty.ee;
package org.eclipse.jetty.ee.webapp;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.Attributes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// ========================================================================
//

package org.eclipse.jetty.ee;
package org.eclipse.jetty.ee.webapp;

import java.io.IOException;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// ========================================================================
//

package org.eclipse.jetty.ee;
package org.eclipse.jetty.ee.webapp;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// ========================================================================
//

package org.eclipse.jetty.ee;
package org.eclipse.jetty.ee.webapp;

import java.io.InputStream;
import java.lang.instrument.ClassFileTransformer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// ========================================================================
//

package org.eclipse.jetty.ee;
package org.eclipse.jetty.ee.webapp;

import java.net.URLStreamHandler;
import java.net.URLStreamHandlerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// ========================================================================
//

package org.eclipse.jetty.ee;
package org.eclipse.jetty.ee.webapp;

import java.util.Arrays;

Expand Down
Loading