This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit b9c3591f68c621b73f67d4d043ccd88f3b010329
Author: Benoit Tellier <btell...@linagora.com>
AuthorDate: Thu Sep 19 09:33:38 2019 +0700

    JAMES-2742 Remove unused MailRepository properties
---
 .../api/MailRepositoryProperties.java              |  92 ----------------
 .../api/MailRepositoryPropertiesStore.java         |  29 -----
 .../api/MailRepositoryPropertiesStoreContract.java | 119 ---------------------
 .../api/MailRepositoryPropertiesTest.java          |  33 ------
 .../MemoryMailRepositoryPropertiesStore.java       |  51 ---------
 .../MemoryMailRepositoryPropertiesStoreTest.java   |  39 -------
 6 files changed, 363 deletions(-)

diff --git 
a/server/mailrepository/mailrepository-api/src/main/java/org/apache/james/mailrepository/api/MailRepositoryProperties.java
 
b/server/mailrepository/mailrepository-api/src/main/java/org/apache/james/mailrepository/api/MailRepositoryProperties.java
deleted file mode 100644
index cd78e2b..0000000
--- 
a/server/mailrepository/mailrepository-api/src/main/java/org/apache/james/mailrepository/api/MailRepositoryProperties.java
+++ /dev/null
@@ -1,92 +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.mailrepository.api;
-
-import java.util.Objects;
-
-import com.google.common.base.MoreObjects;
-
-public class MailRepositoryProperties {
-
-    static class Builder {
-
-        @FunctionalInterface
-        interface RequireBrowsable {
-            ReadyToBuild browsable(boolean browsable);
-
-            default ReadyToBuild canBrowse() {
-                return browsable(true);
-            }
-
-            default ReadyToBuild canNotBrowse() {
-                return browsable(false);
-            }
-        }
-
-        static class ReadyToBuild {
-
-            private final boolean browsable;
-
-            ReadyToBuild(boolean browsable) {
-                this.browsable = browsable;
-            }
-
-            MailRepositoryProperties build() {
-                return new MailRepositoryProperties(browsable);
-            }
-        }
-    }
-
-    static Builder.RequireBrowsable builder() {
-        return Builder.ReadyToBuild::new;
-    }
-
-    private final boolean browsable;
-
-    private MailRepositoryProperties(boolean browsable) {
-        this.browsable = browsable;
-    }
-
-    public boolean isBrowsable() {
-        return browsable;
-    }
-
-    @Override
-    public final boolean equals(Object o) {
-        if (o instanceof MailRepositoryProperties) {
-            MailRepositoryProperties that = (MailRepositoryProperties) o;
-
-            return Objects.equals(this.browsable, that.browsable);
-        }
-        return false;
-    }
-
-    @Override
-    public final int hashCode() {
-        return Objects.hash(browsable);
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects.toStringHelper(this)
-            .add("browsable", browsable)
-            .toString();
-    }
-}
diff --git 
a/server/mailrepository/mailrepository-api/src/main/java/org/apache/james/mailrepository/api/MailRepositoryPropertiesStore.java
 
b/server/mailrepository/mailrepository-api/src/main/java/org/apache/james/mailrepository/api/MailRepositoryPropertiesStore.java
deleted file mode 100644
index b129097..0000000
--- 
a/server/mailrepository/mailrepository-api/src/main/java/org/apache/james/mailrepository/api/MailRepositoryPropertiesStore.java
+++ /dev/null
@@ -1,29 +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.mailrepository.api;
-
-import org.reactivestreams.Publisher;
-
-public interface MailRepositoryPropertiesStore {
-
-    Publisher<Void> store(MailRepositoryUrl url, MailRepositoryProperties 
properties);
-
-    Publisher<MailRepositoryProperties> retrieve(MailRepositoryUrl url);
-}
diff --git 
a/server/mailrepository/mailrepository-api/src/test/java/org/apache/james/mailrepository/api/MailRepositoryPropertiesStoreContract.java
 
