File: UnionServiceTestCase.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 (71 lines) | stat: -rw-r--r-- 2,434 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package test.wsdl.union;

import java.util.Date;
import java.util.Calendar;

import org.apache.axis.types.URI;
import org.apache.axis.encoding.ser.CalendarSerializer;

import junit.framework.TestCase;

public class UnionServiceTestCase extends TestCase {

    public UnionServiceTestCase(String name) {
        super(name);
    }

    public void testBasicUnion1() throws Exception {
        // make sure WSDL2Java generated the right stuff
        
        // we don't really need to test sending a request
        //   and getting a response, since many other tests comprehend that
        // all we need to do is make sure WSDL2Java generated the right beans
        // so, basically, if this compiles, we are good to go
        // but running it won't hurt anything

        FooOpenEnum enum = null;

        String testStrURI = "http://foobar/A";
        enum = new FooOpenEnum(testStrURI);
        assertEquals(testStrURI, enum.toString());
        
        URI testURI = new URI(testStrURI);
        enum = new FooOpenEnum(testURI);
        assertEquals(testStrURI, enum.toString());
        assertEquals(testURI, enum.getAnyURIValue());
        
        enum = new FooOpenEnum(FooEnum.value1);
        assertEquals(FooEnum.value1.toString(), enum.toString());
        assertEquals(FooEnum.value1, enum.getFooEnumValue());
        assertEquals(FooEnum._value1, enum.getAnyURIValue());
    }

    public void testBasicUnion2() throws Exception {
        // make sure WSDL2Java generated the right stuff
        
        // we don't really need to test sending a request
        //   and getting a response, since many other tests comprehend that
        // all we need to do is make sure WSDL2Java generated the right beans
        // so, basically, if this compiles, we are good to go
        // but running it won't hurt anything

        DateOrDateTimeType type = null;

        type = new DateOrDateTimeType(5);
        assertEquals("5", type.toString());

        type = new DateOrDateTimeType(false);
        assertEquals("false", type.toString());
        
        Date date = new Date();
        type = new DateOrDateTimeType(date);
        assertEquals(date.toString(), type.toString());

        Calendar cal = Calendar.getInstance();
        type = new DateOrDateTimeType(cal);

        CalendarSerializer cs = new CalendarSerializer();
        assertEquals(cs.getValueAsString(cal, null), type.toString());
    }

}