Package org.apache.tools.moo

Examples of org.apache.tools.moo.TestResult


    public TestResult getTestResult(HttpURLConnection connection)
    throws Exception {
     
     

        TestResult testResult = new TestResult();

        //handle HTTP codes here
        int code = connection.getResponseCode();
       
       
       if (this.useCookie == true)
         saveCookies(connection);
            
         Thread.currentThread().dumpStack();

        //http response in 400s signifies Client Request Incomplete/Doc Not found
        //http response in 500s signifies servlet error

        out.println("HTTP code" + code);

        if (code != getErrorCode()) {
            testResult.setStatus(false);
            testResult.setMessage("CODE_MISMATCH " + getErrorCode() + "/" + code);
        }
        else { //assume request was OK

            testResult.setStatus(true);
            testResult.setMessage("PASSED");
        }

        // Disconnet.
        connection.disconnect();
View Full Code Here


    // This method overrides the getTestResult of the super class.

    public TestResult getTestResult(HttpURLConnection connection)
    throws Exception {

        TestResult testResult = new TestResult();

        //handle HTTP codes here
        int code = connection.getResponseCode();
       if (this.useCookie == true)
         saveCookies(connection);
        String message = connection.getResponseMessage();

        //http response in 400s signifies Client Request Incomplete/Doc Not found
        //http response in 500s signifies servlet error

        if (code >= 400) {
            testResult.setStatus(false);
            testResult.setMessage(message);
        }
        else { //assume request was OK

            // Get the "actual" result from the socket stream.
            BufferedReader in = new
                                BufferedReader(new InputStreamReader(connection.getInputStream()));
            StringBuffer result = new StringBuffer();
            String line = null;
            while ((line = in.readLine()) != null ) {
                // Tokenize the line
                StringTokenizer tok = new StringTokenizer(line);
                while (tok.hasMoreTokens()) {
                    String token = tok.nextToken();
                    result.append("  " + token);
                }
               
                         
            }
           
           

            // Get the expected result from the "golden" file.
            StringBuffer expResult = getExpectedResult (getGoldenFileName());

            // Compare the results and set the status
            String diff = null;
            boolean status = compare(result.toString(), expResult.toString(), diff);
            testResult.setStatus(status);

            // Set the message (Check with SCheck.
            testResult.setMessage(diff);

            // Now free the connection.
            connection.disconnect();

        } //end else
View Full Code Here

      
      
     public TestResult runTest()     
    
        {
            TestResult tr=new TestResult();
           
            try{
           
                   
                    setGoldenFileName(getGoldenFile());
View Full Code Here

  return sm.getString("positiveDupIDPage1.goldenFile");
   

    public TestResult
    runTest () {
        TestResult testResult = null;

  try {
      setGoldenFileName (getGoldenFile());
      HttpURLConnection connection = getConnection();
      testResult = getTestResult(connection);
View Full Code Here

          
      
     public TestResult runTest()     
    
        {
            TestResult testResult=new TestResult();
           
            try{
           
               
                HttpURLConnection connection=getConnection(null,null,null,"GET");
                   
                int code = connection.getResponseCode();
          String message = connection.getResponseMessage();
               
     
          out.println("HTTP code" + code);
          out.println("Message: " + message);
     
          if (code >= 400) {
       
        testResult.setStatus(false);
        testResult.setMessage(message);
           }
     
     
           else {
       
     
    BufferedReader in = new
    BufferedReader(new InputStreamReader(connection.getInputStream()));
    StringBuffer result = new StringBuffer();
    String line = null;
    while ((line = in.readLine()) != null ) {
        result.append(line);
        out.println (line);
    }
                   
                   
                String str=result.toString()
               
                 
                        
               
                int beg=str.indexOf("01");
                  
                
                 int last=str.indexOf("5999");
               
                 if((beg>=0) && (last>0))
                      {
                         testResult.setMessage("OK");
                         testResult.setStatus(true);
                      }
                     
              }                                     
                   
                   
                }catch(Exception e){
                   
                      testResult.setMessage("FAIL");
                      testResult.setStatus(false);                                           
                 }
                
             return testResult;
                                  
         }
View Full Code Here

  return sm.getString("positivePageScope.goldenFile");
   

    public TestResult
    runTest () {
        TestResult testResult = null;

  try {
      setGoldenFileName (getGoldenFile());
      HttpURLConnection connection = getConnection();
      testResult = getTestResult(connection);
View Full Code Here

    public String getDescription () {
  return sm.getString("negativeInvalidClass.description");
    }

    public TestResult runTest () {
        TestResult testResult = null;
  HttpURLConnection connection = null;

        setErrorCode (500);

  try {
View Full Code Here

  return sm.getString("positiveBeanNameClass.goldenFile");
   

    public TestResult
    runTest () {
        TestResult testResult = null;

  try {
      setGoldenFileName (getGoldenFile());
      HttpURLConnection connection = getConnection();
      testResult = getTestResult(connection);
View Full Code Here

      
      
     public TestResult runTest()     
    
        {
            TestResult tr=new TestResult();
           
            try{
           
                   
                    setGoldenFileName(getGoldenFile());
View Full Code Here

  return sm.getString("negativeBody.description");
    }

    public TestResult
    runTest () {
        TestResult testResult = null;

  try {
      setErrorCode (500);
      HttpURLConnection connection = getConnection();
      testResult = getTestResult(connection);
View Full Code Here

TOP

Related Classes of org.apache.tools.moo.TestResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.