Author: eric
Date: Mon May 11 10:21:23 2015
New Revision: 1678716
URL: http://svn.apache.org/r1678716
Log:
James protocols should use latest version of other James subprojects, patch
contributed by Tellier Benoit (PROTOCOLS-110)
Modified:
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeBuilder.java
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/DeleteACLProcessorTest.java
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/GetACLProcessorTest.java
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/ListRightsProcessorTest.java
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/SetACLProcessorTest.java
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
james/protocols/trunk/pom.xml
Modified:
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java?rev=1678716&r1=1678715&r2=1678716&view=diff
==============================================================================
---
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
(original)
+++
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
Mon May 11 10:21:23 2015
@@ -32,12 +32,13 @@ import org.apache.james.imap.api.process
import org.apache.james.imap.message.request.DeleteACLRequest;
import org.apache.james.mailbox.MailboxManager;
import org.apache.james.mailbox.MailboxSession;
-import org.apache.james.mailbox.MessageManager;
import org.apache.james.mailbox.exception.MailboxException;
import org.apache.james.mailbox.exception.MailboxNotFoundException;
import org.apache.james.mailbox.exception.UnsupportedRightException;
import org.apache.james.mailbox.model.MailboxACL.EditMode;
import org.apache.james.mailbox.model.MailboxACL.MailboxACLEntryKey;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mailbox.model.SimpleMailboxACL;
import org.apache.james.mailbox.model.SimpleMailboxACL.Rfc4314Rights;
import
org.apache.james.mailbox.model.SimpleMailboxACL.SimpleMailboxACLEntryKey;
import org.slf4j.Logger;
@@ -63,9 +64,10 @@ public class DeleteACLProcessor extends
final String mailboxName = message.getMailboxName();
final String identifier = message.getIdentifier();
try {
-
- MessageManager messageManager =
mailboxManager.getMailbox(buildFullPath(session, mailboxName), mailboxSession);
+ MailboxPath mailboxPath = buildFullPath(session, mailboxName);
+ // Check that mailbox exists
+ mailboxManager.getMailbox(mailboxPath, mailboxSession);
/*
* RFC 4314 section 6.
* An implementation MUST make sure the ACL commands themselves do
@@ -76,11 +78,11 @@ public class DeleteACLProcessor extends
* would be used if the mailbox did not exist, thus revealing no
* existence information, much less the mailboxâs ACL.
*/
- if (!messageManager.hasRight(Rfc4314Rights.l_Lookup_RIGHT,
mailboxSession)) {
+ if (!mailboxManager.hasRight(mailboxPath,
Rfc4314Rights.l_Lookup_RIGHT, mailboxSession)) {
no(command, tag, responder,
HumanReadableText.MAILBOX_NOT_FOUND);
}
/* RFC 4314 section 4. */
- else if
(!messageManager.hasRight(Rfc4314Rights.a_Administer_RIGHT, mailboxSession)) {
+ else if (!mailboxManager.hasRight(mailboxPath,
Rfc4314Rights.a_Administer_RIGHT, mailboxSession)) {
Object[] params = new Object[] {
Rfc4314Rights.a_Administer_RIGHT.toString(),
command.getName(),
@@ -102,8 +104,10 @@ public class DeleteACLProcessor extends
// the server MUST refuse to perform the command with a BAD
response.
// Note that Section 6 recommends additional identifierâs
verification
// steps.
-
- messageManager.setRights(key, EditMode.REPLACE, null);
+
+ mailboxManager.setRights(mailboxPath,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key,
EditMode.REPLACE, null), mailboxSession);
+
okComplete(command, tag, responder);
// FIXME should we send unsolicited responses here?
// unsolicitedResponses(session, responder, false);
Modified:
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java?rev=1678716&r1=1678715&r2=1678716&view=diff
==============================================================================
---
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
(original)
+++
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
Mon May 11 10:21:23 2015
@@ -38,6 +38,7 @@ import org.apache.james.mailbox.MessageM
import org.apache.james.mailbox.MessageManager.MetaData.FetchGroup;
import org.apache.james.mailbox.exception.MailboxException;
import org.apache.james.mailbox.exception.MailboxNotFoundException;
+import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mailbox.model.SimpleMailboxACL.Rfc4314Rights;
import org.slf4j.Logger;
@@ -61,8 +62,9 @@ public class GetACLProcessor extends Abs
final String mailboxName = message.getMailboxName();
try {
- MessageManager messageManager =
mailboxManager.getMailbox(buildFullPath(session, mailboxName), mailboxSession);
-
+ MailboxPath mailboxPath = buildFullPath(session, mailboxName);
+ // Check that mailbox exists
+ MessageManager messageManager =
mailboxManager.getMailbox(mailboxPath, mailboxSession);
/*
* RFC 4314 section 6.
* An implementation MUST make sure the ACL commands themselves do
@@ -73,11 +75,11 @@ public class GetACLProcessor extends Abs
* would be used if the mailbox did not exist, thus revealing no
* existence information, much less the mailboxâs ACL.
*/
- if (!messageManager.hasRight(Rfc4314Rights.l_Lookup_RIGHT,
mailboxSession)) {
+ if (!mailboxManager.hasRight(mailboxPath,
Rfc4314Rights.l_Lookup_RIGHT, mailboxSession)) {
no(command, tag, responder,
HumanReadableText.MAILBOX_NOT_FOUND);
}
/* RFC 4314 section 4. */
- else if
(!messageManager.hasRight(Rfc4314Rights.a_Administer_RIGHT, mailboxSession)) {
+ else if (!mailboxManager.hasRight(mailboxPath,
Rfc4314Rights.a_Administer_RIGHT, mailboxSession)) {
Object[] params = new Object[] {
Rfc4314Rights.a_Administer_RIGHT.toString(),
command.getName(),
Modified:
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java?rev=1678716&r1=1678715&r2=1678716&view=diff
==============================================================================
---
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
(original)
+++
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
Mon May 11 10:21:23 2015
@@ -33,11 +33,11 @@ import org.apache.james.imap.message.req
import org.apache.james.imap.message.response.ListRightsResponse;
import org.apache.james.mailbox.MailboxManager;
import org.apache.james.mailbox.MailboxSession;
-import org.apache.james.mailbox.MessageManager;
import org.apache.james.mailbox.exception.MailboxException;
import org.apache.james.mailbox.exception.MailboxNotFoundException;
import org.apache.james.mailbox.model.MailboxACL.MailboxACLEntryKey;
import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights;
+import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mailbox.model.SimpleMailboxACL.Rfc4314Rights;
import
org.apache.james.mailbox.model.SimpleMailboxACL.SimpleMailboxACLEntryKey;
import org.slf4j.Logger;
@@ -64,7 +64,9 @@ public class ListRightsProcessor extends
final String identifier = message.getIdentifier();
try {
- MessageManager messageManager =
mailboxManager.getMailbox(buildFullPath(session, mailboxName), mailboxSession);
+ MailboxPath mailboxPath = buildFullPath(session, mailboxName);
+ // Check that mailbox exists
+ mailboxManager.getMailbox(mailboxPath, mailboxSession);
/*
* RFC 4314 section 6.
@@ -76,11 +78,11 @@ public class ListRightsProcessor extends
* would be used if the mailbox did not exist, thus revealing no
* existence information, much less the mailboxâs ACL.
*/
- if (!messageManager.hasRight(Rfc4314Rights.l_Lookup_RIGHT,
mailboxSession)) {
+ if (!mailboxManager.hasRight(mailboxPath,
Rfc4314Rights.l_Lookup_RIGHT, mailboxSession)) {
no(command, tag, responder,
HumanReadableText.MAILBOX_NOT_FOUND);
}
/* RFC 4314 section 4. */
- else if
(!messageManager.hasRight(Rfc4314Rights.a_Administer_RIGHT, mailboxSession)) {
+ else if (!mailboxManager.hasRight(mailboxPath,
Rfc4314Rights.a_Administer_RIGHT, mailboxSession)) {
Object[] params = new Object[] {
Rfc4314Rights.a_Administer_RIGHT.toString(),
command.getName(),
@@ -103,7 +105,7 @@ public class ListRightsProcessor extends
// Note that Section 6 recommends additional identifierâs
verification
// steps.
- MailboxACLRights[] rights = messageManager.listRigths(key,
mailboxSession);
+ MailboxACLRights[] rights =
mailboxManager.listRigths(mailboxPath, key, mailboxSession);
ListRightsResponse aclResponse = new
ListRightsResponse(mailboxName, identifier, rights);
responder.respond(aclResponse);
okComplete(command, tag, responder);
Modified:
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java?rev=1678716&r1=1678715&r2=1678716&view=diff
==============================================================================
---
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
(original)
+++
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
Mon May 11 10:21:23 2015
@@ -33,10 +33,10 @@ import org.apache.james.imap.message.req
import org.apache.james.imap.message.response.MyRightsResponse;
import org.apache.james.mailbox.MailboxManager;
import org.apache.james.mailbox.MailboxSession;
-import org.apache.james.mailbox.MessageManager;
import org.apache.james.mailbox.exception.MailboxException;
import org.apache.james.mailbox.exception.MailboxNotFoundException;
import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights;
+import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mailbox.model.SimpleMailboxACL.Rfc4314Rights;
import org.slf4j.Logger;
@@ -61,8 +61,10 @@ public class MyRightsProcessor extends A
final String mailboxName = message.getMailboxName();
try {
- MessageManager messageManager =
mailboxManager.getMailbox(buildFullPath(session, mailboxName), mailboxSession);
- MailboxACLRights myRights =
messageManager.myRights(mailboxSession);
+ MailboxPath mailboxPath = buildFullPath(session, mailboxName);
+ // Check that mailbox exists
+ mailboxManager.getMailbox(mailboxPath, mailboxSession);
+ MailboxACLRights myRights = mailboxManager.myRights(mailboxPath,
mailboxSession);
/*
* RFC 4314 section 6. An implementation MUST make sure the ACL
Modified:
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java?rev=1678716&r1=1678715&r2=1678716&view=diff
==============================================================================
---
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
(original)
+++
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
Mon May 11 10:21:23 2015
@@ -32,7 +32,6 @@ import org.apache.james.imap.api.process
import org.apache.james.imap.message.request.SetACLRequest;
import org.apache.james.mailbox.MailboxManager;
import org.apache.james.mailbox.MailboxSession;
-import org.apache.james.mailbox.MessageManager;
import org.apache.james.mailbox.exception.MailboxException;
import org.apache.james.mailbox.exception.MailboxNotFoundException;
import org.apache.james.mailbox.exception.UnsupportedRightException;
@@ -40,6 +39,8 @@ import org.apache.james.mailbox.model.Ma
import org.apache.james.mailbox.model.MailboxACL.EditMode;
import org.apache.james.mailbox.model.MailboxACL.MailboxACLEntryKey;
import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mailbox.model.SimpleMailboxACL;
import org.apache.james.mailbox.model.SimpleMailboxACL.Rfc4314Rights;
import
org.apache.james.mailbox.model.SimpleMailboxACL.SimpleMailboxACLEntryKey;
import org.slf4j.Logger;
@@ -83,7 +84,9 @@ public class SetACLProcessor extends Abs
}
MailboxACLRights mailboxAclRights = new Rfc4314Rights(rights);
- MessageManager messageManager =
mailboxManager.getMailbox(buildFullPath(session, mailboxName), mailboxSession);
+ MailboxPath mailboxPath = buildFullPath(session, mailboxName);
+ // Check that mailbox exists
+ mailboxManager.getMailbox(mailboxPath, mailboxSession);
/*
* RFC 4314 section 6.
@@ -95,11 +98,11 @@ public class SetACLProcessor extends Abs
* would be used if the mailbox did not exist, thus revealing no
* existence information, much less the mailboxâs ACL.
*/
- if (!messageManager.hasRight(Rfc4314Rights.l_Lookup_RIGHT,
mailboxSession)) {
+ if (!mailboxManager.hasRight(mailboxPath,
Rfc4314Rights.l_Lookup_RIGHT, mailboxSession)) {
no(command, tag, responder,
HumanReadableText.MAILBOX_NOT_FOUND);
}
/* RFC 4314 section 4. */
- else if
(!messageManager.hasRight(Rfc4314Rights.a_Administer_RIGHT, mailboxSession)) {
+ else if (!mailboxManager.hasRight(mailboxPath,
Rfc4314Rights.a_Administer_RIGHT, mailboxSession)) {
Object[] params = new Object[] {
Rfc4314Rights.a_Administer_RIGHT.toString(),
command.getName(),
@@ -121,8 +124,10 @@ public class SetACLProcessor extends Abs
// the server MUST refuse to perform the command with a BAD
response.
// Note that Section 6 recommends additional identifierâs
verification
// steps.
-
- messageManager.setRights(key, editMode, mailboxAclRights);
+
+ mailboxManager.setRights(mailboxPath,
+ new SimpleMailboxACL.SimpleMailboxACLCommand(key,
editMode, mailboxAclRights), mailboxSession);
+
okComplete(command, tag, responder);
// FIXME should we send unsolicited responses here?
// unsolicitedResponses(session, responder, false);
Modified:
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeBuilder.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeBuilder.java?rev=1678716&r1=1678715&r2=1678716&view=diff
==============================================================================
---
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeBuilder.java
(original)
+++
james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeBuilder.java
Mon May 11 10:21:23 2015
@@ -39,7 +39,7 @@ import org.apache.james.mime4j.dom.addre
import org.apache.james.mime4j.dom.address.DomainList;
import org.apache.james.mime4j.dom.address.Group;
import org.apache.james.mime4j.dom.address.MailboxList;
-import org.apache.james.mime4j.field.address.LenientAddressBuilder;
+import org.apache.james.mime4j.field.address.LenientAddressParser;
import org.slf4j.Logger;
public final class EnvelopeBuilder {
@@ -131,7 +131,7 @@ public final class EnvelopeBuilder {
results = null;
} else {
- AddressList addressList =
LenientAddressBuilder.DEFAULT.parseAddressList(value);
+ AddressList addressList =
LenientAddressParser.DEFAULT.parseAddressList(value);
final int size = addressList.size();
final List<FetchResponse.Envelope.Address> addresses = new
ArrayList<FetchResponse.Envelope.Address>(size);
for (int i = 0; i < size; i++) {
Modified:
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/DeleteACLProcessorTest.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/DeleteACLProcessorTest.java?rev=1678716&r1=1678715&r2=1678716&view=diff
==============================================================================
---
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/DeleteACLProcessorTest.java
(original)
+++
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/DeleteACLProcessorTest.java
Mon May 11 10:21:23 2015
@@ -75,6 +75,7 @@ public class DeleteACLProcessorTest {
DeleteACLProcessor subject;
User user1Stub;
MailboxACLEntryKey user1Key;
+ MailboxPath path;
private Expectations prepareRightsExpectations() throws MailboxException {
return new Expectations() {
@@ -104,6 +105,7 @@ public class DeleteACLProcessorTest {
@Before
public void setUp() throws Exception {
+ path = new MailboxPath("#private", USER_1, MAILBOX_NAME);
statusResponseFactory = new UnpooledStatusResponseFactory();
mailboxManagerStub = mockery.mock(MailboxManager.class);
subject = new DeleteACLProcessor(mockery.mock(ImapProcessor.class),
mailboxManagerStub, statusResponseFactory);
@@ -122,7 +124,8 @@ public class DeleteACLProcessorTest {
public void testNoListRight() throws Exception {
Expectations expectations = prepareRightsExpectations();
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(false));
expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)),
expectations.with(Expectations.any(MailboxSession.class)));
@@ -145,10 +148,10 @@ public class DeleteACLProcessorTest {
public void testNoAdminRight() throws Exception {
Expectations expectations = prepareRightsExpectations();
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(true));
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(false));
expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)),
expectations.with(Expectations.any(MailboxSession.class)));
@@ -196,13 +199,13 @@ public class DeleteACLProcessorTest {
expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)),
expectations.with(Expectations.any(MailboxSession.class)));
expectations.will(Expectations.returnValue(messageManagerStub));
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(true));
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(true));
-
expectations.allowing(messageManagerStub).setRights(expectations.with(Expectations.equal(user1Key)),
expectations.with(Expectations.equal(EditMode.REPLACE)),
expectations.with(Expectations.aNull(MailboxACLRights.class)));
+
expectations.allowing(mailboxManagerStub).setRights(expectations.with(path),
expectations.with(new SimpleMailboxACL.SimpleMailboxACLCommand(user1Key,
EditMode.REPLACE, null)), expectations.with(mailboxSessionStub));
expectations.allowing(metaDataStub).getACL();
expectations.will(Expectations.returnValue(acl));
Modified:
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/GetACLProcessorTest.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/GetACLProcessorTest.java?rev=1678716&r1=1678715&r2=1678716&view=diff
==============================================================================
---
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/GetACLProcessorTest.java
(original)
+++
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/GetACLProcessorTest.java
Mon May 11 10:21:23 2015
@@ -70,6 +70,7 @@ public class GetACLProcessorTest {
UnpooledStatusResponseFactory statusResponseFactory;
GetACLProcessor subject;
User user1Stub;
+ MailboxPath path;
private Expectations prepareRightsExpectations() throws MailboxException {
return new Expectations() {
@@ -99,6 +100,7 @@ public class GetACLProcessorTest {
@Before
public void setUp() throws Exception {
+ path = new MailboxPath("#private", USER_1, MAILBOX_NAME);
statusResponseFactory = new UnpooledStatusResponseFactory();
mailboxManagerStub = mockery.mock(MailboxManager.class);
subject = new GetACLProcessor(mockery.mock(ImapProcessor.class),
mailboxManagerStub, statusResponseFactory);
@@ -116,7 +118,7 @@ public class GetACLProcessorTest {
public void testNoListRight() throws Exception {
Expectations expectations = prepareRightsExpectations();
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(false));
expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)),
expectations.with(Expectations.any(MailboxSession.class)));
@@ -139,10 +141,10 @@ public class GetACLProcessorTest {
public void testNoAdminRight() throws Exception {
Expectations expectations = prepareRightsExpectations();
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(true));
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(false));
expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)),
expectations.with(Expectations.any(MailboxSession.class)));
@@ -190,10 +192,10 @@ public class GetACLProcessorTest {
expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)),
expectations.with(Expectations.any(MailboxSession.class)));
expectations.will(Expectations.returnValue(messageManagerStub));
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(true));
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(true));
Modified:
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/ListRightsProcessorTest.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/ListRightsProcessorTest.java?rev=1678716&r1=1678715&r2=1678716&view=diff
==============================================================================
---
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/ListRightsProcessorTest.java
(original)
+++
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/ListRightsProcessorTest.java
Mon May 11 10:21:23 2015
@@ -76,6 +76,7 @@ public class ListRightsProcessorTest {
User user1Stub;
MailboxACLEntryKey user1Key;
MailboxACLRights[] listRights;
+ MailboxPath path;
private Expectations prepareRightsExpectations() throws MailboxException {
return new Expectations() {
@@ -105,6 +106,7 @@ public class ListRightsProcessorTest {
@Before
public void setUp() throws Exception {
+ path = new MailboxPath("#private", USER_1, MAILBOX_NAME);
statusResponseFactory = new UnpooledStatusResponseFactory();
mailboxManagerStub = mockery.mock(MailboxManager.class);
subject = new ListRightsProcessor(mockery.mock(ImapProcessor.class),
mailboxManagerStub, statusResponseFactory);
@@ -124,7 +126,7 @@ public class ListRightsProcessorTest {
public void testNoListRight() throws Exception {
Expectations expectations = prepareRightsExpectations();
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(false));
expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)),
expectations.with(Expectations.any(MailboxSession.class)));
@@ -147,10 +149,10 @@ public class ListRightsProcessorTest {
public void testNoAdminRight() throws Exception {
Expectations expectations = prepareRightsExpectations();
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(true));
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(false));
expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)),
expectations.with(Expectations.any(MailboxSession.class)));
@@ -198,13 +200,13 @@ public class ListRightsProcessorTest {
expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)),
expectations.with(Expectations.any(MailboxSession.class)));
expectations.will(Expectations.returnValue(messageManagerStub));
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(true));
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(true));
-
expectations.allowing(messageManagerStub).listRigths(expectations.with(Expectations.equal(user1Key)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).listRigths(expectations.with(path),
expectations.with(Expectations.equal(user1Key)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(listRights));
expectations.allowing(metaDataStub).getACL();
Modified:
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/SetACLProcessorTest.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/SetACLProcessorTest.java?rev=1678716&r1=1678715&r2=1678716&view=diff
==============================================================================
---
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/SetACLProcessorTest.java
(original)
+++
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/SetACLProcessorTest.java
Mon May 11 10:21:23 2015
@@ -78,6 +78,7 @@ public class SetACLProcessorTest {
User user1Stub;
MailboxACLEntryKey user1Key;
MailboxACLRights setRights;
+ MailboxPath path;
private Expectations prepareRightsExpectations() throws MailboxException {
return new Expectations() {
@@ -107,6 +108,7 @@ public class SetACLProcessorTest {
@Before
public void setUp() throws Exception {
+ path = new MailboxPath("#private", USER_1, MAILBOX_NAME);
statusResponseFactory = new UnpooledStatusResponseFactory();
mailboxManagerStub = mockery.mock(MailboxManager.class);
subject = new SetACLProcessor(mockery.mock(ImapProcessor.class),
mailboxManagerStub, statusResponseFactory);
@@ -126,7 +128,7 @@ public class SetACLProcessorTest {
public void testUnsupportedRight() throws Exception {
Expectations expectations = prepareRightsExpectations();
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(false));
expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)),
expectations.with(Expectations.any(MailboxSession.class)));
@@ -149,7 +151,7 @@ public class SetACLProcessorTest {
public void testNoListRight() throws Exception {
Expectations expectations = prepareRightsExpectations();
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(false));
expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)),
expectations.with(Expectations.any(MailboxSession.class)));
@@ -172,10 +174,10 @@ public class SetACLProcessorTest {
public void testNoAdminRight() throws Exception {
Expectations expectations = prepareRightsExpectations();
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(true));
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(false));
expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)),
expectations.with(Expectations.any(MailboxSession.class)));
@@ -226,13 +228,13 @@ public class SetACLProcessorTest {
expectations.allowing(mailboxManagerStub).getMailbox(expectations.with(Expectations.any(MailboxPath.class)),
expectations.with(Expectations.any(MailboxSession.class)));
expectations.will(Expectations.returnValue(messageManagerStub));
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.l_Lookup_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(true));
-
expectations.allowing(messageManagerStub).hasRight(expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
+
expectations.allowing(mailboxManagerStub).hasRight(expectations.with(path),
expectations.with(Expectations.equal(Rfc4314Rights.a_Administer_RIGHT)),
expectations.with(Expectations.same(mailboxSessionStub)));
expectations.will(Expectations.returnValue(true));
-
expectations.allowing(messageManagerStub).setRights(expectations.with(Expectations.equal(user1Key)),
expectations.with(Expectations.equal(editMode)),
expectations.with(Expectations.equal(setRights)));
+
expectations.allowing(mailboxManagerStub).setRights(expectations.with(path),
expectations.with(Expectations.equal(new
SimpleMailboxACL.SimpleMailboxACLCommand(user1Key, editMode, setRights))),
expectations.with(mailboxSessionStub));
expectations.allowing(metaDataStub).getACL();
expectations.will(Expectations.returnValue(acl));
Modified:
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java?rev=1678716&r1=1678715&r2=1678716&view=diff
==============================================================================
---
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
(original)
+++
james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
Mon May 11 10:21:23 2015
@@ -35,6 +35,7 @@ import java.util.Map;
import javax.mail.Flags;
+import org.apache.commons.lang.NotImplementedException;
import org.apache.james.imap.api.ImapSessionState;
import org.apache.james.imap.api.ImapSessionUtils;
import org.apache.james.imap.api.process.ImapLineHandler;
@@ -46,10 +47,9 @@ import org.apache.james.mailbox.MailboxS
import org.apache.james.mailbox.MessageManager;
import org.apache.james.mailbox.exception.BadCredentialsException;
import org.apache.james.mailbox.exception.MailboxException;
-import org.apache.james.mailbox.exception.UnsupportedRightException;
import org.apache.james.mailbox.model.Content;
import org.apache.james.mailbox.model.Headers;
-import org.apache.james.mailbox.model.MailboxACL.EditMode;
+import org.apache.james.mailbox.model.MailboxACL.MailboxACLCommand;
import org.apache.james.mailbox.model.MailboxACL.MailboxACLEntryKey;
import org.apache.james.mailbox.model.MailboxACL.MailboxACLRight;
import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights;
@@ -299,23 +299,6 @@ public class MailboxEventAnalyserTest {
throw new UnsupportedOperationException("Not implemented");
}
-
- public boolean hasRight(MailboxACLRight right, MailboxSession
session) throws MailboxException {
- return true;
- }
-
- public MailboxACLRights myRights(MailboxSession session)
throws MailboxException {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public MailboxACLRights[] listRigths(MailboxACLEntryKey
identifier, MailboxSession session) throws UnsupportedRightException {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public void setRights(MailboxACLEntryKey mailboxACLEntryKey,
EditMode editMode, MailboxACLRights mailboxAclRights) throws
UnsupportedRightException {
- throw new UnsupportedOperationException("Not implemented");
- }
-
};
}
@@ -350,7 +333,26 @@ public class MailboxEventAnalyserTest {
throw new UnsupportedOperationException("Not implemented");
}
+
+ public boolean hasRight(MailboxPath mailboxPath, MailboxACLRight
mailboxACLRight, MailboxSession mailboxSession) throws MailboxException {
+ throw new NotImplementedException("Not implemented");
+ }
+
+ public MailboxACLRights myRights(MailboxPath mailboxPath,
MailboxSession mailboxSession) throws MailboxException {
+ throw new NotImplementedException("Not implemented");
+ }
+
+ public MailboxACLRights[] listRigths(MailboxPath mailboxPath,
MailboxACLEntryKey mailboxACLEntryKey, MailboxSession mailboxSession) throws
MailboxException {
+ throw new NotImplementedException("Not implemented");
+ }
+
+ public void setRights(MailboxPath mailboxPath,
+ MailboxACLCommand mailboxACLCommand, MailboxSession session)
+ throws MailboxException {
+ throw new NotImplementedException("Not implemented");
+ }
};
+
private final class MyMailboxSession implements MailboxSession {
private long sessionId;
Modified: james/protocols/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/pom.xml?rev=1678716&r1=1678715&r2=1678716&view=diff
==============================================================================
--- james/protocols/trunk/pom.xml (original)
+++ james/protocols/trunk/pom.xml Mon May 11 10:21:23 2015
@@ -23,8 +23,7 @@
<parent>
<artifactId>james-project</artifactId>
<groupId>org.apache.james</groupId>
- <version>1.8.1</version>
- <relativePath />
+ <version>1.8.3-SNAPSHOT</version>
</parent>
<artifactId>protocols</artifactId>
@@ -49,8 +48,8 @@
<target.jdk>1.6</target.jdk>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<netty.version>3.3.1.Final</netty.version>
- <apache-mime4j.version>0.7.2</apache-mime4j.version>
- <mailbox.version>0.5</mailbox.version>
+ <apache-mime4j.version>0.8.0-SNAPSHOT</apache-mime4j.version>
+ <mailbox.version>0.6-SNAPSHOT</mailbox.version>
<commons-net.version>3.2</commons-net.version>
<commons-lang.version>2.6</commons-lang.version>
<commons-codec.version>1.7</commons-codec.version>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]