use of org.killbill.billing.util.config.definition.JaxrsConfig in project killbill by killbill.
the class TestBuildResponse method testUriBuilderWithoutPathLikeUrlAndRoot.
@Test(groups = "fast", description = "Tests Uri Builder with Full URL and root Location")
public void testUriBuilderWithoutPathLikeUrlAndRoot() throws Exception {
UUID objectId = UUID.randomUUID();
final UriInfo uriInfo = mock(UriInfo.class);
URI uri = URI.create("http://localhost:8080");
when(uriInfo.getBaseUri()).thenReturn(uri);
when(uriInfo.getAbsolutePath()).thenReturn(uri);
JaxrsConfig jaxrsConfig = mock(JaxrsConfig.class);
when(jaxrsConfig.isJaxrsLocationFullUrl()).thenReturn(true);
JaxrsUriBuilder uriBuilder = new JaxrsUriBuilder(jaxrsConfig);
Response response = uriBuilder.buildResponse(uriInfo, AccountResource.class, "getAccount", objectId, mockRequest(uriInfo));
assertEquals(response.getStatus(), CREATED.getStatusCode());
assertEquals(response.getMetadata().get("Location").get(0).toString(), uri.toString() + "/1.0/kb/accounts/" + objectId.toString());
}
use of org.killbill.billing.util.config.definition.JaxrsConfig in project killbill by killbill.
the class TestBuildResponse method testUriBuilderWithPathLikeUrlAndNonRoot.
@Test(groups = "fast", description = "Tests Uri Builder with Path Like URL and non root Location")
public void testUriBuilderWithPathLikeUrlAndNonRoot() throws Exception {
UUID objectId = UUID.randomUUID();
final UriInfo uriInfo = mock(UriInfo.class);
URI uri = URI.create("http://localhost:8080/killbill");
when(uriInfo.getBaseUri()).thenReturn(uri);
JaxrsConfig jaxrsConfig = mock(JaxrsConfig.class);
when(jaxrsConfig.isJaxrsLocationFullUrl()).thenReturn(false);
JaxrsUriBuilder uriBuilder = new JaxrsUriBuilder(jaxrsConfig);
Response response = uriBuilder.buildResponse(uriInfo, AccountResource.class, "getAccount", objectId, mockRequest(uriInfo));
assertEquals(response.getStatus(), CREATED.getStatusCode());
assertEquals(response.getMetadata().get("Location").get(0), "/killbill/1.0/kb/accounts/" + objectId.toString());
}
use of org.killbill.billing.util.config.definition.JaxrsConfig in project killbill by killbill.
the class TestBuildResponse method testUriBuilderWithPathLikeUrlAndRoot.
@Test(groups = "fast", description = "Tests Uri Builder with Path Like URL and root Location")
public void testUriBuilderWithPathLikeUrlAndRoot() throws Exception {
UUID objectId = UUID.randomUUID();
final UriInfo uriInfo = mock(UriInfo.class);
URI uri = URI.create("http://localhost:8080");
when(uriInfo.getBaseUri()).thenReturn(uri);
JaxrsConfig jaxrsConfig = mock(JaxrsConfig.class);
when(jaxrsConfig.isJaxrsLocationFullUrl()).thenReturn(false);
JaxrsUriBuilder uriBuilder = new JaxrsUriBuilder(jaxrsConfig);
Response response = uriBuilder.buildResponse(uriInfo, AccountResource.class, "getAccount", objectId, mockRequest(uriInfo));
assertEquals(response.getStatus(), CREATED.getStatusCode());
assertEquals(response.getMetadata().get("Location").get(0), "/1.0/kb/accounts/" + objectId.toString());
}
use of org.killbill.billing.util.config.definition.JaxrsConfig in project killbill by killbill.
the class KillpayServerModule method installKillbillModules.
@Override
protected void installKillbillModules() {
install(new AuditModule(configSource));
install(new NodesModule(configSource));
install(new BroadcastModule(configSource));
install(new BeatrixModule(configSource));
install(new CacheModule(configSource));
install(new ConfigModule(configSource));
install(new EventModule(configSource));
install(new CallContextModule(configSource));
install(new CurrencyModule(configSource));
install(new CustomFieldModule(configSource));
install(new DefaultAccountModule(configSource));
install(new ExportModule(configSource));
install(new GlobalLockerModule(configSource));
install(new KillBillShiroAopModule(configSource));
final ConfigurationObjectFactory factory = new ConfigurationObjectFactory(skifeConfigSource);
final JaxrsConfig jaxrsConfig = factory.build(JaxrsConfig.class);
install(new KillbillApiAopModule(jaxrsConfig));
install(new JaxRSAopModule(jaxrsConfig));
install(new KillBillShiroWebModule(servletContext, skifeConfigSource));
install(new NonEntityDaoModule(configSource));
install(new PaymentModule(configSource));
install(new RecordIdModule(configSource));
install(new SecurityModule(configSource));
install(new TagStoreModule(configSource));
install(new DefaultTenantModule(configSource));
// TODO Required by payment for InvoiceInternalApi and InvoicePaymentApi
install(new DefaultInvoiceModule(configSource));
// TODO Dependencies for DefaultInvoiceModule
install(new CatalogModule(configSource));
install(new DefaultEntitlementModule(configSource));
install(new DefaultJunctionModule(configSource));
install(new DefaultSubscriptionModule(configSource));
install(new TemplateModule(configSource));
install(new UsageModule(configSource));
install(new DefaultJaxrsModule(configSource));
// TODO Dependencies for AccountResource
install(new DefaultOverdueModule(configSource));
}
use of org.killbill.billing.util.config.definition.JaxrsConfig in project killbill by killbill.
the class DefaultJaxrsModule method configure.
@Override
protected void configure() {
final ConfigurationObjectFactory factory = new ConfigurationObjectFactory(skifeConfigSource);
final JaxrsConfig jaxrsConfig = factory.build(JaxrsConfig.class);
bind(JaxrsConfig.class).toInstance(jaxrsConfig);
bind(JaxrsUriBuilder.class).asEagerSingleton();
bind(JaxrsExecutors.class).asEagerSingleton();
bind(JaxrsService.class).to(DefaultJaxrsService.class).asEagerSingleton();
}
Aggregations