Skip to content
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

test containers and jakarta upgrade #248

Merged
merged 21 commits into from
Jul 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ jobs:
- name: Build with Maven
run: mvn --batch-mode --update-snapshots package

- name: Locally install filter
run: mvn install --batch-mode

- name: Locally install example
working-directory: container-test/example-webapp
run: mvn install --batch-mode

- name: Run container tests
working-directory: container-test/test-with-testcontainers
run: mvn test --batch-mode

# - uses: actions/upload-artifact@v3
# with:
# name: Package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
*/
package org.tuckey.web.filters.urlrewrite.annotation;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

Expand Down
13 changes: 0 additions & 13 deletions container-test/README.md

This file was deleted.

78 changes: 78 additions & 0 deletions container-test/example-webapp/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<project>

<modelVersion>4.0.0</modelVersion>
<groupId>org.tuckey</groupId>
<artifactId>example-webapp</artifactId>
<packaging>war</packaging>
<version>5.0.0-SNAPSHOT</version>
<name>Example Webapp</name>
<url>http://www.tuckey.org/urlrewrite/</url>
<inceptionYear>2001</inceptionYear>
<description>Example webapp for Integration tests for UrlRewriteFilter</description>
<organization>
<name>Paul Tuckey</name>
</organization>

<licenses>
<license>
<name>BSD</name>
<url>http://www.opensource.org/licenses/bsd-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
<name>Paul Tuckey</name>
</developer>
</developers>

<build>
<finalName>webapp</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<webResources>
<resource>
<targetPath>WEB-INF</targetPath>
<directory>target</directory>
<includes>
<include>urlrewrite-generated.xml</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<!-- run `mvn install` locally root of project -->
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
<version>5.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
/**
* Copyright (c) 2005-2007, Paul Tuckey
* All rights reserved.
* ====================================================================
* Licensed under the BSD License. Text as follows.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* - Neither the name tuckey.org nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*/
package org.tuckey.web.filters.urlrewriteviacontainer;
import org.tuckey.web.filters.urlrewrite.extend.RewriteMatch;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Mock RewriteMatch that can be used for testing. Included here and not in test folder as it needs to be deployed with
* the main library.
*
* @author Paul Tuckey
* @version $Revision: 33 $ $Date: 2006-09-12 16:41:56 +1200 (Tue, 12 Sep 2006) $
*/
public class MockRewriteMatch extends RewriteMatch {
private static long calledTime = 0;
public boolean execute(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
calledTime = System.currentTimeMillis();
try {
Thread.sleep(10);
} catch (InterruptedException e) {
// don't worry
}
return true;
}
public static long getCalledTime() {
return calledTime;
}
}
/**
* Copyright (c) 2005-2007, Paul Tuckey
* All rights reserved.
* ====================================================================
* Licensed under the BSD License. Text as follows.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* - Neither the name tuckey.org nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*/
package org.tuckey.web.filters.urlrewriteviacontainer;

import org.tuckey.web.filters.urlrewrite.extend.RewriteMatch;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;


/**
* Mock RewriteMatch that can be used for testing. Included here and not in test folder as it needs to be deployed with
* the main library.
*
* @author Paul Tuckey
* @version $Revision: 33 $ $Date: 2006-09-12 16:41:56 +1200 (Tue, 12 Sep 2006) $
*/
public class MockRewriteMatch extends RewriteMatch {

private static long calledTime = 0;

public boolean execute(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
calledTime = System.currentTimeMillis();
try {
Thread.sleep(10);
} catch (InterruptedException e) {
// don't worry
}
return true;
}

public static long getCalledTime() {
return calledTime;
}
}
Loading