Skip to content

Commit

Permalink
feature: eclipse-tractusx#639 adapt integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-lcapellino committed Jun 17, 2024
1 parent 88b7fd5 commit e292065
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ spring:

jwt:
resource-client: "Integration-Test"
server:
port: 9998
management:
server:
port: 8082
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.eclipse.tractusx.traceability.integration;

import groovy.json.JsonBuilder;
import io.restassured.RestAssured;
import org.awaitility.Awaitility;
import org.eclipse.tractusx.traceability.integration.common.config.PostgreSQLConfig;
import org.eclipse.tractusx.traceability.integration.common.config.RestAssuredConfig;
Expand All @@ -33,6 +34,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;

Expand All @@ -42,7 +44,7 @@

import static org.awaitility.Awaitility.await;
@ActiveProfiles("integration-spring-boot")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureMockMvc
@ContextConfiguration(initializers = {PostgreSQLConfig.Initializer.class, RestitoConfig.Initializer.class}, classes = {RestAssuredConfig.class})
public class IntegrationTestSpecification {
Expand All @@ -56,8 +58,12 @@ public class IntegrationTestSpecification {
@Autowired
DatabaseSupport databaseSupport;

@LocalServerPort
private Integer port;

@BeforeEach
void beforeEach() throws JoseException {
RestAssured.port = port;
oAuth2ApiSupport.oauth2ApiReturnsTechnicalUserToken();
oAuth2ApiSupport.oauth2ApiReturnsJwkCerts(oAuth2Support.jwk());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;

import java.util.Collections;
import java.util.List;

import static io.restassured.RestAssured.given;
import static org.eclipse.tractusx.traceability.common.security.JwtRole.SUPERVISOR;

@TestPropertySource(properties = "traceability.validUntil=2020-07-04T16:01:05.309Z")
public class InvestigationPolicyExpirationIT extends IntegrationTestSpecification {
@Autowired
NotificationReceiverService notificationReceiverService;
Expand Down Expand Up @@ -79,6 +79,12 @@ public class InvestigationPolicyExpirationIT extends IntegrationTestSpecificatio

ObjectMapper objectMapper;


@DynamicPropertySource
static void dynamicProperties(DynamicPropertyRegistry registry) {
registry.add("traceability.validUntil", () -> "2020-07-04T16:01:05.309Z");
}

@BeforeEach
void setUp() {
objectMapper = new ObjectMapper();
Expand Down

0 comments on commit e292065

Please sign in to comment.