| 1 |
/* |
| 2 |
* Copyright 2001-2004 The Apache Software Foundation. |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
|
| 17 |
package test.functional; |
| 18 |
|
| 19 |
import junit.framework.TestCase; |
| 20 |
import org.apache.axis.client.AdminClient; |
| 21 |
import org.apache.axis.components.logger.LogFactory; |
| 22 |
import org.apache.axis.transport.http.SimpleAxisWorker; |
| 23 |
import org.apache.axis.utils.NetworkUtils; |
| 24 |
import org.apache.commons.logging.Log; |
| 25 |
import samples.encoding.TestElem; |
| 26 |
|
| 27 |
|
| 28 |
/** Test the ElementService sample code. |
| 29 |
*/ |
| 30 |
public class TestElementSample extends TestCase { |
| 31 |
static Log log = |
| 32 |
LogFactory.getLog(TestElementSample.class.getName()); |
| 33 |
|
| 34 |
public TestElementSample(String name) { |
| 35 |
super(name); |
| 36 |
} |
| 37 |
|
| 38 |
public void doTestElement () throws Exception { |
| 39 |
String thisHost = NetworkUtils.getLocalHostname(); |
| 40 |
String thisPort = System.getProperty("test.functional.ServicePort","8080"); |
| 41 |
|
| 42 |
String[] args = {thisHost,thisPort}; |
| 43 |
String xml = "<x:hello xmlns:x=\"urn:foo\">a string</x:hello>"; |
| 44 |
System.out.println("Sending : " + xml ); |
| 45 |
String res = TestElem.doit(args, xml); |
| 46 |
System.out.println("Received: " + res ); |
| 47 |
assertEquals("TestElementSample.doit(): xml must match", res, xml); |
| 48 |
} |
| 49 |
|
| 50 |
public void doTestDeploy () throws Exception { |
| 51 |
String[] args = { "samples/encoding/deploy.wsdd" }; |
| 52 |
AdminClient.main(args); |
| 53 |
} |
| 54 |
|
| 55 |
public void doTestUndeploy () throws Exception { |
| 56 |
String[] args = { "samples/encoding/undeploy.wsdd" }; |
| 57 |
AdminClient.main(args); |
| 58 |
} |
| 59 |
|
| 60 |
public static void main(String args[]) throws Exception { |
| 61 |
TestElementSample tester = new TestElementSample("tester"); |
| 62 |
tester.testElementService(); |
| 63 |
} |
| 64 |
|
| 65 |
public void testElementService () throws Exception { |
| 66 |
log.info("Testing element sample."); |
| 67 |
log.info("Testing deployment..."); |
| 68 |
doTestDeploy(); |
| 69 |
log.info("Testing service..."); |
| 70 |
doTestElement(); |
| 71 |
log.info("Testing undeployment..."); |
| 72 |
doTestUndeploy(); |
| 73 |
log.info("Test complete."); |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
|