You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by GitBox <gi...@apache.org> on 2020/03/24 16:08:49 UTC

[GitHub] [storm] nd368 opened a new pull request #3234: [STORM-1304] port storm.submitter-test to java

nd368 opened a new pull request #3234: [STORM-1304] port storm.submitter-test to java
URL: https://github.com/apache/storm/pull/3234
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [storm] nd368 commented on issue #3234: [STORM-1304] port storm.submitter-test to java

Posted by GitBox <gi...@apache.org>.
nd368 commented on issue #3234: [STORM-1304] port storm.submitter-test to java
URL: https://github.com/apache/storm/pull/3234#issuecomment-612377277
 
 
   changes made - thanks for review :)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [storm] Ethanlm commented on a change in pull request #3234: [STORM-1304] port storm.submitter-test to java

Posted by GitBox <gi...@apache.org>.
Ethanlm commented on a change in pull request #3234: [STORM-1304] port storm.submitter-test to java
URL: https://github.com/apache/storm/pull/3234#discussion_r404869815
 
 

 ##########
 File path: storm-core/test/jvm/org/apache/storm/SubmitterTest.java
 ##########
 @@ -0,0 +1,107 @@
+/*
+ * Copyright 2018 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.storm;
+
+import com.google.common.base.Strings;
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class SubmitterTest {
+
+    @Test
+    public void testMd5DigestSecretGeneration01() {
+        // No payload or scheme are generated when already present
+        Map<String, Object> conf = new HashMap<>();
+        conf.put(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD, "foobar:12345");
+        conf.put(Config.STORM_ZOOKEEPER_AUTH_SCHEME, "anything");
+        Map<String, Object> result = StormSubmitter.prepareZookeeperAuthentication(conf);
+        Object actualPayload = result.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD);
+        Object actualScheme = result.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_SCHEME);
+        assertThat(actualPayload, is("foobar:12345"));
+        assertThat(actualScheme, is("digest"));
+    }
+
+    @Test
+    public void testMd5DigestSecretGeneration02() {
+        // Scheme is set to digest if not already.
+        Map<String, Object> conf = new HashMap<>();
+        conf.put(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD, "foobar:12345");
+        Map<String, Object> result = StormSubmitter.prepareZookeeperAuthentication(conf);
+        Object actualPayload = result.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD);
+        Object actualScheme = result.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_SCHEME);
+        assertThat(actualPayload, is("foobar:12345"));
+        assertThat(actualScheme, is("digest"));
+    }
+
+    @Test
+    public void testMd5DigestSecretGeneration03() {
+        // A payload is generated when no payload is present.
+        Map<String, Object> conf = new HashMap<>();
+        conf.put(Config.STORM_ZOOKEEPER_AUTH_SCHEME, "anything");
+        Map<String, Object> result = StormSubmitter.prepareZookeeperAuthentication(conf);
+        Object actualPayload = result.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD);
+        Object actualScheme = result.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_SCHEME);
+        assertThat(Strings.isNullOrEmpty((String)actualPayload), is(false));
 
 Review comment:
   This should use `StringUtils.isBlank`.
   
   Also can we use `assertFalse` (or `assertTrue`) here and below 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [storm] Ethanlm merged pull request #3234: [STORM-1304] port storm.submitter-test to java

Posted by GitBox <gi...@apache.org>.
Ethanlm merged pull request #3234: [STORM-1304] port storm.submitter-test to java
URL: https://github.com/apache/storm/pull/3234
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [storm] Ethanlm commented on a change in pull request #3234: [STORM-1304] port storm.submitter-test to java

Posted by GitBox <gi...@apache.org>.
Ethanlm commented on a change in pull request #3234: [STORM-1304] port storm.submitter-test to java
URL: https://github.com/apache/storm/pull/3234#discussion_r404867552
 
 

 ##########
 File path: storm-core/test/jvm/org/apache/storm/SubmitterTest.java
 ##########
 @@ -0,0 +1,107 @@
+/*
+ * Copyright 2018 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.storm;
+
+import com.google.common.base.Strings;
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class SubmitterTest {
+
+    @Test
+    public void testMd5DigestSecretGeneration01() {
+        // No payload or scheme are generated when already present
+        Map<String, Object> conf = new HashMap<>();
+        conf.put(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD, "foobar:12345");
+        conf.put(Config.STORM_ZOOKEEPER_AUTH_SCHEME, "anything");
+        Map<String, Object> result = StormSubmitter.prepareZookeeperAuthentication(conf);
+        Object actualPayload = result.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD);
+        Object actualScheme = result.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_SCHEME);
+        assertThat(actualPayload, is("foobar:12345"));
 
 Review comment:
   can we use `assertEquals` here and below?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services