1 /**
2 * .
3 * Copyright � 1999 Erich P G.
4 *
5 */
6
7 package autohit.verify;
8
9 import autohit.transport.Response;
10
11 /**
12 * An interface to a standard verification facillity.
13 * <p>
14 * this may seem like an unneccessary layer of abstraction, but I have
15 * plans for the future...
16 *
17 * @author Erich P. Gatejen
18 * @version 1.0
19 * <i>Version History</i>
20 * <code>EPG - Initial - 5Feb99</code>
21 *
22 */
23 public interface Verify {
24
25 // --- FINAL FIELDS ------------------------------------------------------
26
27 // --- FIELDS ------------------------------------------------------------
28
29 /**
30 * Test for exceptions. Prolly not the best place to put this...
31 */
32 public String psVE_NO_CONTEXT = "No Response Context set.";
33
34 // --- PUBLIC METHODS ----------------------------------------------------
35
36 /**
37 * Create a fresh verification context.
38 *
39 * @param address Address specification.
40 *
41 * @throws autohit.transport.VerifyException
42 */
43 public void fresh(Response context) throws VerifyException;
44
45 /**
46 * Reset the current verification context.
47 *
48 * @param address Address specification.
49 *
50 * @throws autohit.transport.VerifyException
51 */
52 public void reset() throws VerifyException;
53
54 /**
55 * A seek operation.
56 *
57 * @param expected the string to seek.
58 * @return true if it passes verification,otherwise false.
59 *
60 * @throws autohit.transport.VerifyException
61 */
62 public boolean seek(String expected) throws VerifyException;
63
64 /**
65 * A CRC check operation.
66 *
67 * @param expected the expected CRC value.
68 * @return true if it passes verification,otherwise false.
69 *
70 * @throws autohit.transport.VerifyException
71 */
72 public boolean crc(int expected) throws VerifyException;
73
74 /**
75 * A size check operation.
76 *
77 * @param expected the expected size.
78 * @return true if it passes verification,otherwise false.
79 *
80 * @throws autohit.transport.VerifyException
81 */
82 public boolean size(int expected) throws VerifyException;
83
84 /**
85 * Returns the numeric difference from the previous operation. Currently,
86 * if will return the diff between the expected and actual values calculated
87 * in crc and size.
88 * <p>
89 * It is calculated as actual - expected.
90 *
91 * @return numeric delta. It will be 0, if there was no difference.
92 *
93 * @throws autohit.transport.VerifyException
94 */
95 public int lastDelta() throws VerifyException;
96
97 /**
98 * Run a sub-executable to perform a verification.
99 *
100 * @param invocation an invocation string. used by the specific verification
101 * to determine what to run and how to run it.
102 * @param content passed to the sun-executable as content.
103 * @return true if it passes verification,otherwise false.
104 *
105 * @throws autohit.transport.VerifyException
106 */
107 public boolean exec(String invocation, String content) throws VerifyException;
108
109
110 // --- PRIVATE METHODS ---------------------------------------------------
111 }
|