b/server/mailrepository/mailrepository-api/src/test/java/org/apache/james/mailrepository/api/MailRepositoryPropertiesStoreContract.java
deleted file mode 100644
index 72c99e2..0000000
--- 
a/server/mailrepository/mailrepository-api/src/test/java/org/apache/james/mailrepository/api/MailRepositoryPropertiesStoreContract.java
+++ /dev/null
@@ -1,119 +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.mailrepository.api;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-import org.junit.jupiter.api.Test;
-
-import reactor.core.publisher.Mono;
-
-public interface MailRepositoryPropertiesStoreContract {
-
-    MailRepositoryProperties NON_BROWSABLE = MailRepositoryProperties.builder()
-        .canNotBrowse()
-        .build();
-    MailRepositoryProperties BROWSABLE = MailRepositoryProperties.builder()
-        .canBrowse()
-        .build();
-
-    MailRepositoryUrl URL_1 = 
MailRepositoryUrl.from("protocol://deletedMessages/user1");
-    MailRepositoryUrl URL_2 = 
MailRepositoryUrl.from("protocol://deletedMessages/user2");
-    MailRepositoryUrl URL_3 = 
MailRepositoryUrl.from("protocol://deletedMessages/user3");
-
-    MailRepositoryPropertiesStore testee();
-
-    @Test
-    default void storeShouldStorePropertiesWithBelongingUrl() {
-        Mono.from(testee().store(URL_1, NON_BROWSABLE))
-            .block();
-
-        assertThat(Mono.from(testee().retrieve(URL_1)).block())
-            .isEqualTo(NON_BROWSABLE);
-    }
-
-    @Test
-    default void storeShouldOverrideTheResultWhenCalledMultipleTimes() {
-        Mono.from(testee().store(URL_1, NON_BROWSABLE)).block();
-        Mono.from(testee().store(URL_1, BROWSABLE)).block();
-
-        assertThat(Mono.from(testee().retrieve(URL_1)).block())
-            .isEqualTo(BROWSABLE);
-    }
-
-    @Test
-    default void storeShouldNotThrowWhenStoringDifferentUrl() {
-        assertThatCode(() -> {
-                Mono.from(testee().store(URL_1, NON_BROWSABLE)).block();
-                Mono.from(testee().store(URL_2, BROWSABLE)).block();
-            }).doesNotThrowAnyException();
-    }
-
-    @Test
-    default void retrieveShouldReturnTheRightPropertiesByTheUrl() {
-        Mono.from(testee().store(URL_1, NON_BROWSABLE)).block();
-        Mono.from(testee().store(URL_2, BROWSABLE)).block();
-
-        assertThat(Mono.from(testee().retrieve(URL_2)).block())
-            .isEqualTo(BROWSABLE);
-    }
-
-    @Test
-    default void retrieveShouldReturnEmptyWhenRetrievingByNonExistedUrl() {
-        Mono.from(testee().store(URL_1, NON_BROWSABLE)).block();
-        Mono.from(testee().store(URL_2, BROWSABLE)).block();
-
-        assertThat(Mono.from(testee().retrieve(URL_3)).blockOptional())
-            .isEmpty();
-    }
-
-    @Test
-    default void doingMappingOnTheResultShouldNotThrowWhenEmptyResult() {
-        assertThatCode(() ->
-            Mono.from(testee().retrieve(URL_1))
-                .map(MailRepositoryProperties::isBrowsable)
-                .block())
-        .doesNotThrowAnyException();
-    }
-
-    @Test
-    default void 
doingMappingOnTheResultShouldNotThrowAfterANullMappingPipeLineWhenEmptyResult() 
{
-        assertThatCode(() ->
-            Mono.from(testee().retrieve(URL_1))
-                .map(properties -> (MailRepositoryProperties) null)
-                .map(MailRepositoryProperties::isBrowsable)
-                .block())
-        .doesNotThrowAnyException();
-    }
-
-    @Test
-    default void 
doingMappingOnTheResultShouldThrowAfterANullMappingPipeLineWhenNotEmptyResult() 
{
-        Mono.from(testee().store(URL_1, NON_BROWSABLE)).block();
-
-        assertThatThrownBy(() ->
-            Mono.from(testee().retrieve(URL_1))
-                .map(properties -> (MailRepositoryProperties) null)
-                .map(MailRepositoryProperties::isBrowsable)
-                .block())
-        .isInstanceOf(NullPointerException.class);
-    }
-}
diff --git 
a/server/mailrepository/mailrepository-api/src/test/java/org/apache/james/mailrepository/api/MailRepositoryPropertiesTest.java
 
