KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > jbi > messaging > types > InOptionalOutImplTest


1 /**
2  * PETALS - PETALS Services Platform.
3  * Copyright (c) 2005 EBM Websourcing, http://www.ebmwebsourcing.com/
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * -------------------------------------------------------------------------
19  * $Id: InOnlyImplTest.java 17:30:10 ddesjardins $
20  * -------------------------------------------------------------------------
21  */

22 package org.objectweb.petals.jbi.messaging.types;
23
24 import java.io.ByteArrayInputStream JavaDoc;
25
26 import javax.jbi.messaging.MessageExchange.Role;
27 import javax.xml.transform.stream.StreamSource JavaDoc;
28
29 import junit.framework.TestCase;
30
31 import org.objectweb.petals.jbi.messaging.MessageExchangeImpl;
32 import org.objectweb.petals.jbi.messaging.NormalizedMessageImpl;
33
34 /**
35  * Test the InOptionalOutImpl
36  *
37  * @author ddesjardins - eBMWebsourcing
38  */

39 public class InOptionalOutImplTest extends TestCase {
40
41     private MessageExchangeImpl messageExchangeImpl;
42
43     private NormalizedMessageImpl normalizedMessageImpl;
44
45     public void setUp() throws Exception JavaDoc {
46         messageExchangeImpl = new MessageExchangeImpl(null);
47
48         normalizedMessageImpl = new NormalizedMessageImpl();
49
50         StreamSource JavaDoc source = new StreamSource JavaDoc();
51         byte[] msgByte = "test message".getBytes();
52         ByteArrayInputStream JavaDoc in = new ByteArrayInputStream JavaDoc(msgByte);
53         source.setInputStream(in);
54
55         normalizedMessageImpl.setContent(source);
56
57     }
58
59     public void testConstructor() throws Exception JavaDoc {
60         normalizedMessageImpl.setProperty("test", "valuein");
61         messageExchangeImpl.setPattern(MessageExchangeImpl.IN_OUT_PATTERN);
62         messageExchangeImpl.setMessage(normalizedMessageImpl, "in");
63         new InOptionalOutImpl(messageExchangeImpl, Role.CONSUMER);
64
65         assertEquals(messageExchangeImpl.getPattern(), MessageExchangeImpl.IN_OPTIONAL_OUT_PATTERN);
66     }
67
68 }
69
Popular Tags