use of org.eclipse.dataspaceconnector.extension.jetty.PortMapping 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.extension.jetty.PortMapping 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();
}
use of org.eclipse.dataspaceconnector.extension.jetty.PortMapping in project DataSpaceConnector by eclipse-dataspaceconnector.
the class ContractAgreementApiControllerIntegrationTest 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 ContractAgreementApiController(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.extension.jetty.PortMapping in project DataSpaceConnector by eclipse-dataspaceconnector.
the class ContractNegotiationApiControllerIntegrationTest 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 controller = new ContractNegotiationController(monitor);
var jerseyService = new JerseyRestService(jetty, new TypeManager(), mock(CorsFilterConfiguration.class), monitor);
jetty.start();
jerseyService.registerResource("data", controller);
jerseyService.start();
}
use of org.eclipse.dataspaceconnector.extension.jetty.PortMapping in project DataSpaceConnector by eclipse-dataspaceconnector.
the class JerseyRestServiceTest method verifyIdenticalContextPats_throwsException.
@Test
@DisplayName("Verifies that registering two port mappings under the same path throws an exception")
void verifyIdenticalContextPats_throwsException() {
var port1 = getFreePort();
var port2 = getFreePort();
startJetty(new PortMapping("path1", port1, "/path"), new PortMapping("path2", port2, "/path"));
jerseyRestService.registerResource("path1", new TestController());
jerseyRestService.registerResource("path2", new TestController());
assertThatThrownBy(() -> jerseyRestService.start()).isInstanceOf(EdcException.class).hasRootCauseInstanceOf(IllegalStateException.class);
}
Aggregations