Skip to content

Commit

Permalink
chore: fix with the latest EDC/IH changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf4ood committed Mar 18, 2024
1 parent cbcabb1 commit 68082b5
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package org.eclipse.tractusx.edc.edr.store.sql;

import org.eclipse.edc.junit.annotations.PostgresqlDbIntegrationTest;
import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest;
import org.eclipse.edc.spi.result.Result;
import org.eclipse.edc.spi.security.Vault;
import org.eclipse.edc.spi.types.TypeManager;
Expand Down Expand Up @@ -53,7 +53,7 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@PostgresqlDbIntegrationTest
@PostgresqlIntegrationTest
@ExtendWith(PostgresqlStoreSetupExtension.class)
public class SqlEndpointDataReferenceCacheTest extends EndpointDataReferenceCacheTestBase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package org.eclipse.tractusx.edc.edr.store.sql;

import org.eclipse.edc.junit.annotations.PostgresqlDbIntegrationTest;
import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest;
import org.eclipse.edc.spi.persistence.EdcPersistenceException;
import org.eclipse.edc.spi.query.QuerySpec;
import org.eclipse.edc.spi.result.Result;
Expand Down Expand Up @@ -56,7 +56,7 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@PostgresqlDbIntegrationTest
@PostgresqlIntegrationTest
@ExtendWith(PostgresqlStoreSetupExtension.class)
public class SqlEndpointDataReferenceCacheTransactionalTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import java.util.function.Consumer;

import static java.lang.String.format;
import static org.eclipse.edc.identitytrust.SelfIssuedTokenConstants.PRESENTATION_ACCESS_TOKEN_CLAIM;
import static org.eclipse.edc.identitytrust.SelfIssuedTokenConstants.PRESENTATION_TOKEN_CLAIM;
import static org.eclipse.edc.jwt.spi.JwtRegisteredClaimNames.AUDIENCE;
import static org.eclipse.edc.jwt.spi.JwtRegisteredClaimNames.ISSUER;
import static org.eclipse.edc.jwt.spi.JwtRegisteredClaimNames.SUBJECT;
Expand Down Expand Up @@ -84,7 +84,7 @@ public class DimSecureTokenService implements SecureTokenService {
AUDIENCE, "audience",
ISSUER, "issuer",
SUBJECT, "subject",
PRESENTATION_ACCESS_TOKEN_CLAIM, "token");
PRESENTATION_TOKEN_CLAIM, PRESENTATION_TOKEN_CLAIM);

