use of uk.gov.pay.connector.gateway.GatewayOperation.AUTHORISE in project pay-connector by alphagov.
the class ClientFactoryIT method shouldUseGatewaySpecificReadTimeoutOverride_whenSpecified.
@Test
public void shouldUseGatewaySpecificReadTimeoutOverride_whenSpecified() {
app = startApp("config/client-factory-test-config-with-worldpay-timeout-override.yaml", false);
when(mockMetricRegistry.register(any(), any())).thenReturn(null);
String path = "/hello";
wireMockRule.stubFor(get(urlPathEqualTo("/hello")).willReturn(aResponse().withBody("world").withStatus(200).withFixedDelay(2000)));
Client client = new ClientFactory(app.getEnvironment(), app.getConfiguration()).createWithDropwizardClient(WORLDPAY, AUTHORISE, mockMetricRegistry);
Invocation.Builder request = client.target(getServerUrl()).path(path).request();
Long authOverriddenTimeout = app.getConfiguration().getWorldpayConfig().getJerseyClientOverrides().map(override -> override.getAuth().getReadTimeout().toMicroseconds()).orElse(0L);
assertGatewayFailure(request, authOverriddenTimeout);
}
use of uk.gov.pay.connector.gateway.GatewayOperation.AUTHORISE in project pay-connector by alphagov.
the class ClientFactoryIT method shouldUseGatewaySpecificReadTimeoutOverrideForSmartpay_whenSpecified.
@Test
public void shouldUseGatewaySpecificReadTimeoutOverrideForSmartpay_whenSpecified() {
app = startApp("config/client-factory-test-config-with-smartpay-timeout-override.yaml", false);
when(mockMetricRegistry.register(any(), any())).thenReturn(null);
String path = "/hello";
wireMockRule.stubFor(get(urlPathEqualTo("/hello")).willReturn(aResponse().withBody("world").withStatus(200).withFixedDelay(2000)));
Client client = new ClientFactory(app.getEnvironment(), app.getConfiguration()).createWithDropwizardClient(SMARTPAY, AUTHORISE, mockMetricRegistry);
Invocation.Builder request = client.target(getServerUrl()).path(path).request();
Long authOverriddenTimeout = app.getConfiguration().getSmartpayConfig().getJerseyClientOverrides().map(override -> override.getAuth().getReadTimeout().toMicroseconds()).orElse(0L);
assertGatewayFailure(request, authOverriddenTimeout);
}
Aggregations