james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [10/14] james-project git commit: JAMES-2525 enforce bean contract for temp auth configuration
Date Fri, 05 Oct 2018 11:12:53 GMT
JAMES-2525 enforce bean contract for temp auth configuration


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

Branch: refs/heads/master
Commit: cc2cde1c2863ece1e8d5c4b418584a047e034c98
Parents: ccf2687
Author: Jean Helou <jhe@codamens.fr>
Authored: Mon Sep 3 14:33:28 2018 +0200
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Fri Oct 5 18:11:43 2018 +0700

----------------------------------------------------------------------
 .../swift/SwiftTempAuthObjectStorage.java       | 36 ++++++++++++++++++++
 ...tTempAuthObjectStorageConfigurationTest.java |  7 ++++
 2 files changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/cc2cde1c/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorage.java
----------------------------------------------------------------------
diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorage.java
b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorage.java
index 8bc25d7..f65e558 100644
--- a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorage.java
+++ b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorage.java
@@ -32,6 +32,8 @@ import org.jclouds.openstack.keystone.config.KeystoneProperties;
 import org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext;
 import org.jclouds.openstack.swift.v1.reference.TempAuthHeaders;
 
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableSet;
 import com.google.inject.Module;
@@ -190,5 +192,39 @@ public class SwiftTempAuthObjectStorage {
         public Optional<Region> getRegion() {
             return region;
         }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) {
+                return true;
+            }
+            if (o == null || getClass() != o.getClass()) {
+                return false;
+            }
+            Configuration that = (Configuration) o;
+            return Objects.equal(endpoint, that.endpoint) &&
+                Objects.equal(identity, that.identity) &&
+                Objects.equal(region, that.region) &&
+                Objects.equal(credentials, that.credentials) &&
+                Objects.equal(userHeaderName, that.userHeaderName) &&
+                Objects.equal(passHeaderName, that.passHeaderName);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hashCode(endpoint, identity, region, credentials, userHeaderName,
passHeaderName);
+        }
+
+        @Override
+        public String toString() {
+            return MoreObjects.toStringHelper(this)
+                .add("endpoint", endpoint)
+                .add("identity", identity)
+                .add("region", region)
+                .add("credentials", credentials)
+                .add("userHeaderName", userHeaderName)
+                .add("passHeaderName", passHeaderName)
+                .toString();
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/cc2cde1c/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorageConfigurationTest.java
----------------------------------------------------------------------
diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorageConfigurationTest.java
b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorageConfigurationTest.java
index e08ffbe..75a3824 100644
--- a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorageConfigurationTest.java
+++ b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorageConfigurationTest.java
@@ -26,6 +26,8 @@ import java.net.URI;
 
 import org.junit.jupiter.api.Test;
 
+import nl.jqno.equalsverifier.EqualsVerifier;
+
 class SwiftTempAuthObjectStorageConfigurationTest {
 
     private static final TenantName TENANT_NAME = TenantName.of("fake");
@@ -109,4 +111,9 @@ class SwiftTempAuthObjectStorageConfigurationTest {
         assertThat(build.getIdentity()).isEqualTo(SWIFT_IDENTITY);
         assertThat(build.getCredentials()).isEqualTo(CREDENTIALS);
     }
+
+    @Test
+    void configurationShouldEnforceBeanContract() {
+        EqualsVerifier.forClass(SwiftTempAuthObjectStorage.Configuration.class);
+    }
 }
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message