use of org.junit.Before in project camel by apache.
the class SqsProducerTest method setup.
@Before
public void setup() throws Exception {
underTest = new SqsProducer(sqsEndpoint);
sendMessageResult = new SendMessageResult().withMD5OfMessageBody(MESSAGE_MD5).withMessageId(MESSAGE_ID);
sqsConfiguration = new SqsConfiguration();
HeaderFilterStrategy headerFilterStrategy = new SqsHeaderFilterStrategy();
sqsConfiguration.setDelaySeconds(Integer.valueOf(0));
when(sqsEndpoint.getClient()).thenReturn(amazonSQSClient);
when(sqsEndpoint.getConfiguration()).thenReturn(sqsConfiguration);
when(amazonSQSClient.sendMessage(any(SendMessageRequest.class))).thenReturn(sendMessageResult);
when(exchange.getOut()).thenReturn(outMessage);
when(exchange.getIn()).thenReturn(inMessage);
when(exchange.getPattern()).thenReturn(ExchangePattern.InOnly);
when(inMessage.getBody(String.class)).thenReturn(SAMPLE_MESSAGE_BODY);
when(sqsEndpoint.getQueueUrl()).thenReturn(QUEUE_URL);
when(sqsEndpoint.getHeaderFilterStrategy()).thenReturn(headerFilterStrategy);
}
use of org.junit.Before in project camel by apache.
the class SqsEndpointTest method setUp.
@Before
public void setUp() throws Exception {
amazonSQSClient = EasyMock.createMock(AmazonSQSClient.class);
SqsConfiguration config = new SqsConfiguration();
config.setQueueName("test-queue");
config.setAmazonSQSClient(amazonSQSClient);
endpoint = new SqsEndpoint("aws-sqs://test-queue", new SqsComponent(new DefaultCamelContext()), config);
}
use of org.junit.Before in project camel by apache.
the class BonitaAuthFilterConnectionTest method setup.
@Before
public void setup() {
Mockito.when(requestContext.getCookies()).thenReturn(new HashMap<String, Cookie>());
Mockito.when(requestContext.getHeaders()).thenReturn(new MultivaluedHashMap());
}
use of org.junit.Before in project camel by apache.
the class SftpServerTestSupport method setUp.
@Override
@Before
public void setUp() throws Exception {
deleteDirectory(FTP_ROOT_DIR);
oldUserHome = System.getProperty("user.home");
System.setProperty("user.home", "target/user-home");
String simulatedUserHome = "target/user-home";
String simulatedUserSsh = "target/user-home/.ssh";
deleteDirectory(simulatedUserHome);
createDirectory(simulatedUserHome);
createDirectory(simulatedUserSsh);
FileUtils.copyInputStreamToFile(getClass().getClassLoader().getResourceAsStream("known_hosts"), new File(simulatedUserSsh + "/known_hosts"));
super.setUp();
setUpServer();
}
use of org.junit.Before in project camel by apache.
the class FtpServerTestSupport method setUp.
@Override
@Before
public void setUp() throws Exception {
deleteDirectory(FTP_ROOT_DIR);
canTest = false;
FtpServerFactory factory = createFtpServerFactory();
if (factory != null) {
ftpServer = factory.createServer();
if (ftpServer != null) {
ftpServer.start();
canTest = true;
}
}
try {
super.setUp();
} catch (Exception e) {
// ignore if algorithm is not on the OS
NoSuchAlgorithmException nsae = ObjectHelper.getException(NoSuchAlgorithmException.class, e);
if (nsae != null) {
canTest = false;
String name = System.getProperty("os.name");
String message = nsae.getMessage();
log.warn("SunX509 is not avail on this platform [{}] Testing is skipped! Real cause: {}", name, message);
} else {
// some other error then throw it so the test can fail
throw e;
}
}
}
Aggregations