Search in sources :

Example 36 with DbStringFieldRule

use of com.axway.ats.rbv.db.rules.DbStringFieldRule in project ats-framework by Axway.

the class Test_SimpleMonitorListener method verifyNoMatch_ButHasAMatch.

@Test
public void verifyNoMatch_ButHasAMatch() throws RbvException {
    DbFieldsRule dbRule = new DbStringFieldRule("", "key1", "value00", MatchRelation.EQUALS, "verifyNoMatch_ButHasAMatch", true);
    Monitor monitor = new Monitor("monitor1", matchable, dbRule, pollingParams, false, true, false);
    List<Monitor> monitors = new ArrayList<Monitor>();
    monitors.add(monitor);
    SimpleMonitorListener listener = new SimpleMonitorListener(monitors);
    long before = System.currentTimeMillis();
    assertFalse(listener.evaluateMonitors(TIME_END_POLL));
    long after = System.currentTimeMillis();
    assertTrue(after - before >= TIME_BEFORE_END_POLL);
}
Also used : Monitor(com.axway.ats.rbv.Monitor) SimpleMonitorListener(com.axway.ats.rbv.SimpleMonitorListener) ArrayList(java.util.ArrayList) DbFieldsRule(com.axway.ats.rbv.db.rules.DbFieldsRule) DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) Test(org.junit.Test)

Example 37 with DbStringFieldRule

use of com.axway.ats.rbv.db.rules.DbStringFieldRule in project ats-framework by Axway.

the class Test_SimpleMonitorListener method evaluateMonitorsOneMonitorPositiveRunTwice.

@Test
public void evaluateMonitorsOneMonitorPositiveRunTwice() throws RbvException {
    DbFieldsRule dbRule = new DbStringFieldRule("", "key1", "value10", MatchRelation.EQUALS, "evaluateMonitorsOneMonitorPositiveRunTwice", true);
    Monitor monitor = new Monitor("monitor1", matchable, dbRule, pollingParams, true, false, false);
    List<Monitor> monitors = new ArrayList<Monitor>();
    monitors.add(monitor);
    SimpleMonitorListener listener = new SimpleMonitorListener(monitors);
    assertTrue(listener.evaluateMonitors(TIME_END_POLL));
    assertTrue(listener.evaluateMonitors(TIME_END_POLL));
}
Also used : Monitor(com.axway.ats.rbv.Monitor) SimpleMonitorListener(com.axway.ats.rbv.SimpleMonitorListener) ArrayList(java.util.ArrayList) DbFieldsRule(com.axway.ats.rbv.db.rules.DbFieldsRule) DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) Test(org.junit.Test)

Example 38 with DbStringFieldRule

use of com.axway.ats.rbv.db.rules.DbStringFieldRule in project ats-framework by Axway.

the class DbVerification method checkFieldValueDoesNotContain.

/**
     * Add rule to check that the value of the given field does not contain the given string
     *
     * @param tableName     the name of the table which the field is part of
     * @param fieldName     the field to check
     * @param value         the string that should be contained in the field
     */
@PublicAtsApi
public void checkFieldValueDoesNotContain(String tableName, String fieldName, String value) {
    DbStringFieldRule matchingRule = new DbStringFieldRule(tableName, fieldName, value, DbStringFieldRule.MatchRelation.CONTAINS, "checkFieldValueDoesNotContain", false);
    matchingRule.setDbEncryptor(dbEncryptor);
    checkFieldValue(matchingRule);
}
Also used : DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 39 with DbStringFieldRule

use of com.axway.ats.rbv.db.rules.DbStringFieldRule in project ats-framework by Axway.

the class DbSnapshot method checkFieldValueHasChanged.

/**
     * 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
     */
@PublicAtsApi
public void checkFieldValueHasChanged(String keyTableName, String keyFieldName, String keyValue, String tableName, String fieldName, String value) throws RbvException {
    DbStringFieldRule keyRule = new DbStringFieldRule(keyTableName, keyFieldName, keyValue, DbStringFieldRule.MatchRelation.EQUALS, "checkKeyValueEquals", true);
    DbStringFieldRule matchingRule = new DbStringFieldRule(tableName, fieldName, value, DbStringFieldRule.MatchRelation.EQUALS, "checkFieldValueEquals", true);
    matchingRule.setDbEncryptor(dbEncryptor);
    checkFieldValueChanged(keyRule, matchingRule);
}
Also used : DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 40 with DbStringFieldRule

use of com.axway.ats.rbv.db.rules.DbStringFieldRule in project ats-framework by Axway.

the class Test_DbStringFieldRule method isMatchNullExpectedValueNegative.

@Test
public void isMatchNullExpectedValueNegative() throws RbvException {
    testMetaData.putProperty("test", "asdfas");
    DbStringFieldRule rule = new DbStringFieldRule("test", null, MatchRelation.CONTAINS, "isMatchNullActualValue", true);
    assertFalse(rule.isMatch(testMetaData));
}
Also used : DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Aggregations

DbStringFieldRule (com.axway.ats.rbv.db.rules.DbStringFieldRule)64 Test (org.junit.Test)57 ArrayList (java.util.ArrayList)34 Monitor (com.axway.ats.rbv.Monitor)33 DbFieldsRule (com.axway.ats.rbv.db.rules.DbFieldsRule)33 SimpleMonitorListener (com.axway.ats.rbv.SimpleMonitorListener)32 BaseTest (com.axway.ats.rbv.BaseTest)24 MetaData (com.axway.ats.rbv.MetaData)17 DbMetaData (com.axway.ats.rbv.db.DbMetaData)15 SnapshotExecutor (com.axway.ats.rbv.executors.SnapshotExecutor)15 DbSearchTerm (com.axway.ats.rbv.db.DbSearchTerm)8 DbStorage (com.axway.ats.rbv.db.DbStorage)8 MockDbProvider (com.axway.ats.rbv.db.MockDbProvider)8 Matchable (com.axway.ats.rbv.storage.Matchable)8 PublicAtsApi (com.axway.ats.common.PublicAtsApi)7 PollingParameters (com.axway.ats.rbv.PollingParameters)3 AndRuleOperation (com.axway.ats.rbv.rules.AndRuleOperation)2 Rule (com.axway.ats.rbv.rules.Rule)1