KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > webservice > jbws663 > JBWS663BareBoundTestCase


1 /*
2  * JBoss, Home of Professional Open Source
3  * Copyright 2005, JBoss Inc., and individual contributors as indicated
4  * by the @authors tag. See the copyright.txt in the distribution for a
5  * full listing of individual contributors.
6  *
7  * This is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this software; if not, write to the Free
19  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21  */

22 package org.jboss.test.webservice.jbws663;
23
24 import javax.naming.InitialContext JavaDoc;
25 import javax.xml.rpc.Service JavaDoc;
26
27 import junit.framework.Test;
28
29 import org.jboss.test.webservice.WebserviceTestBase;
30 import org.jboss.test.webservice.jbws663.holders.ResponseInfoHolder;
31 import org.jboss.test.webservice.jbws663.holders.SubscriptionInfoHolder;
32
33 /**
34  * Multiple bindings are not supported
35  *
36  * http://jira.jboss.org/jira/browse/JBWS-663
37  *
38  * @author Thomas.Diesler@jboss.org
39  * @since 21-Jan-2006
40  */

41 public class JBWS663BareBoundTestCase extends WebserviceTestBase
42 {
43    private static SMSTextMessagingSoapBareBound port;
44    
45    public JBWS663BareBoundTestCase(String JavaDoc name)
46    {
47       super(name);
48    }
49    
50    /** Deploy the test */
51    public static Test suite() throws Exception JavaDoc
52    {
53       return getDeploySetup(JBWS663BareBoundTestCase.class, "ws4ee-jbws663bb.war, ws4ee-jbws663bb-client.jar");
54    }
55
56    protected void setUp() throws Exception JavaDoc
57    {
58       super.setUp();
59       if (port == null)
60       {
61          InitialContext JavaDoc iniCtx = getClientContext();
62          Service JavaDoc service = (Service JavaDoc)iniCtx.lookup("java:comp/env/service/SMSService");
63          port = (SMSTextMessagingSoapBareBound)service.getPort(SMSTextMessagingSoapBareBound.class);
64       }
65    }
66
67    public void testCreateService() throws Exception JavaDoc
68    {
69       assertNotNull("port not null", port);
70    }
71    
72    public void testSendMessage() throws Exception JavaDoc
73    {
74       if (isJBossWSAvailable())
75       {
76          LicenseInfo li = new LicenseInfo(null, new RegisteredUser("kermit", "thefrog"));
77          ResponseInfoHolder rih = new ResponseInfoHolder();
78          SubscriptionInfoHolder sih = new SubscriptionInfoHolder();
79          SendMessage reqMsg = new SendMessage("1234", "5678", "Kermit", "I luv Piggy");
80          SendMessageResponse resMsg = port.sendMessage(reqMsg, li, rih, sih);
81          SMSTextMessageTargetStatus status = resMsg.getSendMessageResult();
82
83          assertNotNull("status not null", status);
84          assertEquals(100, status.getMessageStatus().getStatusCode());
85          assertEquals("ok", status.getMessageStatus().getStatusText());
86          assertEquals("kermit", status.getMessageStatus().getStatusExtra());
87
88          assertEquals("all ok", rih.value.getResponse());
89          assertEquals("valid", sih.value.getLicenseStatus());
90       }
91    }
92 }
93
Popular Tags