KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > tools > processors > wsdl2 > WSDLToJavaMIMETest


1 package org.objectweb.celtix.tools.processors.wsdl2;
2
3 //import java.io.File;
4
//import java.io.FileReader;
5
////import java.io.FileReader;
6
//
7
//import org.objectweb.celtix.tools.WSDLToJava;
8
import org.objectweb.celtix.tools.common.ToolConstants;
9 //import org.objectweb.celtix.tools.common.toolspec.ToolException;
10
import org.objectweb.celtix.tools.processors.ProcessorTestBase;
11
12 public class WSDLToJavaMIMETest
13     extends ProcessorTestBase {
14
15     public void setUp() throws Exception JavaDoc {
16         super.setUp();
17         env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
18     }
19
20 // public void testHelloWorld() throws Exception {
21
// String[] args = new String[] {"-d", output.getCanonicalPath(),
22
// getLocation("/wsdl/binary_attachment.wsdl")};
23
// WSDLToJava.main(args);
24
// assertNotNull(output);
25
// File org = new File(output, "org");
26
// assertTrue(org.exists());
27
// File objectweb = new File(org, "objectweb");
28
// assertTrue(objectweb.exists());
29
// File helloworldsoaphttp = new File(objectweb, "binary_attachment");
30
// assertTrue(helloworldsoaphttp.exists());
31
// File outputFile = new File(helloworldsoaphttp, "BinaryAttachmentPortType.java");
32
// assertTrue("PortType file is not generated", outputFile.exists());
33
// FileReader fileReader = new FileReader(outputFile);
34
// char[] chars = new char[100];
35
// int size = 0;
36
// StringBuffer sb = new StringBuffer();
37
// while (size < outputFile.length()) {
38
// int readLen = fileReader.read(chars);
39
// sb.append(chars, 0, readLen);
40
// size = size + readLen;
41
// }
42
// String serviceString = new String(sb);
43
// int position1 = serviceString.indexOf("public byte[] echoImage(");
44
// int position2 = serviceString.indexOf("byte[] para0");
45
// int position3 = serviceString.indexOf("java.awt.Image para1,");
46
// int position4 = serviceString
47
// .indexOf("javax.xml.ws.Holder<javax.activation.DataHandler> retn1");
48
// assertTrue(position1 > 0 && position2 > 0 && position3 > 0 && position4 > 0);
49
// assertTrue(position1 < position2 && position2 < position3 && position3 < position4);
50
// }
51
//
52
// public void testWithExternalBindingSwitch() throws Exception {
53
// String[] args = new String[] {"-d", output.getCanonicalPath(), "-b",
54
// getLocation("/wsdl/mime_binding.wsdl"),
55
// getLocation("/wsdl/binary_attachment.wsdl")};
56
// WSDLToJava.main(args);
57
// assertNotNull(output);
58
// File org = new File(output, "org");
59
// assertTrue(org.exists());
60
// File objectweb = new File(org, "objectweb");
61
// assertTrue(objectweb.exists());
62
// File helloworldsoaphttp = new File(objectweb, "binary_attachment");
63
// assertTrue(helloworldsoaphttp.exists());
64
// File outputFile = new File(helloworldsoaphttp, "BinaryAttachmentPortType.java");
65
// assertTrue("PortType file is not generated", outputFile.exists());
66
// FileReader fileReader = new FileReader(outputFile);
67
// char[] chars = new char[100];
68
// int size = 0;
69
// StringBuffer sb = new StringBuffer();
70
// while (size < outputFile.length()) {
71
// int readLen = fileReader.read(chars);
72
// sb.append(chars, 0, readLen);
73
// size = size + readLen;
74
// }
75
// String serviceString = new String(sb);
76
// int position1 = serviceString.indexOf("public java.awt.Image echoImage(");
77
// int position2 = serviceString.indexOf("java.awt.Image para0");
78
// int position3 = serviceString.indexOf("public void echoMultipleImage(");
79
// int position4 = serviceString.indexOf("java.awt.Image para1,");
80
// int position5 = serviceString
81
// .indexOf("javax.xml.ws.Holder<javax.activation.DataHandler> retn1");
82
//// System.out.println("position1=" + position1 + "; position2=" + position2 + "; position3="
83
//// + position3 + "; position4=" + position4 + "; position5=" + position5);
84
// assertTrue(position1 > 0 && position2 > 0 && position3 > 0 && position4 > 0
85
// && position5 > 0);
86
// assertTrue(position1 < position2 && position2 < position3 && position3 < position4
87
// && position4 < position5);
88
// }
89
//
90
// public void testMIMEValidationUniqueRoot() throws Exception {
91
// WSDLToJavaProcessor processor = new WSDLToJavaProcessor();
92
// env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
93
// env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl/mime_fail_unique_root.wsdl"));
94
// processor.setEnvironment(env);
95
// try {
96
// processor.process();
97
// fail("Do not catch expected tool exception for MIME unique root validation failure!");
98
// } catch (Exception e) {
99
// if (!(e instanceof ToolException && e.toString()
100
// .indexOf("There's more than one soap body mime part in its binding input") >= 0)) {
101
// fail("Do not catch expected tool exception for MIME unique root validation failure,"
102
// + " catch other unexpected exception!");
103
// }
104
// }
105
// }
106
//
107
// public void testMIMEValidationDiffParts() throws Exception {
108
// WSDLToJavaProcessor processor = new WSDLToJavaProcessor();
109
// env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
110
// env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl/mime_fail_diff_parts.wsdl"));
111
// processor.setEnvironment(env);
112
// try {
113
// processor.process();
114
// fail("Do not catch expected tool exception for MIME different parts validation failure!");
115
// } catch (Exception e) {
116
// if (!(e instanceof ToolException && e.toString()
117
// .indexOf("Part attribute value for meme:content elements are different") >= 0)) {
118
// fail("Do not catch expected tool exception for MIME different parts validation failure,"
119
// + " catch other unexpected exception!");
120
// }
121
// }
122
// }
123

124 // private String getLocation(String wsdlFile) {
125
// return WSDLToJavaMIMETest.class.getResource(wsdlFile).getFile();
126
// }
127

128     public void testDummy() {
129         System.out.print("");
130     }
131     
132 }
133
Popular Tags