KickJava   Java API By Example, From Geeks To Geeks.

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


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