use of com.axway.ats.rbv.db.rules.DbDateFieldRule in project ats-framework by Axway.
the class DbVerification method checkFieldValueDateBefore.
/**
* Add rule to check that the given timestamp is before the date contained in the given field
*
* @param tableName the name of the table which the field is part of
* @param fieldName the field to check
* @param timestamp the expected timestamp (UNIX timestamp format)
* @param datePattern the pattern in which the date is stored in the field - see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html">Java date patterns</a>
*/
@PublicAtsApi
public void checkFieldValueDateBefore(String tableName, String fieldName, long timestamp, String datePattern) {
DbDateFieldRule matchingRule = new DbDateFieldRule(tableName, fieldName, Long.toString(timestamp), DbDateFieldRule.MatchRelation.BEFORE_DATE, datePattern, "checkFieldValueDateBefore", true);
checkFieldValue(matchingRule);
}
use of com.axway.ats.rbv.db.rules.DbDateFieldRule in project ats-framework by Axway.
the class DbVerification method checkFieldValueDateAfter.
/**
* Add rule to check that the given timestamp is after the date contained in the given field
*
* @param tableName the name of the table which the field is part of
* @param fieldName the field to check
* @param timestamp the expected timestamp (UNIX timestamp format)
* @param datePattern the pattern in which the date is stored in the field - see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html">Java date patterns</a>
*/
@PublicAtsApi
public void checkFieldValueDateAfter(String tableName, String fieldName, long timestamp, String datePattern) {
DbDateFieldRule matchingRule = new DbDateFieldRule(tableName, fieldName, Long.toString(timestamp), DbDateFieldRule.MatchRelation.AFTER_DATE, datePattern, "checkFieldValueDateAfter", true);
checkFieldValue(matchingRule);
}
use of com.axway.ats.rbv.db.rules.DbDateFieldRule in project ats-framework by Axway.
the class DbVerification method checkFieldValueEquals.
/**
* Add rule to check that the value of the given field is the same as the given one
*
* @param tableName the name of the table which the field is part of
* @param fieldName the field to check
* @param value the value expected (Date)
*/
@PublicAtsApi
public void checkFieldValueEquals(String tableName, String fieldName, Date value) {
DbDateFieldRule matchingRule = new DbDateFieldRule(tableName, fieldName, value, MatchRelation.EXACT, "checkFieldValueEquals", true);
checkFieldValue(matchingRule);
}
use of com.axway.ats.rbv.db.rules.DbDateFieldRule in project ats-framework by Axway.
the class Test_DbDateFieldRule method isMatchRelationBeforeDatePositive.
@Test
public void isMatchRelationBeforeDatePositive() throws RbvException {
testMetaData.putProperty("test", "2007-10-09 15:00:00");
DbDateFieldRule rule = new DbDateFieldRule("test", "1191941800", MatchRelation.BEFORE_DATE, "yyyy-MM-dd HH:mm:ss", "isMatchRelationBeforeDatePositive", true);
assertTrue(rule.isMatch(testMetaData));
}
use of com.axway.ats.rbv.db.rules.DbDateFieldRule in project ats-framework by Axway.
the class Test_DbDateFieldRule method isMatchDatePositiveAfter.
@Test
public void isMatchDatePositiveAfter() throws RbvException {
DbDateFieldRule rule = new DbDateFieldRule("test", today, MatchRelation.AFTER_DATE, "isMatchWrongActualDateFormat", true);
testMetaData.putProperty("test", new Timestamp(tomorrow.getTime()));
assertTrue(rule.isMatch(testMetaData));
}
Aggregations