Skip to content

Commit a5d0d8f

Browse files
committed
Fix project build.
1 parent 863ca0a commit a5d0d8f

File tree

137 files changed

+9833
-4800
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+9833
-4800
lines changed

Diff for: .dockerignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Ignore build-related folders
2+
**/target
3+
**/node_modules
4+
5+
# Ignore Docker files
6+
.dockerignore
7+
Dockerfile

Diff for: .github/workflows/build.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
java: [17, 21]
11+
name: "Java ${{ matrix.java }} build"
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up JDK
15+
uses: actions/setup-java@v3
16+
with:
17+
java-version: ${{ matrix.java }}
18+
distribution: 'temurin'
19+
- name: Cache Maven packages
20+
uses: actions/cache@v3
21+
with:
22+
path: ~/.m2
23+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
24+
restore-keys: ${{ runner.os }}-m2
25+
- name: Run the Maven verify phase
26+
run: mvn -B verify --file pom.xml

Diff for: .gitignore

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1+
# Maven
2+
dependency-reduced-pom.xml
13
target/
2-
.idea/
4+
test-output/
5+
6+
# MacOS
7+
.DS_Store
8+
9+
# IDEA
310
*.iml
4-
.classpath
11+
.idea/
12+
13+
# Eclipse
514
.project
6-
.settings/
15+
.settings
16+
.classpath
17+
18+
# VSCode
19+
.vscode/

Diff for: Dockerfile

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
FROM --platform=$BUILDPLATFORM debian:bullseye-slim AS project-build
2+
3+
# Install build dependencies
4+
RUN \
5+
apt-get update && \
6+
apt-get install -y --no-install-recommends openjdk-17-jdk maven unzip chromium git && \
7+
# Workaround Chromium binary path for arm64 (see https://github.com/puppeteer/puppeteer/blob/v4.0.0/src/Launcher.ts#L110)
8+
ln -s /usr/bin/chromium /usr/bin/chromium-browser
9+
10+
# Configure headless Chromium for Puppeteer
11+
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
12+
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
13+
# Use '--no-sandbox' option for Puppeteer's Chromium because of incompatibility with Docker
14+
ENV DISABLE_PUPPETEER_SANDBOX=true
15+
16+
# Copy project files
17+
WORKDIR /project
18+
COPY . .
19+
20+
# Perform actual Wren:IG build
21+
ARG BUILD_ARGS
22+
RUN \
23+
--mount=type=cache,target=/root/.m2 \
24+
--mount=type=cache,target=/root/.npm \
25+
mvn package ${BUILD_ARGS}
26+
27+
# Copy built artifact into target directory
28+
RUN \
29+
mkdir /build && \
30+
mvn -Dexpression=project.version -q -DforceStdout help:evaluate > /build/version.txt && \
31+
unzip openig-war/target/wrenig-$(cat /build/version.txt).war -d /build/wrenig
32+
33+
34+
FROM tomcat:9-jdk17-temurin
35+
36+
# Set environment variables
37+
ENV \
38+
WRENIG_HOME="/srv/wrenig" \
39+
JAVA_OPTS=" \
40+
-Dopenig.base=/srv/wrenig \
41+
" \
42+
CATALINA_OPTS="-server -Xmx512m"
43+
44+
# Create wrenig user
45+
ARG WRENIG_UID=1000
46+
ARG WRENIG_GID=1000
47+
RUN addgroup --gid ${WRENIG_GID} wrenig && \
48+
adduser --uid ${WRENIG_UID} --gid ${WRENIG_GID} --system wrenig
49+
50+
# Deploy wrenig project
51+
COPY --chown=wrenig:root --from=project-build /build/wrenig /usr/local/tomcat/webapps/ROOT
52+
53+
USER ${WRENIG_UID}
54+
WORKDIR ${WRENIG_HOME}
55+
56+
# Prepare Wren:IG configuration directory
57+
RUN mkdir -p $WRENIG_HOME
58+
VOLUME $WRENIG_HOME
59+
60+
CMD ["catalina.sh", "run"]

Diff for: contrib-http-framework/pom.xml

