public class DocumentWorkerFieldValueValidator
extends com.hpe.caf.worker.testing.validation.CustomPropertyValidator
| Modifier and Type | Field and Description |
|---|---|
protected com.hpe.caf.worker.testing.validation.ReferenceDataValidator |
referencedDataValidator |
protected com.hpe.caf.worker.testing.validation.ValuePropertyValidator |
simpleValueValidator |
| Constructor and Description |
|---|
DocumentWorkerFieldValueValidator(com.hpe.caf.api.worker.DataStore dataStore,
com.hpe.caf.worker.testing.TestConfiguration testConfiguration,
com.hpe.caf.api.Codec codec,
String... recognizedPropertyNames)
Constructs a validator that validates DocumentWorkerFieldValue instances of specific named fields
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canValidate(String propertyName,
Object sourcePropertyValue,
Object validatorPropertyValue) |
protected boolean |
equal(DocumentWorkerFieldValue actual,
DocumentWorkerFieldValueExpectation expected)
Compares a DocumentWorkerFieldValue with an expected value and indicates if they can be considered equal.
|
protected byte[] |
getBytes(DocumentWorkerFieldValue value)
Returns byte array representation of data on provided
value. |
protected com.hpe.caf.util.ref.ReferencedData |
getReferencedData(DocumentWorkerFieldValue actual)
Retrieves ReferencedData object for data on provided DocumentWorkerFieldValue.
|
protected boolean |
isValid(Object testedPropertyValue,
Object validatorPropertyValue) |
protected static String |
nullToEmpty(String str)
Returns an empty
String if str is null otherwise returns str. |
protected static DocumentWorkerFieldEncoding |
nullToUtf8(DocumentWorkerFieldEncoding encoding)
Returns encoding as utf8 if
encoding provided is null otherwise returns encoding. |
protected final com.hpe.caf.worker.testing.validation.ReferenceDataValidator referencedDataValidator
protected final com.hpe.caf.worker.testing.validation.ValuePropertyValidator simpleValueValidator
public DocumentWorkerFieldValueValidator(com.hpe.caf.api.worker.DataStore dataStore,
com.hpe.caf.worker.testing.TestConfiguration testConfiguration,
com.hpe.caf.api.Codec codec,
String... recognizedPropertyNames)
dataStore - the data store from which storage reference field values will be retrieved for validationtestConfiguration - various settings controlling testingcodec - the codec to be used when validating storage reference valuesrecognizedPropertyNames - the names of the DocumentWorkerFieldValue fields that are validated by this validator instance; may
be null, in which case the validator may be used to validate any DocumentWorkerFieldValue fieldpublic boolean canValidate(String propertyName, Object sourcePropertyValue, Object validatorPropertyValue)
canValidate in class com.hpe.caf.worker.testing.validation.CustomPropertyValidatorprotected boolean isValid(Object testedPropertyValue, Object validatorPropertyValue)
isValid in class com.hpe.caf.worker.testing.validation.PropertyValidatorprotected boolean equal(DocumentWorkerFieldValue actual, DocumentWorkerFieldValueExpectation expected) throws com.hpe.caf.api.worker.DataStoreException, IOException
actual - the document worker field value to check.expected - expectation that the document worker field value should meet to be considered equal.com.hpe.caf.api.worker.DataStoreException - if there is a failure retrieving the field value from data store.IOException - if there is a failure marshalling field value to bytes for comparison.protected com.hpe.caf.util.ref.ReferencedData getReferencedData(DocumentWorkerFieldValue actual) throws com.hpe.caf.api.worker.DataStoreException, IOException
actual - DocumentWorkerFieldValue to get ReferencedData for.actual.com.hpe.caf.api.worker.DataStoreException - if there is a failure retrieving data from data store when setting on ReferencedData object.IOException - if there is a failure marshalling field value to bytes.protected byte[] getBytes(DocumentWorkerFieldValue value) throws com.hpe.caf.api.worker.DataStoreException, IOException
value.value - field value to convert data for.com.hpe.caf.api.worker.DataStoreException - if there is a failure retrieving data from data store when setting on ReferencedData object.IOException - if there is a failure marshalling field value to bytes.protected static String nullToEmpty(String str)
String if str is null otherwise returns str.str - value to check for null and potentially return.str was null otherwise str unchanged.protected static DocumentWorkerFieldEncoding nullToUtf8(DocumentWorkerFieldEncoding encoding)
encoding provided is null otherwise returns encoding.encoding - value to check for null and potentially return.encoding is null then DocumentWorkerFieldEncoding.utf8 or encoding if it was not null.Copyright © 2016–2021 EntIT Software LLC, a Micro Focus company. All rights reserved.