storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kabh...@apache.org
Subject [3/7] storm git commit: STORM-1236: port backtype.storm.security.auth.SaslTransportPlugin-test to java
Date Thu, 07 Jul 2016 14:26:35 GMT
STORM-1236: port backtype.storm.security.auth.SaslTransportPlugin-test to java


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

Branch: refs/heads/master
Commit: fe5d37a3d9d605c4c10686bf8e9548241bdf4d74
Parents: 473770d
Author: Abhishek Agarwal <abhishek.agarwal@inmobi.com>
Authored: Wed Mar 9 21:57:17 2016 +0530
Committer: Abhishek Agarwal <abhishek.agarwal@inmobi.com>
Committed: Thu Mar 10 18:08:20 2016 +0530

----------------------------------------------------------------------
 .../security/auth/SaslTransportPlugin_test.clj  | 43 -----------------
 .../security/auth/SaslTransportPluginTest.java  | 49 ++++++++++++++++++++
 2 files changed, 49 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/fe5d37a3/storm-core/test/clj/org/apache/storm/security/auth/SaslTransportPlugin_test.clj
----------------------------------------------------------------------
diff --git a/storm-core/test/clj/org/apache/storm/security/auth/SaslTransportPlugin_test.clj
b/storm-core/test/clj/org/apache/storm/security/auth/SaslTransportPlugin_test.clj
deleted file mode 100644
index bfbd6ff..0000000
--- a/storm-core/test/clj/org/apache/storm/security/auth/SaslTransportPlugin_test.clj
+++ /dev/null
@@ -1,43 +0,0 @@
-;; Licensed to the Apache Software Foundation (ASF) under one
-;; or more contributor license agreements.  See the NOTICE file
-;; distributed with this work for additional information
-;; regarding copyright ownership.  The ASF licenses this file
-;; to you 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.
-(ns org.apache.storm.security.auth.SaslTransportPlugin-test
-  (:use [clojure test])
-  (import [org.apache.storm.security.auth SaslTransportPlugin$User])
-)
-
-(deftest test-User-name
-  (let [nam "Andy"
-        user (SaslTransportPlugin$User. nam)]
-    (are [a b] (= a b)
-      nam (.toString user)
-      (.getName user) (.toString user)
-      (.hashCode nam) (.hashCode user)
-    )
-  )
-)
-
-(deftest test-User-equals
-  (let [nam "Andy"
-        user1 (SaslTransportPlugin$User. nam)
-        user2 (SaslTransportPlugin$User. nam)
-        user3 (SaslTransportPlugin$User. "Bobby")]
-    (is (-> user1 (.equals user1)))
-    (is (-> user1 (.equals user2)))
-    (is (not (-> user1 (.equals nil))))
-    (is (not (-> user1 (.equals "Potato"))))
-    (is (not (-> user1 (.equals user3))))
-  )
-)

http://git-wip-us.apache.org/repos/asf/storm/blob/fe5d37a3/storm-core/test/jvm/org/apache/storm/security/auth/SaslTransportPluginTest.java
----------------------------------------------------------------------
diff --git a/storm-core/test/jvm/org/apache/storm/security/auth/SaslTransportPluginTest.java
b/storm-core/test/jvm/org/apache/storm/security/auth/SaslTransportPluginTest.java
new file mode 100644
index 0000000..005d415
--- /dev/null
+++ b/storm-core/test/jvm/org/apache/storm/security/auth/SaslTransportPluginTest.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.security.auth;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class SaslTransportPluginTest {
+
+    @Test
+    public void testUserName() {
+        String name = "Andy";
+        SaslTransportPlugin.User user = new SaslTransportPlugin.User(name);
+        assertEquals(name, user.toString());
+        assertEquals(user.getName(), user.toString());
+        assertEquals(name.hashCode(), user.hashCode());
+    }
+
+    @Test
+    public void testUserEquals() {
+        String name = "Andy";
+        SaslTransportPlugin.User user1 = new SaslTransportPlugin.User(name);
+        SaslTransportPlugin.User user2 = new SaslTransportPlugin.User(name);
+        SaslTransportPlugin.User user3 = new SaslTransportPlugin.User("Bobby");
+        assertTrue(user1.equals(user1));
+        assertTrue(user1.equals(user2));
+        assertFalse(user1.equals(null));
+        assertFalse(user1.equals("Potato"));
+        assertFalse(user1.equals(user3));
+    }
+}


Mime
View raw message