The last change wasn't quite right, this has multiple AndOf's under
a single AnyOf. Multiple AnyOf's are treated as AND's, but what we
really want is a set of OR's.
Issue-ID: POLICY-2490
Change-Id: I7336643302ccf7982c91a9c082d17bcf0adb4ac8
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
// treated as an OR.
//
TargetType target = new TargetType();
// treated as an OR.
//
TargetType target = new TargetType();
+ AnyOfType anyOf = new AnyOfType();
for (Object blacklisted : ((Collection<?>) arrayBlacklisted)) {
AllOfType allOf = new AllOfType();
this.addMatch(allOf, blacklisted, ToscaDictionary.ID_RESOURCE_GUARD_TARGETID);
for (Object blacklisted : ((Collection<?>) arrayBlacklisted)) {
AllOfType allOf = new AllOfType();
this.addMatch(allOf, blacklisted, ToscaDictionary.ID_RESOURCE_GUARD_TARGETID);
- AnyOfType anyOf = new AnyOfType();
anyOf.getAllOf().add(allOf);
anyOf.getAllOf().add(allOf);
- target.getAnyOf().add(anyOf);
+ target.getAnyOf().add(anyOf);
//
// Create our rule and add the target
//
//
// Create our rule and add the target
//
// vfcount=0 below min of 1: should get a Deny because target IS blacklisted
//
requestAndCheckDecision(requestVfCount, DENY);
// vfcount=0 below min of 1: should get a Deny because target IS blacklisted
//
requestAndCheckDecision(requestVfCount, DENY);
+ //
+ // vfcount=1 between min of 1 and max of 2: change the
+ //
+ ((Map<String, Object>) requestVfCount.getResource().get("guard")).put("target",
+ "another-vfmodule-where-root-is-true");
+ //
+ // vfcount=0 below min of 1: should get a Deny because target IS blacklisted
+ //
+ requestAndCheckDecision(requestVfCount, DENY);
}
@SuppressWarnings("unchecked")
}
@SuppressWarnings("unchecked")
continue;
}
assertThat(((RuleType) rule).getTarget()).isNotNull();
continue;
}
assertThat(((RuleType) rule).getTarget()).isNotNull();
- assertThat(((RuleType) rule).getTarget().getAnyOf()).hasSize(2);
+ assertThat(((RuleType) rule).getTarget().getAnyOf()).hasSize(1);
for (AnyOfType anyOf : ((RuleType)rule).getTarget().getAnyOf()) {
assertThat(anyOf.getAllOf()).isNotEmpty();
for (AllOfType allOf : anyOf.getAllOf()) {
for (AnyOfType anyOf : ((RuleType)rule).getTarget().getAnyOf()) {
assertThat(anyOf.getAllOf()).isNotEmpty();
for (AllOfType allOf : anyOf.getAllOf()) {