Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Jun 22, 2017
2 parents d5eaef0 + 72de3ef commit be7797a
Show file tree
Hide file tree
Showing 14 changed files with 272 additions and 103 deletions.
Expand Up @@ -50,26 +50,34 @@ public static String lookForMessage(Throwable e) {
return null;
}

public static boolean isSelected(ErrorSelectorType selector, Throwable exception) {
public static boolean isSelected(ErrorSelectorType selector, Throwable exception, boolean defaultValue) {
if (selector == null) {
return false;
return defaultValue;
}
if (exception instanceof CommunicationException) {
return Boolean.TRUE.equals(selector.isNetwork());
return isSelected(selector.isNetwork(), defaultValue);
}
if (exception instanceof SecurityViolationException) {
return Boolean.TRUE.equals(selector.isSecurity());
return isSelected(selector.isSecurity(), defaultValue);
}
if (exception instanceof PolicyViolationException) {
return Boolean.TRUE.equals(selector.isPolicy());
return isSelected(selector.isPolicy(), defaultValue);
}
if (exception instanceof SchemaException) {
return Boolean.TRUE.equals(selector.isSchema());
return isSelected(selector.isSchema(), defaultValue);
}
if (exception instanceof ConfigurationException || exception instanceof ExpressionEvaluationException) {
return Boolean.TRUE.equals(selector.isConfiguration());
return isSelected(selector.isConfiguration(), defaultValue);
}
return isSelected(selector.isGeneric(), defaultValue);
}

private static boolean isSelected(Boolean value, boolean defaultValue) {
if (value == null) {
return defaultValue;
} else {
return value;
}
return Boolean.TRUE.equals(selector.isGeneric());
}

}
Expand Up @@ -1071,7 +1071,7 @@ private <F extends ObjectType> void finishLoadOfProjectionContext(LensContext<F>
throw e;
}
} else {
if (ExceptionUtil.isSelected(errorSelector, e)) {
if (ExceptionUtil.isSelected(errorSelector, e, true)) {
throw e;
} else {
return;
Expand Down
Expand Up @@ -419,9 +419,10 @@ private <F extends ObjectType> void projectProjection(LensContext<F> context, Le
throw e;
}
} else {
if (ExceptionUtil.isSelected(errorSelector, e)) {
if (ExceptionUtil.isSelected(errorSelector, e, true)) {
throw e;
} else {
LOGGER.warn("Exception {} selected as non-critical in {}, continuing evaluation; exception message: {}", e.getClass().getSimpleName(), resourceType, e.getMessage());
// Just continue evaluation. The error is recorded in the result.
}
}
Expand Down
Expand Up @@ -124,7 +124,7 @@ public <F extends ObjectType> void processProjectionCredentials(LensContext<F> c
}
}

public <F extends FocusType> void processProjectionCredentialsFocus(LensContext<F> context,
private <F extends FocusType> void processProjectionCredentialsFocus(LensContext<F> context,
LensProjectionContext projectionContext, XMLGregorianCalendar now, Task task,
OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException,
SchemaException, PolicyViolationException, CommunicationException, ConfigurationException, SecurityViolationException {
Expand Down
Expand Up @@ -396,6 +396,9 @@ public class AbstractConfiguredModelIntegrationTest extends AbstractModelIntegra
protected static final File PASSWORD_POLICY_GLOBAL_FILE = new File(COMMON_DIR, "password-policy-global.xml");
protected static final String PASSWORD_POLICY_GLOBAL_OID = "12344321-0000-0000-0000-000000000003";

protected static final File PASSWORD_POLICY_BENEVOLENT_FILE = new File(COMMON_DIR, "password-policy-benevolent.xml");
protected static final String PASSWORD_POLICY_BENEVOLENT_OID = "ed8026dc-569a-11e7-abdf-4fce56706755";

protected static final File ORG_MONKEY_ISLAND_FILE = new File(COMMON_DIR, "org-monkey-island.xml");
protected static final String ORG_GOVERNOR_OFFICE_OID = "00000000-8888-6666-0000-100000000001";
protected static final String ORG_SCUMM_BAR_OID = "00000000-8888-6666-0000-100000000006";
Expand Down
Expand Up @@ -273,6 +273,8 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti

// Services
repoAddObjectFromFile(SERVICE_SHIP_SEA_MONKEY_FILE, initResult);

repoAddObjectFromFile(PASSWORD_POLICY_BENEVOLENT_FILE, initResult);

}

Expand Down
Expand Up @@ -81,6 +81,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
initDummyResourcePirate(RESOURCE_DUMMY_BLACK_NAME, RESOURCE_DUMMY_BLACK_FILE, RESOURCE_DUMMY_BLACK_OID, initTask, initResult);

repoAddObjectFromFile(SECURITY_POLICY_FILE, initResult);
repoAddObjectFromFile(PASSWORD_POLICY_BENEVOLENT_FILE, initResult);

repoAddObjectFromFile(USER_JACK_FILE, true, initResult);
repoAddObjectFromFile(USER_GUYBRUSH_FILE, true, initResult);
Expand Down

0 comments on commit be7797a

Please sign in to comment.