File: TerraServiceTestCase.java

package info (click to toggle)
axis 1.4-29
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 52,100 kB
  • sloc: java: 129,124; xml: 10,602; jsp: 983; sh: 84; cs: 36; makefile: 18
file content (57 lines) | stat: -rw-r--r-- 2,313 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
 * TerraServiceTestCase.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis WSDL2Java emitter.
 */

package test.wsdl.terra;

import org.apache.axis.AxisFault;

import java.net.ConnectException;

public class TerraServiceTestCase extends junit.framework.TestCase {
    public TerraServiceTestCase(java.lang.String name) {
        super(name);
    }

    public void test11TerraServiceSoapGetPlaceList() {
        TerraServiceSoap binding;
        try {
            binding = new TerraServiceLocator().getTerraServiceSoap();
        }
        catch (javax.xml.rpc.ServiceException jre) {
            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
        }
        assertTrue("binding is null", binding != null);

        try {
            ArrayOfPlaceFacts value = null;
            value = binding.getPlaceList(new java.lang.String("Boston"), 5, true);
            PlaceFacts[] facts = value.getPlaceFacts();
            for(int i=0;i<facts.length;i++){
                System.out.println("City      :" + facts[i].getPlace().getCity());
                System.out.println("State     :" + facts[i].getPlace().getState());
                System.out.println("Country   :" + facts[i].getPlace().getCountry());
                System.out.println("Lat       :" + facts[i].getCenter().getLon());
                System.out.println("Long      :" + facts[i].getCenter().getLat());
                System.out.println("Theme     :" + facts[i].getAvailableThemeMask());
                System.out.println("PlaceType :" + facts[i].getPlaceTypeId().getValue());
                System.out.println("Population:" + facts[i].getPopulation());
                System.out.println("---------------------------");
            }
        }
        catch (java.rmi.RemoteException re) {
            if (re instanceof AxisFault) {
                AxisFault fault = (AxisFault) re;
                if (fault.detail instanceof ConnectException ||
                    fault.getFaultCode().getLocalPart().equals("HTTP")) {
                    System.err.println("TerraService HTTP error: " + fault);
                    return;
                }
            }
            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
        }
    }
}