You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2002/01/16 15:45:53 UTC

cvs commit: xml-axis/java/test/wsdl/opStyles VerifyTestCase.java

butek       02/01/16 06:45:53

  Added:       java/test/wsdl/opStyles VerifyTestCase.java
  Log:
  This makes the operation style test a bit better by verifying that the expected
  methods are really there and the ones that shouldn't be aren't (solicitResopnse and
  notification style methods).
  
  Revision  Changes    Path
  1.1                  xml-axis/java/test/wsdl/opStyles/VerifyTestCase.java
  
  Index: VerifyTestCase.java
  ===================================================================
  package test.wsdl.opStyles;
  
  import java.lang.reflect.Method;
  
  import java.util.Vector;
  
  // This test makes sure that the OpStyles interface ONLY has oneway and
  // requestResponse methods and that no other methods, particularly
  // solicitResponse and notification, exist.
  
  public class VerifyTestCase extends junit.framework.TestCase {
      public VerifyTestCase(String name) {
          super(name);
      }
  
      public void testOpStyles() {
          Method[] methods =
                  test.wsdl.opStyles.OpStyles.class.getDeclaredMethods();
          boolean sawOneway = false;
          boolean sawRequestResponse = false;
          boolean sawSolicitResponse = false;
          boolean sawNotification = false;
          Vector  others = new Vector();
          for (int i = 0; i < methods.length; ++i) {
              String name = methods[i].getName();
              if ("oneway".equals(name)) {
                  sawOneway = true;
              }
              else if ("requestResponse".equals(name)) {
                  sawRequestResponse = true;
              }
              else {
                  others.add(name);
              }
          }
          assertTrue("Expected method oneWay does not exist on OpStyles", sawOneway == true);
          assertTrue("Expected method requestResponse does not exist on OpStyles",
                  sawRequestResponse == true);
          if (others.size() > 0) {
              String message = "Methods exist on OpStyles but should not:  ";
              boolean needComma = false;
              for (int i = 0; i < others.size(); ++i) {
                  if (needComma) {
                      message += ", ";
                  }
                  else {
                      needComma = true;
                  }
                  message += (String) others.get(i);
              }
          }
      } // testOpStyles
  } // class VerifyTestCase