Modified: james/protocols/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/imap4rev1/ListProcessorTest.java URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/imap4rev1/ListProcessorTest.java?rev=733492&r1=733491&r2=733492&view=diff ============================================================================== --- james/protocols/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/imap4rev1/ListProcessorTest.java (original) +++ james/protocols/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/imap4rev1/ListProcessorTest.java Sun Jan 11 09:17:48 2009 @@ -26,27 +26,26 @@ import org.apache.james.imap.mailbox.ListResult; import org.apache.james.imap.mailbox.MailboxManagerProvider; import org.apache.james.imap.message.response.imap4rev1.server.ListResponse; -import org.apache.james.imap.processor.imap4rev1.ListProcessor; -import org.jmock.Mock; -import org.jmock.MockObjectTestCase; +import org.jmock.Expectations; +import org.jmock.integration.junit3.MockObjectTestCase; public class ListProcessorTest extends MockObjectTestCase { ListProcessor processor; - Mock next; + ImapProcessor next; - Mock provider; + MailboxManagerProvider provider; - Mock responder; + ImapProcessor.Responder responder; - Mock result; + ListResult result; - Mock session; + ImapSession session; - Mock command; + ImapCommand command; - Mock serverResponseFactory; + StatusResponseFactory serverResponseFactory; protected void setUp() throws Exception { serverResponseFactory = mock(StatusResponseFactory.class); @@ -56,9 +55,7 @@ responder = mock(ImapProcessor.Responder.class); result = mock(ListResult.class); provider = mock(MailboxManagerProvider.class); - processor = createProcessor((ImapProcessor) next.proxy(), - (MailboxManagerProvider) provider.proxy(), - (StatusResponseFactory) serverResponseFactory.proxy()); + processor = createProcessor(next, provider, serverResponseFactory); } protected void tearDown() throws Exception { @@ -78,47 +75,45 @@ } void setUpResult(final boolean isNoinferiors, final int selectability, - String hierarchyDelimiter, String name) { - result.expects(once()).method("isNoInferiors").will( - returnValue(isNoinferiors)); - result.expects(once()).method("getSelectability").will( - returnValue(selectability)); - result.expects(once()).method("getHierarchyDelimiter").will( - returnValue(hierarchyDelimiter)); - result.expects(once()).method("getName").will(returnValue(name)); + final String hierarchyDelimiter, final String name) { + checking(new Expectations() {{ + oneOf(result).isNoInferiors();will(returnValue(isNoinferiors)); + oneOf(result).getSelectability();will(returnValue(selectability)); + oneOf(result).getHierarchyDelimiter();will(returnValue(hierarchyDelimiter)); + oneOf(result).getName();will(returnValue(name)); + }}); } public void testNoInferiors() throws Exception { setUpResult(true, ListResult.SELECTABILITY_FLAG_NONE, ".", "#INBOX"); - responder.expects(once()).method("respond").with( - eq(createResponse(true, false, false, false, ".", "#INBOX"))); - processor.processResult((ImapProcessor.Responder) responder.proxy(), - false, 0, (ListResult) result.proxy()); + checking(new Expectations() {{ + oneOf(responder).respond(with(equal(createResponse(true, false, false, false, ".", "#INBOX")))); + }}); + processor.processResult(responder, false, 0, result); } public void testNoSelect() throws Exception { - setUpResult(false, ListResult.SELECTABILITY_FLAG_NOSELECT, ".", - "#INBOX"); - responder.expects(once()).method("respond").with( - eq(createResponse(false, true, false, false, ".", "#INBOX"))); - processor.processResult((ImapProcessor.Responder) responder.proxy(), - false, 0, (ListResult) result.proxy()); + setUpResult(false, ListResult.SELECTABILITY_FLAG_NOSELECT, ".", "#INBOX"); + checking(new Expectations() {{ + oneOf(responder).respond(with(equal(createResponse(false, true, false, false, ".", "#INBOX")))); + }}); + processor.processResult(responder, false, 0, result); } public void testUnMarked() throws Exception { setUpResult(false, ListResult.SELECTABILITY_FLAG_UNMARKED, ".", "#INBOX"); - responder.expects(once()).method("respond").with( - eq(createResponse(false, false, false, true, ".", "#INBOX"))); - processor.processResult((ImapProcessor.Responder) responder.proxy(), - false, 0, (ListResult) result.proxy()); + checking(new Expectations() {{ + oneOf(responder).respond(with(equal(createResponse(false, false, false, true, ".", "#INBOX")))); + }}); + processor.processResult(responder, false, 0, result); } public void testMarked() throws Exception { setUpResult(false, ListResult.SELECTABILITY_FLAG_MARKED, ".", "#INBOX"); - responder.expects(once()).method("respond").with( - eq(createResponse(false, false, true, false, ".", "#INBOX"))); - processor.processResult((ImapProcessor.Responder) responder.proxy(), - false, 0, (ListResult) result.proxy()); + checking(new Expectations() {{ + oneOf(responder).respond(with(equal(createResponse(false, false, true, false, ".", "#INBOX")))); + }}); + processor.processResult(responder, false, 0, result); } }
Modified: james/protocols/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/imap4rev1/SearchProcessorTest.java URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/imap4rev1/SearchProcessorTest.java?rev=733492&r1=733491&r2=733492&view=diff ============================================================================== --- james/protocols/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/imap4rev1/SearchProcessorTest.java (original) +++ james/protocols/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/imap4rev1/SearchProcessorTest.java Sun Jan 11 09:17:48 2009 @@ -36,7 +36,6 @@ import org.apache.james.api.imap.process.ImapProcessor; import org.apache.james.api.imap.process.ImapSession; import org.apache.james.api.imap.process.SelectedMailbox; -import org.apache.james.api.imap.process.ImapProcessor.Responder; import org.apache.james.imap.mailbox.Mailbox; import org.apache.james.imap.mailbox.MailboxManager; import org.apache.james.imap.mailbox.MailboxManagerProvider; @@ -47,9 +46,8 @@ import org.apache.james.imap.message.request.imap4rev1.SearchRequest; import org.apache.james.imap.message.response.imap4rev1.server.SearchResponse; import org.apache.james.imap.processor.base.ImapSessionUtils; -import org.apache.james.imap.processor.imap4rev1.SearchProcessor; -import org.jmock.Mock; -import org.jmock.MockObjectTestCase; +import org.jmock.Expectations; +import org.jmock.integration.junit3.MockObjectTestCase; public class SearchProcessorTest extends MockObjectTestCase { private static final int DAY = 6; @@ -82,53 +80,43 @@ SearchProcessor processor; - Mock next; + ImapProcessor next; - Mock responder; + ImapProcessor.Responder responder; - Mock result; + ImapSession session; - Mock session; + ImapCommand command; - Mock command; + StatusResponseFactory serverResponseFactory; - Mock serverResponseFactory; + StatusResponse statusResponse; - Mock statusResponse; + Mailbox mailbox; - Mock mailbox; - - Mock mailboxManagerProvider; - - Mock mailboxManager; + MailboxManagerProvider mailboxManagerProvider; - Mock mailboxSession; + MailboxManager mailboxManager; - ImapCommand imapCommand; - - ImapProcessor.Responder responderImpl; + MailboxSession mailboxSession; - Mock selectedMailbox; + SelectedMailbox selectedMailbox; protected void setUp() throws Exception { super.setUp(); serverResponseFactory = mock(StatusResponseFactory.class); session = mock(ImapSession.class); command = mock(ImapCommand.class); - imapCommand = (ImapCommand) command.proxy(); next = mock(ImapProcessor.class); responder = mock(ImapProcessor.Responder.class); statusResponse = mock(StatusResponse.class); - responderImpl = (ImapProcessor.Responder) responder.proxy(); mailbox = mock(Mailbox.class); mailboxManagerProvider = mock(MailboxManagerProvider.class); mailboxManager = mock(MailboxManager.class); mailboxSession = mock(MailboxSession.class); selectedMailbox = mock(SelectedMailbox.class); - processor = new SearchProcessor((ImapProcessor) next.proxy(), - (MailboxManagerProvider) mailboxManagerProvider.proxy(), - (StatusResponseFactory) serverResponseFactory.proxy()); + processor = new SearchProcessor(next, mailboxManagerProvider, serverResponseFactory); expectOk(); } @@ -141,17 +129,21 @@ final IdRange[] ids = { new IdRange(Long.MAX_VALUE, 1729) }; final SearchQuery.NumericRange[] ranges = { new SearchQuery.NumericRange( Long.MAX_VALUE, 1729L) }; - selectedMailbox.expects(once()).method("uid").with(eq(1729)).will( - returnValue(1729L)); - + checking(new Expectations() {{ + oneOf(selectedMailbox).uid(with(equal(1729)));will(returnValue(1729L)); + }}); allowUnsolicitedResponses(); check(SearchKey.buildSequenceSet(ids), SearchQuery.uid(ranges)); } private void allowUnsolicitedResponses() { - session.expects(atMostOnce()).method("getAttribute").with(eq(ImapSessionUtils.MAILBOX_USER_ATTRIBUTE_SESSION_KEY)).will(returnValue("user")); - session.expects(atMostOnce()).method("getAttribute").with(eq(ImapSessionUtils.MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY)).will(returnValue(mailboxSession.proxy())); + checking(new Expectations() {{ + atMost(1).of(session).getAttribute( + with(equal(ImapSessionUtils.MAILBOX_USER_ATTRIBUTE_SESSION_KEY)));will(returnValue("user")); + atMost(1).of(session).getAttribute( + with(equal(ImapSessionUtils.MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY)));will(returnValue(mailboxSession)); + }}); } public void testSequenceSetUpperUnlimited() throws Exception { @@ -159,8 +151,9 @@ final IdRange[] ids = { new IdRange(1, Long.MAX_VALUE) }; final SearchQuery.NumericRange[] ranges = { new SearchQuery.NumericRange( 42, Long.MAX_VALUE) }; - selectedMailbox.expects(once()).method("uid").with(eq(1)).will( - returnValue(42L)); + checking(new Expectations() {{ + oneOf(selectedMailbox).uid(with(equal(1)));will(returnValue(42L)); + }}); allowUnsolicitedResponses(); check(SearchKey.buildSequenceSet(ids), SearchQuery.uid(ranges)); } @@ -170,10 +163,10 @@ final IdRange[] ids = { new IdRange(1, 5) }; final SearchQuery.NumericRange[] ranges = { new SearchQuery.NumericRange( 42, 1729) }; - selectedMailbox.expects(once()).method("uid").with(eq(1)).will( - returnValue(42L)); - selectedMailbox.expects(once()).method("uid").with(eq(5)).will( - returnValue(1729L)); + checking(new Expectations() {{ + oneOf(selectedMailbox).uid(with(equal(1)));will(returnValue(42L)); + oneOf(selectedMailbox).uid(with(equal(5)));will(returnValue(1729L)); + }}); allowUnsolicitedResponses(); check(SearchKey.buildSequenceSet(ids), SearchQuery.uid(ranges)); } @@ -183,9 +176,9 @@ final IdRange[] ids = { new IdRange(1) }; final SearchQuery.NumericRange[] ranges = { new SearchQuery.NumericRange( 42) }; - - selectedMailbox.expects(exactly(2)).method("uid").with(eq(1)).will( - returnValue(42L)); + checking(new Expectations() {{ + exactly(2).of(selectedMailbox).uid(with(equal(1)));will(returnValue(42L)); + }}); allowUnsolicitedResponses(); check(SearchKey.buildSequenceSet(ids), SearchQuery.uid(ranges)); } @@ -195,18 +188,20 @@ check(SearchKey.buildAll(), SearchQuery.all()); } - private void expectsGetSelectedMailbox() { - mailboxManagerProvider.expects(atMostOnce()).method("getMailboxManager").will(returnValue(mailboxManager.proxy())); - mailboxManager.expects(atMostOnce()).method("resolve").with(eq("user"), eq("name")).will(returnValue("user")); - mailboxManager.expects(atMostOnce()).method("getMailbox").with(eq("user"), eq(false)).will(returnValue(mailbox.proxy())); - session.expects(atLeastOnce()).method("getSelected").will(returnValue(selectedMailbox.proxy())); - selectedMailbox.expects(atMostOnce()).method("isRecentUidRemoved").will(returnValue(false)); - selectedMailbox.expects(atLeastOnce()).method("isSizeChanged").will(returnValue(false)); - selectedMailbox.expects(atLeastOnce()).method("getName").will(returnValue("MailboxName")); - selectedMailbox.expects(atMostOnce()).method("flagUpdateUids").will(returnValue(Collections.EMPTY_LIST)); - selectedMailbox.expects(atMostOnce()).method("resetEvents"); - mailboxManager.expects(atLeastOnce()).method("getMailbox").will(returnValue(mailbox.proxy())); - selectedMailbox.expects(once()).method("getRecent").will(returnValue(new ArrayList<Long>())); + private void expectsGetSelectedMailbox() throws Exception { + checking(new Expectations() {{ + atMost(1).of(mailboxManagerProvider).getMailboxManager();will(returnValue(mailboxManager)); + atMost(1).of(mailboxManager).resolve(with(equal("user")), with(equal("name")));will(returnValue("user")); + atMost(1).of(mailboxManager).getMailbox(with(equal("user")));will(returnValue(mailbox)); + atMost(1).of(mailboxManager).getMailbox(with(equal("MailboxName")));will(returnValue(mailbox)); + allowing(session).getSelected();will(returnValue(selectedMailbox)); + atMost(1).of(selectedMailbox).isRecentUidRemoved();will(returnValue(false)); + atLeast(1).of(selectedMailbox).isSizeChanged();will(returnValue(false)); + atLeast(1).of(selectedMailbox).getName();will(returnValue("MailboxName")); + atMost(1).of(selectedMailbox).flagUpdateUids();will(returnValue(Collections.EMPTY_LIST)); + atMost(1).of(selectedMailbox).resetEvents(); + oneOf(selectedMailbox).getRecent();will(returnValue(new ArrayList<Long>())); + }}); } public void testANSWERED() throws Exception { @@ -418,27 +413,29 @@ check(key, query); } - private void check(SearchKey key, SearchQuery query) throws Exception { - MailboxSession mailboxSession = (MailboxSession) mock( - MailboxSession.class).proxy(); - session.expects(once()).method("getAttribute").with( - eq(ImapSessionUtils.MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY)) - .will(returnValue((MailboxSession) mailboxSession)); - mailbox.expects(once()).method("search").with(eq(query), - eq(FetchGroupImpl.MINIMAL), eq(mailboxSession)).will( - returnValue(new ArrayList().iterator())); - responder.expects(once()).method("respond").with( - eq(new SearchResponse(EMPTY))); - SearchRequest message = new SearchRequest(imapCommand, key, false, TAG); - processor.doProcess(message, (ImapSession) session.proxy(), TAG, - (ImapCommand) command.proxy(), (Responder) responder.proxy()); + private void check(final SearchKey key, final SearchQuery query) throws Exception { + checking(new Expectations() {{ + allowing(session).getAttribute( + with(equal(ImapSessionUtils.MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY))); will(returnValue((MailboxSession) mailboxSession)); + oneOf(mailbox).search( + with(equal(query)), + with(equal(FetchGroupImpl.MINIMAL)), + with(equal(mailboxSession)));will( + returnValue(new ArrayList().iterator())); + oneOf(responder).respond(with(equal(new SearchResponse(EMPTY)))); + + }}); + SearchRequest message = new SearchRequest(command, key, false, TAG); + processor.doProcess(message, session, TAG, command, responder); } private void expectOk() { - StatusResponse response = (StatusResponse) statusResponse.proxy(); - serverResponseFactory.expects(once()).method("taggedOk").with(eq(TAG), - same(imapCommand), eq(HumanReadableTextKey.COMPLETED)).will( - returnValue(response)); - responder.expects(once()).method("respond").with(same(response)); + checking(new Expectations() {{ + oneOf(serverResponseFactory).taggedOk( + with(equal(TAG)), + with(same(command)), + with(equal(HumanReadableTextKey.COMPLETED)));will(returnValue(statusResponse)); + oneOf(responder).respond(with(same(statusResponse))); + }}); } } Modified: james/protocols/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/imap4rev1/fetch/PartialFetchBodyElementTest.java URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/imap4rev1/fetch/PartialFetchBodyElementTest.java?rev=733492&r1=733491&r2=733492&view=diff ============================================================================== --- james/protocols/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/imap4rev1/fetch/PartialFetchBodyElementTest.java (original) +++ james/protocols/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/imap4rev1/fetch/PartialFetchBodyElementTest.java Sun Jan 11 09:17:48 2009 @@ -21,20 +21,21 @@ import org.apache.james.imap.message.response.imap4rev1.FetchResponse.BodyElement; import org.apache.james.imap.processor.imap4rev1.fetch.PartialFetchBodyElement; -import org.jmock.Mock; -import org.jmock.MockObjectTestCase; +import org.jmock.Expectations; +import org.jmock.integration.junit3.MockObjectTestCase; public class PartialFetchBodyElementTest extends MockObjectTestCase { private static final long NUMBER_OF_OCTETS = 100; - Mock mockBodyElement; + BodyElement mockBodyElement; protected void setUp() throws Exception { super.setUp(); mockBodyElement = mock(BodyElement.class); - mockBodyElement.expects(once()).method("getName").will( - returnValue("Name")); + checking(new Expectations() {{ + oneOf(mockBodyElement).getName();will(returnValue("Name")); + }}); } protected void tearDown() throws Exception { @@ -43,11 +44,12 @@ public void testSizeShouldBeNumberOfOctetsWhenSizeMoreWhenStartIsZero() throws Exception { - long moreThanNumberOfOctets = NUMBER_OF_OCTETS + 1; + final long moreThanNumberOfOctets = NUMBER_OF_OCTETS + 1; PartialFetchBodyElement element = new PartialFetchBodyElement( - (BodyElement) mockBodyElement.proxy(), 0, NUMBER_OF_OCTETS); - mockBodyElement.expects(once()).method("size").will( - returnValue(new Long(moreThanNumberOfOctets))); + mockBodyElement, 0, NUMBER_OF_OCTETS); + checking(new Expectations() {{ + oneOf(mockBodyElement).size();will(returnValue(new Long(moreThanNumberOfOctets))); + }}); assertEquals( "Size is more than number of octets so should be number of octets", NUMBER_OF_OCTETS, element.size()); @@ -55,54 +57,59 @@ public void testSizeShouldBeSizeWhenNumberOfOctetsMoreWhenStartIsZero() throws Exception { - long lessThanNumberOfOctets = NUMBER_OF_OCTETS - 1; + final long lessThanNumberOfOctets = NUMBER_OF_OCTETS - 1; PartialFetchBodyElement element = new PartialFetchBodyElement( - (BodyElement) mockBodyElement.proxy(), 0, NUMBER_OF_OCTETS); - mockBodyElement.expects(once()).method("size").will( - returnValue(new Long(lessThanNumberOfOctets))); + mockBodyElement, 0, NUMBER_OF_OCTETS); + checking(new Expectations() {{ + oneOf(mockBodyElement).size();will(returnValue(new Long(lessThanNumberOfOctets))); + }}); assertEquals("Size is less than number of octets so should be size", lessThanNumberOfOctets, element.size()); } public void testWhenStartPlusNumberOfOctetsIsMoreThanSizeSizeShouldBeSizeMinusStart() throws Exception { - long size = 60; + final long size = 60; PartialFetchBodyElement element = new PartialFetchBodyElement( - (BodyElement) mockBodyElement.proxy(), 10, NUMBER_OF_OCTETS); - mockBodyElement.expects(once()).method("size").will( - returnValue(new Long(size))); + mockBodyElement, 10, NUMBER_OF_OCTETS); + checking(new Expectations() {{ + oneOf(mockBodyElement).size();will(returnValue(new Long(size))); + }}); assertEquals("Size is less than number of octets so should be size", 50, element.size()); } public void testWhenStartPlusNumberOfOctetsIsLessThanSizeSizeShouldBeNumberOfOctetsMinusStart() throws Exception { - long size = 100; + final long size = 100; PartialFetchBodyElement element = new PartialFetchBodyElement( - (BodyElement) mockBodyElement.proxy(), 10, NUMBER_OF_OCTETS); - mockBodyElement.expects(once()).method("size").will( - returnValue(new Long(size))); + mockBodyElement, 10, NUMBER_OF_OCTETS); + checking(new Expectations() {{ + oneOf(mockBodyElement).size();will(returnValue(new Long(size))); + }}); assertEquals("Size is less than number of octets so should be size", 90, element.size()); } public void testSizeShouldBeZeroWhenStartIsMoreThanSize() throws Exception { - long size = 100; + final long size = 100; PartialFetchBodyElement element = new PartialFetchBodyElement( - (BodyElement) mockBodyElement.proxy(), 1000, NUMBER_OF_OCTETS); - mockBodyElement.expects(once()).method("size").will( - returnValue(new Long(size))); + mockBodyElement, 1000, NUMBER_OF_OCTETS); + checking(new Expectations() {{ + oneOf(mockBodyElement).size();will(returnValue(new Long(size))); + }}); assertEquals("Size is less than number of octets so should be size", 0, element.size()); } public void testSizeShouldBeNumberOfOctetsWhenStartMoreThanOctets() throws Exception { - long size = 2000; + final long size = 2000; PartialFetchBodyElement element = new PartialFetchBodyElement( - (BodyElement) mockBodyElement.proxy(), 1000, NUMBER_OF_OCTETS); - mockBodyElement.expects(once()).method("size").will( - returnValue(new Long(size))); + mockBodyElement, 1000, NUMBER_OF_OCTETS); + checking(new Expectations() {{ + oneOf(mockBodyElement).size();will(returnValue(new Long(size))); + }}); assertEquals("Content size is less than start. Size should be zero.", NUMBER_OF_OCTETS, element.size()); } Added: james/protocols/imap/trunk/stage/jmock/jars/jmock-2.5.1.LICENSE URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/stage/jmock/jars/jmock-2.5.1.LICENSE?rev=733492&view=auto ============================================================================== --- james/protocols/imap/trunk/stage/jmock/jars/jmock-2.5.1.LICENSE (added) +++ james/protocols/imap/trunk/stage/jmock/jars/jmock-2.5.1.LICENSE Sun Jan 11 09:17:48 2009 @@ -0,0 +1,25 @@ +Copyright (c) 2000-2007, jMock.org +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of jMock nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. Added: james/protocols/imap/trunk/stage/jmock/jars/jmock-2.5.1.jar URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/stage/jmock/jars/jmock-2.5.1.jar?rev=733492&view=auto ============================================================================== Binary file - no diff available. Propchange: james/protocols/imap/trunk/stage/jmock/jars/jmock-2.5.1.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: james/protocols/imap/trunk/stage/jmock/jars/jmock-junit3-2.5.1.LICENSE URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/stage/jmock/jars/jmock-junit3-2.5.1.LICENSE?rev=733492&view=auto ============================================================================== --- james/protocols/imap/trunk/stage/jmock/jars/jmock-junit3-2.5.1.LICENSE (added) +++ james/protocols/imap/trunk/stage/jmock/jars/jmock-junit3-2.5.1.LICENSE Sun Jan 11 09:17:48 2009 @@ -0,0 +1,25 @@ +Copyright (c) 2000-2007, jMock.org +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of jMock nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. Added: james/protocols/imap/trunk/stage/jmock/jars/jmock-junit3-2.5.1.jar URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/stage/jmock/jars/jmock-junit3-2.5.1.jar?rev=733492&view=auto ============================================================================== Binary file - no diff available. Propchange: james/protocols/imap/trunk/stage/jmock/jars/jmock-junit3-2.5.1.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: james/protocols/imap/trunk/stage/org.hamcrest/jars/hamcrest-core-1.1.LICENSE URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/stage/org.hamcrest/jars/hamcrest-core-1.1.LICENSE?rev=733492&view=auto ============================================================================== --- james/protocols/imap/trunk/stage/org.hamcrest/jars/hamcrest-core-1.1.LICENSE (added) +++ james/protocols/imap/trunk/stage/org.hamcrest/jars/hamcrest-core-1.1.LICENSE Sun Jan 11 09:17:48 2009 @@ -0,0 +1,27 @@ +BSD License + +Copyright (c) 2000-2006, www.hamcrest.org +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of Hamcrest nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. Added: james/protocols/imap/trunk/stage/org.hamcrest/jars/hamcrest-core-1.1.jar URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/stage/org.hamcrest/jars/hamcrest-core-1.1.jar?rev=733492&view=auto ============================================================================== Binary file - no diff available. Propchange: james/protocols/imap/trunk/stage/org.hamcrest/jars/hamcrest-core-1.1.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: james/protocols/imap/trunk/stage/org.hamcrest/jars/hamcrest-library-1.1.LICENSE URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/stage/org.hamcrest/jars/hamcrest-library-1.1.LICENSE?rev=733492&view=auto ============================================================================== --- james/protocols/imap/trunk/stage/org.hamcrest/jars/hamcrest-library-1.1.LICENSE (added) +++ james/protocols/imap/trunk/stage/org.hamcrest/jars/hamcrest-library-1.1.LICENSE Sun Jan 11 09:17:48 2009 @@ -0,0 +1,27 @@ +BSD License + +Copyright (c) 2000-2006, www.hamcrest.org +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of Hamcrest nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. Added: james/protocols/imap/trunk/stage/org.hamcrest/jars/hamcrest-library-1.1.jar URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/stage/org.hamcrest/jars/hamcrest-library-1.1.jar?rev=733492&view=auto ============================================================================== Binary file - no diff available. Propchange: james/protocols/imap/trunk/stage/org.hamcrest/jars/hamcrest-library-1.1.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Modified: james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/MimeDescriptorImpl.java URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/MimeDescriptorImpl.java?rev=733492&r1=733491&r2=733492&view=diff ============================================================================== --- james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/MimeDescriptorImpl.java (original) +++ james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/MimeDescriptorImpl.java Sun Jan 11 09:17:48 2009 @@ -47,7 +47,7 @@ private static MimeDescriptorImpl createDescriptor( final MimeTokenStream parser) throws IOException, MimeException { int next = parser.next(); - final Collection headers = new ArrayList(); + final Collection<ResultHeader> headers = new ArrayList<ResultHeader>(); while (next != MimeTokenStream.T_BODY && next != MimeTokenStream.T_END_OF_STREAM && next != MimeTokenStream.T_START_MULTIPART) { @@ -134,7 +134,7 @@ final String subType = descriptor.getSubType(); final String type = descriptor.getMediaType(); final String transferEncoding = descriptor.getTransferEncoding(); - final Collection contentTypeParameters = new ArrayList(); + final Collection<ResultHeader> contentTypeParameters = new ArrayList<ResultHeader>(); final Map valuesByName = descriptor.getContentTypeParameters(); for (final Iterator it = valuesByName.keySet().iterator(); it.hasNext();) { final String name = (String) it.next(); @@ -163,7 +163,7 @@ final String disposition = descriptor.getContentDispositionType(); final Map dispositionParams = descriptor .getContentDispositionParameters(); - final Collection parts = new ArrayList(); + final Collection<MimeDescriptor> parts = new ArrayList<MimeDescriptor>(); final String location = descriptor.getContentLocation(); final String md5 = descriptor.getContentMD5Raw(); final MimeDescriptorImpl mimeDescriptorImpl = new MimeDescriptorImpl( @@ -200,7 +200,7 @@ private final MessageResult.MimeDescriptor embeddedMessage; - private final Collection parts; + private final Collection<MimeDescriptor> parts; private final String location; @@ -212,7 +212,7 @@ final String transferEncoding, final Collection headers, final Collection contentTypeParameters, final List languages, String disposition, Map dispositionParams, - final MimeDescriptor embeddedMessage, final Collection parts, + final MimeDescriptor embeddedMessage, final Collection<MimeDescriptor> parts, final String location, final String md5) { super(); this.type = type; Modified: james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/PartContentBuilder.java URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/PartContentBuilder.java?rev=733492&r1=733491&r2=733492&view=diff ============================================================================== --- james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/PartContentBuilder.java (original) +++ james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/PartContentBuilder.java Sun Jan 11 09:17:48 2009 @@ -190,12 +190,13 @@ return content; } + @SuppressWarnings("unchecked") public List getMimeHeaders() throws IOException { - final List results; + final List<ResultHeader> results; if (empty) { results = Collections.EMPTY_LIST; } else { - results = new ArrayList(); + results = new ArrayList<ResultHeader>(); for (int state = parser.getState(); state != MimeTokenStream.T_END_HEADER; state = parser .next()) { switch (state) { @@ -214,12 +215,13 @@ return results; } + @SuppressWarnings("unchecked") public List getMessageHeaders() throws IOException { - final List results; + final List<ResultHeader> results; if (empty) { results = Collections.EMPTY_LIST; } else { - results = new ArrayList(); + results = new ArrayList<ResultHeader>(); try { advancedToMessage(); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
