Package org.amplafi.flow.impl

Examples of org.amplafi.flow.impl.FlowActivityImpl


        flow.addPropertyDefinitions(globalDef);
        FlowPropertyDefinitionImpl globalDef1 = new FlowPropertyDefinitionImpl(PROPERTY2);
        globalDef1.setInitial(INITIAL_VALUE);
        flow.addPropertyDefinitions(globalDef1);
        // activity #0
        FlowActivityImpl activity = new FlowActivityImpl();
        flow.addActivity(activity);
        // activity #1
        activity = new FlowActivityImpl();
        flow.addActivity(activity);
        // activity #2
        activity = new FlowActivityImpl();
        FlowPropertyDefinitionImpl localDef1 = new FlowPropertyDefinitionImpl(PROPERTY1);
        activity.addPropertyDefinitions(localDef1);
        flow.addActivity(activity);
        FlowTestingUtils flowTestingUtils = new FlowTestingUtils();
        flowTestingUtils.getFlowTranslatorResolver().resolveFlow(flow);

        flowTestingUtils.getFlowDefinitionsManager().addDefinition(FLOW_TYPE, flow);
View Full Code Here


        String returnToFlowLookupKey = null;
        Map<String, String> initialFlowState = new HashMap<String, String>();
        FlowImplementor flow = new FlowImpl(FLOW_TYPE);
        FlowPropertyDefinitionImpl definition = new FlowPropertyDefinitionImpl("foo", Long.class);
        flow.addPropertyDefinitions(definition);
        FlowActivityImpl fa1 = new FlowActivityImpl();
        flow.addActivity(fa1);
        FlowTestingUtils flowTestingUtils = new FlowTestingUtils();
        flowTestingUtils.getFlowTranslatorResolver().resolve(fa1);
        flowTestingUtils.getFlowDefinitionsManager().addDefinition(FLOW_TYPE, flow);
        FlowManagement flowManagement = flowTestingUtils.getFlowManagement();
