use of org.junit.Before in project camel by apache.
the class CxfRsProducerClientFactoryCacheTest method setUp.
@Before
public void setUp() throws Exception {
applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest1.xml");
context1 = SpringCamelContext.springCamelContext(applicationContext, false);
context1.start();
template1 = context1.createProducerTemplate();
template1.start();
}
use of org.junit.Before in project camel by apache.
the class WSAddressingTest method setUp.
@Before
public void setUp() throws Exception {
template = context.createProducerTemplate();
JaxWsServerFactoryBean svrBean = new JaxWsServerFactoryBean();
svrBean.setAddress(getServerAddress());
svrBean.setServiceClass(Greeter.class);
svrBean.setServiceBean(new GreeterImpl());
SpringBusFactory bf = new SpringBusFactory();
URL cxfConfig = null;
if (getCxfServerConfig() != null) {
cxfConfig = ClassLoaderUtils.getResource(getCxfServerConfig(), this.getClass());
}
svrBean.setBus(bf.createBus(cxfConfig));
serviceEndpoint = svrBean.create();
}
use of org.junit.Before in project camel by apache.
the class FtpConsumerWithCharsetTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
byte[] iso = payload.getBytes("iso-8859-1");
byte[] utf = payload.getBytes("utf-8");
log.debug("iso: {}", new String(iso, Charset.forName("iso-8859-1")));
log.debug("utf: {}", new String(utf, Charset.forName("utf-8")));
for (byte b : iso) {
log.debug("iso byte: {}", b);
}
for (byte b : utf) {
log.debug("utf byte: {}", b);
}
prepareFtpServer();
// Check that the payload exists in upload and is in iso charset.ß
File file = new File(FTP_ROOT_DIR + "/upload/iso.txt");
assertTrue("The uploaded file should exists", file.exists());
// Lets also test byte wise
InputStream fis = IOHelper.buffered(new FileInputStream(file));
byte[] buffer = new byte[100];
int len = fis.read(buffer);
assertTrue("Should read data: " + len, len != -1);
byte[] data = new byte[len];
System.arraycopy(buffer, 0, data, 0, len);
fis.close();
// data should be in iso, where the danish ae is -26, oe is -8 aa is -27
// and copyright is -87
assertEquals(5, data.length);
assertEquals(-26, data[0]);
assertEquals(-8, data[1]);
assertEquals(-27, data[2]);
assertEquals(32, data[3]);
assertEquals(-87, data[4]);
}
use of org.junit.Before in project camel by apache.
the class DefaultExchangeFormatterTest method setUp.
@Before
public void setUp() {
camelContext = new DefaultCamelContext();
Message message = new DefaultMessage();
message.setBody("This is the message body");
exchange = new DefaultExchange(camelContext);
exchange.setIn(message);
exchangeFormatter = new DefaultExchangeFormatter();
}
use of org.junit.Before in project camel by apache.
the class WebsocketCamelRouterTestSupport method setUp.
@Before
public void setUp() throws Exception {
server = new Server(PORT);
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
server.setHandler(context);
servletHolder = new ServletHolder(new CamelWebSocketServlet());
servletHolder.setName("CamelWsServlet");
context.addServlet(servletHolder, "/*");
server.start();
if (startCamelContext) {
super.setUp();
}
}
Aggregations