public class VerifierToFile extends AbstractRuntimeDataVerifier
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.lang.Object> |
actualContents
Holding the actual contents to verify, they are pairs of (flatKey, content) such as
(Response.ID, "FFE3543545JLFS")
(Response.Headers, "{Date=Tue, 06 DEC 2016 03:08:12 GMT}")
(Response.Request.Headers, "{Content-Length=4574, Via=1.1 inetgw38 (squid)}")
|
protected java.util.Set<java.lang.String> |
checkedFields
Each time a field has been checked, then that field will be put into this Set.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
expectedContents
Holding the expected contents for verification, they are pairs of (flatKey, content) such as
(Response.ID, "FFE3543545JLFS")
(Response.Headers, "{Date=Tue, 06 DEC 2016 03:08:12 GMT}")
(Response.Request.Headers, "{Content-Length=4574, Via=1.1 inetgw38 (squid)}")
|
protected java.lang.String |
filename
The name of file to hold the information of a Persistable object to be verified.
|
protected java.util.Set<java.lang.String> |
ignoredFields
Holding the fields which are ignored.
|
protected boolean |
matchAllFields
If the all the fields of actual object need to match with those in the persistent benchmark.
If this is true, all the fields of actual object need to be verified. Otherwise, only the fields specified in the persistent benchmark need to be verified. |
protected boolean |
matched
This field will contain true if the verification succeed.
|
protected java.lang.StringBuilder |
nonMatchedMessages
It contains the messages indicating the non matched fields.
|
protected java.io.Reader |
reader
The Reader object of the bench file.
|
protected boolean |
valueCaseSensitive
If the field's value needs to be matched case-sensitively
|
protected boolean |
valueContains
If the field's value needs to be matched wholly or partially
|
runtime
BOOL_MATCH_ALL_FIELDS, BOOL_VALUE_CASESENSITIVE, BOOL_VALUE_CONTAINS
Constructor and Description |
---|
VerifierToFile(RuntimeDataInterface runtime,
java.lang.String filename) |
Modifier and Type | Method and Description |
---|---|
protected void |
afterCheck(Persistable persistable,
boolean... conditions)
Make the final check.
|
protected void |
beforeCheck(Persistable persistable,
boolean... conditions)
Get some variables prepared for verification.
Parse the optional parameters It is expected that subclass should override this method to provide values to expectedContents and actualContents , such as: |
protected void |
check(Persistable persistable,
boolean... conditions) |
boolean |
equals(java.lang.Object o)
If they have the same filename, then we consider them equivalent
|
PersistenceType |
getType()
The persistence Type.
|
protected boolean |
isIgnoredFiled(java.lang.String field)
Check if the filed is being ignored at the moment for verification.
|
protected void |
match(java.lang.String field,
java.lang.Object expectation)
This method will check a certain filed's value against the
actualContents After calling, these class fields matched , checkedFields , and nonMatchedMessages
may get modified to show the result of verification. |
void |
verify(Persistable persistable,
boolean... conditions)
Verify a Persistable object against the contents stored in a persistence substance.
|
validate
protected java.lang.String filename
protected java.io.Reader reader
protected java.util.Map<java.lang.String,java.lang.Object> actualContents
protected java.util.Map<java.lang.String,java.lang.Object> expectedContents
protected java.util.Set<java.lang.String> checkedFields
#match(String, String)
protected java.util.Set<java.lang.String> ignoredFields
If this Set contains a field 'Response.Request', then all its children will be ignored, such as: Response.Request.Headers Response.Request.MessageBody ...
isIgnoredFiled(String)
protected boolean matchAllFields
protected boolean valueContains
protected boolean valueCaseSensitive
protected boolean matched
protected java.lang.StringBuilder nonMatchedMessages
public VerifierToFile(RuntimeDataInterface runtime, java.lang.String filename)
public void verify(Persistable persistable, boolean... conditions) throws SAFSException
Verifier
verify
in interface Verifier
verify
in class AbstractRuntimeDataVerifier
persistable
- Persistable, the object to verifyconditions
- boolean..., the boolean array to control the verification.
matchAllFields
valueContains
valueCaseSensitive
SAFSException
- when something wrong happens.protected void beforeCheck(Persistable persistable, boolean... conditions) throws SAFSException, java.io.IOException
expectedContents
and actualContents
, such as:
public void beforeCheck(Persistable persistable, boolean... conditions) throws SAFSException, IOException{
super.beforeCheck(persistable, conditions);
//Fill in Map 'actualContents'
//Fill in Map 'expectedContents'
}
SAFSException
java.io.IOException
protected void check(Persistable persistable, boolean... conditions) throws SAFSException, java.io.IOException
SAFSException
java.io.IOException
protected void afterCheck(Persistable persistable, boolean... conditions) throws SAFSException, java.io.IOException
SAFSException
java.io.IOException
protected void match(java.lang.String field, java.lang.Object expectation)
actualContents
matched
, checkedFields
, and nonMatchedMessages
may get modified to show the result of verification.field
- String, the field to checkexpectation
- Object, the field's expected value.protected boolean isIgnoredFiled(java.lang.String field)
If the Set ignoredFields
contains a field 'Response.Request',
then all its children (starting with 'Response.Request') will be ignored, such as:
Response.Request.Headers
Response.Request.MessageBody
...
field
- String, the field to checkignoredFields
public PersistenceType getType()
Verifier
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
Copyright © SAS Institute. All Rights Reserved.