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

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


        verify(logService).doSomething("42");
    }

    @Test
    public void testUpdateRule_shouldWork() throws Exception {
        manager.update(new RuleBaseElementId(RuleBaseElementType.Rule, "hello1"),
            "when\n Event ( name == \"test-context\")\n then \n example.doSomething(\"21\");");
        Event event = new Event("test-context");
        service.processEvent(event);
        verify(logService).doSomething("21");
    }
View Full Code Here


    }

    @Test
    public void testAddInvalidRule_shouldNotModifyRulebase() throws Exception {
        try {
            manager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "hello"), "this*is_invalid");
            fail("expected Exception");
        } catch (RuleBaseException e) {
            // expected
        }
        Event event = new Event("test-context");
View Full Code Here

    }

    @Test
    public void testInvalidModifyRule_shouldNotModifyRulebase() throws Exception {
        try {
            manager.update(new RuleBaseElementId(RuleBaseElementType.Rule, "hello1"), "this*is_invalid");
            fail("expected Exception");
        } catch (RuleBaseException e) {
            assertThat(e.getCause(), nullValue());
        }
        Event event = new Event("test-context");
View Full Code Here

        verify(logService).doSomething(eq("" + id));
    }

    @Test
    public void testStartWorkflowTriggeredByEvent_shouldStartWorkflow() throws Exception {
        manager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "test42"), "when\n" + "  Event()\n" + "then\n"
                + "  kcontext.getKnowledgeRuntime().startProcess(\"ci\");\n");
        service.processEvent(new Event());
        assertThat(service.getRunningFlows().isEmpty(), is(false));
    }
View Full Code Here

    }

    @Test
    public void testProcessEventsConcurrently_shouldProcessBothEvents() throws Exception {
        manager.addImport(TestEvent.class.getName());
        manager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "concurrent test"), "when\n"
                + "TestEvent(value == \"0\")\n"
                + "then\n"
                + "example.doSomething(\"concurrent\");");
        manager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "concurrent test1"), "when\n"
                + "TestEvent(value == \"1\")\n"
                + "then\n"
                + "Thread.sleep(1000);");
        Callable<Void> task = makeProcessEventTask(new TestEvent("1"));
        Callable<Void> task2 = makeProcessEventTask(new TestEvent("0"));
View Full Code Here

    public void testResponseRule_shouldProcessEvent() throws Exception {
        NullDomain nullDomainImpl = mock(NullDomain.class);
        registerServiceViaId(nullDomainImpl, "test-connector", NullDomain.class, Domain.class);

        manager.addImport(NullDomain.class.getName());
        manager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "response-test"), ""
                + "when\n"
                + "   e : Event()\n"
                + "then\n"
                + "   NullDomain origin = (NullDomain) OsgiHelper.getResponseProxy(e, NullDomain.class);"
                + "   origin.nullMethod(42);");
View Full Code Here

        verify(nullDomainImpl).nullMethod(42);
    }

    @Test
    public void testTriggerExceptionInEventProcessing_shouldNotKeepLocked() throws Exception {
        manager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "response-test"), ""
                + "when\n"
                + "   e : Event(name==\"evil\")\n"
                + "then\n"
                + "   String testxx = null;"
                + "   testxx.toString();"); // provoke NPE
View Full Code Here

        }
    }

    @Test
    public void testSerializeConsequenceException_shouldReturnString() throws Exception {
        manager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "response-test"), ""
                + "when\n"
                + "   e : Event(name==\"evil\")\n"
                + "then\n"
                + "   String testxx = null;"
                + "   testxx.toString();"); // provoke NPE
View Full Code Here

    private void setupRulemanager() throws Exception {
        manager = RuleUtil.getRuleManager();
        RuleUtil.addImportsAndGlobals(manager);
        RuleUtil.addHello1Rule(manager);
        RuleUtil.addTestFlows(manager);
        manager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "logtest"),
            "when\n Event ( name == \"test-context\")\n then \n example.doSomething(\"42\");");
    }
View Full Code Here

        File processFile = readExampleProcessFile();

        workflowDeployer.install(ruleFile);
        workflowDeployer.install(processFile);

        RuleBaseElementId idRule = new RuleBaseElementId(RuleBaseElementType.Rule, "org.openengsb", "rule");
        RuleBaseElementId idProcess = new RuleBaseElementId(RuleBaseElementType.Process, "org.openengsb", "process");

        verify(ruleManager, times(1)).addOrUpdate(idRule, FileUtils.readFileToString(ruleFile));
        verify(ruleManager, times(1)).addOrUpdate(idProcess, FileUtils.readFileToString(processFile));
    }
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.