use of org.forgerock.openam.scripting.ScriptConstants.ScriptContext in project OpenAM by OpenRock.
the class ScriptEngineConfiguratorTest method shouldNotUpdateEngineWhenEngineConfigDidNotChange.
@Test
public void shouldNotUpdateEngineWhenEngineConfigDidNotChange() {
// given
ScriptContext context = POLICY_CONDITION;
String serviceComponent = "/" + context.name() + "/SomeOtherConfig";
doCallRealMethod().when(mockEngineConfigurator).globalConfigChanged(anyString(), anyString(), anyString(), anyString(), anyInt());
// when
mockEngineConfigurator.globalConfigChanged(ScriptConstants.SERVICE_NAME, "", "", serviceComponent, 0);
// then
verify(mockEngineConfigurator, times(0)).updateConfig(any(ScriptContext.class));
}
use of org.forgerock.openam.scripting.ScriptConstants.ScriptContext in project OpenAM by OpenRock.
the class ScriptEngineConfiguratorTest method shouldUpdateEngineWithAuthorisationEntitlementConditionConfig.
@Test
public void shouldUpdateEngineWithAuthorisationEntitlementConditionConfig() {
// given
ScriptContext context = POLICY_CONDITION;
String serviceComponent = "/" + context.name() + "/" + ENGINE_CONFIGURATION;
doCallRealMethod().when(mockEngineConfigurator).globalConfigChanged(anyString(), anyString(), anyString(), anyString(), anyInt());
// when
mockEngineConfigurator.globalConfigChanged(ScriptConstants.SERVICE_NAME, "", "", serviceComponent, 0);
// then
ArgumentCaptor<ScriptContext> contextCaptor = ArgumentCaptor.forClass(ScriptContext.class);
verify(mockEngineConfigurator, times(1)).updateConfig(contextCaptor.capture());
assertThat(contextCaptor.getValue()).isEqualTo(context);
}
use of org.forgerock.openam.scripting.ScriptConstants.ScriptContext in project OpenAM by OpenRock.
the class ScriptEngineConfiguratorTest method shouldUpdateEngineWithAuthenticationServerSideConfig.
@Test
public void shouldUpdateEngineWithAuthenticationServerSideConfig() {
// given
ScriptContext context = AUTHENTICATION_SERVER_SIDE;
String serviceComponent = "/" + context.name() + "/" + ENGINE_CONFIGURATION;
doCallRealMethod().when(mockEngineConfigurator).globalConfigChanged(anyString(), anyString(), anyString(), anyString(), anyInt());
// when
mockEngineConfigurator.globalConfigChanged(ScriptConstants.SERVICE_NAME, "", "", serviceComponent, 0);
// then
ArgumentCaptor<ScriptContext> resourceCaptor = ArgumentCaptor.forClass(ScriptContext.class);
verify(mockEngineConfigurator, times(1)).updateConfig(resourceCaptor.capture());
assertThat(resourceCaptor.getValue()).isEqualTo(context);
}
Aggregations