Package org.openengsb.core.workflow.api.model

Examples of org.openengsb.core.workflow.api.model.RuleBaseElementId


        ruleChoice.setModel(new Model<RuleBaseElementId>());
    }

    private void reloadTextArea(AjaxRequestTarget target) {
        target.add(textArea);
        RuleBaseElementId selection = ruleChoice.getModelObject();
        if (selection != null) {
            textArea.setModel(new Model<String>(ruleManagerProvider.getRuleManager().get(selection)));
            textArea.setEnabled(true);
            enableDeleteButton(target);
        } else {
View Full Code Here


        }
        disableButtons(target);
    }

    private void updateRule(AjaxRequestTarget target) {
        RuleBaseElementId selection = ruleChoice.getModelObject();
        String text = textArea.getModelObject();
        boolean error = false;
        if (selection != null && text != null) {
            try {
                ruleManagerProvider.getRuleManager().update(selection, text);
View Full Code Here

        }
        disableButtons(target);
    }

    private void deleteRule(AjaxRequestTarget target) {
        RuleBaseElementId selection = ruleChoice.getModelObject();
        ruleManagerProvider.getRuleManager().delete(selection);
        reloadTextArea(target);
        reloadRuleChoice(target);
    }
View Full Code Here

        trackInvocations((DummyExampleDomain) domains.get("example"), latch).doSomething("it works");

        RemoteEvent reg = new RemoteEvent(TestEvent.class.getName());
        regService.registerEvent(reg, "testPort", "test://localhost", "workflowService");
        String ruleCode = "when RemoteEvent() then example.doSomething(\"it works\");";
        manager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "react to remote-event"), ruleCode);
        service.processEvent(new TestEvent());
        assertThat("did not call example.doSomething() after RemoteEvent", latch.await(5, TimeUnit.SECONDS), is(true));

        executorService.shutdown();
        executorService.awaitTermination(3, TimeUnit.SECONDS);
View Full Code Here

        Map<String, String> nestedEventProperties = new HashMap<String, String>();
        nestedEventProperties.put("value", "testValue");
        reg2.setNestedEventProperties(nestedEventProperties);
        regService.registerEvent(reg2, "testPort", "test://localhost", "workflowService");
        String ruleCode = "when RemoteEvent() then example.doSomething(\"it works\");";
        manager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "react to remote-event"), ruleCode);
        service.processEvent(new TestEvent());

        assertThat(latch.await(5, TimeUnit.SECONDS), is(true));

        executorService.shutdown();
View Full Code Here

        ruleManager.init();
        return ruleManager;
    }

    public static void addHello1Rule(RuleManager manager) throws Exception {
        RuleBaseElementId id = new RuleBaseElementId(RuleBaseElementType.Rule, "hello1");
        String rule = readRule("hello1");
        manager.add(id, rule);
    }
View Full Code Here

        addFlow(manager, "simpleFlow");
        addFlow(manager, "backgroundFlow");
    }

    private static void addFlow(RuleManager manager, String flow) throws IOException, RuleBaseException {
        RuleBaseElementId testFlowId = new RuleBaseElementId(RuleBaseElementType.Process, flow);
        String code = readFlow(flow);
        manager.add(testFlowId, code);
    }
View Full Code Here

public class RuleEditorTest extends AbstractUITest {
    private RuleBaseElementId ruleBaseElementId;

    @Before
    public void init() throws RuleBaseException {
        ruleBaseElementId = new RuleBaseElementId(RuleBaseElementType.Rule, "org.opentest", "test1");
        Collection<RuleBaseElementId> rules = Arrays
            .asList(ruleBaseElementId, new RuleBaseElementId(RuleBaseElementType.Rule, "org.opentest", "test2"));
        when(ruleManager.listAll(RuleBaseElementType.Rule)).thenReturn(rules);
        when(ruleManager.get(ruleBaseElementId)).thenReturn("testsource");
        tester.startPage(RuleEditorPage.class);
        verify(ruleManager).listAll(RuleBaseElementType.Rule);
    }
View Full Code Here

        assertTrue(tester.getComponentFromLastRenderedPage("ruleEditor:form:ruleChoice").isVisible());
        tester.assertComponent("ruleEditor:form:ruleChoice", DropDownChoice.class);

        assertEquals(RuleBaseElementType.Rule, ((DropDownChoice<RuleBaseElementType>) tester
            .getComponentFromLastRenderedPage("ruleEditor:form:typeChoice")).getDefaultModelObject());
        RuleBaseElementId ruleBaseElementId = new RuleBaseElementId(RuleBaseElementType.Rule, "rulename");
        verify(ruleManager).add(ruleBaseElementId, "new rule source");
        verify(ruleManager, times(2)).listAll(RuleBaseElementType.Rule);
        assertEquals(ruleBaseElementId,
            tester.getComponentFromLastRenderedPage("ruleEditor:form:ruleChoice").getDefaultModelObject());
    }
View Full Code Here

        assertTrue(tester.getComponentFromLastRenderedPage("ruleEditor:form:cancel").isEnabled());
        assertFalse(tester.getComponentFromLastRenderedPage("ruleEditor:form:new").isEnabled());
        tester.executeAjaxEvent("ruleEditor:form:save", "onclick");

        verify(ruleManager, times(1))
            .add(new RuleBaseElementId(RuleBaseElementType.Rule, "rulename"), "new rule source");
        textArea = (TextArea<String>) tester.getComponentFromLastRenderedPage("ruleEditor:form:text");
        assertTrue(textArea.isEnabled());
        assertEquals("new rule source", textArea.getModelObject());
        tester.assertErrorMessages(new String[]{ "error" });
        assertFalse(tester.getComponentFromLastRenderedPage("ruleEditor:form:cancel").isEnabled());
View Full Code Here

TOP

Related Classes of org.openengsb.core.workflow.api.model.RuleBaseElementId

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.