use of org.apache.cxf.systest.jaxrs.BookStore in project cxf by apache.
the class LoadDistributorTest method testSingleAltAddress.
@Test
public void testSingleAltAddress() throws Exception {
LoadDistributorFeature feature = new LoadDistributorFeature();
List<String> alternateAddresses = new ArrayList<>();
alternateAddresses.add(Server.ADDRESS2);
SequentialStrategy strategy = new SequentialStrategy();
strategy.setAlternateAddresses(alternateAddresses);
feature.setStrategy(strategy);
BookStore bookStore = getBookStore(Server.ADDRESS1, feature);
Book book = bookStore.getBook("123");
assertEquals("unexpected id", 123L, book.getId());
book = bookStore.getBook("123");
assertEquals("unexpected id", 123L, book.getId());
}
use of org.apache.cxf.systest.jaxrs.BookStore in project cxf by apache.
the class Server method createEndpoint.
private void createEndpoint(String address) {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(BookStore.class);
sf.setResourceProvider(BookStore.class, new SingletonResourceProvider(new BookStore(), false));
sf.setAddress(address);
servers.add(sf.create());
}
use of org.apache.cxf.systest.jaxrs.BookStore in project cxf by apache.
the class BookHttpsServer method run.
protected void run() {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(BookStore.class);
// default lifecycle is per-request, change it to singleton
sf.setResourceProvider(BookStore.class, new SingletonResourceProvider(new BookStore()));
sf.setAddress("https://localhost:" + PORT + "/");
sf.create();
}
use of org.apache.cxf.systest.jaxrs.BookStore in project cxf by apache.
the class JAXRSHttpsBookTest method testCustomVerbProxyFromSpringWildcard.
@Test
public void testCustomVerbProxyFromSpringWildcard() throws Exception {
if (System.getProperty("java.version").startsWith("9")) {
// CXF-7270
return;
}
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { CLIENT_CONFIG_FILE3 });
Object bean = ctx.getBean("bookService.proxyFactory");
assertNotNull(bean);
JAXRSClientFactoryBean cfb = (JAXRSClientFactoryBean) bean;
BookStore bs = cfb.create(BookStore.class);
WebClient.getConfig(bs).getRequestContext().put("use.httpurlconnection.method.reflection", true);
// CXF RS Client code will set this property to true if the http verb is unknown
// and this property is not already set. The async conduit is loaded in the tests module
// but we do want to test HTTPUrlConnection reflection hence we set this property to false
WebClient.getConfig(bs).getRequestContext().put("use.async.http.conduit", false);
Book book = bs.retrieveBook(new Book("Retrieve", 123L));
assertEquals("Retrieve", book.getName());
ctx.close();
}
Aggregations