This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch CAMEL-13402
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/CAMEL-13402 by this push:
new e7566aa Removing some whitespace
e7566aa is described below
commit e7566aafac83206ecc1ed7bd311eda82220022b4
Author: Colm O hEigeartaigh <[email protected]>
AuthorDate: Mon Apr 29 12:53:58 2019 +0100
Removing some whitespace
---
.../java/org/apache/camel/coap/CoAPComponent.java | 4 +-
.../java/org/apache/camel/coap/CoAPEndpoint.java | 59 +++++++++++-----------
.../java/org/apache/camel/coap/CoAPProducer.java | 2 +-
.../apache/camel/coap/CoAPComponentTLSTest.java | 2 +-
.../camel/coap/CoAPRestComponentTLSTest.java | 16 +++---
5 files changed, 41 insertions(+), 42 deletions(-)
diff --git
a/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPComponent.java
b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPComponent.java
index 8cfeb8c..6c213ef 100644
---
a/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPComponent.java
+++
b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPComponent.java
@@ -64,7 +64,7 @@ public class CoAPComponent extends DefaultComponent
implements RestConsumerFacto
NetworkConfig config = NetworkConfig.createStandardWithoutFile();
InetSocketAddress address = new InetSocketAddress(port);
coapBuilder.setNetworkConfig(config);
-
+
// Configure TLS
if (CoAPEndpoint.enableTLS(endpoint.getUri())) {
DTLSConnector connector =
endpoint.createDTLSConnector(address, false);
@@ -75,7 +75,7 @@ public class CoAPComponent extends DefaultComponent
implements RestConsumerFacto
server = new CoapServer();
server.addEndpoint(coapBuilder.build());
-
+
servers.put(port, server);
if (this.isStarted()) {
server.start();
diff --git
a/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPEndpoint.java
b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPEndpoint.java
index c47438c..ab58077 100644
---
a/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPEndpoint.java
+++
b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPEndpoint.java
@@ -55,16 +55,16 @@ public class CoAPEndpoint extends DefaultEndpoint {
private URI uri;
@UriParam(label = "consumer")
private String coapMethodRestrict;
-
+
@UriParam
private KeyStoreParameters keyStoreParameters;
-
+
@UriParam
private KeyStore keystore;
-
+
@UriParam
private KeyStoreParameters trustStoreParameters;
-
+
@UriParam
private KeyStore truststore;
@@ -82,17 +82,17 @@ public class CoAPEndpoint extends DefaultEndpoint {
@UriParam
private String alias;
-
+
@UriParam(label = "security", javaType = "java.lang.String", secret = true)
private char[] password;
-
+
@UriParam
private String cipherSuites;
-
+
private String[] configuredCipherSuites;
-
+
private String clientAuthentication;
-
+
private CoAPComponent component;
public CoAPEndpoint(String uri, CoAPComponent component) {
@@ -142,9 +142,9 @@ public class CoAPEndpoint extends DefaultEndpoint {
public CoapServer getCoapServer() {
return component.getServer(getUri().getPort(), this);
}
-
+
/**
- * The KeyStoreParameters object to use with TLS to configure the
keystore. Alternatively, a "keystore"
+ * The KeyStoreParameters object to use with TLS to configure the
keystore. Alternatively, a "keystore"
* parameter can be directly configured instead. An alias and password
should also be configured on the route definition.
*/
public KeyStoreParameters getKeyStoreParameters() {
@@ -157,9 +157,9 @@ public class CoAPEndpoint extends DefaultEndpoint {
this.keystore = keyStoreParameters.createKeyStore();
}
}
-
+
/**
- * The KeyStoreParameters object to use with TLS to configure the
truststore. Alternatively, a "truststore"
+ * The KeyStoreParameters object to use with TLS to configure the
truststore. Alternatively, a "truststore"
* object can be directly configured instead. All certificates in the
truststore are used to establish trust.
*/
public KeyStoreParameters getTrustStoreParameters() {
@@ -172,7 +172,7 @@ public class CoAPEndpoint extends DefaultEndpoint {
this.truststore = trustStoreParameters.createKeyStore();
}
}
-
+
/**
* Gets the TLS key store. Alternatively, a KeyStoreParameters object can
be configured instead.
* An alias and password should also be configured on the route definition.
@@ -188,7 +188,7 @@ public class CoAPEndpoint extends DefaultEndpoint {
public void setKeystore(KeyStore keystore) {
this.keystore = keystore;
}
-
+
/**
* Gets the TLS trust store. Alternatively, a "trustStoreParameters"
object can be configured instead.
* All certificates in the truststore are used to establish trust.
@@ -204,7 +204,7 @@ public class CoAPEndpoint extends DefaultEndpoint {
public void setTruststore(KeyStore truststore) {
this.truststore = truststore;
}
-
+
/**
* Gets the alias used to query the KeyStore for the private key and
certificate.
*/
@@ -288,7 +288,7 @@ public class CoAPEndpoint extends DefaultEndpoint {
public void setPassword(char[] password) {
this.password = password;
}
-
+
/**
* Gets the cipherSuites String. This is a comma separated String of
ciphersuites to configure.
*/
@@ -305,12 +305,11 @@ public class CoAPEndpoint extends DefaultEndpoint {
configuredCipherSuites = cipherSuites.split(",");
}
}
-
+
private String[] getConfiguredCipherSuites() {
return configuredCipherSuites;
}
-
-
+
/**
* Gets the configuration options for server-side client-authentication
requirements. The value is
* either null or one of NONE, WANT, REQUIRE.
@@ -322,23 +321,23 @@ public class CoAPEndpoint extends DefaultEndpoint {
/**
* Sets the configuration options for server-side client-authentication
requirements.
* The value must be one of NONE, WANT, REQUIRE.
- *
+ *
* @param value the desired configuration options or {@code null} to use
the defaults
*/
public void setClientAuthentication(String clientAuthentication) {
this.clientAuthentication = clientAuthentication;
}
-
+
private boolean isClientAuthenticationRequired() {
- return clientAuthentication != null
+ return clientAuthentication != null
&& ClientAuthentication.valueOf(clientAuthentication) ==
ClientAuthentication.REQUIRE;
}
-
+
private boolean isClientAuthenticationWanted() {
- return clientAuthentication != null
+ return clientAuthentication != null
&& ClientAuthentication.valueOf(clientAuthentication) ==
ClientAuthentication.WANT;
}
-
+
private Certificate[] getTrustedCerts() throws KeyStoreException {
if (truststore != null) {
Enumeration<String> aliases = truststore.aliases();
@@ -356,7 +355,7 @@ public class CoAPEndpoint extends DefaultEndpoint {
return new Certificate[0];
}
-
+
public static boolean enableTLS(URI uri) {
return "coaps".equals(uri.getScheme());
}
@@ -368,7 +367,7 @@ public class CoAPEndpoint extends DefaultEndpoint {
if (trustedRpkStore == null && getTruststore() == null && pskStore
== null) {
throw new IllegalStateException("A truststore must be
configured to use TLS");
}
-
+
builder.setClientOnly();
} else {
if (privateKey == null && getKeystore() == null && pskStore ==
null) {
@@ -387,7 +386,7 @@ public class CoAPEndpoint extends DefaultEndpoint {
&& (getTruststore() == null && publicKey == null)) {
throw new IllegalStateException("A truststore must be
configured to support TLS client authentication");
}
-
+
builder.setAddress(address);
builder.setClientAuthenticationRequired(isClientAuthenticationRequired());
builder.setClientAuthenticationWanted(isClientAuthenticationWanted());
@@ -396,7 +395,7 @@ public class CoAPEndpoint extends DefaultEndpoint {
try {
// Configure the identity if the keystore or privateKey parameter
is specified
if (getKeystore() != null) {
- PrivateKey privateKey =
+ PrivateKey privateKey =
(PrivateKey)getKeystore().getKey(getAlias(),
getPassword());
builder.setIdentity(privateKey,
getKeystore().getCertificateChain(getAlias()));
} else if (privateKey != null) {
diff --git
a/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPProducer.java
b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPProducer.java
index 2d380d5..b9187fb 100644
---
a/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPProducer.java
+++
b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPProducer.java
@@ -93,7 +93,7 @@ public class CoAPProducer extends DefaultProducer {
uri = endpoint.getUri();
}
client = new CoapClient(uri);
-
+
// Configure TLS
if (CoAPEndpoint.enableTLS((uri))) {
DTLSConnector connector = endpoint.createDTLSConnector(null,
true);
diff --git
a/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPComponentTLSTest.java
b/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPComponentTLSTest.java
index a7f1a35..1792952 100644
---
a/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPComponentTLSTest.java
+++
b/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPComponentTLSTest.java
@@ -104,7 +104,7 @@ public class CoAPComponentTLSTest extends CamelTestSupport {
sendBodyAndHeader("direct:failedclientauth", "Camel CoAP",
CoAPConstants.COAP_METHOD, "POST");
assertMockEndpointsSatisfied();
}
-
+
@Test
public void testCipherSuites() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
diff --git
a/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPRestComponentTLSTest.java
b/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPRestComponentTLSTest.java
index 8d94bce..3a01947 100644
---
a/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPRestComponentTLSTest.java
+++
b/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPRestComponentTLSTest.java
@@ -33,7 +33,7 @@ public class CoAPRestComponentTLSTest extends
CamelTestSupport {
@Produce("direct:start")
protected ProducerTemplate sender;
-
+
@Test
public void testPOST() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
@@ -43,7 +43,7 @@ public class CoAPRestComponentTLSTest extends
CamelTestSupport {
sender.sendBodyAndHeader("Camel CoAP", CoAPConstants.COAP_METHOD,
"POST");
assertMockEndpointsSatisfied();
}
-
+
@Test
public void testGET() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
@@ -53,21 +53,21 @@ public class CoAPRestComponentTLSTest extends
CamelTestSupport {
sender.sendBody("");
assertMockEndpointsSatisfied();
}
-
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
KeyStoreParameters keystoreParameters = new KeyStoreParameters();
keystoreParameters.setResource("service.jks");
keystoreParameters.setPassword("security");
-
+
KeyStoreParameters truststoreParameters = new KeyStoreParameters();
truststoreParameters.setResource("truststore.jks");
truststoreParameters.setPassword("storepass");
-
+
context.getRegistry().bind("keystoreParameters", keystoreParameters);
context.getRegistry().bind("truststoreParameters",
truststoreParameters);
-
+
return new RouteBuilder() {
@Override
public void configure() throws Exception {
@@ -75,7 +75,7 @@ public class CoAPRestComponentTLSTest extends
CamelTestSupport {
.endpointProperty("keyStoreParameters",
"#keystoreParameters")
.endpointProperty("alias", "service")
.endpointProperty("password", "security");
-
+
rest("/TestResource")
.get().to("direct:get1")
.post().to("direct:post1");
@@ -91,7 +91,7 @@ public class CoAPRestComponentTLSTest extends
CamelTestSupport {
exchange.getOut().setBody("Hello " +
exchange.getIn().getBody(String.class));
}
});
-
+
from("direct:start")
.toF("coaps://localhost:%d/TestResource?trustStoreParameters=#truststoreParameters",
PORT)
.to("mock:result");