01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.tools.java2wsdl;
19:
20: import org.apache.cxf.tools.common.ToolTestBase;
21: import org.junit.After;
22: import org.junit.Test;
23:
24: public class JavaToWSDLTest extends ToolTestBase {
25:
26: @After
27: public void tearDown() {
28: super .tearDown();
29: }
30:
31: @Test
32: public void testVersionOutput() throws Exception {
33: String[] args = new String[] { "-v" };
34: JavaToWSDL.main(args);
35: assertNotNull(getStdOut());
36: }
37:
38: @Test
39: public void testHelpOutput() {
40: String[] args = new String[] { "-help" };
41: JavaToWSDL.main(args);
42: assertNotNull(getStdOut());
43: }
44:
45: @Test
46: public void testNormalArgs() throws Exception {
47: System.err.println(getLocation("test.wsdl"));
48: String[] args = new String[] { "-o",
49: getLocation("normal.wsdl"),
50: "org.apache.hello_world_soap_http.Greeter" };
51: JavaToWSDL.main(args);
52: assertNotNull(getStdOut());
53: }
54:
55: @Test
56: public void testBadUsage() {
57: String[] args = new String[] { "-ttt", "a.ww" };
58: JavaToWSDL.main(args);
59: assertNotNull(getStdOut());
60:
61: }
62:
63: @Test
64: public void testValidArgs() {
65: String[] args = new String[] { "a.ww" };
66: JavaToWSDL.main(args);
67: assertNotNull(getStdOut());
68:
69: }
70:
71: @Test
72: public void testNoOutPutFile() throws Exception {
73: String[] args = new String[] { "-o",
74: getLocation("nooutput.wsdl"),
75: "org.apache.hello_world_soap_http.Greeter" };
76: JavaToWSDL.main(args);
77: assertNotNull(getStdOut());
78: }
79:
80: @Test
81: public void testNoArg() {
82: String[] args = new String[] {};
83: JavaToWSDL.main(args);
84: assertEquals(-1, getStdOut().indexOf("Caused by:"));
85: }
86: }
|