You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2016/03/04 17:25:06 UTC
[1/3] storm git commit: STORM-1283: port backtype.storm.MockAutoCred
to java
Repository: storm
Updated Branches:
refs/heads/master cc7ef89c3 -> e06599833
STORM-1283: port backtype.storm.MockAutoCred to java
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/035f47a0
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/035f47a0
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/035f47a0
Branch: refs/heads/master
Commit: 035f47a0edbffe445f642bb5c6138d776a472bff
Parents: d42c437
Author: Abhishek Agarwal <ab...@inmobi.com>
Authored: Wed Mar 2 17:53:54 2016 +0530
Committer: Abhishek Agarwal <ab...@inmobi.com>
Committed: Wed Mar 2 17:53:54 2016 +0530
----------------------------------------------------------------------
.../src/clj/org/apache/storm/MockAutoCred.clj | 58 ---------------
.../src/jvm/org/apache/storm/MockAutoCred.java | 75 ++++++++++++++++++++
.../test/clj/org/apache/storm/nimbus_test.clj | 10 +--
3 files changed, 80 insertions(+), 63 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/035f47a0/storm-core/src/clj/org/apache/storm/MockAutoCred.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/org/apache/storm/MockAutoCred.clj b/storm-core/src/clj/org/apache/storm/MockAutoCred.clj
deleted file mode 100644
index 7e23c6b..0000000
--- a/storm-core/src/clj/org/apache/storm/MockAutoCred.clj
+++ /dev/null
@@ -1,58 +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.
-
-;;mock implementation of INimbusCredentialPlugin,IAutoCredentials and ICredentialsRenewer for testing only.
-(ns org.apache.storm.MockAutoCred
- (:use [org.apache.storm testing config])
- (:import [org.apache.storm.security.INimbusCredentialPlugin]
- [org.apache.storm.security.auth ICredentialsRenewer])
- (:gen-class
- :implements [org.apache.storm.security.INimbusCredentialPlugin
- org.apache.storm.security.auth.IAutoCredentials
- org.apache.storm.security.auth.ICredentialsRenewer]))
-
-(def nimbus-cred-key "nimbusCredTestKey")
-(def nimbus-cred-val "nimbusTestCred")
-(def nimbus-cred-renew-val "renewedNimbusTestCred")
-(def gateway-cred-key "gatewayCredTestKey")
-(def gateway-cred-val "gatewayTestCred")
-(def gateway-cred-renew-val "renewedGatewayTestCred")
-
-(defn -populateCredentials
- ([this creds conf]
- (.put creds nimbus-cred-key nimbus-cred-val))
- ([this creds]
- (.put creds gateway-cred-key gateway-cred-val)))
-
-(defn -prepare
- [this conf])
-
-(defn -renew
- [this cred conf]
- (.put cred nimbus-cred-key nimbus-cred-renew-val)
- (.put cred gateway-cred-key gateway-cred-renew-val))
-
-(defn -populateSubject
- [subject credentials]
- (.add (.getPublicCredentials subject) (.get credentials nimbus-cred-key))
- (.add (.getPublicCredentials subject) (.get credentials gateway-cred-key)))
-
-(defn -updateSubject
- [subject credentials]
- (-populateSubject subject credentials))
-
-
-
http://git-wip-us.apache.org/repos/asf/storm/blob/035f47a0/storm-core/src/jvm/org/apache/storm/MockAutoCred.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/MockAutoCred.java b/storm-core/src/jvm/org/apache/storm/MockAutoCred.java
new file mode 100644
index 0000000..2bcf973
--- /dev/null
+++ b/storm-core/src/jvm/org/apache/storm/MockAutoCred.java
@@ -0,0 +1,75 @@
+/**
+ * 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;
+
+import org.apache.storm.security.INimbusCredentialPlugin;
+import org.apache.storm.security.auth.IAutoCredentials;
+import org.apache.storm.security.auth.ICredentialsRenewer;
+
+import java.util.Map;
+
+import javax.security.auth.Subject;
+
+/**
+ * mock implementation of INimbusCredentialPlugin,IAutoCredentials and ICredentialsRenewer for testing only.
+ */
+public class MockAutoCred implements INimbusCredentialPlugin, IAutoCredentials, ICredentialsRenewer {
+ public static final String NIMBUS_CRED_KEY = "nimbusCredTestKey";
+ public static final String NIMBUS_CRED_VAL = "nimbusTestCred";
+ public static final String NIMBUS_CRED_RENEW_VAL = "renewedNimbusTestCred";
+ public static final String GATEWAY_CRED_KEY = "gatewayCredTestKey";
+ public static final String GATEWAY_CRED_VAL = "gatewayTestCred";
+ public static final String GATEWAY_CRED_RENEW_VAL = "renewedGatewayTestCred";
+
+ @Override
+ public void populateCredentials(Map<String, String> credentials) {
+ credentials.put(GATEWAY_CRED_KEY, GATEWAY_CRED_VAL);
+ }
+
+ @Override
+ public void populateCredentials(Map<String, String> credentials, Map conf) {
+ credentials.put(NIMBUS_CRED_KEY, NIMBUS_CRED_VAL);
+ }
+
+ @Override
+ public void populateSubject(Subject subject, Map<String, String> credentials) {
+ subject.getPublicCredentials().add(credentials.get(NIMBUS_CRED_KEY));
+ subject.getPublicCredentials().add(credentials.get(GATEWAY_CRED_KEY));
+ }
+
+ @Override
+ public void updateSubject(Subject subject, Map<String, String> credentials) {
+ populateSubject(subject, credentials);
+ }
+
+ @Override
+ public void renew(Map<String, String> credentials, Map topologyConf) {
+ credentials.put(NIMBUS_CRED_KEY, NIMBUS_CRED_RENEW_VAL);
+ credentials.put(GATEWAY_CRED_KEY, GATEWAY_CRED_RENEW_VAL);
+ }
+
+ @Override
+ public void prepare(Map conf) {
+
+ }
+
+ @Override
+ public void shutdown() {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/storm/blob/035f47a0/storm-core/test/clj/org/apache/storm/nimbus_test.clj
----------------------------------------------------------------------
diff --git a/storm-core/test/clj/org/apache/storm/nimbus_test.clj b/storm-core/test/clj/org/apache/storm/nimbus_test.clj
index 3670fd1..fb000da 100644
--- a/storm-core/test/clj/org/apache/storm/nimbus_test.clj
+++ b/storm-core/test/clj/org/apache/storm/nimbus_test.clj
@@ -22,7 +22,7 @@
TestAggregatesCounter TestPlannerSpout TestPlannerBolt]
[org.apache.storm.nimbus InMemoryTopologyActionNotifier]
[org.apache.storm.generated GlobalStreamId]
- [org.apache.storm Thrift])
+ [org.apache.storm Thrift MockAutoCred])
(:import [org.apache.storm.testing.staticmocking MockedZookeeper])
(:import [org.apache.storm.scheduler INimbus])
(:import [org.mockito Mockito])
@@ -41,7 +41,7 @@
(:import [org.apache.commons.io FileUtils]
[org.json.simple JSONValue])
(:import [org.apache.storm.cluster StormClusterStateImpl ClusterStateContext ClusterUtils])
- (:use [org.apache.storm testing MockAutoCred util config log converter])
+ (:use [org.apache.storm testing util config log converter])
(:use [org.apache.storm.daemon common])
(:require [conjure.core])
@@ -316,12 +316,12 @@
} topology submitOptions)
credentials (getCredentials cluster topology-name)]
; check that the credentials have nimbus auto generated cred
- (is (= (.get credentials nimbus-cred-key) nimbus-cred-val))
+ (is (= (.get credentials MockAutoCred/NIMBUS_CRED_KEY) MockAutoCred/NIMBUS_CRED_VAL))
;advance cluster time so the renewers can execute
(advance-cluster-time cluster 20)
;check that renewed credentials replace the original credential.
- (is (= (.get (getCredentials cluster topology-name) nimbus-cred-key) nimbus-cred-renew-val))
- (is (= (.get (getCredentials cluster topology-name) gateway-cred-key) gateway-cred-renew-val)))))
+ (is (= (.get (getCredentials cluster topology-name) MockAutoCred/NIMBUS_CRED_KEY) MockAutoCred/NIMBUS_CRED_RENEW_VAL))
+ (is (= (.get (getCredentials cluster topology-name) MockAutoCred/GATEWAY_CRED_KEY) MockAutoCred/GATEWAY_CRED_RENEW_VAL)))))
(defmacro letlocals
[& body]
[2/3] storm git commit: Merge branch 'mockautocred' of
https://github.com/abhishekagarwal87/storm into STORM-1283
Posted by bo...@apache.org.
Merge branch 'mockautocred' of https://github.com/abhishekagarwal87/storm into STORM-1283
STORM-1283: port backtype.storm.MockAutoCred to java
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/47793e42
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/47793e42
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/47793e42
Branch: refs/heads/master
Commit: 47793e4214ba0ca0cdfbc2ac72bdff083bd21d7c
Parents: cc7ef89 035f47a
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Fri Mar 4 09:52:40 2016 -0600
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Fri Mar 4 09:52:40 2016 -0600
----------------------------------------------------------------------
.../src/clj/org/apache/storm/MockAutoCred.clj | 58 ---------------
.../src/jvm/org/apache/storm/MockAutoCred.java | 75 ++++++++++++++++++++
.../test/clj/org/apache/storm/nimbus_test.clj | 10 +--
3 files changed, 80 insertions(+), 63 deletions(-)
----------------------------------------------------------------------
[3/3] storm git commit: Added STORM-1283 to Changelog and moved test
file to test directory
Posted by bo...@apache.org.
Added STORM-1283 to Changelog and moved test file to test directory
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/e0659983
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/e0659983
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/e0659983
Branch: refs/heads/master
Commit: e065998334f2cde09506851fb9364e5d1b40803d
Parents: 47793e4
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Fri Mar 4 09:53:29 2016 -0600
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Fri Mar 4 09:53:29 2016 -0600
----------------------------------------------------------------------
CHANGELOG.md | 1 +
.../src/jvm/org/apache/storm/MockAutoCred.java | 75 --------------------
.../test/jvm/org/apache/storm/MockAutoCred.java | 75 ++++++++++++++++++++
3 files changed, 76 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/e0659983/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9604293..58133dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
## 2.0.0
+ * STORM-1283: port backtype.storm.MockAutoCred to java
* STORM-1592: clojure code calling into Utils.exitProcess throws ClassCastException
* STORM-1579: Fix NoSuchFileException when running tests in storm-core
* STORM-1244: port backtype.storm.command.upload-credentials to java
http://git-wip-us.apache.org/repos/asf/storm/blob/e0659983/storm-core/src/jvm/org/apache/storm/MockAutoCred.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/MockAutoCred.java b/storm-core/src/jvm/org/apache/storm/MockAutoCred.java
deleted file mode 100644
index 2bcf973..0000000
--- a/storm-core/src/jvm/org/apache/storm/MockAutoCred.java
+++ /dev/null
@@ -1,75 +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.
- */
-package org.apache.storm;
-
-import org.apache.storm.security.INimbusCredentialPlugin;
-import org.apache.storm.security.auth.IAutoCredentials;
-import org.apache.storm.security.auth.ICredentialsRenewer;
-
-import java.util.Map;
-
-import javax.security.auth.Subject;
-
-/**
- * mock implementation of INimbusCredentialPlugin,IAutoCredentials and ICredentialsRenewer for testing only.
- */
-public class MockAutoCred implements INimbusCredentialPlugin, IAutoCredentials, ICredentialsRenewer {
- public static final String NIMBUS_CRED_KEY = "nimbusCredTestKey";
- public static final String NIMBUS_CRED_VAL = "nimbusTestCred";
- public static final String NIMBUS_CRED_RENEW_VAL = "renewedNimbusTestCred";
- public static final String GATEWAY_CRED_KEY = "gatewayCredTestKey";
- public static final String GATEWAY_CRED_VAL = "gatewayTestCred";
- public static final String GATEWAY_CRED_RENEW_VAL = "renewedGatewayTestCred";
-
- @Override
- public void populateCredentials(Map<String, String> credentials) {
- credentials.put(GATEWAY_CRED_KEY, GATEWAY_CRED_VAL);
- }
-
- @Override
- public void populateCredentials(Map<String, String> credentials, Map conf) {
- credentials.put(NIMBUS_CRED_KEY, NIMBUS_CRED_VAL);
- }
-
- @Override
- public void populateSubject(Subject subject, Map<String, String> credentials) {
- subject.getPublicCredentials().add(credentials.get(NIMBUS_CRED_KEY));
- subject.getPublicCredentials().add(credentials.get(GATEWAY_CRED_KEY));
- }
-
- @Override
- public void updateSubject(Subject subject, Map<String, String> credentials) {
- populateSubject(subject, credentials);
- }
-
- @Override
- public void renew(Map<String, String> credentials, Map topologyConf) {
- credentials.put(NIMBUS_CRED_KEY, NIMBUS_CRED_RENEW_VAL);
- credentials.put(GATEWAY_CRED_KEY, GATEWAY_CRED_RENEW_VAL);
- }
-
- @Override
- public void prepare(Map conf) {
-
- }
-
- @Override
- public void shutdown() {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/storm/blob/e0659983/storm-core/test/jvm/org/apache/storm/MockAutoCred.java
----------------------------------------------------------------------
diff --git a/storm-core/test/jvm/org/apache/storm/MockAutoCred.java b/storm-core/test/jvm/org/apache/storm/MockAutoCred.java
new file mode 100644
index 0000000..2bcf973
--- /dev/null
+++ b/storm-core/test/jvm/org/apache/storm/MockAutoCred.java
@@ -0,0 +1,75 @@
+/**
+ * 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;
+
+import org.apache.storm.security.INimbusCredentialPlugin;
+import org.apache.storm.security.auth.IAutoCredentials;
+import org.apache.storm.security.auth.ICredentialsRenewer;
+
+import java.util.Map;
+
+import javax.security.auth.Subject;
+
+/**
+ * mock implementation of INimbusCredentialPlugin,IAutoCredentials and ICredentialsRenewer for testing only.
+ */
+public class MockAutoCred implements INimbusCredentialPlugin, IAutoCredentials, ICredentialsRenewer {
+ public static final String NIMBUS_CRED_KEY = "nimbusCredTestKey";
+ public static final String NIMBUS_CRED_VAL = "nimbusTestCred";
+ public static final String NIMBUS_CRED_RENEW_VAL = "renewedNimbusTestCred";
+ public static final String GATEWAY_CRED_KEY = "gatewayCredTestKey";
+ public static final String GATEWAY_CRED_VAL = "gatewayTestCred";
+ public static final String GATEWAY_CRED_RENEW_VAL = "renewedGatewayTestCred";
+
+ @Override
+ public void populateCredentials(Map<String, String> credentials) {
+ credentials.put(GATEWAY_CRED_KEY, GATEWAY_CRED_VAL);
+ }
+
+ @Override
+ public void populateCredentials(Map<String, String> credentials, Map conf) {
+ credentials.put(NIMBUS_CRED_KEY, NIMBUS_CRED_VAL);
+ }
+
+ @Override
+ public void populateSubject(Subject subject, Map<String, String> credentials) {
+ subject.getPublicCredentials().add(credentials.get(NIMBUS_CRED_KEY));
+ subject.getPublicCredentials().add(credentials.get(GATEWAY_CRED_KEY));
+ }
+
+ @Override
+ public void updateSubject(Subject subject, Map<String, String> credentials) {
+ populateSubject(subject, credentials);
+ }
+
+ @Override
+ public void renew(Map<String, String> credentials, Map topologyConf) {
+ credentials.put(NIMBUS_CRED_KEY, NIMBUS_CRED_RENEW_VAL);
+ credentials.put(GATEWAY_CRED_KEY, GATEWAY_CRED_RENEW_VAL);
+ }
+
+ @Override
+ public void prepare(Map conf) {
+
+ }
+
+ @Override
+ public void shutdown() {
+
+ }
+}