1   /***
2    *
3    * Copyright 2005 LogicBlaze, Inc.
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    * http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   *
17   **/
18  package org.logicblaze.lingo.jms.marshall;
19  
20  import org.logicblaze.lingo.LingoInvocation;
21  import org.logicblaze.lingo.MethodMetadata;
22  import org.logicblaze.lingo.jms.JmsTestSupport;
23  import org.logicblaze.lingo.jms.Requestor;
24  
25  import javax.jms.Message;
26  import javax.jms.TextMessage;
27  
28  /***
29   * @version $Revision: 1.1 $
30   */
31  public class XStreamMarshallerTest extends JmsTestSupport {
32      Marshaller marshaller = new XStreamMarshaller();
33  
34      public void testMarshall() throws Exception {
35          Requestor requestor = createRequestor(getDestinationName());
36  
37          LingoInvocation invocation = new LingoInvocation("foo", new Class[0], new Object[0], new MethodMetadata(false));
38          Message message = marshaller.createRequestMessage(requestor, invocation);
39  
40          assertTrue("Should have created a text message: " + message, message instanceof TextMessage);
41  
42          TextMessage textMessage = (TextMessage) message;
43          String text = textMessage.getText();
44          assertTrue("Should have created a valid string", text != null && text.length() > 0);
45  
46          System.out.println("XML is: ");
47          System.out.println(text);
48      }
49  }