当前位置: 首页>>代码示例>>Java>>正文


Java StepConfig.setCompleted方法代码示例

本文整理汇总了Java中org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig.setCompleted方法的典型用法代码示例。如果您正苦于以下问题:Java StepConfig.setCompleted方法的具体用法?Java StepConfig.setCompleted怎么用?Java StepConfig.setCompleted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig的用法示例。


在下文中一共展示了StepConfig.setCompleted方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testHandleLastStep

import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入方法依赖的package包/类
@Test(dataProvider = "stepData")
public void testHandleLastStep(boolean isRequestAuthenticated,
                               boolean isOverallAuthenticationSucceeded) throws Exception {
    StepHandler stepHandler = getMockedStepHandlerForSuccessfulRequestAuthentication();
    mockStatic(FrameworkUtils.class);
    when(FrameworkUtils.getStepHandler()).thenReturn(stepHandler);

    StepConfig firstStep = new StepConfig();
    firstStep.setOrder(1);

    // Second step is completed.
    StepConfig lastStep = new StepConfig();
    lastStep.setOrder(2);
    lastStep.setCompleted(true);

    SequenceConfig sequenceConfig = new SequenceConfig();
    sequenceConfig.getStepMap().put(1, firstStep);
    sequenceConfig.getStepMap().put(2, lastStep);

    doNothing().when(stepBasedSequenceHandler).handlePostAuthentication(any(HttpServletRequest.class), any
            (HttpServletResponse.class), any(AuthenticationContext.class));

    // currently we have completed second step
    context.setCurrentStep(2);
    context.setSequenceConfig(sequenceConfig);
    context.setRequestAuthenticated(isRequestAuthenticated);

    stepBasedSequenceHandler.handle(request, response, context);
    assertResetContext(context);
    assertEquals(context.isRequestAuthenticated(), isOverallAuthenticationSucceeded);
    assertTrue(context.getSequenceConfig().isCompleted());
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:33,代码来源:DefaultStepBasedSequenceHandlerTest.java

示例2: testHandlePassiveAuthenticateWhenMultiOptionStep

import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入方法依赖的package包/类
@Test
public void testHandlePassiveAuthenticateWhenMultiOptionStep() throws Exception {

    StepHandler stepHandler = getMockedStepHandlerForSuccessfulRequestAuthentication();
    mockStatic(FrameworkUtils.class);
    when(FrameworkUtils.getStepHandler()).thenReturn(stepHandler);

    StepConfig firstStep = new StepConfig();
    firstStep.setOrder(1);

    // Second step is completed.
    StepConfig lastStep = new StepConfig();
    lastStep.setMultiOption(true);
    lastStep.setOrder(2);
    lastStep.setCompleted(true);

    SequenceConfig sequenceConfig = new SequenceConfig();
    sequenceConfig.getStepMap().put(1, firstStep);
    sequenceConfig.getStepMap().put(2, lastStep);

    doNothing().when(stepBasedSequenceHandler).handlePostAuthentication(any(HttpServletRequest.class), any
            (HttpServletResponse.class), any(AuthenticationContext.class));

    // currently we have completed second step
    context.setCurrentStep(2);
    context.setSequenceConfig(sequenceConfig);
    context.setPassiveAuthenticate(true);
    context.setRequestAuthenticated(false);

    stepBasedSequenceHandler.handle(request, response, context);
    assertResetContext(context);
    assertTrue(context.getSequenceConfig().isCompleted());
    assertFalse(context.getSequenceConfig().getStepMap().get(context.getCurrentStep()).isRetrying());
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:35,代码来源:DefaultStepBasedSequenceHandlerTest.java

示例3: testHandleMultiOptionStep

import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入方法依赖的package包/类
@Test
public void testHandleMultiOptionStep() throws Exception {

    StepHandler stepHandler = getMockedStepHandlerForIncompleteStep(true);
    mockStatic(FrameworkUtils.class);
    when(FrameworkUtils.getStepHandler()).thenReturn(stepHandler);

    StepConfig firstStep = new StepConfig();
    firstStep.setOrder(1);

    // Second step is completed.
    StepConfig lastStep = new StepConfig();
    lastStep.setMultiOption(true);
    lastStep.setOrder(2);
    lastStep.setCompleted(true);

    SequenceConfig sequenceConfig = new SequenceConfig();
    sequenceConfig.getStepMap().put(1, firstStep);
    sequenceConfig.getStepMap().put(2, lastStep);

    doNothing().when(stepBasedSequenceHandler).handlePostAuthentication(any(HttpServletRequest.class), any
            (HttpServletResponse.class), any(AuthenticationContext.class));

    // currently we have completed second step
    context.setCurrentStep(2);
    context.setSequenceConfig(sequenceConfig);
    context.setRequestAuthenticated(false);

    stepBasedSequenceHandler.handle(request, response, context);
    assertResetContext(context);
    // Assert whether the sequence is retrying the step
    assertTrue(context.getSequenceConfig().getStepMap().get(context.getCurrentStep()).isRetrying());
    // Assert whether before retrying the context request authentication status was set to true.
    assertTrue(context.isRequestAuthenticated());

    // step handler completes the step successfully
    stepHandler = getMockedStepHandlerForSuccessfulRequestAuthentication();
    when(FrameworkUtils.getStepHandler()).thenReturn(stepHandler);

    stepBasedSequenceHandler.handle(request, response, context);
    assertTrue(context.getSequenceConfig().isCompleted());
    assertTrue(context.isRequestAuthenticated());
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:44,代码来源:DefaultStepBasedSequenceHandlerTest.java


注:本文中的org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig.setCompleted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。