protected Client getNewSecureClient(String keyStoreResourcePath) throws Exception { TlsConfiguration tlsConfiguration = new TlsConfiguration(); tlsConfiguration.setKeyStorePath(new File(resourceFilePath(keyStoreResourcePath))); tlsConfiguration.setKeyStorePassword("notsecret"); tlsConfiguration.setTrustStorePath(new File(resourceFilePath("tls/test-truststore.jks"))); tlsConfiguration.setTrustStorePassword("notsecret"); tlsConfiguration.setVerifyHostname(false); tlsConfiguration.setSupportedCiphers(Lists.newArrayList("TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384")); tlsConfiguration.setSupportedProtocols(Lists.newArrayList("TLSv1.2")); JerseyClientConfiguration configuration = new JerseyClientConfiguration(); configuration.setTlsConfiguration(tlsConfiguration); configuration.setTimeout(Duration.seconds(30)); configuration.setConnectionTimeout(Duration.seconds(30)); configuration.setConnectionRequestTimeout(Duration.seconds(30)); return new JerseyClientBuilder(USER_INFO_APP_RULE.getEnvironment()) .using(configuration) .build(UUID.randomUUID().toString()); }
private TestPolicyConfiguration( JerseyClientConfiguration httpClient, ServiceInfoConfiguration serviceInfo, ClientTrustStoreConfiguration clientTrustStoreConfiguration, Duration timeoutPeriod, Duration matchingServiceResponseWaitPeriod, Duration assertionLifetime) { this.eventSinkUri = URI.create("http://event-sink"); this.samlEngineUri = URI.create("http://saml-engine"); this.samlSoapProxyUri = URI.create("http://saml-soap-proxy"); this.httpClient = httpClient; this.serviceInfo = serviceInfo; this.clientTrustStoreConfiguration = clientTrustStoreConfiguration; this.timeoutPeriod = timeoutPeriod; this.matchingServiceResponseWaitPeriod = matchingServiceResponseWaitPeriod; this.assertionLifetime = assertionLifetime; this.configUri = URI.create("http://config"); }
public static JerseyClientConfiguration getDefaultJerseyClientConfiguration(boolean verifyHostname, boolean trustSelfSignedCertificates) { JerseyClientConfiguration jerseyClientConfiguration = new JerseyClientConfiguration(); jerseyClientConfiguration.setTimeout(Duration.seconds(60)); jerseyClientConfiguration.setTimeToLive(Duration.minutes(10)); jerseyClientConfiguration.setCookiesEnabled(false); jerseyClientConfiguration.setConnectionTimeout(Duration.seconds(4)); jerseyClientConfiguration.setRetries(3); jerseyClientConfiguration.setKeepAlive(Duration.seconds(60)); jerseyClientConfiguration.setChunkedEncodingEnabled(false); jerseyClientConfiguration.setValidateAfterInactivityPeriod(Duration.seconds(5)); TlsConfiguration tlsConfiguration = new TlsConfiguration(); tlsConfiguration.setProtocol("TLSv1.2"); tlsConfiguration.setVerifyHostname(verifyHostname); tlsConfiguration.setTrustSelfSignedCertificates(trustSelfSignedCertificates); jerseyClientConfiguration.setTlsConfiguration(tlsConfiguration); jerseyClientConfiguration.setGzipEnabledForRequests(false); return jerseyClientConfiguration; }
public BaseClient(Environment environment, ClientConfiguration clientConfiguration, JerseyClientConfiguration jerseyClientConfiguration, String clientName) { httpClient = new JerseyClientBuilder(environment) .using(jerseyClientConfiguration) .build(clientName); StringBuilder targetBuilder = new StringBuilder(); String target = targetBuilder.append(clientConfiguration.host) .append(':') .append(clientConfiguration.port) .append('/') .append(clientConfiguration.serviceContext).toString(); webTarget = httpClient.target(target); }
@Override public void run() { CamundaProviderConfiguration camundaProviderConfiguration = (CamundaProviderConfiguration) providerConfiguration; JerseyClientConfiguration jerseyClientConfiguration = camundaProviderConfiguration.getJerseyClientConfiguration(); jerseyClientConfiguration.setGzipEnabledForRequests(false); Client client = new JerseyClientBuilder(environment).using( camundaProviderConfiguration.getJerseyClientConfiguration()).build( "CamundaWorker" + threadNumber); WebTarget target = client.target(camundaProviderConfiguration.getEndpoint()); Response response = target.request(MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON_TYPE) .post(Entity.entity(EventUtils.toJson(event), MediaType.APPLICATION_JSON)); if (response.getStatus() != 200) logger.error("Failed to send event to Camunda with HTTP error code: " + response.getStatus()); else logger.info("Incident: {}", response.readEntity(String.class)); }
@Override public void run(TestConfiguration configuration, Environment environment) throws Exception { AbstractBinder binder = new AbstractBinder() { @Override protected void configure() { bind(throwInternalError).to(AtomicBoolean.class); bind(counter).to(AtomicInteger.class); } }; environment.jersey().register(binder); environment.jersey().register(MockResource.class); JerseyClientConfiguration clientConfiguration = new JerseyClientConfiguration(); clientConfiguration.setMaxConnectionsPerRoute(Integer.MAX_VALUE); clientConfiguration.setMaxConnections(Integer.MAX_VALUE); client = new ClientBuilder(environment).buildJerseyClient(clientConfiguration, "test"); startedLatch.countDown(); }
@JsonCreator public BreakerboxServiceConfiguration(@JsonProperty("azure") AzureTableConfiguration azure, @JsonProperty("tenacityClient") JerseyClientConfiguration tenacityClientConfiguration, @JsonProperty("breakerboxServicesPropertyKeys") TenacityConfiguration breakerboxServicesPropertyKeys, @JsonProperty("breakerboxServicesConfiguration") TenacityConfiguration breakerboxServicesConfiguration, @JsonProperty("breakerbox") BreakerboxConfiguration breakerboxConfiguration, @JsonProperty("ldap") LdapConfiguration ldapConfiguration, @JsonProperty("archaiusOverride") ArchaiusOverrideConfiguration archaiusOverride, @JsonProperty("database") JdbiConfiguration jdbiConfiguration, @JsonProperty("breakerboxHostAndPort") HostAndPort breakerboxHostAndPort, @JsonProperty("defaultDashboard") String defaultDashboard) { this.azure = Optional.fromNullable(azure); this.tenacityClient = tenacityClientConfiguration; this.breakerboxServicesPropertyKeys = Optional.fromNullable(breakerboxServicesPropertyKeys).or(new TenacityConfiguration()); this.breakerboxServicesConfiguration = Optional.fromNullable(breakerboxServicesConfiguration).or(new TenacityConfiguration()); this.breakerboxConfiguration = breakerboxConfiguration; this.ldapConfiguration = Optional.fromNullable(ldapConfiguration); this.archaiusOverride = Optional.fromNullable(archaiusOverride).or(new ArchaiusOverrideConfiguration()); this.jdbiConfiguration = Optional.fromNullable(jdbiConfiguration); this.breakerboxHostAndPort = Optional.fromNullable(breakerboxHostAndPort).or(HostAndPort.fromParts("localhost", 20040)); this.defaultDashboard = Optional.fromNullable(defaultDashboard).or("production"); }
@Before public void createClient() { final JerseyClientConfiguration configuration = new JerseyClientConfiguration(); configuration.setTimeout(Duration.minutes(1L)); configuration.setConnectionTimeout(Duration.minutes(1L)); configuration.setConnectionRequestTimeout(Duration.minutes(1L)); this.client = new JerseyClientBuilder(this.RULE.getEnvironment()).using(configuration) .build("test client"); assertThat(this.client .target(String.format(CREDENTIAL_END_POINT, this.RULE.getLocalPort())) .request() .header(X_AUTH_RSA_HEADER, BASE_64_PUBLIC_KEY) .post(Entity.json(this.credential)).getStatus()) .isEqualTo(Status.CREATED.getStatusCode()); }
public NullableMetadataConfiguration(String trustStorePath, String trustStorePassword, URI uri, Long minRefreshDelay, Long maxRefreshDelay, String expectedEntityId, JerseyClientConfiguration client, String jerseyClientName) { this.trustStorePath = trustStorePath; this.trustStorePassword = trustStorePassword; this.uri = uri; this.minRefreshDelay = minRefreshDelay; this.maxRefreshDelay = maxRefreshDelay; this.expectedEntityId = expectedEntityId; this.client = client; this.jerseyClientName = jerseyClientName; }
@BeforeClass public static void setUp() throws Exception { JerseyClientConfiguration jerseyClientConfiguration = new JerseyClientConfiguration(); jerseyClientConfiguration.setConnectionTimeout(Duration.seconds(10)); jerseyClientConfiguration.setTimeout(Duration.seconds(10)); client = new JerseyClientBuilder(samlProxyAppRule.getEnvironment()) .using(jerseyClientConfiguration) .build(HubMetadataIntegrationTests.class.getName()); DateTimeFreezer.freezeTime(); }
@BeforeClass public static void setUpClient() throws Exception { JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build(); client = new JerseyClientBuilder(samlProxyAppRule.getEnvironment()).using(jerseyClientConfiguration).build (SamlMessageReceiverApiResourceTest.class.getSimpleName()); eventSinkStubRule.register(Urls.HubSupportUrls.HUB_SUPPORT_EVENT_SINK_RESOURCE, Response.Status.OK.getStatusCode()); }
@BeforeClass public static void setUpClient() throws Exception { JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build(); client = new JerseyClientBuilder(samlProxyAppRule.getEnvironment()).using(jerseyClientConfiguration).build (SamlMessageReceiverApiResourceEidasEnabledTest.class.getSimpleName()); eventSinkStubRule.register(Urls.HubSupportUrls.HUB_SUPPORT_EVENT_SINK_RESOURCE, Response.Status.OK.getStatusCode()); }
@BeforeClass public static void setUpClient() throws Exception { JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build(); client = new JerseyClientBuilder(samlProxyAppRule.getEnvironment()).using(jerseyClientConfiguration).build (SamlMessageReceiverApiResourceEidasDisabledTest.class.getSimpleName()); eventSinkStubRule.register(Urls.HubSupportUrls.HUB_SUPPORT_EVENT_SINK_RESOURCE, Response.Status.OK.getStatusCode()); }
@BeforeClass public static void beforeClass() throws Exception { IdaSamlBootstrap.bootstrap(); JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build(); client = new JerseyClientBuilder(policy.getEnvironment()) .using(jerseyClientConfiguration) .build(EidasSessionResourceContractTest.class.getSimpleName()); sessionId = SessionId.createNewSessionId(); samlAuthnResponseContainerDto = createAuthnResponseSignedByKeyPair(sessionId, TestCertificateStrings.STUB_IDP_PUBLIC_PRIMARY_CERT, TestCertificateStrings.STUB_IDP_PUBLIC_PRIMARY_PRIVATE_KEY); encryptedIdentityAssertion = AssertionBuilder.anAssertion().withId(UUID.randomUUID().toString()).build(); encryptedIdentityAssertionString = XML_OBJECT_XML_OBJECT_TO_BASE_64_ENCODED_STRING_TRANSFORMER.apply(encryptedIdentityAssertion); }
@BeforeClass public static void beforeClass() { JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build(); client = new JerseyClientBuilder(policy.getEnvironment()) .using(jerseyClientConfiguration) .build(EidasSessionResourceIntegrationTest.class.getSimpleName()); }
@BeforeClass public static void beforeClass() { JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build(); client = new JerseyClientBuilder(policy.getEnvironment()).using(jerseyClientConfiguration).build(EidasDisabledIntegrationTest.class.getSimpleName()); }
@BeforeClass public static void beforeClass() { JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build(); client = new JerseyClientBuilder(policy.getEnvironment()) .using(jerseyClientConfiguration) .build(EidasMatchingServiceResourceIntegrationTest.class.getSimpleName()); }
public PolicyConfiguration build() { return new TestPolicyConfiguration( new JerseyClientConfiguration(), serviceInfo, mock(ClientTrustStoreConfiguration.class), timeoutPeriod, Duration.minutes(1), Duration.minutes(15)); }
@BeforeClass public static void setup() throws Exception { JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder .aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build(); client = new JerseyClientBuilder(samlEngineAppRule.getEnvironment()).using(jerseyClientConfiguration) .build(MatchingServiceHealthcheckResponseTranslatorResourceTest.class.getSimpleName()); }
@BeforeClass public static void setupClass() throws Exception { JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder .aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build(); client = new JerseyClientBuilder(samlEngineAppRule.getEnvironment()).using(jerseyClientConfiguration) .build(CountryMatchingServiceRequestGeneratorResourceTest.class.getSimpleName()); }
@BeforeClass public static void setupClass() throws Exception { JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder .aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build(); client = new JerseyClientBuilder(samlEngineAppRule.getEnvironment()).using(jerseyClientConfiguration) .build(HealthCheckWithoutCountryTest.class.getSimpleName()); }
@BeforeClass public static void setup() throws Exception { JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder .aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build(); client = new JerseyClientBuilder(samlEngineAppRule.getEnvironment()).using(jerseyClientConfiguration) .build(MatchingServiceRequestGeneratorResourceTest.class.getSimpleName()); }
@BeforeClass public static void setup() throws Exception { JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder .aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build(); client = new JerseyClientBuilder(samlEngineAppRule.getEnvironment()).using(jerseyClientConfiguration) .build(MatchingServiceHealthcheckRequestGeneratorResourceTest.class.getSimpleName()); }
@BeforeClass public static void setUpClass() throws Exception { JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build(); client = new JerseyClientBuilder(samlSoapProxyAppRule.getEnvironment()).using(jerseyClientConfiguration).build(MatchingServiceRequestSenderTest.class.getSimpleName()); eventSinkStubRule.setupStubForLogging(); configStub.setupStubForCertificates(TEST_RP_MS); String soap = createMsaResponse(); final String attibute_query_resource = "/attribute-query-request"; RequestAndResponse requestAndResponse = ExpectedRequestBuilder.expectRequest().withPath(attibute_query_resource).andWillRespondWith().withStatus(200).withBody(soap).withContentType(MediaType.TEXT_XML_TYPE.toString()).build(); msaStubRule.register(requestAndResponse); }
@BeforeClass public static void setUp() throws Exception { JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration() .withTimeout(Duration.seconds(10)).build(); client = new JerseyClientBuilder(samlSoapProxyAppRule.getEnvironment()).using(jerseyClientConfiguration) .build(MatchingServiceHealthCheckIntegrationTests.class.getSimpleName()); eventSinkStub.setupStubForLogging(); configStub.setupStubForCertificates(msaEntityId, TEST_RP_MS_PUBLIC_SIGNING_CERT, TEST_RP_MS_PUBLIC_ENCRYPTION_CERT); configStub.setupStubForCertificates(msaEntityId2, TEST_RP_MS_PUBLIC_SIGNING_CERT, TEST_RP_MS_PUBLIC_ENCRYPTION_CERT); }
@BeforeClass public static void setupClass() { // We need to enable typing otherwise abstract types, e.g. ExpressionItem, won't be deserialisable. RULE.getEnvironment().getObjectMapper().enableDefaultTyping(); app = RULE.getApplication(); JerseyClientConfiguration clientConfiguration = new JerseyClientConfiguration(); clientConfiguration.setConnectionRequestTimeout(io.dropwizard.util.Duration.seconds(10)); clientConfiguration.setConnectionTimeout(io.dropwizard.util.Duration.seconds(10)); clientConfiguration.setTimeout(Duration.seconds(10)); client = new JerseyClientBuilder(RULE.getEnvironment()) .using(clientConfiguration) .build("test client"); APPLICATION_PORT = RULE.getLocalPort(); ADMIN_PORT = RULE.getAdminPort(); // STATISTICS_URL = String.format("http://localhost:%d/statistics", APPLICATION_PORT); QUERY_SEARCH_URL = String.format("http://localhost:%d" + ResourcePaths.ROOT_PATH + ResourcePaths.STROOM_STATS + ResourcePaths.V2 + QueryResource.SEARCH_ENDPOINT, APPLICATION_PORT); BASE_TASKS_URL = String.format("http://localhost:%d/tasks/", ADMIN_PORT); HEALTH_CHECKS_URL = String.format("http://localhost:%d/admin/healthcheck?pretty=true", ADMIN_PORT); START_PROCESSING_URL = BASE_TASKS_URL + "startProcessing"; STOP_PROCESSING_URL = BASE_TASKS_URL + "stopProcessing"; LOGGER.info("Query url: {}", QUERY_SEARCH_URL); LOGGER.info("Health checks url: {}", HEALTH_CHECKS_URL); LOGGER.info("Start processing url: {}, e.g. curl -X POST {}", START_PROCESSING_URL, START_PROCESSING_URL); LOGGER.info("Stop processing url: {}, e.g. curl -X POST {}", STOP_PROCESSING_URL, STOP_PROCESSING_URL); }
private static Client buildClient(JerseyClientBuilder clientBuilder) { final JerseyClientConfiguration jerseyConfig = new JerseyClientConfiguration(); jerseyConfig.setConnectionTimeout(Duration.milliseconds(500)); jerseyConfig.setKeepAlive(Duration.minutes(5)); jerseyConfig.setMaxConnections(2048); jerseyConfig.setMaxConnectionsPerRoute(2048); jerseyConfig.setTimeout(Duration.hours(1)); jerseyConfig.setTimeToLive(Duration.minutes(5)); final JerseyClientBuilder builder = clientBuilder != null ? clientBuilder : new JerseyClientBuilder(new MetricRegistry()); return builder .using(Executors.newSingleThreadExecutor(), new ObjectMapper()) .using(jerseyConfig).build("SECPClient"); }
@JsonCreator public HubMetadataConfiguration( @JsonProperty("uri") @JsonAlias({"url"}) URI uri, @JsonProperty("minRefreshDelay") Long minRefreshDelay, @JsonProperty("maxRefreshDelay") Long maxRefreshDelay, @JsonProperty("expectedEntityId") String expectedEntityId, @JsonProperty("client") JerseyClientConfiguration client, @JsonProperty("jerseyClientName") String jerseyClientName, @JsonProperty("hubFederationId") String hubFederationId, @JsonProperty("trustStore") TrustStoreConfiguration trustStoreConfiguration) { super(uri, minRefreshDelay, maxRefreshDelay, expectedEntityId, client, ofNullable(jerseyClientName).orElse(HUB_JERSEY_CLIENT_NAME), hubFederationId); this.trustStoreConfiguration = trustStoreConfiguration; }
@JsonCreator public MsaMetadataConfiguration( @JsonProperty("uri") @JsonAlias({ "url" }) URI uri, @JsonProperty("minRefreshDelay") Long minRefreshDelay, @JsonProperty("maxRefreshDelay") Long maxRefreshDelay, @JsonProperty(value = "expectedEntityId", required = true) String expectedEntityId, @JsonProperty("client") JerseyClientConfiguration client, @JsonProperty("jerseyClientName") String jerseyClientName, @JsonProperty("hubFederationId") String hubFederationId ) { super(uri, minRefreshDelay, maxRefreshDelay, expectedEntityId, client, ofNullable(jerseyClientName).orElse(MSA_JERSEY_CLIENT_NAME), hubFederationId); }
@BeforeClass public static void beforeClass() { JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build(); client = new JerseyClientBuilder(msaApplicationRule.getEnvironment()).using(jerseyClientConfiguration).build(CountryEnabledIntegrationTest.class.getSimpleName()); msaMatchingUrl = "http://localhost:" + msaApplicationRule.getLocalPort() + Urls.MatchingServiceAdapterUrls.MATCHING_SERVICE_ROOT + Urls.MatchingServiceAdapterUrls.MATCHING_SERVICE_MATCH_REQUEST_PATH; }
public CredentialStorageServiceClient(final File privateKey, final File publicKey, final String serverURL, final JerseyClientConfiguration clientConfiguration) throws NoSuchAlgorithmException, InvalidKeySpecException, FileNotFoundException, IOException { this(new DecryptionUtil(privateKey), createJerseyClient(clientConfiguration).target(serverURL).path(CREDENTIAL_URL_PATH), readFileContentAsBase64(publicKey)); }
public CredentialStorageServiceClient(final File privateKey, final File publicKey, final String serverURL, final JerseyClientConfiguration clientConfiguration, final Environment environment) throws NoSuchAlgorithmException, InvalidKeySpecException, IOException, URISyntaxException { this(new DecryptionUtil(privateKey), createJerseyClient(clientConfiguration, environment).target(serverURL) .path(CREDENTIAL_URL_PATH), readFileContentAsBase64(publicKey)); }
private static Client createJerseyClient(final JerseyClientConfiguration clientConfiguration) { return new JerseyClientBuilder(new MetricRegistry()) // TODO This should not be hard-coded. .using(new ThreadPoolExecutor(5, 10, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue<>())) .using(clientConfiguration) .using(new ObjectMapper().setPropertyNamingStrategy( PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES)) .build(CLIENT_NAME); }
@Before public void setup() throws Exception { final JerseyClientConfiguration configuration = new JerseyClientConfiguration(); configuration.setTimeout(Duration.minutes(1L)); configuration.setConnectionTimeout(Duration.minutes(1L)); this.client = new CredentialStorageServiceClient( new File("./src/test/resources/private_key.der"), new File("./src/test/resources/public_key.der"), String.format("http://localhost:%d/", this.RULE.getLocalPort()), configuration); }
public static Client createTestJerseyClient(Duration timeout) { Environment environment = new Environment("test-dropwizard-apache-connector", Jackson.newObjectMapper(), buildDefaultValidatorFactory().getValidator(), new MetricRegistry(), TestJerseyClientBuilder.class.getClassLoader()); JerseyClientConfiguration configuration = new JerseyClientConfiguration(); configuration.setTimeout(timeout); return new JerseyClientBuilder(environment).using(configuration).build("test-jersey-client"); }
@Override protected void configure() { bind(TaskRegistry.class).to(getTaskRegistryClass()).asEagerSingleton(); bind(ResourceRegistry.class).to(DropwizardResourceRegistry.class).asEagerSingleton(); bind(String.class).annotatedWith(ServerCluster.class).toInstance(_configuration.getCluster()); bind(JerseyClientConfiguration.class).toInstance(_configuration.getHttpClientConfiguration()); install(new SelfHostAndPortModule()); }
@BeforeClass public static void setupClass() { // setup service ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.host = "http://localhost"; clientConfiguration.port = RULE.getLocalPort(); clientConfiguration.serviceContext = "people"; JerseyClientConfiguration jerseyConfiguration = new JerseyClientConfiguration(); client = new PersonClient(RULE.getEnvironment(), clientConfiguration, jerseyConfiguration); }
public RxJerseyBundle() { setClientConfigurationProvider(configuration -> { int cores = Runtime.getRuntime().availableProcessors(); JerseyClientConfiguration clientConfiguration = new JerseyClientConfiguration(); clientConfiguration.setMaxThreads(cores); return clientConfiguration; }); }
@Override public void run(T configuration, Environment environment) throws Exception { JerseyEnvironment jersey = environment.jersey(); JerseyClientConfiguration clientConfiguration = clientConfigurationProvider.apply(configuration); Client client = getClient(environment, clientConfiguration); rxJerseyClientFeature.register(client); jersey.register(rxJerseyServerFeature); jersey.register(rxJerseyClientFeature); }