private void createStandardCriteria(ProfilingRule rule) throws Exception
{
RuleCriterion criterion;
assertNotNull("ProfilingRule is null", rule);
for (int count = 0; count < 5; count++)
{
switch (count)
{
case 0:
criterion = this.addRuleCriterion(rule,ProfilingRule.STANDARD_PAGE, "type-" + count, DEFAULT_PAGE, count, RuleCriterion.FALLBACK_STOP);
assertTrue("criteria name " + criterion.getName(), criterion.getName().equals(
ProfilingRule.STANDARD_PAGE));
assertNotNull("criteria value", criterion.getValue());
assertTrue("criteria value", criterion.getValue().equals(DEFAULT_PAGE));
assertTrue("fallback type", criterion.getFallbackType() == RuleCriterion.FALLBACK_STOP);
break;
case 1:
criterion = this.addRuleCriterion(rule,ProfilingRule.STANDARD_USER, "type-" + count, null, count, RuleCriterion.FALLBACK_STOP);
assertTrue("criteria name", criterion.getName().equals(ProfilingRule.STANDARD_USER));
assertNull("criteria value", criterion.getValue());
assertTrue("fallback type", criterion.getFallbackType() == RuleCriterion.FALLBACK_STOP);
break;
case 2:
criterion = this.addRuleCriterion(rule,ProfilingRule.STANDARD_MEDIATYPE, "type-" + count, null, count, RuleCriterion.FALLBACK_CONTINUE);
assertTrue("criteria name", criterion.getName().equals(ProfilingRule.STANDARD_MEDIATYPE));
assertNull("criteria value", criterion.getValue());
assertTrue("fallback type", criterion.getFallbackType() == RuleCriterion.FALLBACK_CONTINUE);
break;
case 3:
criterion = this.addRuleCriterion(rule,ProfilingRule.STANDARD_LANGUAGE, "type-" + count, null, count, RuleCriterion.FALLBACK_CONTINUE);
assertTrue("criteria name", criterion.getName().equals(ProfilingRule.STANDARD_LANGUAGE));
assertNull("criteria value", criterion.getValue());
assertTrue("fallback type", criterion.getFallbackType() == RuleCriterion.FALLBACK_CONTINUE);
break;
case 4:
criterion = this.addRuleCriterion(rule,ProfilingRule.STANDARD_COUNTRY, "type-" + count, null, count, RuleCriterion.FALLBACK_CONTINUE);
assertTrue("criteria name", criterion.getName().equals(ProfilingRule.STANDARD_COUNTRY));
assertNull("criteria value", criterion.getValue());
assertTrue("fallback type", criterion.getFallbackType() == RuleCriterion.FALLBACK_CONTINUE);
break;
}
}
}