| 1 |
package test.wsdl.opStyles; |
| 2 |
|
| 3 |
import java.lang.reflect.Method; |
| 4 |
import java.util.Vector; |
| 5 |
|
| 6 |
// This test makes sure that the OpStyles interface ONLY has oneway and |
| 7 |
// requestResponse methods and that no other methods, particularly |
| 8 |
// solicitResponse and notification, exist. |
| 9 |
|
| 10 |
public class VerifyTestCase extends junit.framework.TestCase { |
| 11 |
public VerifyTestCase(String name) { |
| 12 |
super(name); |
| 13 |
} |
| 14 |
|
| 15 |
public void testOpStyles() { |
| 16 |
Method[] methods = |
| 17 |
test.wsdl.opStyles.OpStyles.class.getDeclaredMethods(); |
| 18 |
boolean sawOneway = false; |
| 19 |
boolean sawRequestResponse = false; |
| 20 |
boolean sawSolicitResponse = false; |
| 21 |
boolean sawNotification = false; |
| 22 |
Vector others = new Vector(); |
| 23 |
for (int i = 0; i < methods.length; ++i) { |
| 24 |
String name = methods[i].getName(); |
| 25 |
if ("oneway".equals(name)) { |
| 26 |
sawOneway = true; |
| 27 |
} |
| 28 |
else if ("requestResponse".equals(name)) { |
| 29 |
sawRequestResponse = true; |
| 30 |
} |
| 31 |
else { |
| 32 |
others.add(name); |
| 33 |
} |
| 34 |
} |
| 35 |
assertTrue("Expected method oneWay does not exist on OpStyles", sawOneway == true); |
| 36 |
assertTrue("Expected method requestResponse does not exist on OpStyles", |
| 37 |
sawRequestResponse == true); |
| 38 |
if (others.size() > 0) { |
| 39 |
String message = "Methods exist on OpStyles but should not: "; |
| 40 |
boolean needComma = false; |
| 41 |
for (int i = 0; i < others.size(); ++i) { |
| 42 |
if (needComma) { |
| 43 |
message += ", "; |
| 44 |
} |
| 45 |
else { |
| 46 |
needComma = true; |
| 47 |
} |
| 48 |
message += (String) others.get(i); |
| 49 |
} |
| 50 |
} |
| 51 |
} // testOpStyles |
| 52 |
} // class VerifyTestCase |
| 53 |
|