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);
}
}
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);
}
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);
}
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();
}
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();
}
Aggregations