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

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


    public static List<Object[]> data() {
        List<Object[]> data = new ArrayList<Object[]>();

        List<TestElement> testData = new ArrayList<TestElement>();
        // functions:
        RuleBaseElementId funcId1 = new RuleBaseElementId(RuleBaseElementType.Function, "org.openengsb", "test42");
        RuleBaseElementId funcId2 = new RuleBaseElementId(RuleBaseElementType.Function, "at.ac.tuwien", "test");
        String func1 = "function void test42(){ System.out.println(\"sample-code\");}";
        String func2 = "function void test(){ System.out.println(\"bla42\");}";

        testData.add(new TestElement(funcId1, func1));
        testData.add(new TestElement(funcId1, func1));
        testData.add(new TestElement(funcId2, func2));
        testData.add(new TestElement(funcId2, func2));
        data.add(new Object[]{ testData });

        testData = new ArrayList<TestElement>();

        RuleBaseElementId ruleId1 = new RuleBaseElementId(RuleBaseElementType.Rule, "org.openengsb", "test42");
        RuleBaseElementId ruleId2 = new RuleBaseElementId(RuleBaseElementType.Rule, "at.ac.tuwien", "test");
        String rule1 = "when\nthen\nSystem.out.println(\"sample-code\");";
        String rule2 = "when\nthen\nSystem.out.println(\"\");";

        testData.add(new TestElement(ruleId1, rule1));
        testData.add(new TestElement(ruleId1, rule2));
        testData.add(new TestElement(ruleId2, rule1));
        testData.add(new TestElement(ruleId2, rule2));
        data.add(new Object[]{ testData });

        testData = new ArrayList<TestElement>();
        String sampleFlow = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                + "<process xmlns=\"http://drools.org/drools-5.0/process\""
                + "         xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\""
                + "         xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-5.0.xsd\""
                + "         type=\"RuleFlow\" name=\"flowname\" id=\"flowId\" "
                + "package-name=\"org.openengsb\" >" + "" + "  <header>" + "  </header>" + "  <nodes>"
                + "    <start id=\"1\" name=\"Start\" x=\"100\" y=\"100\" width=\"48\" height=\"48\" />"
                + "    <end id=\"2\" name=\"End\" x=\"245\" y=\"105\" width=\"48\" height=\"48\" />" + "  </nodes>"
                + "  <connections>" + "    <connection from=\"1\" to=\"2\" />" + "  </connections>" + "</process>";

        RuleBaseElementId flowId1 = new RuleBaseElementId(RuleBaseElementType.Process, "org.openengsb", "flowId");
        RuleBaseElementId flowId2 = new RuleBaseElementId(RuleBaseElementType.Process, "at.ac.tuwien", "flowId2");

        testData.add(new TestElement(flowId1, sampleFlow));
        testData.add(new TestElement(flowId1, sampleFlow));
        sampleFlow = sampleFlow.replace("org.openengsb", "at.ac.tuwien").replace("flowId", "flowId2");
        testData.add(new TestElement(flowId2, sampleFlow));
View Full Code Here


        assertTrue("Testpanel was not found!", taskOverviewPage.asText().contains("I am a test message!"));

    }

    private void addWorkflow() throws IOException, RuleBaseException {
        if (ruleManager.get(new RuleBaseElementId(RuleBaseElementType.Process, WORKFLOW)) == null) {
            InputStream is =
                getClass().getClassLoader().getResourceAsStream("rulebase/org/openengsb/" + WORKFLOW + ".rf");
            String testWorkflow = IOUtils.toString(is);
            RuleBaseElementId id = new RuleBaseElementId(RuleBaseElementType.Process, WORKFLOW);
            ruleManager.add(id, testWorkflow);
            IOUtils.closeQuietly(is);
        }
    }
View Full Code Here

    public void setCode(String code) {
        this.code = code;
    }

    public RuleBaseElementId generateId() {
        return new RuleBaseElementId(type, packageName, name);
    }
View Full Code Here

        builder.reloadPackage(name.getPackageName());
    }

    @Override
    public Collection<RuleBaseElementId> listAll(RuleBaseElementType type) {
        RuleBaseElementId example = new RuleBaseElementId();
        example.setPackageName(null);
        example.setType(type);
        return listByExample(example);
    }
View Full Code Here

        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

        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

        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

        taskboxService.finishTask(task);
        assertThat(taskboxService.getOpenTasks().size(), is(0));
    }

    private void addWorkflow(String workflow) throws IOException, RuleBaseException {
        if (ruleManager.get(new RuleBaseElementId(RuleBaseElementType.Process, workflow)) == null) {
            InputStream is =
                getClass().getClassLoader().getResourceAsStream("rulebase/org/openengsb/" + workflow + ".rf");
            String testWorkflow = IOUtils.toString(is);
            RuleBaseElementId id = new RuleBaseElementId(RuleBaseElementType.Process, workflow);
            ruleManager.add(id, testWorkflow);
            IOUtils.closeQuietly(is);
        }
    }
View Full Code Here

        addWorkflow("simpleFlow");
        String string = null;
        while (string == null) {
            // TODO OPENENGSB-2097 find a better way than an endless loop
            logger.warn("checking for simpleFlow to be present");
            string = ruleManager.get(new RuleBaseElementId(RuleBaseElementType.Process, "simpleFlow"));
            Thread.sleep(1000);
        }
    }
View Full Code Here

    protected DefaultOsgiUtilsService getOsgiUtils() throws Exception {
        return new DefaultOsgiUtilsService(getBundleContext());
    }

    protected void addWorkflow(String workflow) throws IOException, RuleBaseException {
        if (ruleManager.get(new RuleBaseElementId(RuleBaseElementType.Process, workflow)) == null) {
            InputStream is =
                getClass().getClassLoader().getResourceAsStream("rulebase/org/openengsb/" + workflow + ".rf");
            String testWorkflow = IOUtils.toString(is);
            RuleBaseElementId id = new RuleBaseElementId(RuleBaseElementType.Process, workflow);
            ruleManager.add(id, testWorkflow);
            IOUtils.closeQuietly(is);
        }
    }
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.