Move Credentials and UsernamePassword to auth package

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

Branch: refs/heads/master
Commit: a6c9f71e3fde1daeddb869ed9b9af71fb43ae6a2
Parents: be52a74
Author: Sam Corbett <sam.corb...@cloudsoftcorp.com>
Authored: Mon Dec 18 15:28:15 2017 +0000
Committer: Sam Corbett <sam.corb...@cloudsoftcorp.com>
Committed: Mon Dec 18 16:52:35 2017 +0000

----------------------------------------------------------------------
 .../core/effector/http/HttpCommandEffector.java |  3 +-
 .../org/apache/brooklyn/feed/http/HttpFeed.java |  2 +-
 .../util/core/ResourceUtilsHttpTest.java        |  2 +-
 .../util/executor/HttpExecutorImplTest.java     |  3 +-
 .../brooklyn/util/http/auth/Credentials.java    | 36 ++++++++++++++++
 .../util/http/auth/UsernamePassword.java        | 44 ++++++++++++++++++++
 .../util/http/executor/Credentials.java         | 12 +++---
 .../util/http/executor/HttpRequest.java         |  2 +
 .../util/http/executor/HttpRequestImpl.java     |  2 +-
 .../util/http/executor/UsernamePassword.java    | 26 +++---------
 10 files changed, 98 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a6c9f71e/core/src/main/java/org/apache/brooklyn/core/effector/http/HttpCommandEffector.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/brooklyn/core/effector/http/HttpCommandEffector.java
 
b/core/src/main/java/org/apache/brooklyn/core/effector/http/HttpCommandEffector.java
index 12a847a..fc28f95 100644
--- 
a/core/src/main/java/org/apache/brooklyn/core/effector/http/HttpCommandEffector.java
+++ 
b/core/src/main/java/org/apache/brooklyn/core/effector/http/HttpCommandEffector.java
@@ -42,7 +42,6 @@ import org.apache.brooklyn.core.effector.AddEffector;
 import org.apache.brooklyn.core.effector.EffectorBody;
 import org.apache.brooklyn.core.effector.Effectors.EffectorBuilder;
 import org.apache.brooklyn.core.entity.EntityInitializers;
-import org.apache.brooklyn.core.entity.trait.Startable;
 import org.apache.brooklyn.core.sensor.Sensors;
 import org.apache.brooklyn.util.collections.Jsonya;
 import org.apache.brooklyn.util.core.config.ConfigBag;
@@ -52,7 +51,7 @@ import org.apache.brooklyn.util.http.executor.HttpConfig;
 import org.apache.brooklyn.util.http.executor.HttpExecutor;
 import org.apache.brooklyn.util.http.executor.HttpRequest;
 import org.apache.brooklyn.util.http.executor.HttpResponse;
-import org.apache.brooklyn.util.http.executor.UsernamePassword;
+import org.apache.brooklyn.util.http.auth.UsernamePassword;
 import org.apache.brooklyn.util.http.executor.apacheclient.HttpExecutorImpl;
 import org.apache.brooklyn.util.text.Strings;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a6c9f71e/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java 
b/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java
index 64a6169..bd62ef6 100644
--- a/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java
+++ b/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java
@@ -53,7 +53,7 @@ import org.apache.brooklyn.util.http.executor.HttpConfig;
 import org.apache.brooklyn.util.http.executor.HttpExecutor;
 import org.apache.brooklyn.util.http.executor.HttpRequest;
 import org.apache.brooklyn.util.http.executor.HttpResponse;
-import org.apache.brooklyn.util.http.executor.UsernamePassword;
+import org.apache.brooklyn.util.http.auth.UsernamePassword;
 import org.apache.brooklyn.util.http.executor.apacheclient.HttpExecutorImpl;
 import org.apache.brooklyn.util.stream.Streams;
 import org.apache.brooklyn.util.time.Duration;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a6c9f71e/core/src/test/java/org/apache/brooklyn/util/core/ResourceUtilsHttpTest.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/brooklyn/util/core/ResourceUtilsHttpTest.java 
b/core/src/test/java/org/apache/brooklyn/util/core/ResourceUtilsHttpTest.java
index 5963ebe..e427a51 100644
--- 
a/core/src/test/java/org/apache/brooklyn/util/core/ResourceUtilsHttpTest.java
+++ 
b/core/src/test/java/org/apache/brooklyn/util/core/ResourceUtilsHttpTest.java
@@ -27,7 +27,7 @@ import java.io.InputStream;
 import org.apache.brooklyn.test.http.TestHttpRequestHandler;
 import org.apache.brooklyn.test.http.TestHttpServer;
 import org.apache.brooklyn.util.core.http.AuthHandler;
-import org.apache.brooklyn.util.http.executor.UsernamePassword;
+import org.apache.brooklyn.util.http.auth.UsernamePassword;
 import org.apache.brooklyn.util.stream.Streams;
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a6c9f71e/core/src/test/java/org/apache/brooklyn/util/executor/HttpExecutorImplTest.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/brooklyn/util/executor/HttpExecutorImplTest.java
 
b/core/src/test/java/org/apache/brooklyn/util/executor/HttpExecutorImplTest.java
index 46e84a0..dfee8f3 100644
--- 
a/core/src/test/java/org/apache/brooklyn/util/executor/HttpExecutorImplTest.java
+++ 
b/core/src/test/java/org/apache/brooklyn/util/executor/HttpExecutorImplTest.java
@@ -29,12 +29,11 @@ import com.google.common.base.Function;
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.Collections2;
 import org.apache.brooklyn.util.core.http.BetterMockWebServer;
