use of javax.jbi.servicedesc.ServiceEndpoint in project petals-bc-gateway by petalslink.
the class ConsumerDomain method splitPerService.
private static Map<QName, Collection<ServiceEndpoint>> splitPerService(final Collection<ServiceEndpoint> endpoints) {
final Map<QName, Collection<ServiceEndpoint>> res = new HashMap<>();
for (final ServiceEndpoint endpoint : endpoints) {
final QName serviceName = endpoint.getServiceName();
Collection<ServiceEndpoint> c = res.get(serviceName);
if (c == null) {
c = new LinkedList<>();
res.put(serviceName, c);
}
c.add(endpoint);
}
assert validate(res);
return res;
}
use of javax.jbi.servicedesc.ServiceEndpoint in project petals-bc-gateway by petalslink.
the class AbstractComponentTest method deployTwoDomains.
/**
* TODO it would be relevant to check for all domain deployed that everything has been cleaned as desired
*/
protected ServiceEndpoint deployTwoDomains(final boolean specifyService, final boolean specifyEndpoint, @Nullable final String clientCertificate, @Nullable final String clientKey, @Nullable final String clientRemoteCertificate, @Nullable final String serverCertificate, @Nullable final String serverKey, @Nullable final String serverRemoteCertificate, @Nullable final Integer retryMax, @Nullable final Long retryDelay, @Nullable final Long pollingDelay) throws Exception {
COMPONENT_UNDER_TEST.deployService(SU_CONSUMER_NAME, createHelloConsumes(specifyService, specifyEndpoint, serverCertificate, serverKey, serverRemoteCertificate, pollingDelay));
COMPONENT_UNDER_TEST.deployService(SU_PROVIDER_NAME, createProvider(TEST_AUTH_NAME, TEST_TRANSPORT_PORT, clientCertificate, clientKey, clientRemoteCertificate, retryMax, retryDelay));
Awaitility.await("External endpoint not propagated !").atMost(Duration.ofSeconds(10)).until(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return getPropagatedServiceEndpoint() != null;
}
});
final ServiceEndpoint endpoint = getPropagatedServiceEndpoint();
assert endpoint != null;
return endpoint;
}
use of javax.jbi.servicedesc.ServiceEndpoint in project petals-bc-gateway by petalslink.
the class BcGatewayLifecyclesTest method testNotNewExchangeAfterShutdown.
public void testNotNewExchangeAfterShutdown(final boolean stopConsumer, final boolean stopProvider) throws Exception {
final ServiceEndpoint endpoint = deployTwoDomains();
final ServiceProviderImplementation provider = ServiceProviderImplementation.outMessage(OUT);
COMPONENT_UNDER_TEST.pushRequestToProvider(helloRequest(endpoint, MEPPatternConstants.IN_OUT.value()));
// let's wait for the request to be on the service provider side
await().atMost(Duration.ofSeconds(2)).untilAsserted(() -> assertEquals(1, COMPONENT_UNDER_TEST.getRequestsFromConsumerCount()));
if (stopProvider) {
COMPONENT_UNDER_TEST.stopService(SU_PROVIDER_NAME);
COMPONENT_UNDER_TEST.shutdownService(SU_PROVIDER_NAME);
}
if (stopConsumer) {
COMPONENT_UNDER_TEST.stopService(SU_CONSUMER_NAME);
COMPONENT_UNDER_TEST.shutdownService(SU_CONSUMER_NAME);
}
COMPONENT.receiveResponseAsExternalProvider(provider, false);
final ResponseMessage response = COMPONENT_UNDER_TEST.pollResponseFromProvider(DEFAULT_TIMEOUT_FOR_COMPONENT_SEND);
MessageChecks.hasOut().andThen(MessageChecks.hasXmlContent(OUT)).checks(response);
COMPONENT.sendDoneStatus(response, provider);
}
use of javax.jbi.servicedesc.ServiceEndpoint in project petals-bc-gateway by petalslink.
the class BcGatewaySendTest method testTimeout.
@Test
public void testTimeout() throws Exception {
final ServiceEndpoint endpoint = deployTwoDomains();
final ServiceProviderImplementation provider = ServiceProviderImplementation.errorMessage(ERROR).with(new MessageChecks() {
@Override
public void checks(@Nullable final Message message) throws Exception {
Thread.sleep(DEFAULT_TIMEOUT_FOR_COMPONENT_SEND + 1000);
}
});
final StatusMessage response = COMPONENT.sendAndGetStatus(helloRequest(endpoint, MEPPatternConstants.IN_OUT.value()), provider);
assertEquals(AbstractDomain.TIMEOUT_EXCEPTION.getMessage(), response.getError().getMessage());
}
use of javax.jbi.servicedesc.ServiceEndpoint in project petals-bc-gateway by petalslink.
the class MonitTraceFilteringTest method deployAndStartSUs.
/**
* Deploy and start required service units on components.
*
* @param ruleIdx
* MONIT flow tracing rule index.
* @param mepType
* Current MEP of the current test rule.
* @param consEnableFlowTracing
* Flow tracing activation state to set on the service consumer of the provider domain
* @param consEnableFlowTracingPropagation
* Propagation of the flow tracing activation to set on the service consumer of the provider domain
* @return The service provider to test running on the component under test.
*/
private ProvidesServiceConfiguration deployAndStartSUs(final String ruleIdPrefix, final MEPType mepType, final Optional<Boolean> consEnableFlowTracing, final Optional<Boolean> consEnableFlowTracingPropagation) throws Exception {
final ConsumesServiceConfiguration consumerServiceCfg = AbstractEnvironmentTest.createHelloConsumes(true, true, Long.valueOf(30000));
if (consEnableFlowTracing.isPresent()) {
consumerServiceCfg.setParameter(new QName("http://petals.ow2.org/components/extensions/version-5", "activate-flow-tracing"), Boolean.toString(consEnableFlowTracing.get()));
}
if (consEnableFlowTracingPropagation.isPresent()) {
consumerServiceCfg.setParameter(new QName("http://petals.ow2.org/components/extensions/version-5", "propagate-flow-tracing-activation"), Boolean.toString(consEnableFlowTracingPropagation.get()));
}
this.cutProviderDomain.deployService(AbstractEnvironmentTest.SU_CONSUMER_NAME, consumerServiceCfg);
this.cutConsumerDomain.deployService(AbstractEnvironmentTest.SU_PROVIDER_NAME, AbstractEnvironmentTest.createProvider(AbstractEnvironmentTest.TEST_AUTH_NAME, TRANSPORT_PORT));
Awaitility.await().atMost(Duration.ofSeconds(10)).until(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return AbstractEnvironmentTest.getPropagatedServiceEndpoint(cutConsumerDomain) != null;
}
});
final ServiceEndpoint notExtSvcEdp = AbstractEnvironmentTest.getPropagatedServiceEndpoint(this.cutConsumerDomain);
this.proxyServiceEndpoint = new ProvidesServiceConfiguration(notExtSvcEdp.getInterfaces()[0], notExtSvcEdp.getServiceName(), notExtSvcEdp.getEndpointName());
return this.proxyServiceEndpoint;
}
Aggregations