b/server/mailrepository/mailrepository-api/src/test/java/org/apache/james/mailrepository/api/MailRepositoryPropertiesTest.java
deleted file mode 100644
index bca1954..0000000
--- 
a/server/mailrepository/mailrepository-api/src/test/java/org/apache/james/mailrepository/api/MailRepositoryPropertiesTest.java
+++ /dev/null
@@ -1,33 +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.mailrepository.api;
-
-import org.junit.jupiter.api.Test;
-
-import nl.jqno.equalsverifier.EqualsVerifier;
-
-class MailRepositoryPropertiesTest {
-
-    @Test
-    void shouldMatchBeanContract() {
-        EqualsVerifier.forClass(MailRepositoryProperties.class)
-            .verify();
-    }
-}
diff --git 
a/server/mailrepository/mailrepository-memory/src/main/java/org/apache/james/mailrepository/memory/MemoryMailRepositoryPropertiesStore.java
 
b/server/mailrepository/mailrepository-memory/src/main/java/org/apache/james/mailrepository/memory/MemoryMailRepositoryPropertiesStore.java
deleted file mode 100644
index 82f8dea..0000000
--- 
a/server/mailrepository/mailrepository-memory/src/main/java/org/apache/james/mailrepository/memory/MemoryMailRepositoryPropertiesStore.java
+++ /dev/null
@@ -1,51 +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.mailrepository.memory;
-
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.james.mailrepository.api.MailRepositoryProperties;
-import org.apache.james.mailrepository.api.MailRepositoryPropertiesStore;
-import org.apache.james.mailrepository.api.MailRepositoryUrl;
-import org.reactivestreams.Publisher;
-
-import com.google.common.annotations.VisibleForTesting;
-
-import reactor.core.publisher.Mono;
-
-public class MemoryMailRepositoryPropertiesStore implements 
MailRepositoryPropertiesStore {
-
-    private final ConcurrentHashMap<MailRepositoryUrl, 
MailRepositoryProperties> propertiesMap;
-
-    @VisibleForTesting
-    MemoryMailRepositoryPropertiesStore() {
-        this.propertiesMap = new ConcurrentHashMap<>();
-    }
-
-    @Override
-    public Publisher<Void> store(MailRepositoryUrl url, 
MailRepositoryProperties properties) {
-        return Mono.fromRunnable(() -> propertiesMap.put(url, properties));
-    }
-
-    @Override
-    public Publisher<MailRepositoryProperties> retrieve(MailRepositoryUrl url) 
{
-        return Mono.fromSupplier(() -> propertiesMap.get(url));
-    }
-}
diff --git 
a/server/mailrepository/mailrepository-memory/src/test/java/org/apache/james/mailrepository/memory/MemoryMailRepositoryPropertiesStoreTest.java
 
b/server/mailrepository/mailrepository-memory/src/test/java/org/apache/james/mailrepository/memory/MemoryMailRepositoryPropertiesStoreTest.java
deleted file mode 100644
index 33b6d66..0000000
--- 
a/server/mailrepository/mailrepository-memory/src/test/java/org/apache/james/mailrepository/memory/MemoryMailRepositoryPropertiesStoreTest.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.mailrepository.memory;
-
-import org.apache.james.mailrepository.api.MailRepositoryPropertiesStore;
-import 
org.apache.james.mailrepository.api.MailRepositoryPropertiesStoreContract;
-import org.junit.jupiter.api.BeforeEach;
-
-class MemoryMailRepositoryPropertiesStoreTest implements 
MailRepositoryPropertiesStoreContract {
-
-    private MemoryMailRepositoryPropertiesStore testee;
-
-    @BeforeEach
-    void beforeEach() {
-        testee = new MemoryMailRepositoryPropertiesStore();
-    }
-
-    @Override
-    public MailRepositoryPropertiesStore testee() {
-        return testee;
-    }
-}


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

Reply via email to