1 /*
2  * Copyright (C) 2015 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 package com.android.compatibility.common.tradefed.testtype;
17 
18 import com.android.tradefed.config.ConfigurationDescriptor;
19 import com.android.tradefed.device.DeviceNotAvailableException;
20 import com.android.tradefed.invoker.IInvocationContext;
21 import com.android.tradefed.testtype.IAbi;
22 import com.android.tradefed.testtype.IBuildReceiver;
23 import com.android.tradefed.testtype.IDeviceTest;
24 import com.android.tradefed.testtype.IInvocationContextReceiver;
25 import com.android.tradefed.testtype.IRemoteTest;
26 import com.android.tradefed.testtype.IRuntimeHintProvider;
27 import com.android.tradefed.testtype.ITestCollector;
28 import com.android.tradefed.testtype.suite.ModuleDefinition;
29 
30 import java.util.List;
31 import java.util.Set;
32 
33 /**
34  * Container for Compatibility test info.
35  *
36  * @deprecated This class is associated with {@link CompatibilityTest} which is deprecated
37  */
38 @Deprecated
39 public interface IModuleDef
40         extends Comparable<IModuleDef>,
41                 IBuildReceiver,
42                 IDeviceTest,
43                 IRemoteTest,
44                 IRuntimeHintProvider,
45                 ITestCollector,
46                 IInvocationContextReceiver {
47 
48     /** key names used for saving module info into {@link IInvocationContext} */
49     // This currently references ModuleDefinition so that there's only once source for String
50     // literals and making it easier to converge IModuleDef and ModuleDefinition later
51     public static String MODULE_NAME = ModuleDefinition.MODULE_NAME;
52     public static String MODULE_ABI = ModuleDefinition.MODULE_ABI;
53     public static String MODULE_ID = ModuleDefinition.MODULE_ID;
54 
55     /**
56      * @return The name of this module.
57      */
getName()58     String getName();
59 
60     /**
61      * @return a {@link String} to uniquely identify this module.
62      */
getId()63     String getId();
64 
65     /**
66      * @return the abi of this test module.
67      */
getAbi()68     IAbi getAbi();
69 
70     /**
71      * @return the {@link Set} of tokens a device must have in order to run this module.
72      */
getTokens()73     Set<String> getTokens();
74 
75     /**
76      * @return the {@link IRemoteTest} that runs the tests.
77      */
getTest()78     IRemoteTest getTest();
79 
80     /**
81      * Set a list of preparers to allow to run before or after a test. If this list is empty, then
82      * all configured preparers will run.
83      *
84      * @param preparerAllowlist list containing the simple name of the preparer to run.
85      */
setPreparerAllowlist(Set<String> preparerAllowlist)86     void setPreparerAllowlist(Set<String> preparerAllowlist);
87 
88     /**
89      * Pushes dynamic configuration, then runs the module's precondition checks and setup tasks.
90      * @param skipPrep whether preparation should be skipped
91      * @param preconditionArgs arguments to set on precondition preparers for the module, taking
92      * format arg-name:arg-value. If "arg-value" is unset, the value will default to "true".
93      * @return whether preparation succeeded.
94      */
prepare(boolean skipPrep, List<String> preconditionArgs)95     boolean prepare(boolean skipPrep, List<String> preconditionArgs)
96             throws DeviceNotAvailableException;
97 
98     /**
99      * Retrieves the {@link ConfigurationDescriptor} associated with module config
100      */
getConfigurationDescriptor()101     ConfigurationDescriptor getConfigurationDescriptor();
102 }
103