use of org.mule.extension.ws.api.transport.CustomTransportConfiguration in project mule-wsc-connector by mulesoft.
the class ConfigEqualsTestCase method testCustomTransportsEquals.
@Test
public void testCustomTransportsEquals() {
EasyRandomParameters parameters = new EasyRandomParameters();
parameters.collectionSizeRange(1, 3);
EasyRandom factory = new EasyRandom(parameters);
EasyRandom factory2 = new EasyRandom(parameters);
for (int i = 0; i < 1000; i++) {
CustomTransportConfiguration customTransport = factory.nextObject(CustomHttpTransportConfiguration.class);
CustomTransportConfiguration anotherCustomTransport = factory.nextObject(DefaultHttpTransportConfiguration.class);
CustomTransportConfiguration clonedCustomTransport = factory2.nextObject(CustomHttpTransportConfiguration.class);
CustomTransportConfiguration anotherClonedCustomTransport = factory2.nextObject(DefaultHttpTransportConfiguration.class);
assertThat(customTransport, is(clonedCustomTransport));
assertThat(customTransport.hashCode(), is(clonedCustomTransport.hashCode()));
assertThat(anotherCustomTransport, is(anotherClonedCustomTransport));
assertThat(anotherCustomTransport.hashCode(), is(anotherClonedCustomTransport.hashCode()));
assertThat(customTransport, not(anotherCustomTransport));
assertThat(customTransport.hashCode(), not(anotherCustomTransport.hashCode()));
assertThat(clonedCustomTransport, not(anotherClonedCustomTransport));
assertThat(clonedCustomTransport.hashCode(), not(anotherClonedCustomTransport.hashCode()));
}
}
use of org.mule.extension.ws.api.transport.CustomTransportConfiguration in project mule-wsc-connector by mulesoft.
the class ConsumeTestCase method consumeConcurrently.
@Test
public void consumeConcurrently() {
WsdlConnectionInfo info = mock(WsdlConnectionInfo.class);
CountDownLatch latch = new CountDownLatch(1);
CustomTransportConfiguration configuration = mock(CustomTransportConfiguration.class);
ExtensionsClient extensionsClient = mock(ExtensionsClient.class);
SoapClient soapClient = mock(SoapClient.class);
SoapRequest soapRequest = mock(SoapRequest.class);
CheckedSupplier<SoapClient> supplier = mock(CheckedSupplier.class);
when(soapClient.consume(any(SoapRequest.class), any(TransportDispatcher.class))).thenReturn(mock(SoapResponse.class));
when(supplier.get()).then(new Answer<SoapClient>() {
@Override
public SoapClient answer(InvocationOnMock invocation) throws Throwable {
latch.await();
return soapClient;
}
});
WscSoapClient client = new WscSoapClient(info, supplier, configuration, null);
executorService.submit(() -> client.consume(soapRequest, extensionsClient));
executorService.submit(() -> client.consume(soapRequest, extensionsClient));
latch.countDown();
verify(supplier, times(1)).get();
}
Aggregations