+74-67
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,84 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
The contents of this file are subject to the terms of the Common Development and
4-
Distribution License (the License). You may not use this file except in compliance with the
5-
License.
3+
The contents of this file are subject to the terms of the Common Development and
4+
Distribution License (the License). You may not use this file except in compliance with the
5+
License.
66
7-
You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
8-
specific language governing permission and limitations under the License.
7+
You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
8+
specific language governing permission and limitations under the License.
99
10-
When distributing Covered Software, include this CDDL Header Notice in each file and include
11-
the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
12-
Header, with the fields enclosed by brackets [] replaced by your own identifying
13-
information: "Portions copyright [year] [name of copyright owner]".
14-
15-
Copyright 2016 ForgeRock AS.
16-
-->
10+
When distributing Covered Software, include this CDDL Header Notice in each file and include
11+
the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
12+
Header, with the fields enclosed by brackets [] replaced by your own identifying
13+
information: "Portions copyright [year] [name of copyright owner]".
1714
15+
Copyright 2016 ForgeRock AS.
16+
Portions Copyright 2023 Wren Security.
17+
-->
1818
<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">
19-
<parent>
20-
<artifactId>openig-project</artifactId>
21-
<groupId>org.forgerock.openig</groupId>
22-
<version>5.0.0-SNAPSHOT</version>
23-
</parent>
24-
<modelVersion>4.0.0</modelVersion>
19+
<modelVersion>4.0.0</modelVersion>
20+
21+
<parent>
22+
<groupId>org.wrensecurity.wrenig</groupId>
23+
<artifactId>openig-project</artifactId>
24+
<version>5.0.0-SNAPSHOT</version>
25+
</parent>
26+
27+
<artifactId>contrib-http-framework</artifactId>
28+
29+
<name>Wren:IG - HTTP Framework contributions</name>
30+
<description>This module will temporary hold the file that to be contributed to forgerock-http-framework.</description>
31+
32+
<dependencies>
33+
<dependency>
34+
<groupId>org.wrensecurity.http</groupId>
35+
<artifactId>chf-http-core</artifactId>
36+
</dependency>
37+
38+
<dependency>
39+
<groupId>org.wrensecurity.commons.guava</groupId>
40+
<artifactId>wrensec-guava-base</artifactId>
41+
</dependency>
42+
43+
<dependency>
44+
<groupId>org.assertj</groupId>
45+
<artifactId>assertj-core</artifactId>
46+
<scope>test</scope>
47+
</dependency>
48+
49+
<dependency>
50+
<groupId>org.mockito</groupId>
51+
<artifactId>mockito-core</artifactId>
52+
<scope>test</scope>
53+
</dependency>
54+
55+
<dependency>
56+
<groupId>org.testng</groupId>
57+
<artifactId>testng</artifactId>
58+
<scope>test</scope>
59+
</dependency>
2560

26-
<artifactId>contrib-http-framework</artifactId>
27-
<name>OpenIG HTTP Framework future contributions </name>
28-
<description>This module will temporary hold the file that to be contributed to forgerock-http-framework.</description>
61+
<dependency>
62+
<groupId>org.slf4j</groupId>
63+
<artifactId>slf4j-nop</artifactId>
64+
<scope>test</scope>
65+
</dependency>
66+
</dependencies>
2967

30-
<dependencies>
31-
<dependency>
32-
<groupId>org.forgerock.http</groupId>
33-
<artifactId>chf-http-core</artifactId>
34-
</dependency>
35-
<dependency>
36-
<groupId>org.forgerock.commons.guava</groupId>
37-
<artifactId>forgerock-guava-base</artifactId>
38-
</dependency>
39-
<dependency>
40-
<groupId>org.assertj</groupId>
41-
<artifactId>assertj-core</artifactId>
42-
<scope>test</scope>
43-
</dependency>
44-
<dependency>
45-
<groupId>org.mockito</groupId>
46-
<artifactId>mockito-all</artifactId>
47-
<scope>test</scope>
48-
</dependency>
49-
<dependency>
50-
<groupId>org.testng</groupId>
51-
<artifactId>testng</artifactId>
52-
<scope>test</scope>
53-
</dependency>
54-
<dependency>
55-
<groupId>org.slf4j</groupId>
56-
<artifactId>slf4j-nop</artifactId>
57-
<scope>test</scope>
58-
</dependency>
59-
</dependencies>
68+
<build>
69+
<plugins>
70+
<plugin>
71+
<groupId>org.apache.maven.plugins</groupId>
72+
<artifactId>maven-jar-plugin</artifactId>
73+
<executions>
74+
<execution>
75+
<goals>
76+
<goal>test-jar</goal>
77+
</goals>
78+
</execution>
79+
</executions>
80+
</plugin>
81+
</plugins>
82+
</build>
6083

61-
<build>
62-
<plugins>
63-
<plugin>
64-
<groupId>org.apache.maven.plugins</groupId>
65-
<artifactId>maven-jar-plugin</artifactId>
66-
<executions>
67-
<execution>
68-
<goals>
69-
<goal>test-jar</goal>
70-
</goals>
71-
</execution>
72-
</executions>
73-
</plugin>
74-
</plugins>
75-
</build>
76-
7784
</project>

Diff for: contrib-http-framework/src/main/java/org/forgerock/http/filter/throttling/TokenBucket.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
* information: "Portions copyright [year] [name of copyright owner]".
1313
*
1414
* Copyright 2016 ForgeRock AS.
15+
* Portions Copyright 2023 Wren Security.
1516
*/
1617
package org.forgerock.http.filter.throttling;
1718

1819
import static java.util.concurrent.TimeUnit.NANOSECONDS;
1920

2021
import java.util.concurrent.atomic.AtomicReference;
2122

22-
import org.forgerock.guava.common.base.Ticker;
23+
import org.wrensecurity.guava.common.base.Ticker;
2324
import org.forgerock.util.Reject;
2425

