-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(CPA): obliviates the control plane adapter term and module r…
…efactor
- Loading branch information
Showing
96 changed files
with
1,005 additions
and
382 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
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
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
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
54 changes: 54 additions & 0 deletions
54
core/edr-core/src/main/java/org/eclipse/tractusx/edc/edr/core/EdrCoreExtension.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,54 @@ | ||
/* | ||
* 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.edr.core; | ||
|
||
import org.eclipse.edc.connector.spi.contractnegotiation.ContractNegotiationService; | ||
import org.eclipse.edc.runtime.metamodel.annotation.Extension; | ||
import org.eclipse.edc.runtime.metamodel.annotation.Inject; | ||
import org.eclipse.edc.runtime.metamodel.annotation.Provider; | ||
import org.eclipse.edc.spi.monitor.Monitor; | ||
import org.eclipse.edc.spi.system.ServiceExtension; | ||
import org.eclipse.tractusx.edc.edr.core.service.EdrServiceImpl; | ||
import org.eclipse.tractusx.edc.edr.spi.service.EdrService; | ||
import org.eclipse.tractusx.edc.edr.spi.store.EndpointDataReferenceCache; | ||
|
||
/** | ||
* Registers default services for the EDR cache. | ||
*/ | ||
@Extension(value = EdrCoreExtension.NAME) | ||
public class EdrCoreExtension implements ServiceExtension { | ||
static final String NAME = "EDR Core"; | ||
|
||
|
||
@Inject | ||
private Monitor monitor; | ||
|
||
@Inject | ||
private ContractNegotiationService contractNegotiationService; | ||
|
||
@Inject | ||
private EndpointDataReferenceCache endpointDataReferenceCache; | ||
|
||
@Override | ||
public String name() { | ||
return NAME; | ||
} | ||
|
||
|
||
@Provider | ||
public EdrService adapterTransferProcessService() { | ||
return new EdrServiceImpl(contractNegotiationService, endpointDataReferenceCache); | ||
} | ||
} |
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
50 changes: 50 additions & 0 deletions
50
...dr-core/src/test/java/org/eclipse/tractusx/edc/edr/core/service/EdrCoreExtensionTest.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,50 @@ | ||
/* | ||
* 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.edr.core.service; | ||
|
||
import org.eclipse.edc.connector.spi.contractnegotiation.ContractNegotiationService; | ||
import org.eclipse.edc.junit.extensions.DependencyInjectionExtension; | ||
import org.eclipse.edc.spi.system.ServiceExtensionContext; | ||
import org.eclipse.edc.spi.system.injection.ObjectFactory; | ||
import org.eclipse.tractusx.edc.edr.core.EdrCoreExtension; | ||
import org.eclipse.tractusx.edc.edr.spi.store.EndpointDataReferenceCache; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.mockito.Mockito.mock; | ||
|
||
@ExtendWith(DependencyInjectionExtension.class) | ||
public class EdrCoreExtensionTest { | ||
|
||
EdrCoreExtension extension; | ||
|
||
@BeforeEach | ||
void setUp(ObjectFactory factory, ServiceExtensionContext context) { | ||
context.registerService(ContractNegotiationService.class, mock(ContractNegotiationService.class)); | ||
context.registerService(EndpointDataReferenceCache.class, mock(EndpointDataReferenceCache.class)); | ||
extension = factory.constructInstance(EdrCoreExtension.class); | ||
} | ||
|
||
@Test | ||
void shouldInitializeTheExtension(ServiceExtensionContext context) { | ||
extension.initialize(context); | ||
|
||
var service = extension.adapterTransferProcessService(); | ||
assertThat(service).isInstanceOf(EdrServiceImpl.class); | ||
|
||
} | ||
} |
Oops, something went wrong.