Repository: samza
Updated Branches:
  refs/heads/samza-fluent-api-v1 03bacdc60 -> d39bce9cb


SAMZA-1096: Followup - Two more tests and remove a comment block that was missed


Project: http://git-wip-us.apache.org/repos/asf/samza/repo
Commit: http://git-wip-us.apache.org/repos/asf/samza/commit/d39bce9c
Tree: http://git-wip-us.apache.org/repos/asf/samza/tree/d39bce9c
Diff: http://git-wip-us.apache.org/repos/asf/samza/diff/d39bce9c

Branch: refs/heads/samza-fluent-api-v1
Commit: d39bce9cbb97ac534e5f20352f4521248cadc225
Parents: 03bacdc
Author: Jacob Maes <jm...@linkedin.com>
Authored: Thu Feb 23 12:06:02 2017 -0800
Committer: Jacob Maes <jm...@linkedin.com>
Committed: Thu Feb 23 12:06:02 2017 -0800

----------------------------------------------------------------------
 .../org/apache/samza/system/StreamSpec.java     |  5 -----
 .../TestAbstractExecutionEnvironment.java       | 21 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/samza/blob/d39bce9c/samza-api/src/main/java/org/apache/samza/system/StreamSpec.java
----------------------------------------------------------------------
diff --git a/samza-api/src/main/java/org/apache/samza/system/StreamSpec.java 
b/samza-api/src/main/java/org/apache/samza/system/StreamSpec.java
index 3bd0076..ffd9d4a 100644
--- a/samza-api/src/main/java/org/apache/samza/system/StreamSpec.java
+++ b/samza-api/src/main/java/org/apache/samza/system/StreamSpec.java
@@ -197,11 +197,6 @@ public class StreamSpec {
   }
 
   private void validateLogicalIdentifier(String identifierName, String 
identifierValue) {
-    /*if (identifier == null) {
-      throw new NullPointerException();
-    } else if (identifier.isEmpty()) {
-
-    } else*/
     if (!identifierValue.matches("[A-Za-z0-9_-]+")) {
       throw new IllegalArgumentException(String.format("Identifier '%s' must 
match the expression [A-Za-z0-9_-]+", identifierName));
     }

http://git-wip-us.apache.org/repos/asf/samza/blob/d39bce9c/samza-core/src/test/java/org/apache/samza/system/TestAbstractExecutionEnvironment.java
----------------------------------------------------------------------
diff --git 
a/samza-core/src/test/java/org/apache/samza/system/TestAbstractExecutionEnvironment.java
 
b/samza-core/src/test/java/org/apache/samza/system/TestAbstractExecutionEnvironment.java
index e547322..3bb2b26 100644
--- 
a/samza-core/src/test/java/org/apache/samza/system/TestAbstractExecutionEnvironment.java
+++ 
b/samza-core/src/test/java/org/apache/samza/system/TestAbstractExecutionEnvironment.java
@@ -233,6 +233,17 @@ public class TestAbstractExecutionEnvironment {
     env.streamFromConfig(STREAM_ID, TEST_PHYSICAL_NAME, TEST_SYSTEM_INVALID);
   }
 
+  // Empty strings are NOT allowed for system name, because it's used as an 
identifier in the config.
+  @Test(expected = IllegalArgumentException.class)
+  public void testStreamFromConfigSystemNameArgEmpty() {
+    Config config = buildStreamConfig(STREAM_ID,
+        StreamConfig.PHYSICAL_NAME(), TEST_PHYSICAL_NAME2,
+        StreamConfig.SYSTEM(), TEST_SYSTEM2);
+
+    ExecutionEnvironment env = new 
TestAbstractExecutionEnvironmentImpl(config);
+    env.streamFromConfig(STREAM_ID, TEST_PHYSICAL_NAME, "");
+  }
+
   // Null is not allowed for system name.
   @Test(expected = NullPointerException.class)
   public void testStreamFromConfigSystemNameArgNull() {
@@ -254,6 +265,16 @@ public class TestAbstractExecutionEnvironment {
     env.streamFromConfig(STREAM_ID_INVALID);
   }
 
+  // Empty strings are NOT allowed for streamId, because it's used as an 
identifier in the config.
+  @Test(expected = IllegalArgumentException.class)
+  public void testStreamFromConfigStreamIdEmpty() {
+    Config config = buildStreamConfig("",
+        StreamConfig.SYSTEM(), TEST_SYSTEM);
+
+    ExecutionEnvironment env = new 
TestAbstractExecutionEnvironmentImpl(config);
+    env.streamFromConfig("");
+  }
+
   // Null is not allowed for streamId.
   @Test(expected = NullPointerException.class)
   public void testStreamFromConfigStreamIdNull() {

Reply via email to