-import org.apache.brooklyn.util.executor.HttpExecutorFactoryImpl;
 import org.apache.brooklyn.util.http.executor.HttpExecutor;
 import org.apache.brooklyn.util.http.executor.HttpRequest;
 import org.apache.brooklyn.util.http.executor.HttpRequestImpl;
 import org.apache.brooklyn.util.http.executor.HttpResponse;
-import org.apache.brooklyn.util.http.executor.UsernamePassword;
+import org.apache.brooklyn.util.http.auth.UsernamePassword;
 import org.apache.commons.codec.binary.Base64;
 import org.bouncycastle.util.Strings;
 import org.testng.annotations.AfterMethod;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a6c9f71e/utils/common/src/main/java/org/apache/brooklyn/util/http/auth/Credentials.java
----------------------------------------------------------------------
diff --git 
a/utils/common/src/main/java/org/apache/brooklyn/util/http/auth/Credentials.java
 
b/utils/common/src/main/java/org/apache/brooklyn/util/http/auth/Credentials.java
new file mode 100644
index 0000000..d9f90f2
--- /dev/null
+++ 
b/utils/common/src/main/java/org/apache/brooklyn/util/http/auth/Credentials.java
@@ -0,0 +1,36 @@
+/*
+ * 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.brooklyn.util.http.auth;
+
+import com.google.common.annotations.Beta;
+
+@Beta
+public interface Credentials {
+
+    /**
+     * @return A username for an HTTP request.
+     */
+    String getUser();
+
+    /**
+     * @return A password for an HTTP request.
+     */
+    String getPassword();
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a6c9f71e/utils/common/src/main/java/org/apache/brooklyn/util/http/auth/UsernamePassword.java
----------------------------------------------------------------------
diff --git 
a/utils/common/src/main/java/org/apache/brooklyn/util/http/auth/UsernamePassword.java
 
b/utils/common/src/main/java/org/apache/brooklyn/util/http/auth/UsernamePassword.java
new file mode 100644
index 0000000..9e35130
--- /dev/null
+++ 
b/utils/common/src/main/java/org/apache/brooklyn/util/http/auth/UsernamePassword.java
@@ -0,0 +1,44 @@
+/*
+ * 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.brooklyn.util.http.auth;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.annotations.Beta;
+
+@Beta
+public class UsernamePassword implements Credentials {
+    private final String username;
+    private final String password;
+
+    public UsernamePassword(String username, String password) {
+        this.username = checkNotNull(username, "username");
+        this.password = password;
+    }
+
+    @Override
+    public String getUser() {
+        return username;
+    }
+
+    @Override
+    public String getPassword() {
+        return password;
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a6c9f71e/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/Credentials.java
----------------------------------------------------------------------
diff --git 
a/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/Credentials.java
 
b/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/Credentials.java
index a19f2cf..c57f438 100644
--- 
a/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/Credentials.java
+++ 
b/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/Credentials.java
@@ -16,13 +16,11 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.brooklyn.util.http.executor;
-
-import com.google.common.annotations.Beta;
 
-@Beta
-public interface Credentials {
-    String getUser();
+package org.apache.brooklyn.util.http.executor;
 
-    String getPassword();
+/**
+ * @deprecated since 1.0.0 use {@link 
org.apache.brooklyn.util.http.auth.Credentials} instead.
+ */
+public interface Credentials extends 
org.apache.brooklyn.util.http.auth.Credentials {
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a6c9f71e/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/HttpRequest.java
----------------------------------------------------------------------
diff --git 
a/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/HttpRequest.java
 
b/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/HttpRequest.java
index e3c6db8..9db2839 100644
--- 
a/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/HttpRequest.java
+++ 
b/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/HttpRequest.java
@@ -25,6 +25,8 @@ import java.util.Map;
 
 import javax.annotation.Nullable;
 
+import org.apache.brooklyn.util.http.auth.Credentials;
+
 import com.google.common.annotations.Beta;
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.Multimap;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a6c9f71e/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/HttpRequestImpl.java
----------------------------------------------------------------------
diff --git 
a/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/HttpRequestImpl.java
 
b/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/HttpRequestImpl.java
index dda08fe..a7cffc6 100644
--- 
a/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/HttpRequestImpl.java
+++ 
b/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/HttpRequestImpl.java
@@ -22,7 +22,7 @@ import static 
com.google.common.base.Preconditions.checkNotNull;
 
 import java.net.URI;
 
-import org.apache.brooklyn.util.http.executor.Credentials;
+import org.apache.brooklyn.util.http.auth.Credentials;
 
 import com.google.common.annotations.Beta;
 import com.google.common.collect.ArrayListMultimap;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a6c9f71e/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/UsernamePassword.java
----------------------------------------------------------------------
diff --git 
a/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/UsernamePassword.java
 
b/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/UsernamePassword.java
index da74b3c..9bbd7ad 100644
--- 
a/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/UsernamePassword.java
+++ 
b/utils/common/src/main/java/org/apache/brooklyn/util/http/executor/UsernamePassword.java
@@ -16,28 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.brooklyn.util.http.executor;
-
-import com.google.common.annotations.Beta;
 
-@Beta
-public class UsernamePassword implements Credentials {
-    private final String username;
-    private final String password;
+package org.apache.brooklyn.util.http.executor;
 
+/**
+ * @deprecated since 1.0.0 use {@link 
org.apache.brooklyn.util.http.auth.UsernamePassword} instead.
+ */
+public class UsernamePassword extends 
org.apache.brooklyn.util.http.auth.UsernamePassword {
     public UsernamePassword(String username, String password) {
-        this.username = username;
-        this.password = password;
-    }
-
-    @Override
-    public String getUser() {
-        return username;
-    }
-
-    @Override
-    public String getPassword() {
-        return password;
+        super(username, password);
     }
 }
-

Reply via email to