Search in sources :

Example 11 with Before

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();
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) Before(org.junit.Before)

Example 12 with Before

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();
}
Also used : SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) URL(java.net.URL) Before(org.junit.Before)

Example 13 with Before

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]);
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) File(java.io.File) FileInputStream(java.io.FileInputStream) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Before(org.junit.Before)

Example 14 with Before

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();
}
Also used : DefaultMessage(org.apache.camel.impl.DefaultMessage) DefaultExchange(org.apache.camel.impl.DefaultExchange) Message(org.apache.camel.Message) DefaultMessage(org.apache.camel.impl.DefaultMessage) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Before(org.junit.Before)

Example 15 with Before

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();
    }
}
Also used : Server(org.eclipse.jetty.server.Server) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)8594 File (java.io.File)733 Properties (java.util.Properties)270 Configuration (org.apache.hadoop.conf.Configuration)266 TreeMap (java.util.TreeMap)247 ArrayList (java.util.ArrayList)228 HashMap (java.util.HashMap)162 IOException (java.io.IOException)159 URL (java.net.URL)137 Path (org.apache.hadoop.fs.Path)130 Config (com.hazelcast.config.Config)115 HazelcastInstance (com.hazelcast.core.HazelcastInstance)111 InputStream (java.io.InputStream)109 Date (java.util.Date)96 InvocationOnMock (org.mockito.invocation.InvocationOnMock)96 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)92 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)90 ByteArrayOutputStream (java.io.ByteArrayOutputStream)83 Connection (java.sql.Connection)78 Random (java.util.Random)75