-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Changes from all commits
25769f1
7c9f2e0
8057f45
f8b4537
8aceb5b
d557a8b
5a3e4c0
4af0964
dd68bda
2e0fdba
5deb23f
22d0caf
6081bb7
db962e9
692f7d3
42057c7
2f97aaf
a6aa00d
d559f8e
0e83bcd
f8a7a43
829443b
73d5611
cd1f2f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
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 |
---|---|---|
@@ -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; | ||
} | ||
} |
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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. didn;t work using There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. Can this be improved? Sure, does it need to be fixed here, now, and in this PR? no. |
||
</excludes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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