Search in sources :

Example 1 with TypeManager

use of org.eclipse.dataspaceconnector.spi.types.TypeManager in project edc-showcase by microsoft.

the class EdcExtension method beforeTestExecution.

@Override
public void beforeTestExecution(ExtensionContext extensionContext) {
    var typeManager = new TypeManager();
    var monitor = ExtensionLoader.loadMonitor();
    MonitorProvider.setInstance(monitor);
    context = new TestServiceExtensionContext(typeManager, monitor, new MultiSourceServiceLocator());
    context.initialize();
    serviceMocks.forEach((key, value) -> context.registerService(cast(key), value));
    try {
        if (!serviceMocks.containsKey(Vault.class)) {
            ExtensionLoader.loadVault(context);
        }
        runningServiceExtensions = context.loadServiceExtensions();
        ExtensionLoader.bootServiceExtensions(runningServiceExtensions, context);
    } catch (Exception e) {
        throw new EdcException(e);
    }
}
Also used : TypeManager(org.eclipse.dataspaceconnector.spi.types.TypeManager) Vault(org.eclipse.dataspaceconnector.spi.security.Vault) EdcException(org.eclipse.dataspaceconnector.spi.EdcException) EdcException(org.eclipse.dataspaceconnector.spi.EdcException)

Example 2 with TypeManager

use of org.eclipse.dataspaceconnector.spi.types.TypeManager in project MinimumViableDataspace by agera-edc.

the class JsonFileBasedNodeDirectoryExtension method initialize.

@Override
public void initialize(ServiceExtensionContext context) {
    var monitor = context.getMonitor();
    TypeManager typeManager = context.getTypeManager();
    var nodeJsonPath = Path.of(Objects.requireNonNull(System.getenv("NODES_JSON_DIR"), "Env var NODES_JSON_DIR is null"));
    var nodeJsonPrefix = Objects.requireNonNull(System.getenv("NODES_JSON_FILES_PREFIX"), "Env var NODES_JSON_FILES_PREFIX is null");
    var service = new JsonFileBasedNodeDirectory(nodeJsonPath, nodeJsonPrefix, monitor, typeManager);
    context.registerService(FederatedCacheNodeDirectory.class, service);
}
Also used : TypeManager(org.eclipse.dataspaceconnector.spi.types.TypeManager)

Example 3 with TypeManager

use of org.eclipse.dataspaceconnector.spi.types.TypeManager in project MinimumViableDataspace by agera-edc.

the class TransferSimulationUtils method loadContractAgreement.

private static String loadContractAgreement(String providerUrl) {
    var policy = Policy.Builder.newInstance().id(UUID.randomUUID().toString()).permission(Permission.Builder.newInstance().target("test-document").action(Action.Builder.newInstance().type("USE").build()).build()).type(PolicyType.SET).build();
    var request = Map.of("connectorId", "provider", "connectorAddress", providerUrl, "protocol", "ids-multipart", "offer", Map.of("offerId", CONTRACT_DEFINITION_ID + ":" + POLICY_ID, "assetId", PROVIDER_ASSET_ID, "policy", policy));
    return new TypeManager().writeValueAsString(request);
}
Also used : TypeManager(org.eclipse.dataspaceconnector.spi.types.TypeManager)

Example 4 with TypeManager

use of org.eclipse.dataspaceconnector.spi.types.TypeManager in project DataSpaceConnector by eclipse-dataspaceconnector.

the class ContractDefinitionsApiControllerIntegrationTest method prepareWebserver.

