Package org.apache.kato.tck.harness.scenario

Source Code of org.apache.kato.tck.harness.scenario.CheckPointRunner

/*******************************************************************************
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/

package org.apache.kato.tck.harness.scenario;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import org.apache.kato.tck.api.ICheckpoint;

class CheckPointRunner implements Runnable {

  private CheckPointHandler handler = null;
  private Method method = null;
  private ScenarioElement scenario = null;

  public CheckPointRunner(CheckPointHandler checkPointHandler,
      Method method, ScenarioElement scenario) {
    this.method = method;
    this.scenario = scenario;
    this.handler = checkPointHandler;
  }

  public void run() {

    // run method
    ICheckpoint checkpoint = new ICheckpoint() {

      public void checkpoint() {
        handler.checkpoint(method);
        while (true) {
          try {
            Thread.sleep(10000);
          } catch (InterruptedException e) {
          }
        }
      }
    };

    try {
      method.invoke(scenario, new Object[] { checkpoint });
      // Thread.sleep(10000);
    } catch (IllegalArgumentException e) {
      checkpoint.checkpoint();

    } catch (IllegalAccessException e) {
      checkpoint.checkpoint();
    } catch (InvocationTargetException e) {
      checkpoint.checkpoint();
    }

  }

}
TOP

Related Classes of org.apache.kato.tck.harness.scenario.CheckPointRunner

TOP
Copyright © 2018 www.massapi.com. 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.