2526
/**

Diff for: contrib-http-framework/src/main/java/org/forgerock/http/filter/throttling/TokenBucketThrottlingStrategy.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* information: "Portions copyright [year] [name of copyright owner]".
1313
*
1414
* Copyright 2016 ForgeRock AS.
15+
* Portions Copyright 2023 Wren Security.
1516
*/
1617

1718
package org.forgerock.http.filter.throttling;
@@ -28,7 +29,7 @@
2829
import java.util.concurrent.ScheduledExecutorService;
2930
import java.util.concurrent.ScheduledFuture;
3031

31-
import org.forgerock.guava.common.base.Ticker;
32+
import org.wrensecurity.guava.common.base.Ticker;
3233
import org.forgerock.util.promise.NeverThrowsException;
3334
import org.forgerock.util.promise.Promise;
3435
import org.forgerock.util.time.Duration;

Diff for: contrib-http-framework/src/test/java/org/forgerock/http/filter/ConditionalFilterTest.java

+10-9
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
* information: "Portions copyright [year] [name of copyright owner]".
1313
*
1414
* Copyright 2016 ForgeRock AS.
15+
* Portions Copyright 2023 Wren Security.
1516
*/
1617

1718
package org.forgerock.http.filter;
1819

1920
import static org.forgerock.util.promise.Promises.newResultPromise;
20-
import static org.mockito.Matchers.any;
21-
import static org.mockito.Matchers.eq;
21+
import static org.mockito.ArgumentMatchers.any;
22+
import static org.mockito.ArgumentMatchers.eq;
2223
import static org.mockito.Mockito.mock;
2324
import static org.mockito.Mockito.reset;
2425
import static org.mockito.Mockito.verify;
25-
import static org.mockito.Mockito.verifyZeroInteractions;
26+
import static org.mockito.Mockito.verifyNoInteractions;
2627
import static org.mockito.Mockito.when;
27-
import static org.mockito.MockitoAnnotations.initMocks;
2828

2929
import org.forgerock.http.ContextAndRequest;
3030
import org.forgerock.http.Filter;
@@ -34,6 +34,7 @@
3434
import org.forgerock.services.context.RootContext;
3535
import org.forgerock.util.AsyncFunction;
3636
import org.mockito.Mock;
37+
import org.mockito.MockitoAnnotations;
3738
import org.testng.annotations.BeforeMethod;
3839
import org.testng.annotations.Test;
3940

@@ -51,7 +52,7 @@ public class ConditionalFilterTest {
5152

5253
@BeforeMethod
5354
public void setUp() throws Exception {
54-
initMocks(this);
55+
MockitoAnnotations.openMocks(this);
5556
context = new RootContext();
5657
request = new Request();
5758
}
@@ -65,7 +66,7 @@ public void shouldExecuteTheDelegatedFilter() throws Exception {
6566
@Test
6667
public void shouldSkipTheDelegatedFilter() throws Exception {
6768
new ConditionalFilter(delegate, false).filter(context, request, next);
68-
verifyZeroInteractions(delegate);
69+
verifyNoInteractions(delegate);
6970
verify(next).handle(eq(context), eq(request));
7071
}
7172

@@ -79,15 +80,15 @@ public void shouldEvaluateTheConditionForEveryRequest() throws Exception {
7980
// First time the function evaluates to false
8081
filter.filter(context, request, next);
8182

82-
verifyZeroInteractions(delegate);
83+
verifyNoInteractions(delegate);
8384
verify(next).handle(eq(context), eq(request));
8485

8586
// Second time the function evaluates to true
8687
reset(delegate, next);
8788
filter.filter(context, request, next);
8889

8990
verify(delegate).filter(eq(context), eq(request), eq(next));
90-
verifyZeroInteractions(next);
91+
verifyNoInteractions(next);
9192
}
9293

9394
@Test
@@ -99,7 +100,7 @@ public void shouldSkipTheDelegatedFilterInCaseOfException() throws Exception {
99100

100101
filter.filter(context, request, next);
101102

102-
verifyZeroInteractions(delegate);
103+
verifyNoInteractions(delegate);
103104
verify(next).handle(eq(context), eq(request));
104105
}
105106
}

Diff for: contrib-http-framework/src/test/java/org/forgerock/http/filter/throttling/DefaultRateThrottlingPolicyTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
* information: "Portions copyright [year] [name of copyright owner]".
1313
*
1414
* Copyright 2015-2016 ForgeRock AS.
15+
* Portions Copyright 2023 Wren Security.
1516
*/
1617
package org.forgerock.http.filter.throttling;
1718

1819
import static org.assertj.core.api.Assertions.assertThat;
1920
import static org.forgerock.util.time.Duration.duration;
20-
import static org.mockito.Matchers.any;
21+
import static org.mockito.ArgumentMatchers.any;
2122
import static org.mockito.Mockito.mock;
2223
import static org.mockito.Mockito.verify;
2324
import static org.mockito.Mockito.when;

0 commit comments

Comments
 (0)