Search in sources :

Example 1 with Monitor

use of org.eclipse.dataspaceconnector.spi.monitor.Monitor in project edc-showcase by microsoft.

the class CatalogDataseedingExtension method initialize.

@Override
public void initialize(ServiceExtensionContext context) {
    Monitor monitor = context.getMonitor();
    var nodesFile = context.getSetting(NODES_FILE_SETTING, "nodes.json");
    monitor.info("Using FCC Node directory file " + nodesFile);
    // generate+save assets
    var assets = createAssets(context.getConnectorId());
    assets.forEach(assetIndexLoader::accept);
    // generate+save policies
    var accessPolicies = IntStream.range(0, 10).mapToObj(i -> createAccessPolicy("edc-demo-access-policy-" + i)).peek(policyStore::save).collect(Collectors.toList());
    var contractPolicies = IntStream.range(0, 10).mapToObj(i -> createContractPolicy("edc-demo-contract-policy-" + i)).peek(policyStore::save).collect(Collectors.toList());
    // publish asset
    assets.stream().map(AssetEntry::getAsset).forEach(a -> publishAsset(a, random(accessPolicies), random(contractPolicies)));
    // populate node directory
    var nodes = readNodesFromJson(nodesFile);
    nodes.forEach(nodeDirectory::insert);
    monitor.info("Catalog Data seeding done");
}
Also used : Monitor(org.eclipse.dataspaceconnector.spi.monitor.Monitor)

Example 2 with Monitor

use of org.eclipse.dataspaceconnector.spi.monitor.Monitor in project edc-showcase by microsoft.

the class IdentityHubCredentialsVerifierTest method setUp.

@BeforeEach
void setUp() throws NoSuchAlgorithmException {
    KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
    kpg.initialize(2048);
    KeyPair kp = kpg.generateKeyPair();
    publicKey = (RSAPublicKey) kp.getPublic();
    hubClient = EasyMock.createMock(IdentityHubClient.class);
    credentialsVerifier = new IdentityHubCredentialsVerifier(hubClient, new Monitor() {
    }, "did:ion:test");
}
Also used : KeyPair(java.security.KeyPair) Monitor(org.eclipse.dataspaceconnector.spi.monitor.Monitor) KeyPairGenerator(java.security.KeyPairGenerator) IdentityHubClient(org.eclipse.dataspaceconnector.iam.did.spi.hub.IdentityHubClient) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with Monitor

use of org.eclipse.dataspaceconnector.spi.monitor.Monitor in project product-edc by catenax-ng.

the class BusinessPartnerValidationExtensionTest method setup.

@BeforeEach
public void setup() {
    policyEngine = Mockito.mock(PolicyEngine.class);
    ruleBindingRegistry = Mockito.mock(RuleBindingRegistry.class);
    final Monitor monitor = Mockito.mock(Monitor.class);
    serviceExtensionContext = Mockito.mock(ServiceExtensionContext.class);
    Mockito.when(serviceExtensionContext.getMonitor()).thenReturn(monitor);
    Mockito.when(serviceExtensionContext.getService(PolicyEngine.class)).thenReturn(policyEngine);
    Mockito.when(serviceExtensionContext.getService(RuleBindingRegistry.class)).thenReturn(ruleBindingRegistry);
    extension = new BusinessPartnerValidationExtension();
}
Also used : Monitor(org.eclipse.dataspaceconnector.spi.monitor.Monitor) PolicyEngine(org.eclipse.dataspaceconnector.spi.policy.PolicyEngine) RuleBindingRegistry(org.eclipse.dataspaceconnector.spi.policy.RuleBindingRegistry) ServiceExtensionContext(org.eclipse.dataspaceconnector.spi.system.ServiceExtensionContext) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with Monitor

use of org.eclipse.dataspaceconnector.spi.monitor.Monitor in project DataSpaceConnector by eclipse-dataspaceconnector.

the class TransferProcessManagerImplTest method setup.

@BeforeEach
void setup() {
    var resourceManifest = ResourceManifest.Builder.newInstance().definitions(List.of(new TestResourceDefinition())).build();
    when(manifestGenerator.generateResourceManifest(any(TransferProcess.class))).thenReturn(resourceManifest);
    manager = TransferProcessManagerImpl.Builder.newInstance().provisionManager(provisionManager).dataFlowManager(mock(DataFlowManager.class)).waitStrategy(mock(ExponentialWaitStrategy.class)).batchSize(TRANSFER_MANAGER_BATCHSIZE).dispatcherRegistry(dispatcherRegistry).manifestGenerator(manifestGenerator).monitor(mock(Monitor.class)).commandQueue(mock(CommandQueue.class)).commandRunner(mock(CommandRunner.class)).typeManager(new TypeManager()).statusCheckerRegistry(statusCheckerRegistry).observable(mock(TransferProcessObservable.class)).store(store).build();
}
Also used : Monitor(org.eclipse.dataspaceconnector.spi.monitor.Monitor) TypeManager(org.eclipse.dataspaceconnector.spi.types.TypeManager) TestResourceDefinition(org.eclipse.dataspaceconnector.transfer.core.TestResourceDefinition) TransferProcess(org.eclipse.dataspaceconnector.spi.types.domain.transfer.TransferProcess) ExponentialWaitStrategy(org.eclipse.dataspaceconnector.spi.retry.ExponentialWaitStrategy) CommandRunner(org.eclipse.dataspaceconnector.spi.command.CommandRunner) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with Monitor

