1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 /* 19 * $Id$ 20 */ 21 22 package org.apache.qetest; 23 24 /** 25 * Interface for 'check'ing (validating) equivalence of two items. 26 * 27 * Implementers provide their own algorithims for determining 28 * equivalence, including custom algorithims for complex objects. 29 * CheckServices should log out both any pertinent information about 30 * the checking they've performed, then log out a checkPass or 31 * checkFail (or Ambg, etc.) record, as well as returning the 32 * appropriate result constant to the caller. 33 * 34 * The Configurable interface also allows callers to attempt to 35 * set attributes on either the CheckService or on any 36 * underlying validation algorithims. 37 * 38 * @author Shane_Curcuru@lotus.com 39 * @version $Id$ 40 */ 41 public interface CheckService extends Configurable 42 { 43 44 /** 45 * Compare two objects for equivalence, and return appropriate result. 46 * Implementers should provide the details of their "equals" 47 * algorithim in getDescription(). They must also call the 48 * appropriate checkPass()/checkFail()/etc. method on the 49 * supplied Logger. 50 * 51 * Note that the order of actual, reference is usually 52 * important in determining the result. 53 * <li>Typically: 54 * <ul>any unexpected Exceptions thrown -> ERRR_RESULT</ul> 55 * <ul>actual does not exist -> FAIL_RESULT</ul> 56 * <ul>reference does not exist -> AMBG_RESULT</ul> 57 * <ul>actual is equivalent to reference -> PASS_RESULT</ul> 58 * <ul>actual is not equivalent to reference -> FAIL_RESULT</ul> 59 * </li> 60 * 61 * @param logger to dump any output messages to 62 * @param actual (current) Object to check 63 * @param reference (gold, or expected) Object to check against 64 * @param description of what you're checking 65 * @param msg comment to log out with this test point 66 * @return Logger.*_RESULT code denoting status; each method may 67 * define it's own meanings for pass, fail, ambiguous, etc. 68 */ check(Logger logger, Object actual, Object reference, String msg)69 public int check(Logger logger, Object actual, 70 Object reference, String msg); 71 72 /** 73 * Compare two objects for equivalence, and return appropriate result. 74 * 75 * @param logger to dump any output messages to 76 * @param actual (current) Object to check 77 * @param reference (gold, or expected) Object to check against 78 * @param description of what you're checking 79 * @param msg comment to log out with this test point 80 * @param id ID tag to log out with this test point 81 * @return Logger.*_RESULT code denoting status; each method may 82 * define it's own meanings for pass, fail, ambiguous, etc. 83 */ check(Logger logger, Object actual, Object reference, String msg, String id)84 public int check(Logger logger, Object actual, 85 Object reference, String msg, String id); 86 87 /** 88 * Gets extended information about the last check call. 89 * 90 * This is somewhat optional, and may be removed. CheckServices 91 * should probably log out any additional info themselves to 92 * their logger before calling checkPass, etc., thus removing 93 * the need for callers to explicitly ask for this info. 94 * 95 * @return String describing any additional info about the last 96 * two Objects that were checked, or null if none available 97 */ getExtendedInfo()98 public String getExtendedInfo(); 99 100 } // end of class CheckService 101 102