You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/09/27 12:07:11 UTC
[camel] 07/16: CAMEL-13998 - formatting + unit tests
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 973edb0e85384b09d7ed7b76588607230072e2a5
Author: marius cornescu <ma...@yahoo.com>
AuthorDate: Sat Sep 21 13:27:54 2019 +0200
CAMEL-13998 - formatting + unit tests
---
.../java/org/apache/camel/component/hdfs/HdfsConfiguration.java | 6 ++----
.../hdfs/kerberos/HdfsKerberosConfigurationFactoryTest.java | 9 +++++----
.../camel/component/hdfs/kerberos/KerberosConfigurationTest.java | 8 ++++----
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java
index 5a9d1d7..f97fd89 100644
--- a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java
+++ b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java
@@ -45,13 +45,11 @@ public class HdfsConfiguration {
private boolean wantAppend;
private List<HdfsProducer.SplitStrategy> splitStrategies;
- @UriPath
- @Metadata(required = true)
+ @UriPath @Metadata(required = true)
private String hostName;
@UriPath(defaultValue = "" + HdfsConstants.DEFAULT_PORT)
private int port = HdfsConstants.DEFAULT_PORT;
- @UriPath
- @Metadata(required = true)
+ @UriPath @Metadata(required = true)
private String path;
@UriParam(label = "producer", defaultValue = "true")
private boolean overwrite = true;
diff --git a/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/kerberos/HdfsKerberosConfigurationFactoryTest.java b/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/kerberos/HdfsKerberosConfigurationFactoryTest.java
index 014dc84..5055e38 100644
--- a/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/kerberos/HdfsKerberosConfigurationFactoryTest.java
+++ b/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/kerberos/HdfsKerberosConfigurationFactoryTest.java
@@ -2,20 +2,21 @@ package org.apache.camel.component.hdfs.kerberos;
import org.junit.Test;
+import java.io.FileNotFoundException;
import java.io.IOException;
public class HdfsKerberosConfigurationFactoryTest {
- @Test
- public void setupExistingKerberosConfigFile() throws IOException {
+ @Test(expected = FileNotFoundException.class)
+ public void setupExistingKerberosConfigFileWithMissingConfigFile() throws IOException {
// given
- String kerberosConfigFileLocation = null;
+ String kerberosConfigFileLocation = "missing.conf";
// when
HdfsKerberosConfigurationFactory.setKerberosConfigFile(kerberosConfigFileLocation);
// then
-
+ /* exception was thrown */
}
diff --git a/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/kerberos/KerberosConfigurationTest.java b/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/kerberos/KerberosConfigurationTest.java
index 6e9788a..f9af902 100644
--- a/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/kerberos/KerberosConfigurationTest.java
+++ b/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/kerberos/KerberosConfigurationTest.java
@@ -53,8 +53,8 @@ public class KerberosConfigurationTest {
/* exception was thrown */
}
- @Test
- public void loginWithKeytab() throws IOException {
+ @Test(expected = FileNotFoundException.class)
+ public void loginWithMissingKeytabFile() throws IOException {
// given
List<String> namedNodes = Arrays.asList("kerb_node_01.example.com:8021", "kerb_node_02.example.com:8022");
String kerberosConfigFileLocation = pwd() + "/src/test/resources/kerberos/test-kerb5.conf";
@@ -62,13 +62,13 @@ public class KerberosConfigurationTest {
underTest = new KerberosConfiguration(namedNodes, kerberosConfigFileLocation, replicationFactor);
String username = "test_user";
- String keyTabFileLocation = pwd() + "/src/test/resources/kerberos/test-keytab.bin";
+ String keyTabFileLocation = pwd() + "/src/test/resources/kerberos/missing.bin";
// when
underTest.loginWithKeytab(username, keyTabFileLocation);
// then
-
+ /* exception was thrown */
}
private String pwd() {