use of org.eclipse.dataspaceconnector.spi.monitor.Monitor in project DataSpaceConnector by eclipse-dataspaceconnector.

the class TransferProcessManagerImplIntegrationTest method setup.

@SuppressWarnings("unchecked")
@BeforeEach
void setup() {
    var resourceManifest = ResourceManifest.Builder.newInstance().definitions(List.of(new TestResourceDefinition())).build();
    when(manifestGenerator.generateConsumerResourceManifest(any(DataRequest.class), any(Policy.class))).thenReturn(resourceManifest);
    var policyArchive = mock(PolicyArchive.class);
    when(policyArchive.findPolicyForContract(anyString())).thenReturn(Policy.Builder.newInstance().build());
    transferProcessManager = TransferProcessManagerImpl.Builder.newInstance().provisionManager(provisionManager).dataFlowManager(mock(DataFlowManager.class)).waitStrategy(mock(ExponentialWaitStrategy.class)).batchSize(TRANSFER_MANAGER_BATCHSIZE).dispatcherRegistry(mock(RemoteMessageDispatcherRegistry.class)).manifestGenerator(manifestGenerator).monitor(mock(Monitor.class)).commandQueue(mock(CommandQueue.class)).commandRunner(mock(CommandRunner.class)).typeManager(new TypeManager()).statusCheckerRegistry(mock(StatusCheckerRegistry.class)).observable(mock(TransferProcessObservable.class)).transferProcessStore(store).policyArchive(policyArchive).addressResolver(mock(DataAddressResolver.class)).build();
}
Also used : Policy(org.eclipse.dataspaceconnector.policy.model.Policy) DataAddressResolver(org.eclipse.dataspaceconnector.spi.asset.DataAddressResolver) Monitor(org.eclipse.dataspaceconnector.spi.monitor.Monitor) TypeManager(org.eclipse.dataspaceconnector.spi.types.TypeManager) TestResourceDefinition(org.eclipse.dataspaceconnector.transfer.core.TestResourceDefinition) DataRequest(org.eclipse.dataspaceconnector.spi.types.domain.transfer.DataRequest) StatusCheckerRegistry(org.eclipse.dataspaceconnector.spi.types.domain.transfer.StatusCheckerRegistry) ExponentialWaitStrategy(org.eclipse.dataspaceconnector.spi.retry.ExponentialWaitStrategy) RemoteMessageDispatcherRegistry(org.eclipse.dataspaceconnector.spi.message.RemoteMessageDispatcherRegistry) CommandRunner(org.eclipse.dataspaceconnector.spi.command.CommandRunner) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Monitor (org.eclipse.dataspaceconnector.spi.monitor.Monitor)22 BeforeEach (org.junit.jupiter.api.BeforeEach)17 TypeManager (org.eclipse.dataspaceconnector.spi.types.TypeManager)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 URI (java.net.URI)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 IdsTransformerRegistry (org.eclipse.dataspaceconnector.ids.spi.transform.IdsTransformerRegistry)2 CommandRunner (org.eclipse.dataspaceconnector.spi.command.CommandRunner)2 ContractOfferService (org.eclipse.dataspaceconnector.spi.contract.offer.ContractOfferService)2 ContractValidationService (org.eclipse.dataspaceconnector.spi.contract.validation.ContractValidationService)2 ExponentialWaitStrategy (org.eclipse.dataspaceconnector.spi.retry.ExponentialWaitStrategy)2 Vault (org.eclipse.dataspaceconnector.spi.security.Vault)2 TestResourceDefinition (org.eclipse.dataspaceconnector.transfer.core.TestResourceDefinition)2 Representation (de.fraunhofer.iais.eis.Representation)1 Resource (de.fraunhofer.iais.eis.Resource)1 KeyPair (java.security.KeyPair)1 KeyPairGenerator (java.security.KeyPairGenerator)1 Duration (java.time.Duration)1 ChronoUnit (java.time.temporal.ChronoUnit)1 List (java.util.List)1