-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(build): updates to EDC 0.1.3 (#569)
* chore(deps): upgrade to EDC 0.1.3 * chore(deps): fix tests * chore(deps): updates changelog
- Loading branch information
Showing
14 changed files
with
298 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
.../tractusx/edc/api/cp/adapter/transform/EndpointDataReferenceToDataAddressTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.tractusx.edc.api.cp.adapter.transform; | ||
|
||
import org.eclipse.edc.spi.types.domain.DataAddress; | ||
import org.eclipse.edc.spi.types.domain.edr.EndpointDataReference; | ||
import org.eclipse.edc.transform.spi.TransformerContext; | ||
import org.eclipse.edc.transform.spi.TypeTransformer; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import static org.eclipse.edc.spi.types.domain.edr.EndpointDataReference.AUTH_CODE; | ||
import static org.eclipse.edc.spi.types.domain.edr.EndpointDataReference.AUTH_KEY; | ||
import static org.eclipse.edc.spi.types.domain.edr.EndpointDataReference.EDR_SIMPLE_TYPE; | ||
import static org.eclipse.edc.spi.types.domain.edr.EndpointDataReference.ENDPOINT; | ||
import static org.eclipse.edc.spi.types.domain.edr.EndpointDataReference.ID; | ||
|
||
public class EndpointDataReferenceToDataAddressTransformer implements TypeTransformer<EndpointDataReference, DataAddress> { | ||
@Override | ||
public Class<EndpointDataReference> getInputType() { | ||
return EndpointDataReference.class; | ||
} | ||
|
||
@Override | ||
public Class<DataAddress> getOutputType() { | ||
return DataAddress.class; | ||
} | ||
|
||
@Override | ||
public @Nullable DataAddress transform(@NotNull EndpointDataReference edr, @NotNull TransformerContext context) { | ||
return DataAddress.Builder.newInstance() | ||
.type(EDR_SIMPLE_TYPE) | ||
.property(ID, edr.getId()) | ||
.property(AUTH_CODE, edr.getAuthCode()) | ||
.property(AUTH_KEY, edr.getAuthKey()) | ||
.property(ENDPOINT, edr.getEndpoint()) | ||
.properties(edr.getProperties()) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
...ava/org/eclipse/tractusx/edc/api/cp/adapter/dto/NegotiateEdrRequestDtoValidationTest.java
This file was deleted.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
...ctusx/edc/api/cp/adapter/transform/EndpointDataReferenceToDataAddressTransformerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.tractusx.edc.api.cp.adapter.transform; | ||
|
||
import org.eclipse.edc.transform.spi.TransformerContext; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.eclipse.edc.spi.types.domain.edr.EndpointDataReference.AUTH_CODE; | ||
import static org.eclipse.edc.spi.types.domain.edr.EndpointDataReference.AUTH_KEY; | ||
import static org.eclipse.edc.spi.types.domain.edr.EndpointDataReference.Builder; | ||
import static org.eclipse.edc.spi.types.domain.edr.EndpointDataReference.EDR_SIMPLE_TYPE; | ||
import static org.eclipse.edc.spi.types.domain.edr.EndpointDataReference.ENDPOINT; | ||
import static org.eclipse.edc.spi.types.domain.edr.EndpointDataReference.ID; | ||
import static org.mockito.Mockito.mock; | ||
|
||
public class EndpointDataReferenceToDataAddressTransformerTest { | ||
|
||
private final TransformerContext context = mock(TransformerContext.class); | ||
private EndpointDataReferenceToDataAddressTransformer transformer; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
transformer = new EndpointDataReferenceToDataAddressTransformer(); | ||
} | ||
|
||
@Test | ||
void transform() { | ||
|
||
var dto = Builder.newInstance() | ||
.id("dataRequestId") | ||
.authCode("authCode") | ||
.authKey("authKey") | ||
.endpoint("http://endpoint") | ||
.build(); | ||
|
||
var dataAddress = transformer.transform(dto, context); | ||
|
||
assertThat(dataAddress).isNotNull(); | ||
assertThat(dataAddress.getType()).isEqualTo(EDR_SIMPLE_TYPE); | ||
assertThat(dataAddress.getProperty(ID)).isEqualTo(dto.getId()); | ||
assertThat(dataAddress.getProperty(ENDPOINT)).isEqualTo(dto.getEndpoint()); | ||
assertThat(dataAddress.getProperty(AUTH_KEY)).isEqualTo(dto.getAuthKey()); | ||
assertThat(dataAddress.getProperty(AUTH_CODE)).isEqualTo(dto.getAuthCode()); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.