use of com.axway.ats.rbv.db.DbMetaData in project ats-framework by Axway.
the class Test_DbStringFieldRule method isMatchExpectedTrueNegative.
@Test
public void isMatchExpectedTrueNegative() throws RbvException {
DbMetaData metaData = new DbMetaData();
metaData.putProperty("test1", "test123");
assertFalse(ruleTest1ExpectTrue.isMatch(metaData));
}
use of com.axway.ats.rbv.db.DbMetaData in project ats-framework by Axway.
the class Test_DbStringFieldRule method isMatchExpectedTruePositive.
@Test
public void isMatchExpectedTruePositive() throws RbvException {
DbMetaData metaData = new DbMetaData();
metaData.putProperty("test1", "test");
assertTrue(ruleTest1ExpectTrue.isMatch(metaData));
}
use of com.axway.ats.rbv.db.DbMetaData in project ats-framework by Axway.
the class Test_DbStringFieldRule method isMatchExpectedFalseNegative.
@Test
public void isMatchExpectedFalseNegative() throws RbvException {
DbMetaData metaData = new DbMetaData();
metaData.putProperty("test1", "test");
assertFalse(ruleTest1ExpectFalse.isMatch(metaData));
}
use of com.axway.ats.rbv.db.DbMetaData in project ats-framework by Axway.
the class DbDateFieldRule method performMatch.
@Override
protected boolean performMatch(MetaData metaData) throws RbvException {
//this cast is safe, as isMatch has already checked the type of meta data
DbMetaData dbMetaData = (DbMetaData) metaData;
Object actualValue = dbMetaData.getProperty(this.expectedMetaDataKey.toString());
// check for null
if (this.expectedValue == null) {
if (actualValue == null) {
return true;
}
return false;
}
// expected value is not null, but if actual is null then we have a negative match
if (actualValue == null) {
return false;
}
if (expectedValue instanceof String) {
return checkString(dbMetaData);
}
return checkDate(dbMetaData);
}
use of com.axway.ats.rbv.db.DbMetaData in project ats-framework by Axway.
the class DbBinaryFieldRule method performMatch.
@Override
protected boolean performMatch(MetaData metaData) throws RbvException {
boolean actualResult = false;
//this cast is safe, as isMatch has already checked the type of meta data
DbMetaData dbMetaData = (DbMetaData) metaData;
byte[] actualValue;
try {
actualValue = (byte[]) dbMetaData.getProperty(expectedMetaDataKey.toString());
} catch (ClassCastException cce) {
throw new MetaDataIncorrectException("Meta data is incorrect - expected byte[]");
}
if (Arrays.equals((byte[]) expectedValue, actualValue)) {
actualResult = true;
}
return actualResult;
}
Aggregations