1 /* 2 * Copyright (C) 2018 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.tradefed.suite.checker; 17 18 /** Contains the result of a {@link ISystemStatusChecker} execution. */ 19 public class StatusCheckerResult { 20 21 public enum CheckStatus { 22 /** status check was successful */ 23 SUCCESS, 24 /** status check did not succeed. An error message might be available (optional). */ 25 FAILED, 26 } 27 28 private CheckStatus mCheckStatus = CheckStatus.FAILED; 29 private String mErrorMessage = null; 30 31 /** Create a {@link StatusCheckerResult} with the default {@link CheckStatus#FAILED} status. */ StatusCheckerResult()32 public StatusCheckerResult() {} 33 34 /** 35 * Create a {@link StatusCheckerResult} with the given status. 36 * 37 * @param status the {@link CheckStatus} 38 */ StatusCheckerResult(CheckStatus status)39 public StatusCheckerResult(CheckStatus status) { 40 mCheckStatus = status; 41 } 42 43 /** Returns the {@link CheckStatus} of the checker. */ getStatus()44 public CheckStatus getStatus() { 45 return mCheckStatus; 46 } 47 48 /** Sets the {@link CheckStatus} of the checker. */ setStatus(CheckStatus status)49 public void setStatus(CheckStatus status) { 50 mCheckStatus = status; 51 } 52 53 /** 54 * Returns the error message associated with a failure. Can be null even in case of failures. 55 */ getErrorMessage()56 public String getErrorMessage() { 57 return mErrorMessage; 58 } 59 60 /** Sets the error message associated with a failure. */ setErrorMessage(String message)61 public void setErrorMessage(String message) { 62 mErrorMessage = message; 63 } 64 } 65