001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999-2005 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or 1any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: F_WsWarSample.java 7547 2005-10-20 15:03:58Z sauthieg $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.examples.clients.webservices;
025:
026: import java.io.File;
027:
028: import junit.framework.TestSuite;
029:
030: /**
031: * Define a class to test the webServices examples wsWarExample
032: * Test WebServices deployment OK and test Call on deployed WebService
033: * @author Guillaume Sauthier
034: */
035: public class F_WsWarSample extends A_WebServicesEndpoint {
036:
037: /**
038: * URL of the wsWarSample page
039: */
040: private static final String URL_WSWARSAMPLE = "/wswarsample/";
041:
042: /**
043: * Main method
044: * @param args the arguments
045: */
046: public static void main(String[] args) {
047:
048: String testtorun = null;
049: // Get args
050: for (int argn = 0; argn < args.length; argn++) {
051: String sArg = args[argn];
052: if (sArg.equals("-n")) {
053: testtorun = args[++argn];
054: }
055: }
056:
057: if (testtorun == null) {
058: junit.textui.TestRunner.run(suite());
059: } else {
060: junit.textui.TestRunner.run(new F_WsWarSample(testtorun));
061: }
062: }
063:
064: /**
065: * Get a new TestSuite for this class
066: * @return a new TestSuite for this class
067: */
068: public static TestSuite suite() {
069: return new TestSuite(F_WsWarSample.class);
070: }
071:
072: /**
073: * Setup need for these tests
074: * earsample is required
075: * @throws Exception if it fails
076: */
077: protected void setUp() throws Exception {
078: super .setUp();
079: useWar("wswarsample");
080: }
081:
082: /**
083: * Constructor with a specified name
084: * @param s name
085: */
086: public F_WsWarSample(String s) {
087: super (s, URL_WSWARSAMPLE);
088: }
089:
090: /**
091: * Check if home page is accessible
092: * @throws Exception if an error occurs
093: */
094: public void testDeploymentCompleted() throws Exception {
095: // 3 links + 3 logo links on homepage
096: checkDeploymentCompleted(3 + 3);
097: }
098:
099: /**
100: * Check if Axis is Running
101: * @throws Exception if an error occurs
102: */
103: public void testAxisServicesAccessible() throws Exception {
104:
105: // links to /jaxrpcEndpoint1/* in first place (0)
106: checkAxisServicesAccessible(3, "endpoints", "jaxrpc");
107: }
108:
109: /**
110: * Check if WSDL is generated
111: * @throws Exception if an error occurs
112: */
113: public void testAxisWSDL() throws Exception {
114:
115: // for wsWarSample axis generated WSDL link is in second place (1)
116: checkAxisWSDL("endpoints/jaxrpc?JWSDL");
117: }
118:
119: /**
120: * Check if deployed WebService is running
121: * @throws Exception if an error occurs
122: */
123: public void testDeployedWebService() throws Exception {
124:
125: this .wc.setAuthorization("jonas", "jonas");
126: checkDeployedWebService("jaxrpcTest.jsp", url
127: + "endpoints/jaxrpc", "JOnAS",
128: "JOnAS JaxRpc WebService Test Page");
129: }
130:
131: /**
132: * Check if WSDL has been published
133: * @throws Exception if an error occurs
134: */
135: public void testWSDLPublication() throws Exception {
136:
137: checkWSDLPublication("MyWebService" + File.separator
138: + "jaxrpcEndpoint.wsdl",
139: "http://ws.servlets.wssample.objectweb.org",
140: "JaxRpcEndpointInterfaceService", "JaxRpcEndpoint1",
141: url + "endpoints/jaxrpc");
142:
143: }
144:
145: }
|