You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2020/12/11 10:44:17 UTC
[james-project] 13/15: [REFACTORING] Remove unused
MailboxIdDeserializer class
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 9386502947f7877343acd0964d641ca18668ff23
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Dec 6 22:02:30 2020 +0700
[REFACTORING] Remove unused MailboxIdDeserializer class
This is now handled by the MailboxId.Factory class
---
.../ids/CassandraMailboxIdDeserializer.java | 38 ---------------
.../ids/CassandraMailboxIdDeserializerTest.java | 55 ---------------------
.../mailbox/jpa/JPAMailboxIdDeserializer.java | 35 --------------
.../main/resources/META-INF/spring/mailbox-jpa.xml | 2 -
.../mailbox/jpa/JPAMailboxIdDeserializerTest.java | 53 --------------------
.../maildir/MaildirMailboxIdDeserializer.java | 35 --------------
.../resources/META-INF/spring/mailbox-maildir.xml | 2 -
.../maildir/MaildirMailboxIdDeserializerTest.java | 56 ----------------------
.../inmemory/InMemoryMailboxIdDeserializer.java | 36 --------------
.../resources/META-INF/spring/mailbox-memory.xml | 2 -
.../InMemoryMailboxIdDeserializerTest.java | 54 ---------------------
.../store/mail/model/MailboxIdDeserializer.java | 28 -----------
12 files changed, 396 deletions(-)
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/CassandraMailboxIdDeserializer.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/CassandraMailboxIdDeserializer.java
deleted file mode 100644
index 96fc17c..0000000
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/ids/CassandraMailboxIdDeserializer.java
+++ /dev/null
@@ -1,38 +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.mailbox.cassandra.ids;
-
-import java.util.UUID;
-
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserialisationException;
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserializer;
-
-public class CassandraMailboxIdDeserializer implements MailboxIdDeserializer {
-
- @Override
- public CassandraId deserialize(String serializedMailboxId) throws MailboxIdDeserialisationException {
- try {
- return CassandraId.of(UUID.fromString(serializedMailboxId));
- } catch (Exception e) {
- throw new MailboxIdDeserialisationException("Error de-serialising " + serializedMailboxId, e);
- }
- }
-
-}
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/ids/CassandraMailboxIdDeserializerTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/ids/CassandraMailboxIdDeserializerTest.java
deleted file mode 100644
index 597f529..0000000
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/ids/CassandraMailboxIdDeserializerTest.java
+++ /dev/null
@@ -1,55 +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.mailbox.cassandra.ids;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-import java.util.UUID;
-
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserialisationException;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-class CassandraMailboxIdDeserializerTest {
-
- private static final String UUID_STRING = "5530370f-44c6-4647-990e-7768ce5131d4";
- private static final String MALFORMED_UUID_STRING = "xyz";
- private static final CassandraId CASSANDRA_ID = CassandraId.of(UUID.fromString(UUID_STRING));
-
- private CassandraMailboxIdDeserializer mailboxIdDeserializer;
-
- @BeforeEach
- void setUp() {
- mailboxIdDeserializer = new CassandraMailboxIdDeserializer();
- }
-
- @Test
- void deserializeShouldWork() throws Exception {
- assertThat(mailboxIdDeserializer.deserialize(UUID_STRING)).isEqualTo(CASSANDRA_ID);
- }
-
- @Test
- void deserializeShouldThrowOnMalformedData() {
- assertThatThrownBy(() -> mailboxIdDeserializer.deserialize(MALFORMED_UUID_STRING))
- .isInstanceOf(MailboxIdDeserialisationException.class);
- }
-
-}
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxIdDeserializer.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxIdDeserializer.java
deleted file mode 100644
index 9e4f7d6..0000000
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxIdDeserializer.java
+++ /dev/null
@@ -1,35 +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.mailbox.jpa;
-
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserialisationException;
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserializer;
-
-public class JPAMailboxIdDeserializer implements MailboxIdDeserializer {
-
- @Override
- public JPAId deserialize(String serializedMailboxId) throws MailboxIdDeserialisationException {
- try {
- return JPAId.of(Long.parseLong(serializedMailboxId));
- } catch (Exception e) {
- throw new MailboxIdDeserialisationException("Error deserializing " + serializedMailboxId, e);
- }
- }
-}
diff --git a/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml b/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml
index 8dd4aba..fb646fc 100644
--- a/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml
+++ b/mailbox/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml
@@ -87,8 +87,6 @@
<property name="showSql" value="false"/>
</bean>
- <bean id="jpa-mailbox-id-deserializer" class="org.apache.james.mailbox.jpa.JPAMailboxIdDeserializer"/>
-
<bean id="jpa-per-user-max-quota-dao" class="org.apache.james.mailbox.jpa.quota.JPAPerUserMaxQuotaDAO">
<constructor-arg index="0" ref="entityManagerFactory"/>
</bean>
diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxIdDeserializerTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxIdDeserializerTest.java
deleted file mode 100644
index 1ad1d88..0000000
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxIdDeserializerTest.java
+++ /dev/null
@@ -1,53 +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.mailbox.jpa;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserialisationException;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-class JPAMailboxIdDeserializerTest {
-
- static final String SERIALIZED_ID = "123456789012";
- static final String MALFORMED_SERIALIZED_ID = "abcz";
- static final JPAId JPA_ID = JPAId.of(Long.parseLong(SERIALIZED_ID));
-
- JPAMailboxIdDeserializer mailboxIdDeserializer;
-
- @BeforeEach
- void setUp() {
- mailboxIdDeserializer = new JPAMailboxIdDeserializer();
- }
-
- @Test
- void deserializeShouldWork() throws Exception {
- assertThat(mailboxIdDeserializer.deserialize(SERIALIZED_ID)).isEqualTo(JPA_ID);
- }
-
- @Test
- void deserializeShouldThrowOnMalformedData() {
- assertThatThrownBy(() -> mailboxIdDeserializer.deserialize(MALFORMED_SERIALIZED_ID))
- .isInstanceOf(MailboxIdDeserialisationException.class);
- }
-
-}
diff --git a/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirMailboxIdDeserializer.java b/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirMailboxIdDeserializer.java
deleted file mode 100644
index 088b5b8..0000000
--- a/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirMailboxIdDeserializer.java
+++ /dev/null
@@ -1,35 +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.mailbox.maildir;
-
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserialisationException;
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserializer;
-
-public class MaildirMailboxIdDeserializer implements MailboxIdDeserializer {
-
- @Override
- public MaildirId deserialize(String serializedMailboxId) throws MailboxIdDeserialisationException {
- try {
- return MaildirId.fromString(serializedMailboxId);
- } catch (Exception e) {
- throw new MailboxIdDeserialisationException("Can not deserialize " + serializedMailboxId, e);
- }
- }
-}
diff --git a/mailbox/maildir/src/main/resources/META-INF/spring/mailbox-maildir.xml b/mailbox/maildir/src/main/resources/META-INF/spring/mailbox-maildir.xml
index 6ebdc31..50adf609 100644
--- a/mailbox/maildir/src/main/resources/META-INF/spring/mailbox-maildir.xml
+++ b/mailbox/maildir/src/main/resources/META-INF/spring/mailbox-maildir.xml
@@ -63,6 +63,4 @@
</bean>
<alias name="jvm-locker" alias="maildir-locker"/>
- <bean id="maildir-mailbox-id-deserializer" class="org.apache.james.mailbox.maildir.MaildirMailboxIdDeserializer"/>
-
</beans>
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxIdDeserializerTest.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxIdDeserializerTest.java
deleted file mode 100644
index bed406b..0000000
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxIdDeserializerTest.java
+++ /dev/null
@@ -1,56 +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.mailbox.maildir;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-import java.util.UUID;
-
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserialisationException;
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserializer;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-class MaildirMailboxIdDeserializerTest {
-
- static final String SERIALIZED_ID = "2f3a4fcc-ca64-36e3-9bcf-33e92dd93135";
- static final String MALFORMED_SERIALIZED_ID = "az";
- static final MaildirId MAILDIR_ID = MaildirId.of(UUID.fromString(SERIALIZED_ID));
-
- MailboxIdDeserializer mailboxIdDeserializer;
-
- @BeforeEach
- void setUp() {
- mailboxIdDeserializer = new MaildirMailboxIdDeserializer();
- }
-
- @Test
- void deserializeShouldWork() throws Exception {
- assertThat(mailboxIdDeserializer.deserialize(SERIALIZED_ID)).isEqualTo(MAILDIR_ID);
- }
-
- @Test
- void deserializeShouldThrowOnMalformedData() {
- assertThatThrownBy(() -> mailboxIdDeserializer.deserialize(MALFORMED_SERIALIZED_ID))
- .isInstanceOf(MailboxIdDeserialisationException.class);
- }
-
-}
diff --git a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxIdDeserializer.java b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxIdDeserializer.java
deleted file mode 100644
index 0530a1a..0000000
--- a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxIdDeserializer.java
+++ /dev/null
@@ -1,36 +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.mailbox.inmemory;
-
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserialisationException;
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserializer;
-
-public class InMemoryMailboxIdDeserializer implements MailboxIdDeserializer {
-
- @Override
- public InMemoryId deserialize(String serializedMailboxId) throws MailboxIdDeserialisationException {
- try {
- return InMemoryId.of(Long.parseLong(serializedMailboxId));
- } catch (Exception e) {
- throw new MailboxIdDeserialisationException("Error deserializing " + serializedMailboxId, e);
- }
- }
-
-}
diff --git a/mailbox/memory/src/main/resources/META-INF/spring/mailbox-memory.xml b/mailbox/memory/src/main/resources/META-INF/spring/mailbox-memory.xml
index 2d31f25..c701d67 100644
--- a/mailbox/memory/src/main/resources/META-INF/spring/mailbox-memory.xml
+++ b/mailbox/memory/src/main/resources/META-INF/spring/mailbox-memory.xml
@@ -53,6 +53,4 @@
<alias name="jvm-locker" alias="memory-locker"/>
- <bean id="memory-mailbox-id-deserializer" class="org.apache.james.mailbox.inmemory.InMemoryMailboxIdDeserializer"/>
-
</beans>
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMailboxIdDeserializerTest.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMailboxIdDeserializerTest.java
deleted file mode 100644
index d0f83bc..0000000
--- a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMailboxIdDeserializerTest.java
+++ /dev/null
@@ -1,54 +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.mailbox.inmemory;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserialisationException;
-import org.apache.james.mailbox.store.mail.model.MailboxIdDeserializer;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-class InMemoryMailboxIdDeserializerTest {
-
- static final String SERIALIZED_ID = "1234567890123";
- static final String MALFORMED_SERIALIZED_ID = "aEZ";
- static final InMemoryId IN_MEMORY_ID = InMemoryId.of(Long.parseLong(SERIALIZED_ID));
-
- MailboxIdDeserializer mailboxIdDeserializer;
-
- @BeforeEach
- void setUp() {
- mailboxIdDeserializer = new InMemoryMailboxIdDeserializer();
- }
-
- @Test
- void deserializeShouldWork() throws MailboxIdDeserialisationException {
- assertThat(mailboxIdDeserializer.deserialize(SERIALIZED_ID)).isEqualTo(IN_MEMORY_ID);
- }
-
- @Test
- void deserializeShouldThrowOnMalformedData() {
- assertThatThrownBy(() -> mailboxIdDeserializer.deserialize(MALFORMED_SERIALIZED_ID))
- .isInstanceOf(MailboxIdDeserialisationException.class);
- }
-
-}
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxIdDeserializer.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxIdDeserializer.java
deleted file mode 100644
index 864be74..0000000
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxIdDeserializer.java
+++ /dev/null
@@ -1,28 +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.mailbox.store.mail.model;
-
-import org.apache.james.mailbox.model.MailboxId;
-
-public interface MailboxIdDeserializer {
-
- MailboxId deserialize(String serializedMailboxId) throws MailboxIdDeserialisationException;
-
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org