JAMES-2525 move swift specific types to swift subpackage
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/ccf26875 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/ccf26875 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/ccf26875 Branch: refs/heads/master Commit: ccf26875def9d38a2bd5d30a1ff4280ee17c0cbd Parents: d9aca59 Author: Jean Helou <j...@codamens.fr> Authored: Fri Aug 31 12:10:18 2018 +0200 Committer: Benoit Tellier <btell...@linagora.com> Committed: Fri Oct 5 18:11:43 2018 +0700 ---------------------------------------------------------------------- .../james/blob/objectstorage/Credentials.java | 63 ---------------- .../james/blob/objectstorage/HeaderName.java | 59 --------------- .../blob/objectstorage/PassHeaderName.java | 30 -------- .../james/blob/objectstorage/ProjectName.java | 63 ---------------- .../apache/james/blob/objectstorage/Region.java | 63 ---------------- .../james/blob/objectstorage/SwiftIdentity.java | 75 -------------------- .../james/blob/objectstorage/TenantName.java | 63 ---------------- .../blob/objectstorage/UserHeaderName.java | 30 -------- .../james/blob/objectstorage/UserName.java | 63 ---------------- .../blob/objectstorage/swift/Credentials.java | 63 ++++++++++++++++ .../blob/objectstorage/swift/HeaderName.java | 59 +++++++++++++++ .../blob/objectstorage/swift/Identity.java | 75 ++++++++++++++++++++ .../objectstorage/swift/PassHeaderName.java | 30 ++++++++ .../blob/objectstorage/swift/ProjectName.java | 63 ++++++++++++++++ .../james/blob/objectstorage/swift/Region.java | 63 ++++++++++++++++ .../swift/SwiftTempAuthObjectStorage.java | 19 ++--- .../blob/objectstorage/swift/TenantName.java | 63 ++++++++++++++++ .../objectstorage/swift/UserHeaderName.java | 30 ++++++++ .../blob/objectstorage/swift/UserName.java | 63 ++++++++++++++++ .../blob/objectstorage/CredentialsTest.java | 31 -------- .../blob/objectstorage/HeaderNameTest.java | 31 -------- .../ObjectStorageBlobsDAOTest.java | 8 ++- .../blob/objectstorage/ProjectNameTest.java | 31 -------- .../james/blob/objectstorage/RegionTest.java | 31 -------- .../blob/objectstorage/SwiftIdentityTest.java | 39 ---------- .../blob/objectstorage/TenantNameTest.java | 31 -------- .../james/blob/objectstorage/UserNameTest.java | 31 -------- .../objectstorage/swift/CredentialsTest.java | 31 ++++++++ .../objectstorage/swift/HeaderNameTest.java | 31 ++++++++ .../blob/objectstorage/swift/IdentityTest.java | 39 ++++++++++ .../objectstorage/swift/ProjectNameTest.java | 31 ++++++++ .../blob/objectstorage/swift/RegionTest.java | 31 ++++++++ ...tTempAuthObjectStorageConfigurationTest.java | 10 +-- .../objectstorage/swift/TenantNameTest.java | 31 ++++++++ .../blob/objectstorage/swift/UserNameTest.java | 31 ++++++++ 35 files changed, 750 insertions(+), 755 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/Credentials.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/Credentials.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/Credentials.java deleted file mode 100644 index 7719894..0000000 --- a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/Credentials.java +++ /dev/null @@ -1,63 +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.james.blob.objectstorage; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; - -public final class Credentials { - public static Credentials of(String value) { - return new Credentials(value); - } - - private final String credentials; - - private Credentials(String value) { - this.credentials = value; - } - - public String value() { - return credentials; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Credentials that = (Credentials) o; - return Objects.equal(credentials, that.credentials); - } - - @Override - public int hashCode() { - return Objects.hashCode(credentials); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("credentials", credentials) - .toString(); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/HeaderName.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/HeaderName.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/HeaderName.java deleted file mode 100644 index 79ec77e..0000000 --- a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/HeaderName.java +++ /dev/null @@ -1,59 +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.james.blob.objectstorage; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; - -public class HeaderName { - private final String value; - - protected HeaderName(String value) { - this.value = value; - } - - public String value() { - return value; - } - - @Override - public final boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof HeaderName)) { - return false; - } - HeaderName that = (HeaderName) o; - return Objects.equal(value, that.value); - } - - @Override - public final int hashCode() { - return Objects.hashCode(value); - } - - @Override - public final String toString() { - return MoreObjects.toStringHelper(this) - .add("value", value) - .toString(); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/PassHeaderName.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/PassHeaderName.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/PassHeaderName.java deleted file mode 100644 index 6299c9c..0000000 --- a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/PassHeaderName.java +++ /dev/null @@ -1,30 +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.james.blob.objectstorage; - -public final class PassHeaderName extends HeaderName { - public static PassHeaderName of(String value) { - return new PassHeaderName(value); - } - - private PassHeaderName(String value) { - super(value); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/ProjectName.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/ProjectName.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/ProjectName.java deleted file mode 100644 index b70674c..0000000 --- a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/ProjectName.java +++ /dev/null @@ -1,63 +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.james.blob.objectstorage; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; - -public final class ProjectName { - public static ProjectName of(String value) { - return new ProjectName(value); - } - - private final String value; - - private ProjectName(String value) { - this.value = value; - } - - public String value() { - return value; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ProjectName that = (ProjectName) o; - return Objects.equal(value, that.value); - } - - @Override - public int hashCode() { - return Objects.hashCode(value); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("value", value) - .toString(); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/Region.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/Region.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/Region.java deleted file mode 100644 index 638de2a..0000000 --- a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/Region.java +++ /dev/null @@ -1,63 +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.james.blob.objectstorage; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; - -public final class Region { - public static Region of(String value) { - return new Region(value); - } - - private final String region; - - private Region(String value) { - this.region = value; - } - - public String value() { - return region; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Region region1 = (Region) o; - return Objects.equal(region, region1.region); - } - - @Override - public int hashCode() { - return Objects.hashCode(region); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("region", region) - .toString(); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/SwiftIdentity.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/SwiftIdentity.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/SwiftIdentity.java deleted file mode 100644 index e23a602..0000000 --- a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/SwiftIdentity.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.james.blob.objectstorage; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; - -public final class SwiftIdentity { - public static SwiftIdentity of(TenantName tenant, UserName userName) { - return new SwiftIdentity(tenant, userName); - } - - private final TenantName tenant; - private final UserName userName; - - private SwiftIdentity(TenantName tenant, UserName userName) { - this.tenant = tenant; - this.userName = userName; - } - - public String asString() { - return tenant.value() + ":" + userName.value(); - } - - public TenantName getTenant() { - return tenant; - } - - public UserName getUserName() { - return userName; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SwiftIdentity swiftIdentity = (SwiftIdentity) o; - return Objects.equal(tenant, swiftIdentity.tenant) && - Objects.equal(userName, swiftIdentity.userName); - } - - @Override - public int hashCode() { - return Objects.hashCode(tenant, userName); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("tenant", tenant) - .add("userName", userName) - .toString(); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/TenantName.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/TenantName.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/TenantName.java deleted file mode 100644 index 85fb17d..0000000 --- a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/TenantName.java +++ /dev/null @@ -1,63 +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.james.blob.objectstorage; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; - -public final class TenantName { - public static TenantName of(String value) { - return new TenantName(value); - } - - private final String value; - - private TenantName(String value) { - this.value = value; - } - - public String value() { - return value; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TenantName that = (TenantName) o; - return Objects.equal(value, that.value); - } - - @Override - public int hashCode() { - return Objects.hashCode(value); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("value", value) - .toString(); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/UserHeaderName.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/UserHeaderName.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/UserHeaderName.java deleted file mode 100644 index 5c9bf8a..0000000 --- a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/UserHeaderName.java +++ /dev/null @@ -1,30 +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.james.blob.objectstorage; - -public final class UserHeaderName extends HeaderName { - public static UserHeaderName of(String value) { - return new UserHeaderName(value); - } - - private UserHeaderName(String value) { - super(value); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/UserName.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/UserName.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/UserName.java deleted file mode 100644 index a2b7d64..0000000 --- a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/UserName.java +++ /dev/null @@ -1,63 +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.james.blob.objectstorage; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; - -public final class UserName { - public static UserName of(String value) { - return new UserName(value); - } - - private final String value; - - private UserName(String value) { - this.value = value; - } - - public String value() { - return value; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UserName that = (UserName) o; - return Objects.equal(value, that.value); - } - - @Override - public int hashCode() { - return Objects.hashCode(value); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("value", value) - .toString(); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/Credentials.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/Credentials.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/Credentials.java new file mode 100644 index 0000000..7d41396 --- /dev/null +++ b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/Credentials.java @@ -0,0 +1,63 @@ +/**************************************************************** + * 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.james.blob.objectstorage.swift; + +import com.google.common.base.MoreObjects; +import com.google.common.base.Objects; + +public final class Credentials { + public static Credentials of(String value) { + return new Credentials(value); + } + + private final String credentials; + + private Credentials(String value) { + this.credentials = value; + } + + public String value() { + return credentials; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Credentials that = (Credentials) o; + return Objects.equal(credentials, that.credentials); + } + + @Override + public int hashCode() { + return Objects.hashCode(credentials); + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("credentials", credentials) + .toString(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/HeaderName.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/HeaderName.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/HeaderName.java new file mode 100644 index 0000000..7b9fb16 --- /dev/null +++ b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/HeaderName.java @@ -0,0 +1,59 @@ +/**************************************************************** + * 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.james.blob.objectstorage.swift; + +import com.google.common.base.MoreObjects; +import com.google.common.base.Objects; + +public class HeaderName { + private final String value; + + protected HeaderName(String value) { + this.value = value; + } + + public String value() { + return value; + } + + @Override + public final boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof HeaderName)) { + return false; + } + HeaderName that = (HeaderName) o; + return Objects.equal(value, that.value); + } + + @Override + public final int hashCode() { + return Objects.hashCode(value); + } + + @Override + public final String toString() { + return MoreObjects.toStringHelper(this) + .add("value", value) + .toString(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/Identity.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/Identity.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/Identity.java new file mode 100644 index 0000000..1b72275 --- /dev/null +++ b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/Identity.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.james.blob.objectstorage.swift; + +import com.google.common.base.MoreObjects; +import com.google.common.base.Objects; + +public final class Identity { + public static Identity of(TenantName tenant, UserName userName) { + return new Identity(tenant, userName); + } + + private final TenantName tenant; + private final UserName userName; + + private Identity(TenantName tenant, UserName userName) { + this.tenant = tenant; + this.userName = userName; + } + + public String asString() { + return tenant.value() + ":" + userName.value(); + } + + public TenantName getTenant() { + return tenant; + } + + public UserName getUserName() { + return userName; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Identity identity = (Identity) o; + return Objects.equal(tenant, identity.tenant) && + Objects.equal(userName, identity.userName); + } + + @Override + public int hashCode() { + return Objects.hashCode(tenant, userName); + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("tenant", tenant) + .add("userName", userName) + .toString(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/PassHeaderName.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/PassHeaderName.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/PassHeaderName.java new file mode 100644 index 0000000..f2fd626 --- /dev/null +++ b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/PassHeaderName.java @@ -0,0 +1,30 @@ +/**************************************************************** + * 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.james.blob.objectstorage.swift; + +public final class PassHeaderName extends HeaderName { + public static PassHeaderName of(String value) { + return new PassHeaderName(value); + } + + private PassHeaderName(String value) { + super(value); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/ProjectName.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/ProjectName.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/ProjectName.java new file mode 100644 index 0000000..e91adb3 --- /dev/null +++ b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/ProjectName.java @@ -0,0 +1,63 @@ +/**************************************************************** + * 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.james.blob.objectstorage.swift; + +import com.google.common.base.MoreObjects; +import com.google.common.base.Objects; + +public final class ProjectName { + public static ProjectName of(String value) { + return new ProjectName(value); + } + + private final String value; + + private ProjectName(String value) { + this.value = value; + } + + public String value() { + return value; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProjectName that = (ProjectName) o; + return Objects.equal(value, that.value); + } + + @Override + public int hashCode() { + return Objects.hashCode(value); + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("value", value) + .toString(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/Region.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/Region.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/Region.java new file mode 100644 index 0000000..62fa01a --- /dev/null +++ b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/Region.java @@ -0,0 +1,63 @@ +/**************************************************************** + * 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.james.blob.objectstorage.swift; + +import com.google.common.base.MoreObjects; +import com.google.common.base.Objects; + +public final class Region { + public static Region of(String value) { + return new Region(value); + } + + private final String region; + + private Region(String value) { + this.region = value; + } + + public String value() { + return region; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Region region1 = (Region) o; + return Objects.equal(region, region1.region); + } + + @Override + public int hashCode() { + return Objects.hashCode(region); + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("region", region) + .toString(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/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 c03e9f9..8bc25d7 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 @@ -24,14 +24,7 @@ import java.util.Optional; import java.util.Properties; import java.util.function.Supplier; -import org.apache.james.blob.objectstorage.Credentials; import org.apache.james.blob.objectstorage.ObjectStorageBlobsDAOBuilder; -import org.apache.james.blob.objectstorage.PassHeaderName; -import org.apache.james.blob.objectstorage.Region; -import org.apache.james.blob.objectstorage.SwiftIdentity; -import org.apache.james.blob.objectstorage.TenantName; -import org.apache.james.blob.objectstorage.UserHeaderName; -import org.apache.james.blob.objectstorage.UserName; import org.jclouds.ContextBuilder; import org.jclouds.blobstore.BlobStore; import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; @@ -65,7 +58,7 @@ public class SwiftTempAuthObjectStorage { public BlobStore get() { RegionScopedBlobStoreContext blobStoreContext = contextBuilder() .endpoint(testConfig.getEndpoint().toString()) - .credentials(testConfig.getSwiftIdentity().asString(), testConfig.getCredentials().value()) + .credentials(testConfig.getIdentity().asString(), testConfig.getCredentials().value()) .overrides(testConfig.getOverrides()) .modules(JCLOUDS_MODULES) .buildView(RegionScopedBlobStoreContext.class); @@ -102,7 +95,7 @@ public class SwiftTempAuthObjectStorage { return this; } - public Builder identity(SwiftIdentity identity) { + public Builder identity(Identity identity) { this.tenantName = identity.getTenant(); this.userName = identity.getUserName(); return this; @@ -143,21 +136,21 @@ public class SwiftTempAuthObjectStorage { Preconditions.checkState(tenantName != null); Preconditions.checkState(userName != null); Preconditions.checkState(credentials != null); - SwiftIdentity identity = SwiftIdentity.of(tenantName, userName); + Identity identity = Identity.of(tenantName, userName); return new Configuration(endpoint, identity, credentials, region, userHeaderName, passHeaderName); } } private final URI endpoint; - private final SwiftIdentity identity; + private final Identity identity; private final Optional<Region> region; private final Credentials credentials; private final Optional<UserHeaderName> userHeaderName; private final Optional<PassHeaderName> passHeaderName; private Configuration(URI endpoint, - SwiftIdentity identity, + Identity identity, Credentials credentials, Optional<Region> region, Optional<UserHeaderName> userHeaderName, @@ -174,7 +167,7 @@ public class SwiftTempAuthObjectStorage { return endpoint; } - public SwiftIdentity getSwiftIdentity() { + public Identity getIdentity() { return identity; } http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/TenantName.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/TenantName.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/TenantName.java new file mode 100644 index 0000000..d004c84 --- /dev/null +++ b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/TenantName.java @@ -0,0 +1,63 @@ +/**************************************************************** + * 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.james.blob.objectstorage.swift; + +import com.google.common.base.MoreObjects; +import com.google.common.base.Objects; + +public final class TenantName { + public static TenantName of(String value) { + return new TenantName(value); + } + + private final String value; + + private TenantName(String value) { + this.value = value; + } + + public String value() { + return value; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TenantName that = (TenantName) o; + return Objects.equal(value, that.value); + } + + @Override + public int hashCode() { + return Objects.hashCode(value); + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("value", value) + .toString(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/UserHeaderName.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/UserHeaderName.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/UserHeaderName.java new file mode 100644 index 0000000..b530f5d --- /dev/null +++ b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/UserHeaderName.java @@ -0,0 +1,30 @@ +/**************************************************************** + * 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.james.blob.objectstorage.swift; + +public final class UserHeaderName extends HeaderName { + public static UserHeaderName of(String value) { + return new UserHeaderName(value); + } + + private UserHeaderName(String value) { + super(value); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/UserName.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/UserName.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/UserName.java new file mode 100644 index 0000000..5c6f406 --- /dev/null +++ b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/UserName.java @@ -0,0 +1,63 @@ +/**************************************************************** + * 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.james.blob.objectstorage.swift; + +import com.google.common.base.MoreObjects; +import com.google.common.base.Objects; + +public final class UserName { + public static UserName of(String value) { + return new UserName(value); + } + + private final String value; + + private UserName(String value) { + this.value = value; + } + + public String value() { + return value; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserName that = (UserName) o; + return Objects.equal(value, that.value); + } + + @Override + public int hashCode() { + return Objects.hashCode(value); + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("value", value) + .toString(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/CredentialsTest.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/CredentialsTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/CredentialsTest.java deleted file mode 100644 index 1177167..0000000 --- a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/CredentialsTest.java +++ /dev/null @@ -1,31 +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.james.blob.objectstorage; - -import org.junit.jupiter.api.Test; - -import nl.jqno.equalsverifier.EqualsVerifier; - -class CredentialsTest { - @Test - public void credentialsShouldRespectBeanContract() { - EqualsVerifier.forClass(Credentials.class).verify(); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/HeaderNameTest.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/HeaderNameTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/HeaderNameTest.java deleted file mode 100644 index 9077927..0000000 --- a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/HeaderNameTest.java +++ /dev/null @@ -1,31 +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.james.blob.objectstorage; - -import org.junit.jupiter.api.Test; - -import nl.jqno.equalsverifier.EqualsVerifier; - -class HeaderNameTest { - @Test - public void credentialsShouldRespectBeanContract() { - EqualsVerifier.forClass(HeaderName.class).verify(); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOTest.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOTest.java index a712580..92eeed1 100644 --- a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOTest.java +++ b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOTest.java @@ -25,7 +25,13 @@ import org.apache.james.blob.api.BlobId; import org.apache.james.blob.api.BlobStore; import org.apache.james.blob.api.BlobStoreContract; import org.apache.james.blob.api.HashBlobId; +import org.apache.james.blob.objectstorage.swift.Credentials; +import org.apache.james.blob.objectstorage.swift.Identity; +import org.apache.james.blob.objectstorage.swift.PassHeaderName; import org.apache.james.blob.objectstorage.swift.SwiftTempAuthObjectStorage; +import org.apache.james.blob.objectstorage.swift.TenantName; +import org.apache.james.blob.objectstorage.swift.UserHeaderName; +import org.apache.james.blob.objectstorage.swift.UserName; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.extension.ExtendWith; @@ -35,7 +41,7 @@ public class ObjectStorageBlobsDAOTest implements BlobStoreContract { private static final TenantName TENANT_NAME = TenantName.of("test"); private static final UserName USER_NAME = UserName.of("tester"); private static final Credentials PASSWORD = Credentials.of("testing"); - private static final SwiftIdentity SWIFT_IDENTITY = SwiftIdentity.of(TENANT_NAME, USER_NAME); + private static final Identity SWIFT_IDENTITY = Identity.of(TENANT_NAME, USER_NAME); private ContainerName containerName; private org.jclouds.blobstore.BlobStore blobStore; http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ProjectNameTest.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ProjectNameTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ProjectNameTest.java deleted file mode 100644 index 19cea03..0000000 --- a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ProjectNameTest.java +++ /dev/null @@ -1,31 +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.james.blob.objectstorage; - -import org.junit.jupiter.api.Test; - -import nl.jqno.equalsverifier.EqualsVerifier; - -class ProjectNameTest { - @Test - public void projectNameShouldRespectBeanContract() { - EqualsVerifier.forClass(ProjectName.class).verify(); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/RegionTest.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/RegionTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/RegionTest.java deleted file mode 100644 index be196bb..0000000 --- a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/RegionTest.java +++ /dev/null @@ -1,31 +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.james.blob.objectstorage; - -import org.junit.jupiter.api.Test; - -import nl.jqno.equalsverifier.EqualsVerifier; - -class RegionTest { - @Test - public void regionShouldRespectBeanContract() { - EqualsVerifier.forClass(Region.class).verify(); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/SwiftIdentityTest.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/SwiftIdentityTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/SwiftIdentityTest.java deleted file mode 100644 index 785a1b1..0000000 --- a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/SwiftIdentityTest.java +++ /dev/null @@ -1,39 +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.james.blob.objectstorage; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.jupiter.api.Test; - -import nl.jqno.equalsverifier.EqualsVerifier; - -class SwiftIdentityTest { - @Test - void swiftIdentityRendersProperlyAsString() { - SwiftIdentity swiftIdentity = SwiftIdentity.of(TenantName.of("tenant"), UserName.of("user")); - assertThat(swiftIdentity.asString()).isEqualTo("tenant:user"); - } - - @Test - public void credentialsShouldRespectBeanContract() { - EqualsVerifier.forClass(SwiftIdentity.class).verify(); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/TenantNameTest.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/TenantNameTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/TenantNameTest.java deleted file mode 100644 index 2394757..0000000 --- a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/TenantNameTest.java +++ /dev/null @@ -1,31 +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.james.blob.objectstorage; - -import org.junit.jupiter.api.Test; - -import nl.jqno.equalsverifier.EqualsVerifier; - -class TenantNameTest { - @Test - public void tenantNameShouldRespectBeanContract() { - EqualsVerifier.forClass(TenantName.class).verify(); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/UserNameTest.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/UserNameTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/UserNameTest.java deleted file mode 100644 index da73e4e..0000000 --- a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/UserNameTest.java +++ /dev/null @@ -1,31 +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.james.blob.objectstorage; - -import org.junit.jupiter.api.Test; - -import nl.jqno.equalsverifier.EqualsVerifier; - -class UserNameTest { - @Test - public void userNameShouldRespectBeanContract() { - EqualsVerifier.forClass(UserName.class).verify(); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/CredentialsTest.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/CredentialsTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/CredentialsTest.java new file mode 100644 index 0000000..e3d21f5 --- /dev/null +++ b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/CredentialsTest.java @@ -0,0 +1,31 @@ +/**************************************************************** + * 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.james.blob.objectstorage.swift; + +import org.junit.jupiter.api.Test; + +import nl.jqno.equalsverifier.EqualsVerifier; + +class CredentialsTest { + @Test + public void credentialsShouldRespectBeanContract() { + EqualsVerifier.forClass(Credentials.class).verify(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/HeaderNameTest.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/HeaderNameTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/HeaderNameTest.java new file mode 100644 index 0000000..b384f86 --- /dev/null +++ b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/HeaderNameTest.java @@ -0,0 +1,31 @@ +/**************************************************************** + * 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.james.blob.objectstorage.swift; + +import org.junit.jupiter.api.Test; + +import nl.jqno.equalsverifier.EqualsVerifier; + +class HeaderNameTest { + @Test + public void credentialsShouldRespectBeanContract() { + EqualsVerifier.forClass(HeaderName.class).verify(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/IdentityTest.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/IdentityTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/IdentityTest.java new file mode 100644 index 0000000..bb7e47d --- /dev/null +++ b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/IdentityTest.java @@ -0,0 +1,39 @@ +/**************************************************************** + * 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.james.blob.objectstorage.swift; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; + +import nl.jqno.equalsverifier.EqualsVerifier; + +class IdentityTest { + @Test + void swiftIdentityRendersProperlyAsString() { + Identity identity = Identity.of(TenantName.of("tenant"), UserName.of("user")); + assertThat(identity.asString()).isEqualTo("tenant:user"); + } + + @Test + public void credentialsShouldRespectBeanContract() { + EqualsVerifier.forClass(Identity.class).verify(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/ProjectNameTest.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/ProjectNameTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/ProjectNameTest.java new file mode 100644 index 0000000..ac9c1b6 --- /dev/null +++ b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/ProjectNameTest.java @@ -0,0 +1,31 @@ +/**************************************************************** + * 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.james.blob.objectstorage.swift; + +import org.junit.jupiter.api.Test; + +import nl.jqno.equalsverifier.EqualsVerifier; + +class ProjectNameTest { + @Test + public void projectNameShouldRespectBeanContract() { + EqualsVerifier.forClass(ProjectName.class).verify(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/RegionTest.java ---------------------------------------------------------------------- diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/RegionTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/RegionTest.java new file mode 100644 index 0000000..509e366 --- /dev/null +++ b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/RegionTest.java @@ -0,0 +1,31 @@ +/**************************************************************** + * 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.james.blob.objectstorage.swift; + +import org.junit.jupiter.api.Test; + +import nl.jqno.equalsverifier.EqualsVerifier; + +class RegionTest { + @Test + public void regionShouldRespectBeanContract() { + EqualsVerifier.forClass(Region.class).verify(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/ccf26875/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 86c087a..e08ffbe 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 @@ -24,10 +24,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.net.URI; -import org.apache.james.blob.objectstorage.Credentials; -import org.apache.james.blob.objectstorage.SwiftIdentity; -import org.apache.james.blob.objectstorage.TenantName; -import org.apache.james.blob.objectstorage.UserName; import org.junit.jupiter.api.Test; class SwiftTempAuthObjectStorageConfigurationTest { @@ -36,7 +32,7 @@ class SwiftTempAuthObjectStorageConfigurationTest { private static final UserName USER_NAME = UserName.of("fake"); private static URI ENDPOINT = URI.create("http://example.com"); private static Credentials CREDENTIALS = Credentials.of("fake"); - private static SwiftIdentity SWIFT_IDENTITY = SwiftIdentity.of(TenantName.of("fake"), + private static Identity SWIFT_IDENTITY = Identity.of(TenantName.of("fake"), UserName.of("fake")); @Test @@ -95,7 +91,7 @@ class SwiftTempAuthObjectStorageConfigurationTest { SwiftTempAuthObjectStorage.Configuration build = builder.build(); assertThat(build.getEndpoint()).isEqualTo(ENDPOINT); - assertThat(build.getSwiftIdentity()).isEqualTo(SWIFT_IDENTITY); + assertThat(build.getIdentity()).isEqualTo(SWIFT_IDENTITY); assertThat(build.getCredentials()).isEqualTo(CREDENTIALS); } @@ -110,7 +106,7 @@ class SwiftTempAuthObjectStorageConfigurationTest { SwiftTempAuthObjectStorage.Configuration build = builder.build(); assertThat(build.getEndpoint()).isEqualTo(ENDPOINT); - assertThat(build.getSwiftIdentity()).isEqualTo(SWIFT_IDENTITY); + assertThat(build.getIdentity()).isEqualTo(SWIFT_IDENTITY); assertThat(build.getCredentials()).isEqualTo(CREDENTIALS); } } \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org