public DimSecureTokenService(EdcHttpClient httpClient, String dimBaseUrl, DimOauth2Client dimOauth2Client, ObjectMapper mapper, Monitor monitor) {
this.httpClient = httpClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import java.util.function.Consumer;

import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.edc.identitytrust.SelfIssuedTokenConstants.PRESENTATION_ACCESS_TOKEN_CLAIM;
import static org.eclipse.edc.identitytrust.SelfIssuedTokenConstants.PRESENTATION_TOKEN_CLAIM;
import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat;
import static org.eclipse.edc.junit.testfixtures.TestUtils.testHttpClient;
import static org.eclipse.edc.jwt.spi.JwtRegisteredClaimNames.AUDIENCE;
Expand Down Expand Up @@ -130,7 +130,7 @@ void createToken_signToken() throws IOException {
when(interceptor.intercept(isA(Interceptor.Chain.class)))
.thenAnswer(invocation -> createResponse(200, invocation, requestAcceptor, response));

var input = Map.of(ISSUER, "issuer", SUBJECT, "issuer", AUDIENCE, "audience", PRESENTATION_ACCESS_TOKEN_CLAIM, "accessToken");
var input = Map.of(ISSUER, "issuer", SUBJECT, "issuer", AUDIENCE, "audience", PRESENTATION_TOKEN_CLAIM, "accessToken");
var result = client.createToken(input, null);

assertThat(result).isSucceeded()
Expand Down Expand Up @@ -209,7 +209,7 @@ void createToken_signFails_withDimFailure() throws IOException {
when(interceptor.intercept(isA(Interceptor.Chain.class)))
.thenAnswer(invocation -> createResponse(500, invocation));

var input = Map.of(ISSUER, "issuer", SUBJECT, "issuer", AUDIENCE, "audience", PRESENTATION_ACCESS_TOKEN_CLAIM, "token");
var input = Map.of(ISSUER, "issuer", SUBJECT, "issuer", AUDIENCE, "audience", PRESENTATION_TOKEN_CLAIM, "token");
var result = client.createToken(input, null);

assertThat(result).isFailed()
Expand All @@ -224,7 +224,7 @@ void createToken_signFails_whenBadResponsePayload() throws IOException {
when(interceptor.intercept(isA(Interceptor.Chain.class)))
.thenAnswer(invocation -> createResponse(200, invocation, Map.of()));

var input = Map.of(ISSUER, "issuer", SUBJECT, "issuer", AUDIENCE, "audience", PRESENTATION_ACCESS_TOKEN_CLAIM, "token");
var input = Map.of(ISSUER, "issuer", SUBJECT, "issuer", AUDIENCE, "audience", PRESENTATION_TOKEN_CLAIM, "token");
var result = client.createToken(input, null);

assertThat(result).isFailed()
Expand All @@ -247,7 +247,7 @@ void createToken_signFails_whenClaimsMissing() throws IOException {
.satisfies(failure -> assertThat(failure.getFailureDetail())
.contains("Key iss not found")
.contains("Key sub not found")
.contains("Key access_token not found")
.contains("Key token not found")
.contains("Key aud not found"));

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import org.eclipse.edc.connector.store.sql.assetindex.SqlAssetIndex;
import org.eclipse.edc.connector.store.sql.assetindex.schema.postgres.PostgresDialectStatements;
import org.eclipse.edc.junit.annotations.PostgresqlDbIntegrationTest;
import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest;
import org.eclipse.edc.spi.types.TypeManager;
import org.eclipse.edc.spi.types.domain.asset.Asset;
import org.eclipse.edc.sql.QueryExecutor;
Expand All @@ -35,7 +35,7 @@

import static org.assertj.core.api.Assertions.assertThat;

@PostgresqlDbIntegrationTest
@PostgresqlIntegrationTest
@ExtendWith(PostgresqlStoreSetupExtension.class)
class AssetPostgresqlMigrationExtensionTest {

Expand All @@ -48,7 +48,8 @@ void setUp(PostgresqlStoreSetupExtension extension, QueryExecutor queryExecutor)
queryExecutor);
}

@Test // bugfix https://github.com/eclipse-tractusx/tractusx-edc/issues/1003
// bugfix https://github.com/eclipse-tractusx/tractusx-edc/issues/1003
@Test
void version006shouldTransformPropertiesListToMap(PostgresqlStoreSetupExtension extension) {
var dataSource = extension.getDataSourceRegistry().resolve(extension.getDatasourceName());
FlywayManager.migrate(dataSource, "asset", "public", MigrationVersion.fromVersion("0.0.5"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

package org.eclipse.tractusx.edc.tests.catalog;

import org.eclipse.edc.junit.annotations.PostgresqlDbIntegrationTest;
import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest;
import org.eclipse.tractusx.edc.lifecycle.PgParticipantRuntime;
import org.junit.jupiter.api.extension.RegisterExtension;

@PostgresqlDbIntegrationTest
@PostgresqlIntegrationTest
public class CatalogPostgresqlTest extends AbstractCatalogTest {

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

package org.eclipse.tractusx.edc.tests.edr;

import org.eclipse.edc.junit.annotations.PostgresqlDbIntegrationTest;
import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest;
import org.eclipse.tractusx.edc.lifecycle.PgParticipantRuntime;
import org.junit.jupiter.api.extension.RegisterExtension;

@PostgresqlDbIntegrationTest
@PostgresqlIntegrationTest
public class DeleteEdrPostgresqlTest extends AbstractDeleteEdrTest {

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

package org.eclipse.tractusx.edc.tests.edr;

import org.eclipse.edc.junit.annotations.PostgresqlDbIntegrationTest;
import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest;
import org.eclipse.tractusx.edc.lifecycle.PgHashicorpParticipantRuntime;
import org.eclipse.tractusx.edc.lifecycle.PgParticipantRuntime;
import org.junit.jupiter.api.extension.RegisterExtension;

@PostgresqlDbIntegrationTest
@PostgresqlIntegrationTest
public class NegotiateEdrPostgresqlHashicorpVaultTest extends AbstractNegotiateEdrTest {

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

package org.eclipse.tractusx.edc.tests.edr;

import org.eclipse.edc.junit.annotations.PostgresqlDbIntegrationTest;
import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest;
import org.eclipse.tractusx.edc.lifecycle.PgParticipantRuntime;
import org.junit.jupiter.api.extension.RegisterExtension;

@PostgresqlDbIntegrationTest
@PostgresqlIntegrationTest
public class NegotiateEdrPostgresqlTest extends AbstractNegotiateEdrTest {

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

package org.eclipse.tractusx.edc.tests.edr;

import org.eclipse.edc.junit.annotations.PostgresqlDbIntegrationTest;
import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest;
import org.eclipse.tractusx.edc.lifecycle.PgParticipantRuntime;
import org.junit.jupiter.api.extension.RegisterExtension;

@PostgresqlDbIntegrationTest
@PostgresqlIntegrationTest
public class RenewalEdrPostgresqlTest extends AbstractRenewalEdrTest {

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

package org.eclipse.tractusx.edc.tests.policy;

import org.eclipse.edc.junit.annotations.PostgresqlDbIntegrationTest;
import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest;
import org.eclipse.tractusx.edc.lifecycle.PgParticipantRuntime;
import org.junit.jupiter.api.extension.RegisterExtension;

@PostgresqlDbIntegrationTest
@PostgresqlIntegrationTest
public class PolicyMonitorPostgresqlTest extends AbstractPolicyMonitorTest {

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

package org.eclipse.tractusx.edc.tests.proxy;

import org.eclipse.edc.junit.annotations.PostgresqlDbIntegrationTest;
import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest;
import org.eclipse.tractusx.edc.lifecycle.PgParticipantRuntime;
import org.junit.jupiter.api.extension.RegisterExtension;

@PostgresqlDbIntegrationTest
@PostgresqlIntegrationTest
public class DataPlaneProxyPostgresqlTest extends AbstractDataPlaneProxyTest {

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

package org.eclipse.tractusx.edc.tests.transfer;

import org.eclipse.edc.junit.annotations.PostgresqlDbIntegrationTest;
import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest;
import org.eclipse.tractusx.edc.lifecycle.PgParticipantRuntime;
import org.junit.jupiter.api.extension.RegisterExtension;

@PostgresqlDbIntegrationTest
@PostgresqlIntegrationTest
public class HttpConsumerPullWithProxyPostgresqlTest extends AbstractHttpConsumerPullWithProxyTest {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

package org.eclipse.tractusx.edc.tests.transfer;

import org.eclipse.edc.junit.annotations.PostgresqlDbIntegrationTest;
import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest;
import org.eclipse.tractusx.edc.lifecycle.PgParticipantRuntime;
import org.junit.jupiter.api.extension.RegisterExtension;

@PostgresqlDbIntegrationTest
@PostgresqlIntegrationTest
public class HttpProviderPushInPostgresqlTest extends AbstractHttpProviderPushTest {

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import java.util.Optional;
import java.util.stream.Collectors;

import static org.eclipse.edc.identitytrust.SelfIssuedTokenConstants.PRESENTATION_ACCESS_TOKEN_CLAIM;
import static org.eclipse.edc.identitytrust.SelfIssuedTokenConstants.PRESENTATION_TOKEN_CLAIM;
import static org.eclipse.edc.jwt.spi.JwtRegisteredClaimNames.AUDIENCE;
import static org.eclipse.edc.jwt.spi.JwtRegisteredClaimNames.ISSUER;
import static org.eclipse.edc.jwt.spi.JwtRegisteredClaimNames.SUBJECT;
Expand Down Expand Up @@ -100,7 +100,7 @@ private MockResponse signTokenHandler(Map<String, Object> params) {
ISSUER, issuer,
SUBJECT, subject,
AUDIENCE, audience,
PRESENTATION_ACCESS_TOKEN_CLAIM, accessToken);
PRESENTATION_TOKEN_CLAIM, accessToken);

var sts = secureTokenServices.get(issuer);
var token = sts.createToken(claims, null)
Expand Down

0 comments on commit 68082b5

Please sign in to comment.