diff --git a/tests/integration/pom.xml b/tests/integration/pom.xml index f1b8753f55..1c7d51acfc 100644 --- a/tests/integration/pom.xml +++ b/tests/integration/pom.xml @@ -196,6 +196,7 @@ servlet-request-wrapper-binding-2 sonar-test spring6 + test-utils tracing-support diff --git a/tests/integration/security-digest/pom.xml b/tests/integration/security-digest/pom.xml index 25ad2b53ef..e64a67b481 100644 --- a/tests/integration/security-digest/pom.xml +++ b/tests/integration/security-digest/pom.xml @@ -69,10 +69,19 @@ my-realm - ${basedir}/src/main/resources/jetty/realm.properties + + ${basedir}/src/main/resources/jetty/realm.properties + + + + org.glassfish.jersey.tests.integration + test-utils + ${project.version} + + diff --git a/tests/integration/test-utils/pom.xml b/tests/integration/test-utils/pom.xml new file mode 100644 index 0000000000..a8ba315d5a --- /dev/null +++ b/tests/integration/test-utils/pom.xml @@ -0,0 +1,37 @@ + + + + + + project + org.glassfish.jersey.tests.integration + 3.1.99-SNAPSHOT + + 4.0.0 + + test-utils + + + + org.eclipse.jetty + jetty-util + + + + \ No newline at end of file diff --git a/tests/integration/test-utils/src/main/java/org/glassfish/jersey/tests/integration/utils/JerseyPathResource.java b/tests/integration/test-utils/src/main/java/org/glassfish/jersey/tests/integration/utils/JerseyPathResource.java new file mode 100644 index 0000000000..501fcabaef --- /dev/null +++ b/tests/integration/test-utils/src/main/java/org/glassfish/jersey/tests/integration/utils/JerseyPathResource.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.glassfish.jersey.tests.integration.utils; + +import org.eclipse.jetty.util.resource.Resource; + +import java.io.File; +import java.net.URI; +import java.nio.file.Path; + +/** + * A {@link Resource} implementation with a default constructor to support using it in Maven {@code implementation} attributes. + * This is obsolete from Jetty >12.0.0.beta3. + * + * TODO: remove this + */ +public class JerseyPathResource extends Resource { + private String path; + + @Override + public Path getPath() { + return new File(path).toPath(); + } + + @Override + public boolean isContainedIn(Resource r) { + return false; + } + + @Override + public boolean isDirectory() { + return new File(path).isDirectory(); + } + + @Override + public boolean isReadable() { + return new File(path).canRead(); + } + + @Override + public URI getURI() { + return new File(path).toURI(); + } + + @Override + public String getName() { + return path; + } + + @Override + public String getFileName() { + return path; + } + + @Override + public Resource resolve(String subUriPath) { + return null; + } +}