Package org.openengsb.core.workflow.api

Examples of org.openengsb.core.workflow.api.RuleManager


        assertThat(logService.isWasCalled(), is(true));
    }

    private void addHelloWorldRule() throws Exception {
        RuleManager ruleManager = getOsgiService(RuleManager.class);
        ruleManager.addImport("org.openengsb.domain.example.ExampleDomain");

        ruleManager.addGlobal("org.openengsb.domain.example.ExampleDomain", "example");

        RuleBaseElementId id = new RuleBaseElementId(RuleBaseElementType.Rule, "hello1");
        String rule = readRule();
        ruleManager.add(id, rule);
    }
View Full Code Here


        properties.put("domain", "example");
        properties.put("connector", "example");
        properties.put("location.foo", "example2");
        getBundleContext().registerService(ExampleDomain.class.getName(), exampleMock, properties);

        RuleManager ruleManager = getOsgiService(RuleManager.class);

        ruleManager.addImport(ExampleDomain.class.getName());
        ruleManager.addImport(LogEvent.class.getName());
        ruleManager.addImport(TransformationEngine.class.getName());
        ruleManager.addImport(ModelUtils.class.getName());
        ruleManager.addImport(ExampleResponseModel.class.getName());
        ruleManager.addImport(ExampleRequestModel.class.getName());
        ruleManager.addImport(ModelDescription.class.getName());
        ruleManager.addImport(OpenEngSBModelEntry.class.getName());

        ruleManager.addGlobal(ExampleDomain.class.getName(), "example2");
        ruleManager.addGlobal(TransformationEngine.class.getName(), "ekbTransformationService");

        String sourceDescription = "ModelDescription source = new ModelDescription(\"%s\", \"%s\");";
        String targetDescription = "ModelDescription target = new ModelDescription(\"%s\", \"%s\");";
        sourceDescription =
            String.format(sourceDescription, ExampleResponseModel.class.getName(), exampleDomainVersion.toString());
        targetDescription =
            String.format(targetDescription, ExampleRequestModel.class.getName(), exampleDomainVersion.toString());

        ruleManager.add(
            new RuleBaseElementId(RuleBaseElementType.Rule, "example"),
            ""
                    + "when\n"
                    + "  event : LogEvent()\n"
                    + "then\n"
View Full Code Here

    }
   
    private void waitForRequiredTasks() throws Exception {
        authenticationContext = getOsgiService(AuthenticationContext.class);
        waitForUserDataInitializer();
        RuleManager rm = getOsgiService(RuleManager.class);
        int count = 0;
        while (rm.getGlobalType("auditing") == null) {
            LOGGER.warn("waiting for auditing to finish init");
            waitasec();
            if (count++ > 100) {
                throw new IllegalStateException("auditing-config did not finish in time");
            }
        }
        count = 0;
        while (!rm.listImports().contains(OsgiHelper.class.getName())) {
            LOGGER.warn("waiting for auditing to finish init");
            waitasec();
            if (count++ > 100) {
                throw new IllegalStateException("auditing-config did not finish in time");
            }
        }
        count = 0;
        while (rm.get(new RuleBaseElementId(RuleBaseElementType.Process, "humantask")) == null) {
            LOGGER.warn("waiting for taskboxConfig to finish init");
            waitasec();
            if (count++ > 100) {
                throw new IllegalStateException("taskbox-config did not finish in time");
            }
View Full Code Here

                exampleMock, properties);
    }

    @Test
    public void testCreateRuleAndTriggerDomain_shouldTriggerDomain() throws Exception {
        RuleManager ruleManager = getOsgiService(RuleManager.class);

        ruleManager.addImport(ExampleDomain.class.getName());
        ruleManager.addImport(LogEvent.class.getName());

        ruleManager.addGlobal(ExampleDomain.class.getName(), "example2");

        ruleManager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "example-trigger"), ""
                + "when\n"
                + "    l : LogEvent()\n"
                + "then\n"
                + "    example2.doSomethingWithMessage(\"42\");\n"
        );
View Full Code Here

        assertThat(exampleMock.wasCalled, is(true));
    }

    @Test
    public void testCreateAndTriggerResponseRule_shouldCallOrigin() throws Exception {
        RuleManager ruleManager = getOsgiService(RuleManager.class);

        ruleManager.addImport(ExampleDomain.class.getName());
        ruleManager.addImport(LogEvent.class.getName());

        ruleManager.addGlobal(ExampleDomain.class.getName(), "example2");

        ruleManager.add(new RuleBaseElementId(RuleBaseElementType.Rule, "example-response"), ""
                + "when\n"
                + "    l : LogEvent()\n"
                + "then\n"
                + "   ExampleDomain origin = (ExampleDomain) OsgiHelper.getResponseProxy(l, ExampleDomain.class);"
                + "   origin.doSomethingWithMessage(\"42\");"
View Full Code Here

TOP

Related Classes of org.openengsb.core.workflow.api.RuleManager

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.