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.util;
17 
18 import java.io.File;
19 import java.util.List;
20 import java.util.Map;
21 import java.util.Set;
22 
23 /**
24  * Interface for a the result of a single Compatibility invocation.
25  */
26 public interface IInvocationResult {
27 
28     /**
29      * @return the starting timestamp.
30      */
getStartTime()31     long getStartTime();
32 
33     /**
34      * @param time the starting timestamp
35      */
setStartTime(long time)36     void setStartTime(long time);
37 
38     /**
39      * Count the number of results with given status.
40      */
countResults(TestStatus result)41     int countResults(TestStatus result);
42 
43     /**
44      * @param plan the plan associated with this result.
45      */
setTestPlan(String plan)46     void setTestPlan(String plan);
47 
48     /**
49      * @return the test plan associated with this result.
50      */
getTestPlan()51     String getTestPlan();
52 
53     /**
54      * Adds the given device serial to the result.
55      */
addDeviceSerial(String serial)56     void addDeviceSerial(String serial);
57 
58     /**
59      * @return the device serials associated with result.
60      */
getDeviceSerials()61     Set<String> getDeviceSerials();
62 
63     /**
64      * @return the {@link IModuleResult} for the given id, creating one if it doesn't exist
65      */
getOrCreateModule(String id)66     IModuleResult getOrCreateModule(String id);
67 
68     /**
69      * @return the {@link IModuleResult}s sorted by id.
70      */
getModules()71     List<IModuleResult> getModules();
72 
73     /**
74      * Merges a module result to the invocation result.
75      */
mergeModuleResult(IModuleResult moduleResult)76     void mergeModuleResult(IModuleResult moduleResult);
77 
78     /**
79      * Adds the given invocation info to the result.
80      */
addInvocationInfo(String key, String value)81     void addInvocationInfo(String key, String value);
82 
83     /**
84      * Gets the {@link Map} of invocation info collected.
85      */
getInvocationInfo()86     Map<String, String> getInvocationInfo();
87 
88     /**
89      *  Set the string containing the command line arguments to the run command.
90      */
setCommandLineArgs(String setCommandLineArgs)91     void setCommandLineArgs(String setCommandLineArgs);
92 
93     /**
94      * Retrieve the command line arguments to the run command.
95      */
getCommandLineArgs()96     String getCommandLineArgs();
97 
98     /**
99      * @param buildFingerprint the build fingerprint associated with this result.
100      */
setBuildFingerprint(String buildFingerprint)101     void setBuildFingerprint(String buildFingerprint);
102 
103     /**
104      * @return the device build fingerprint associated with result.
105      */
getBuildFingerprint()106     String getBuildFingerprint();
107 
108     /**
109      * Return the number of completed test modules for this invocation.
110      */
getModuleCompleteCount()111     int getModuleCompleteCount();
112 }
113