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      * @return the number of tests that have not been executed in this moduleResult.
45      */
getNotExecuted()46     int getNotExecuted();
47 
48     /**
49      * @param plan the plan associated with this result.
50      */
setTestPlan(String plan)51     void setTestPlan(String plan);
52 
53     /**
54      * @return the test plan associated with this result.
55      */
getTestPlan()56     String getTestPlan();
57 
58     /**
59      * Adds the given device serial to the result.
60      */
addDeviceSerial(String serial)61     void addDeviceSerial(String serial);
62 
63     /**
64      * @return the device serials associated with result.
65      */
getDeviceSerials()66     Set<String> getDeviceSerials();
67 
68     /**
69      * @return the {@link IModuleResult} for the given id, creating one if it doesn't exist
70      */
getOrCreateModule(String id)71     IModuleResult getOrCreateModule(String id);
72 
73     /**
74      * @return the {@link IModuleResult}s sorted by id.
75      */
getModules()76     List<IModuleResult> getModules();
77 
78     /**
79      * Merges a module result to the invocation result.
80      */
mergeModuleResult(IModuleResult moduleResult)81     void mergeModuleResult(IModuleResult moduleResult);
82 
83     /**
84      * Adds the given invocation info to the result.
85      */
addInvocationInfo(String key, String value)86     void addInvocationInfo(String key, String value);
87 
88     /**
89      * Gets the {@link Map} of invocation info collected.
90      */
getInvocationInfo()91     Map<String, String> getInvocationInfo();
92 
93     /**
94      *  Set the string containing the command line arguments to the run command.
95      */
setCommandLineArgs(String setCommandLineArgs)96     void setCommandLineArgs(String setCommandLineArgs);
97 
98     /**
99      * Retrieve the command line arguments to the run command.
100      */
getCommandLineArgs()101     String getCommandLineArgs();
102 
103     /**
104      * @param buildFingerprint the build fingerprint associated with this result.
105      */
setBuildFingerprint(String buildFingerprint)106     void setBuildFingerprint(String buildFingerprint);
107 
108     /**
109      * @return the device build fingerprint associated with result.
110      */
getBuildFingerprint()111     String getBuildFingerprint();
112 
113     /**
114      * Return the number of completed test modules for this invocation.
115      */
getModuleCompleteCount()116     int getModuleCompleteCount();
117 
118     /**
119      * Return status of checksum from previous session
120      */
getRetryChecksumStatus()121     RetryChecksumStatus getRetryChecksumStatus();
122 
123     /**
124      * Set status of checksum from previous session
125      */
setRetryChecksumStatus(RetryChecksumStatus retryStatus)126     void setRetryChecksumStatus(RetryChecksumStatus retryStatus);
127 
128     /**
129      * Return the directory of the previous sessions results
130      */
getRetryDirectory()131     File getRetryDirectory();
132 
133     /**
134      * Set the directory of the previous sessions results
135      */
setRetryDirectory(File resultDir)136     void setRetryDirectory(File resultDir);
137 
138 }
139