View Full Code Here

     * Make sure that a FA changing its visibility does not cause other FAs to change their visibility.
     */
    @Test(enabled=TEST_ENABLED)
    public void testInvisibleFlowActivitiesInterferingWithVisibleFA() {
        FlowTestingUtils flowTestingUtils = new FlowTestingUtils();
        FlowActivityImplementor vis0 = new FlowActivityImpl("vis0").initInvisible(false);
        FlowActivityImplementor inv1 = new FlowActivityImpl("inv1").initInvisible(true);
        FlowActivityImplementor chg2 = new FlowActivityImpl("chg2").initInvisible(false);
        FlowActivityImplementor vis3 = new FlowActivityImpl("vis3").initInvisible(false);
        String flowTypeName = flowTestingUtils.addFlowDefinition(vis0, inv1, chg2,vis3);
        FlowManagement flowManagement = flowTestingUtils.getFlowManagement();
        String prefix = chg2.getFlowPropertyProviderFullName();
        //TODO need mechanism to generate correct namespace/key for setting an override value.
        Map<String, String> initialFlowState = FlowUtils.INSTANCE.createState(prefix + NamespaceMapKey.NAMESPACE_SEPARATOR + FAINVISIBLE, true);
View Full Code Here

    private static final String FLOW_TYPE_3 = "ftype3";
    private static final boolean TEST_ENABLED = true;
    @Test(enabled=TEST_ENABLED)
    public void testSimpleFlowTransitionMapChecking() {
        FlowImpl flow = new FlowImpl(FLOW_TYPE_1);
        FlowActivityImpl fa1 = new FlowActivityImpl().initInvisible(false);
        FlowPropertyDefinitionImplementor definition = fa1.getFlowPropertyDefinition(FSFLOW_TRANSITIONS);
        assertNull(definition);
        flow.addActivity(fa1);
        definition = fa1.getFlowPropertyDefinition(FSFLOW_TRANSITIONS);
        assertNotNull(definition);
        String returnToFlowLookupKey = null;
        definition.setFlowPropertyValueProvider(new AddToMapFlowPropertyValueProvider<FlowPropertyProvider, String,FlowTransition>(new FlowTransition("foo", FLOW_TYPE_2, "foo", TransitionType.alternate, null)));
        FlowManagement baseFlowManagement = getFlowManagement(flow);
        FlowState flowState = baseFlowManagement.startFlowState(FLOW_TYPE_1, false, null, returnToFlowLookupKey);
View Full Code Here

        FlowImpl mainFlow = new FlowImpl(FLOW_TYPE_1);
        String defaultAfterPage1 = "default-after-page-for-"+FLOW_TYPE_1;
        String defaultPage1 = "page-of-"+FLOW_TYPE_1;
        mainFlow.setPageName(defaultPage1);
        mainFlow.setDefaultAfterPage(defaultAfterPage1);
        FlowActivityImpl fa1 = new FlowActivityImpl().initInvisible(false);
        FlowPropertyDefinitionImpl copiedBackProperty = new FlowPropertyDefinitionImpl("copiedBackProperty").initAccess(PropertyScope.flowLocal, PropertyUsage.io);
        fa1.addPropertyDefinition(copiedBackProperty);
        mainFlow.addActivity(fa1);

        FlowImpl subFlow = new FlowImpl(FLOW_TYPE_2);
        String defaultAfterPage2 = "default-after-page-for-"+FLOW_TYPE_2;
        String defaultPage2 = "page-of-"+FLOW_TYPE_2;
        subFlow.setPageName(defaultPage2);
        subFlow.setDefaultAfterPage(defaultAfterPage2);
        FlowActivityImpl fa2_1 = new FlowActivityImpl().initInvisible(false);
        fa2_1.addPropertyDefinition(copiedBackProperty.clone());
        subFlow.addActivity(fa2_1);
        subFlow.addActivity(new TransitionFlowActivity());

        FlowImpl continuedFlow = new FlowImpl(FLOW_TYPE_3);
        String defaultAfterPage3 = "default-after-page-for-"+FLOW_TYPE_3;
        String defaultPage3 = "page-of-"+FLOW_TYPE_3;
        continuedFlow.setPageName(defaultPage3);
        continuedFlow.setDefaultAfterPage(defaultAfterPage3);
        FlowActivityImpl fa3_1 = new FlowActivityImpl().initInvisible(false);
        continuedFlow.addActivity(fa3_1);

        Object returnToFlowLookupKey = true;
        FlowManagement baseFlowManagement = getFlowManagement(mainFlow, subFlow, continuedFlow);
        FlowState flowState1 = baseFlowManagement.startFlowState(FLOW_TYPE_1, true, null, returnToFlowLookupKey);
View Full Code Here

     * <li>make sure that cache is cleared on flow completion.</li>
     * </ul>
     */
    @Test(enabled=TEST_ENABLED)
    public void testAvoidConflictsOnFlowTransitions() {
        FlowActivityImpl flowActivity1 = new FlowActivityImpl().initInvisible(false);
        // initialized by "first" flow ignored by second flow.
        final String initializedByFirst = "initializedByFirst";
        flowActivity1.addPropertyDefinitions(new FlowPropertyDefinitionImpl(initializedByFirst).initPropertyUsage(PropertyUsage.initialize));

        FlowTestingUtils flowTestingUtils = new FlowTestingUtils();
        flowTestingUtils.addFlowDefinition("first", flowActivity1,
            new TransitionFlowActivity(null, "second", TransitionType.normal));

        FlowActivityImpl flowActivity2 = new FlowActivityImpl().initInvisible(false);
        // this property name is unknown to "first" flow so "first" flow should not affect this property value at all.
        // for second flow, the property is flowLocal/ internalState so the setting should only affect the flowLocal copy.
        String privatePropertyForSecondFlow = "privateForSecond";
        String globalSettingForSecondFlowPrivateProperty = "global_for_privateForSecond";
        FlowPropertyDefinitionImpl flowPropertyDefinition_secondflow_prop0 = new FlowPropertyDefinitionImpl(privatePropertyForSecondFlow, Boolean.class).initAccess(flowLocal, PropertyUsage.internalState);
        // first flow doesn't understand this property but it sets it for the second flow to use.
        String opaqueSecondFlowProperty = "secondFlowProperty";
        flowActivity2.addPropertyDefinitions(
            flowPropertyDefinition_secondflow_prop0,
            new FlowPropertyDefinitionImpl(opaqueSecondFlowProperty, String.class).initPropertyScope(flowLocal).initPropertyUsage(PropertyUsage.io)
            );
        flowTestingUtils.addFlowDefinition("second", flowActivity2);
        FlowManagement flowManagement = flowTestingUtils.getFlowManagement();
View Full Code Here

     * Test to make sure that a {@link FlowActivityImpl} returns true (advance to next {@link FlowActivity} ) in {@link FlowActivityImpl#activate(FlowStepDirection)} if there
     * is no page or component name.
     */
    @Test(enabled=TEST_ENABLED)
    public void testTransitionActivate() {
        FlowActivityImpl obj = new FlowActivityImpl();
        FlowImplementor flow = EasyMock.createMock(FlowImplementor.class);
        FlowState flowState = EasyMock.createNiceMock(FlowStateImplementor.class);
        expect(flow.getFlowState()).andReturn(flowState).anyTimes();
        expect(flow.getFlowPropertyDefinition(FlowConstants.FAINVISIBLE)).andReturn(new FlowPropertyDefinitionImpl(FlowConstants.FAINVISIBLE, boolean.class)).anyTimes();
        expect(flow.getFlowPropertyDefinition(FlowConstants.FSAUTO_COMPLETE)).andReturn(new FlowPropertyDefinitionImpl(FlowConstants.FSAUTO_COMPLETE, boolean.class)).anyTimes();
        obj.setFlow(flow);
        EasyMock.replay(flow, flowState);
        assertTrue(obj.activate(FlowStepDirection.inPlace));
        obj.setPageName("foo");
        assertFalse(obj.activate(FlowStepDirection.inPlace));
        obj.setPageName(null);
        assertTrue(obj.activate(FlowStepDirection.inPlace));
        obj.setComponentName("foo");
        assertFalse(obj.activate(FlowStepDirection.inPlace));
    }
View Full Code Here

TOP

Related Classes of org.amplafi.flow.impl.FlowActivityImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.