Search in sources :

Example 11 with DbDateFieldRule

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);
}
Also used : DbDateFieldRule(com.axway.ats.rbv.db.rules.DbDateFieldRule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 12 with DbDateFieldRule

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);
}
Also used : DbDateFieldRule(com.axway.ats.rbv.db.rules.DbDateFieldRule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 13 with DbDateFieldRule

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);
}
Also used : DbDateFieldRule(com.axway.ats.rbv.db.rules.DbDateFieldRule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 14 with DbDateFieldRule

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));
}
Also used : DbDateFieldRule(com.axway.ats.rbv.db.rules.DbDateFieldRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 15 with DbDateFieldRule

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));
}
Also used : DbDateFieldRule(com.axway.ats.rbv.db.rules.DbDateFieldRule) Timestamp(java.sql.Timestamp) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Aggregations

DbDateFieldRule (com.axway.ats.rbv.db.rules.DbDateFieldRule)15 BaseTest (com.axway.ats.rbv.BaseTest)11 Test (org.junit.Test)11 PublicAtsApi (com.axway.ats.common.PublicAtsApi)3 Timestamp (java.sql.Timestamp)2 DbMetaData (com.axway.ats.rbv.db.DbMetaData)1 Calendar (java.util.Calendar)1 BeforeClass (org.junit.BeforeClass)1