1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.tradefed.invoker; 18 19 import com.android.tradefed.config.IConfiguration; 20 import com.android.tradefed.device.DeviceNotAvailableException; 21 import com.android.tradefed.result.ITestInvocationListener; 22 23 /** 24 * Handles one TradeFederation test invocation. 25 */ 26 public interface ITestInvocation { 27 28 /** 29 * Perform the test invocation. 30 * 31 * @param metadata the {@link IInvocationContext} to perform tests. 32 * @param config the {@link IConfiguration} of this test run. 33 * @param rescheduler the {@link IRescheduler}, for rescheduling portions of the invocation for 34 * execution on another resource(s) 35 * @param extraListeners {@link ITestInvocationListener}s to notify, in addition to those in 36 * <var>config</var> 37 * @throws DeviceNotAvailableException if communication with device was lost 38 * @throws Throwable 39 */ invoke(IInvocationContext metadata, IConfiguration config, IRescheduler rescheduler, ITestInvocationListener... extraListeners)40 public void invoke(IInvocationContext metadata, IConfiguration config, 41 IRescheduler rescheduler, ITestInvocationListener... extraListeners) 42 throws DeviceNotAvailableException, Throwable; 43 44 /** Notify the {@link TestInvocation} that TradeFed has been requested to stop. */ notifyInvocationStopped()45 public default void notifyInvocationStopped() {} 46 } 47