use of com.palantir.conjure.java.client.jaxrs.TestService in project conjure-java-runtime by palantir.
the class ServiceConfigTest method testResource.
@Test
public void testResource() {
ServiceConfigurationFactory factory = ServiceConfigurationFactory.of(rule.getConfiguration().getServiceDiscoveryConfiguration());
TestService full = JaxRsClient.create(TestService.class, AGENT, new HostMetricsRegistry(), ClientConfigurations.of(factory.get("full")));
TestService minimal = JaxRsClient.create(TestService.class, AGENT, new HostMetricsRegistry(), ClientConfigurations.of(factory.get("minimal")));
assertThat(full.string()).isEqualTo("string");
assertThat(minimal.string()).isEqualTo("string");
}
use of com.palantir.conjure.java.client.jaxrs.TestService in project conjure-java-runtime by palantir.
the class UserAgentTest method testUserAgent_usesUnknownAgentWhenProvidedWithBogusAgentString.
@Test
public void testUserAgent_usesUnknownAgentWhenProvidedWithBogusAgentString() throws InterruptedException {
TestService service = JaxRsClient.create(TestService.class, UserAgents.tryParse("bogus version string"), new HostMetricsRegistry(), createTestConfig(endpointUri));
service.string();
RecordedRequest request = server.takeRequest();
assertThat(request.getHeader("User-Agent")).startsWith("unknown/0.0.0");
}
use of com.palantir.conjure.java.client.jaxrs.TestService in project conjure-java-runtime by palantir.
the class UserAgentTest method testUserAgent_augmentedByHttpRemotingAndServiceComponents.
@Test
public void testUserAgent_augmentedByHttpRemotingAndServiceComponents() throws Exception {
TestService service = JaxRsClient.create(TestService.class, AGENT, new HostMetricsRegistry(), createTestConfig(endpointUri));
service.string();
RecordedRequest request = server.takeRequest();
String dialogueVersion = Channel.class.getPackage().getImplementationVersion();
UserAgent expected = AGENT.addAgent(UserAgent.Agent.of("TestService", "0.0.0")).addAgent(UserAgent.Agent.of("dialogue", MoreObjects.firstNonNull(dialogueVersion, "0.0.0")));
assertThat(request.getHeader("User-Agent")).isEqualTo(UserAgents.format(expected));
}
use of com.palantir.conjure.java.client.jaxrs.TestService in project conjure-java-runtime by palantir.
the class UserAgentTest method testUserAgent_default.
@Test
public void testUserAgent_default() throws InterruptedException {
TestService service = JaxRsClient.create(TestService.class, AGENT, new HostMetricsRegistry(), createTestConfig(endpointUri));
service.string();
RecordedRequest request = server.takeRequest();
assertThat(request.getHeader("User-Agent")).startsWith(UserAgents.format(AGENT));
}
Aggregations