Skip to content
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
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ If Maven needs to be invoked directly, only do so from the repository root.
* Run multiple tests: `make test-single MODULE=apiserver TEST="FooTest,BarTest"`
* Clean: `make clean`
* Clean build cache: `make clean-build-cache`
* Run e2e tests: `make test-e2e`
* Lint (Java): `make lint-java`
* Lint (OpenAPI): `make lint-openapi`
* Lint (Protobuf): `make lint-proto`
Expand Down
6 changes: 6 additions & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ Run a single test method:
make test-single MODULE=apiserver TEST="FooTest#testFoo"
```

Run e2e tests:

```shell
make test-e2e
```

## Dev Mode

Dev mode launches the API server with auto-provisioned containers for PostgreSQL, Kafka,
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ apiserver-dev:
$(MVN) $(MVN_FLAGS) -q -Pquick,dev-services -pl apiserver -am verify
.PHONY: apiserver-dev

test-e2e: build-image
$(MVND) $(MVN_FLAGS) -pl e2e -DskipE2E=false verify
.PHONY: test-e2e

clean:
$(MVND) $(MVN_FLAGS) -q -Dmaven.build.cache.enabled=false clean
.PHONY: clean
Expand Down
148 changes: 148 additions & 0 deletions e2e/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ This file is part of Dependency-Track.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
~ SPDX-License-Identifier: Apache-2.0
~ Copyright (c) OWASP Foundation. All Rights Reserved.
-->
<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.dependencytrack</groupId>
<artifactId>dependency-track-parent</artifactId>
<version>5.7.0-alpha.3-SNAPSHOT</version>
</parent>

<artifactId>e2e</artifactId>
<packaging>jar</packaging>

<name>End-to-End Tests</name>

<properties>
<checkstyle.skip>true</checkstyle.skip>
<cyclonedx.skip>true</cyclonedx.skip>
<jacoco.skip>true</jacoco.skip>
<maven.install.skip>true</maven.install.skip>
<skipE2E>true</skipE2E>
</properties>

<dependencies>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-jaxrs3</artifactId>
</dependency>

<dependency>
<groupId>com.icegreen</groupId>
<artifactId>greenmail-junit5</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-jvm</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.adobe.testing</groupId>
<artifactId>s3mock-testcontainers</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-postgresql</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.5.5</version>
<configuration>
<skipTests>${skipE2E}</skipTests>
<includes>
<include>**/*E2ET.java</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* This file is part of Dependency-Track.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
* Copyright (c) OWASP Foundation. All Rights Reserved.
*/
package org.dependencytrack.e2e.api;

import feign.RequestInterceptor;
import feign.RequestTemplate;

public class ApiAuthInterceptor implements RequestInterceptor {

private static String bearerToken;
private static String apiKey;

@Override
public void apply(final RequestTemplate requestTemplate) {
if (apiKey != null) {
requestTemplate.header("X-Api-Key", apiKey);
} else if (bearerToken != null) {
requestTemplate.header("Authorization", "Bearer " + bearerToken);
}
}

public static void setBearerToken(final String bearerToken) {
ApiAuthInterceptor.bearerToken = bearerToken;
}

public static void setApiKey(final String apiKey) {
ApiAuthInterceptor.apiKey = apiKey;
}

public static void reset() {
ApiAuthInterceptor.bearerToken = null;
ApiAuthInterceptor.apiKey = null;
}

}
Loading
Loading