use of org.springframework.webflow.core.collection.LocalAttributeMap in project cas by apereo.
the class AbstractCasWebflowEventResolver method validateEventIdForMatchingTransitionInContext.
/**
* Validate event for transition.
*
* @param eventId the event id
* @param context the context
* @param attributes the attributes
* @return the event
*/
protected Event validateEventIdForMatchingTransitionInContext(final String eventId, final RequestContext context, final Map<String, Object> attributes) {
try {
final AttributeMap<Object> attributesMap = new LocalAttributeMap<>(attributes);
final Event event = new Event(this, eventId, attributesMap);
LOGGER.debug("Resulting event id is [{}]. Locating transitions in the context for that event id...", event.getId());
final TransitionDefinition def = context.getMatchingTransition(event.getId());
if (def == null) {
LOGGER.warn("Transition definition cannot be found for event [{}]", event.getId());
throw new AuthenticationException();
}
LOGGER.debug("Found matching transition [{}] with target [{}] for event [{}] with attributes [{}].", def.getId(), def.getTargetStateId(), event.getId(), event.getAttributes());
return event;
} catch (final Exception e) {
throw Throwables.propagate(e);
}
}
use of org.springframework.webflow.core.collection.LocalAttributeMap in project cas by apereo.
the class FrontChannelLogoutActionTests method onSetUp.
@Before
public void onSetUp() throws Exception {
final DefaultSingleLogoutServiceMessageHandler handler = new DefaultSingleLogoutServiceMessageHandler(new SimpleHttpClientFactoryBean().getObject(), new SamlCompliantLogoutMessageCreator(), servicesManager, new DefaultSingleLogoutServiceLogoutUrlBuilder(), false, new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()));
final LogoutManagerImpl logoutManager = new LogoutManagerImpl(new SamlCompliantLogoutMessageCreator(), handler, false);
this.frontChannelLogoutAction = new FrontChannelLogoutAction(logoutManager);
final MockHttpServletRequest request = new MockHttpServletRequest();
final MockHttpServletResponse response = new MockHttpServletResponse();
this.requestContext = mock(RequestContext.class);
final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
when(this.requestContext.getExternalContext()).thenReturn(servletExternalContext);
when(servletExternalContext.getNativeRequest()).thenReturn(request);
when(servletExternalContext.getNativeResponse()).thenReturn(response);
final LocalAttributeMap flowScope = new LocalAttributeMap();
when(this.requestContext.getFlowScope()).thenReturn(flowScope);
final MockFlowExecutionKey mockFlowExecutionKey = new MockFlowExecutionKey(FLOW_EXECUTION_KEY);
final MockFlowExecutionContext mockFlowExecutionContext = new MockFlowExecutionContext();
mockFlowExecutionContext.setKey(mockFlowExecutionKey);
when(this.requestContext.getFlowExecutionContext()).thenReturn(mockFlowExecutionContext);
}
use of org.springframework.webflow.core.collection.LocalAttributeMap in project head by mifos.
the class CreateSavingsAccountTest method testStartFlow_CustomerIdProvided.
@Test
public void testStartFlow_CustomerIdProvided() {
Integer customerId = 1;
MutableAttributeMap input = new LocalAttributeMap();
MockParameterMap requestParameterMap = new MockParameterMap();
requestParameterMap.put("customerId", customerId.toString());
MockExternalContext context = new MockExternalContext();
context.setRequestParameterMap(requestParameterMap);
startFlow(input, context);
assertCurrentStateEquals("selectProductOfferingStep");
verify(controller).customerSelected(eq(customerId), any(CreateSavingsAccountFormBean.class));
verify(controller).getProductOfferings(any(CreateSavingsAccountFormBean.class));
}
use of org.springframework.webflow.core.collection.LocalAttributeMap in project cas by apereo.
the class CasWebflowContextConfigurationTests method verifyFlowExecutorByServerSession.
@Test
public void verifyFlowExecutorByServerSession() {
final RequestContext ctx = getMockRequestContext();
final LocalAttributeMap map = new LocalAttributeMap<>();
flowExecutorViaServerSessionBindingExecution.launchExecution("login", map, ctx.getExternalContext());
}
use of org.springframework.webflow.core.collection.LocalAttributeMap in project cas by apereo.
the class ServiceThemeResolverTests method verifyGetServiceThemeDoesNotExist.
@Test
public void verifyGetServiceThemeDoesNotExist() {
final RegexRegisteredService r = new RegexRegisteredService();
r.setTheme("myTheme");
r.setId(1000);
r.setName("Test Service");
r.setServiceId("myServiceId");
this.servicesManager.save(r);
final MockHttpServletRequest request = new MockHttpServletRequest();
final RequestContext ctx = mock(RequestContext.class);
final MutableAttributeMap scope = new LocalAttributeMap();
scope.put("service", RegisteredServiceTestUtils.getService(r.getServiceId()));
when(ctx.getFlowScope()).thenReturn(scope);
RequestContextHolder.setRequestContext(ctx);
request.addHeader(WebUtils.USER_AGENT_HEADER, MOZILLA);
assertEquals(DEFAULT_THEME_NAME, this.serviceThemeResolver.resolveThemeName(request));
}
Aggregations