@BeforeAll
static void prepareWebserver() {
    port = TestUtils.getFreePort();
    var monitor = mock(Monitor.class);
    var config = new JettyConfiguration(null, null);
    config.portMapping(new PortMapping("data", port, "/api/v1/data"));
    var jetty = new JettyService(config, monitor);
    var ctrl = new ContractDefinitionApiController(monitor);
    var jerseyService = new JerseyRestService(jetty, new TypeManager(), mock(CorsFilterConfiguration.class), monitor);
    jetty.start();
    jerseyService.registerResource("data", ctrl);
    jerseyService.start();
}
Also used : JerseyRestService(org.eclipse.dataspaceconnector.extension.jersey.JerseyRestService) JettyConfiguration(org.eclipse.dataspaceconnector.extension.jetty.JettyConfiguration) TypeManager(org.eclipse.dataspaceconnector.spi.types.TypeManager) PortMapping(org.eclipse.dataspaceconnector.extension.jetty.PortMapping) CorsFilterConfiguration(org.eclipse.dataspaceconnector.extension.jersey.CorsFilterConfiguration) JettyService(org.eclipse.dataspaceconnector.extension.jetty.JettyService) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 5 with TypeManager

use of org.eclipse.dataspaceconnector.spi.types.TypeManager in project DataSpaceConnector by eclipse-dataspaceconnector.

the class PolicyApiControllerIntegrationTest method prepareWebserver.

@BeforeAll
static void prepareWebserver() {
    port = TestUtils.getFreePort();
    var monitor = mock(Monitor.class);
    var config = new JettyConfiguration(null, null);
    config.portMapping(new PortMapping("data", port, "/api/v1/data"));
    var jetty = new JettyService(config, monitor);
    var ctrl = new PolicyApiController(monitor);
    var jerseyService = new JerseyRestService(jetty, new TypeManager(), mock(CorsFilterConfiguration.class), monitor);
    jetty.start();
    jerseyService.registerResource("data", ctrl);
    jerseyService.start();
}
Also used : JerseyRestService(org.eclipse.dataspaceconnector.extension.jersey.JerseyRestService) JettyConfiguration(org.eclipse.dataspaceconnector.extension.jetty.JettyConfiguration) TypeManager(org.eclipse.dataspaceconnector.spi.types.TypeManager) PortMapping(org.eclipse.dataspaceconnector.extension.jetty.PortMapping) CorsFilterConfiguration(org.eclipse.dataspaceconnector.extension.jersey.CorsFilterConfiguration) JettyService(org.eclipse.dataspaceconnector.extension.jetty.JettyService) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

TypeManager (org.eclipse.dataspaceconnector.spi.types.TypeManager)48 BeforeEach (org.junit.jupiter.api.BeforeEach)26 Monitor (org.eclipse.dataspaceconnector.spi.monitor.Monitor)10 BeforeAll (org.junit.jupiter.api.BeforeAll)9 JettyConfiguration (org.eclipse.dataspaceconnector.extension.jetty.JettyConfiguration)8 JettyService (org.eclipse.dataspaceconnector.extension.jetty.JettyService)8 CorsFilterConfiguration (org.eclipse.dataspaceconnector.extension.jersey.CorsFilterConfiguration)7 JerseyRestService (org.eclipse.dataspaceconnector.extension.jersey.JerseyRestService)7 PortMapping (org.eclipse.dataspaceconnector.extension.jetty.PortMapping)7 Test (org.junit.jupiter.api.Test)7 ConsoleMonitor (org.eclipse.dataspaceconnector.spi.monitor.ConsoleMonitor)6 RetryPolicy (net.jodah.failsafe.RetryPolicy)5 DefaultProviderExtension (org.eclipse.dataspaceconnector.boot.system.testextensions.DefaultProviderExtension)5 MultiplexingMonitor (org.eclipse.dataspaceconnector.spi.monitor.MultiplexingMonitor)5 DisplayName (org.junit.jupiter.api.DisplayName)5 CosmosDbApiImpl (org.eclipse.dataspaceconnector.azure.cosmos.CosmosDbApiImpl)4 TestFunctions.createProviderExtension (org.eclipse.dataspaceconnector.boot.system.TestFunctions.createProviderExtension)3 ProviderExtension (org.eclipse.dataspaceconnector.boot.system.testextensions.ProviderExtension)3 NoopTransactionContext (org.eclipse.dataspaceconnector.spi.transaction.NoopTransactionContext)3 DataSourceRegistry (org.eclipse.dataspaceconnector.spi.transaction.datasource.DataSourceRegistry)3