use of java.util.Properties in project camel by apache.
the class KafkaComponentTest method getProducerKeys.
private Properties getProducerKeys() {
Properties props = new Properties();
props.put(ProducerConfig.ACKS_CONFIG, "1");
props.put(ProducerConfig.BUFFER_MEMORY_CONFIG, "33554432");
props.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, "none");
props.put(ProducerConfig.RETRIES_CONFIG, "0");
props.put(ProducerConfig.BATCH_SIZE_CONFIG, "16384");
props.put(ProducerConfig.CONNECTIONS_MAX_IDLE_MS_CONFIG, "540000");
props.put(ProducerConfig.LINGER_MS_CONFIG, "0");
props.put(ProducerConfig.MAX_BLOCK_MS_CONFIG, "60000");
props.put(ProducerConfig.MAX_REQUEST_SIZE_CONFIG, "1048576");
props.put(ProducerConfig.PARTITIONER_CLASS_CONFIG, KafkaConstants.KAFKA_DEFAULT_PARTITIONER);
props.put(ProducerConfig.RECEIVE_BUFFER_CONFIG, "32768");
props.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, "30000");
props.put(ProducerConfig.SEND_BUFFER_CONFIG, "131072");
props.put(ProducerConfig.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION, "5");
props.put(ProducerConfig.METADATA_MAX_AGE_CONFIG, "300000");
props.put(ProducerConfig.METRICS_NUM_SAMPLES_CONFIG, "2");
props.put(ProducerConfig.METRICS_SAMPLE_WINDOW_MS_CONFIG, "30000");
props.put(ProducerConfig.RECONNECT_BACKOFF_MS_CONFIG, "50");
props.put(ProducerConfig.RETRY_BACKOFF_MS_CONFIG, "100");
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, KafkaConstants.KAFKA_DEFAULT_SERIALIZER);
props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, KafkaConstants.KAFKA_DEFAULT_SERIALIZER);
props.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "PLAINTEXT");
props.put(SslConfigs.SSL_ENABLED_PROTOCOLS_CONFIG, "TLSv1.2, TLSv1.1, TLSv1");
props.put(SslConfigs.SSL_KEYSTORE_TYPE_CONFIG, "JKS");
props.put(SslConfigs.SSL_PROTOCOL_CONFIG, "TLS");
props.put(SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG, "JKS");
props.put(SaslConfigs.SASL_KERBEROS_KINIT_CMD, "/usr/bin/kinit");
props.put(SaslConfigs.SASL_KERBEROS_MIN_TIME_BEFORE_RELOGIN, "60000");
props.put(SaslConfigs.SASL_KERBEROS_TICKET_RENEW_JITTER, "0.05");
props.put(SaslConfigs.SASL_KERBEROS_TICKET_RENEW_WINDOW_FACTOR, "0.8");
props.put(SaslConfigs.SASL_MECHANISM, "PLAIN");
props.put(SslConfigs.SSL_KEYMANAGER_ALGORITHM_CONFIG, "SunX509");
props.put(SslConfigs.SSL_TRUSTMANAGER_ALGORITHM_CONFIG, "PKIX");
return props;
}
use of java.util.Properties in project camel by apache.
the class MailEndpointTlsTest method testMailEndpointNoTslConfig.
@Test
public void testMailEndpointNoTslConfig() throws Exception {
MailConfiguration cfg = new MailConfiguration();
cfg.setPort(21);
cfg.setProtocol(protocol);
cfg.setHost("myhost");
cfg.setUsername("james");
cfg.setPassword("secret");
cfg.setSslContextParameters(MailTestHelper.createSslContextParameters());
Properties javaMailProperties = cfg.createJavaMailSender().getJavaMailProperties();
assertFalse(cfg.isStartTlsEnabled());
if (protocol.endsWith("s")) {
assertTrue(cfg.isSecureProtocol());
assertNotNull(javaMailProperties.get("mail." + protocol + ".socketFactory"));
assertNotNull(javaMailProperties.get("mail." + protocol + ".socketFactory.fallback"));
assertNotNull(javaMailProperties.get("mail." + protocol + ".socketFactory.port"));
} else {
assertFalse(cfg.isSecureProtocol());
assertNull(javaMailProperties.get("mail." + protocol + ".socketFactory"));
assertNull(javaMailProperties.get("mail." + protocol + ".socketFactory.fallback"));
assertNull(javaMailProperties.get("mail." + protocol + ".socketFactory.port"));
}
}
use of java.util.Properties in project camel by apache.
the class MailUsingCustomSessionTest method createRegistry.
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry registry = super.createRegistry();
mailSession = Session.getInstance(new Properties());
registry.bind("myCustomMailSession", mailSession);
return registry;
}
use of java.util.Properties in project camel by apache.
the class MimeMessageConsumeTest method testSendAndReceiveMails.
@Test
public void testSendAndReceiveMails() throws Exception {
Mailbox.clearAll();
MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
resultEndpoint.expectedMinimumMessageCount(1);
Properties properties = new Properties();
properties.put("mail.smtp.host", "localhost");
Session session = Session.getInstance(properties, null);
MimeMessage message = new MimeMessage(session);
populateMimeMessageBody(message);
message.setRecipients(Message.RecipientType.TO, "james3@localhost");
Transport.send(message);
// lets test the receive worked
resultEndpoint.assertIsSatisfied();
Exchange exchange = resultEndpoint.getReceivedExchanges().get(0);
String text = exchange.getIn().getBody(String.class);
assertEquals("mail body", body, text);
assertNotNull("attachments got lost", exchange.getIn().getAttachments());
for (String s : exchange.getIn().getAttachmentNames()) {
DataHandler dh = exchange.getIn().getAttachment(s);
Object content = dh.getContent();
assertNotNull("Content should not be empty", content);
assertEquals("log4j2.properties", dh.getName());
}
}
use of java.util.Properties in project camel by apache.
the class MultipleDestinationConsumeTest method setUp.
@Override
@Before
public void setUp() throws Exception {
Properties properties = new Properties();
properties.put("mail.smtp.host", "localhost");
mailSession = Session.getInstance(properties, null);
super.setUp();
}
Aggregations