Package org.apache.tools.moo

Examples of org.apache.tools.moo.TestResult


  return sm.getString("positiveBodyExists.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

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

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

        setErrorCode (500);

  try {
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 {
       
         //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 ) {
        result.append(line);
        out.println (line);
    }
                   
                   
                String str=result.toString();    
               
                
                 
                int beg=str.indexOf("01");
               
                   
                          
                                 
                int last=str.indexOf("999");
               
                                 
                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("positiveBeanNameRes.goldenFile");
   

    public TestResult
    runTest () {
        TestResult testResult = null;

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

  return sm.getString("HelloWorld.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();
            int code=0;
            String message=null;
            HttpURLConnection connection;
            FileReader fis=null;
            BufferedReader in=null;
            File file=null;
            int i=0;
           
           
            try
            {
                //  getting connection to jsp  //
             
                  connection=getConnection(null,null,null,"GET");
            }
            catch(Exception k)
            {
                  testResult.setMessage("FAIL");
                  testResult.setStatus(false);
                  return testResult;
            }
            try
            {
                  code = connection.getResponseCode();
            }
            catch(IOException io)
            {
                  testResult.setMessage("FAIL");
                  testResult.setStatus(false);
                  return testResult;
            }
           
            try
            {
                  message = connection.getResponseMessage();
            }
            catch(IOException j)
            {
                  testResult.setMessage(message);
                  testResult.setStatus(false);
                  return testResult;
            }
           
            try
            {
                  out.println("HTTP code" + code);
                  out.println("Message: " + message);
            }
            catch(IOException h)
            {
                  testResult.setStatus(false);
                  testResult.setMessage(message);
            }           
            if(code >= 400)
            {
                  testResult.setStatus(false);
                  testResult.setMessage(message);
            }
            else
            {
                  try
                  {
                   
                    //Reading from the input stream  //
                   
                        in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                  }
                  catch(IOException u)
                  {
                        testResult.setStatus(false);
                        testResult.setMessage("error at buffered reader");
                  }   
                  StringBuffer result = new StringBuffer();
                  String line = null;
                  try
                  {
                        while ((line = in.readLine()) != null )
                        {
                              result.append(line);
                              out.println (line);
                        }
                  }
                  catch(IOException me)
                  {
                        testResult.setStatus(false);
                        testResult.setMessage("error in readline");
                  }      
            }          
          
             // In the jsp, data is written into the
             // output stream after closing the stream
             //Exception is thrown.In the catch block
             //a file " positiveClose.err is
             //  created and message is written
            
          
          
            String dir=System.getProperty("user.home");
            String sss=dir+System.getProperty("file.separator")+"positiveClose.err";
           
           
            //the file is opened and read
           
           
            file=new File(sss);
            try
            {
                  fis =new FileReader(file);
            }
            catch(Exception ee)
            {
                 
                  testResult.setStatus(false);
                  testResult.setMessage("error in filereader");
                  return testResult;
            }  
           
           
           
            char b[]=new char[15];
           
           
           
           
            try
            {
               fis.read(b);
              
            }
            catch(IOException u)
            {
                 
                  testResult.setStatus(false);
                  testResult.setMessage("unable to read from file");
                  return testResult;
           
           
           
           
            String str= new String(b);
            str = str.trim();
           
           
            // checking for the written message
           
            if(str.equals("out is not null"))
            {
                  testResult.setStatus(true);
                  testResult.setMessage("OK");
                  return testResult;            
            }
            else
            {
                  testResult.setStatus(false);
                  testResult.setMessage("error");
                  return testResult;                      
            }
      }
View Full Code Here

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

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

      
      
     public TestResult runTest()     
    
        {
            TestResult tr=new TestResult();
           
            try{
           
                   
                    setGoldenFileName(getGoldenFile());
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.