james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [07/15] james-project git commit: PROTOCOLS-117 Bonus: Remove another "Mock like" ImapSession implementation
Date Fri, 03 Nov 2017 12:27:30 GMT
PROTOCOLS-117 Bonus: Remove another "Mock like" ImapSession implementation


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

Branch: refs/heads/master
Commit: c2669b885b44d15e184e31407c9d750f8f08a82f
Parents: b99318e
Author: benwa <btellier@linagora.com>
Authored: Wed Nov 1 13:58:27 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Fri Nov 3 15:48:40 2017 +0700

----------------------------------------------------------------------
 .../james/mpt/host/JamesImapHostSystem.java     |   8 +-
 .../james/mpt/session/ImapSessionImpl.java      | 129 -------------------
 2 files changed, 4 insertions(+), 133 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/c2669b88/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
index 662002a..21386e7 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
@@ -28,6 +28,7 @@ import org.apache.james.imap.api.ImapConfiguration;
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.decode.ImapDecoder;
 import org.apache.james.imap.decode.main.ImapRequestStreamHandler;
+import org.apache.james.imap.encode.FakeImapSession;
 import org.apache.james.imap.encode.ImapEncoder;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
@@ -40,7 +41,6 @@ import org.apache.james.mpt.api.ImapHostSystem;
 import org.apache.james.mpt.helper.ByteBufferInputStream;
 import org.apache.james.mpt.helper.ByteBufferOutputStream;
 import org.apache.james.mpt.imapmailbox.GrantRightsOnHost;
-import org.apache.james.mpt.session.ImapSessionImpl;
 import org.apache.james.user.memory.MemoryUsersRepository;
 
 import com.google.common.base.Throwables;
@@ -123,7 +123,7 @@ public abstract class JamesImapHostSystem implements ImapHostSystem, GrantRights
 
         ImapRequestStreamHandler handler;
 
-        ImapSessionImpl session;
+        FakeImapSession session;
 
         boolean isReadLast = true;
 
@@ -131,7 +131,7 @@ public abstract class JamesImapHostSystem implements ImapHostSystem, GrantRights
             out = new ByteBufferOutputStream(continuation);
             in = new ByteBufferInputStream();
             handler = new ImapRequestStreamHandler(decoder, processor, encoder);
-            session = new ImapSessionImpl();
+            session = new FakeImapSession();
         }
 
         public String readLine() throws Exception {
@@ -148,7 +148,7 @@ public abstract class JamesImapHostSystem implements ImapHostSystem, GrantRights
         }
 
         public void restart() throws Exception {
-            session = new ImapSessionImpl();
+            session = new FakeImapSession();
         }
 
         public void stop() throws Exception {

http://git-wip-us.apache.org/repos/asf/james-project/blob/c2669b88/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/session/ImapSessionImpl.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/session/ImapSessionImpl.java
b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/session/ImapSessionImpl.java
deleted file mode 100644
index 5c9d5e2..0000000
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/session/ImapSessionImpl.java
+++ /dev/null
@@ -1,129 +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.mpt.session;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.james.imap.api.ImapSessionState;
-import org.apache.james.imap.api.process.ImapLineHandler;
-import org.apache.james.imap.api.process.ImapSession;
-import org.apache.james.imap.api.process.SelectedMailbox;
-
-public class ImapSessionImpl implements ImapSession {
-
-    private ImapSessionState state = ImapSessionState.NON_AUTHENTICATED;
-
-    private SelectedMailbox selectedMailbox = null;
-
-    private final Map<String, Object> attributesByKey;
-
-    public ImapSessionImpl() {
-        this.attributesByKey = new ConcurrentHashMap<>();
-    }
-
-    public void logout() {
-        closeMailbox();
-        state = ImapSessionState.LOGOUT;
-    }
-
-    public void authenticated() {
-        this.state = ImapSessionState.AUTHENTICATED;
-    }
-
-    public void deselect() {
-        this.state = ImapSessionState.AUTHENTICATED;
-        closeMailbox();
-    }
-
-    public void selected(SelectedMailbox mailbox) {
-        this.state = ImapSessionState.SELECTED;
-        closeMailbox();
-        this.selectedMailbox = mailbox;
-    }
-
-    public SelectedMailbox getSelected() {
-        return this.selectedMailbox;
-    }
-
-    public ImapSessionState getState() {
-        return this.state;
-    }
-
-    public void closeMailbox() {
-        if (selectedMailbox != null) {
-            selectedMailbox.deselect();
-            selectedMailbox = null;
-        }
-    }
-
-    public Object getAttribute(String key) {
-        return attributesByKey.get(key);
-    }
-
-    public void setAttribute(String key, Object value) {
-        if (value == null) {
-            attributesByKey.remove(key);
-        }
-        else {
-            attributesByKey.put(key, value);
-        }
-    }
-
-    public boolean startTLS() {
-        return false;
-    }
-
-    public boolean supportStartTLS() {
-        return false;
-    }
-
-    public boolean isCompressionSupported() {
-        return false;
-    }
-
-    public boolean startCompression() {
-        return false;
-    }
-
-    public void pushLineHandler(ImapLineHandler lineHandler) {
-
-    }
-
-    public void popLineHandler() {
-
-    }
-
-    public boolean isPlainAuthDisallowed() {
-        return false;
-    }
-
-    public boolean isTLSActive() {
-        return false;
-    }
-
-    public boolean supportMultipleNamespaces() {
-        return false;
-    }
-
-    public boolean isCompressionActive() {
-        return false;
-    }
-
-}


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


Mime
View raw message