Package org.openengsb.core.workflow.api

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


        globals.put("glob1", "aaaa.bbbb.ccc");
        globals.put("glob2", "aaaa.bbbb.ddd");
        globals.put("glob3", "aaaa.bbbb.eee");

        when(ruleManager.listGlobals()).thenReturn(globals);
        doThrow(new RuleBaseException()).when(ruleManager).addGlobal("test", "test");
        doThrow(new RuleBaseException()).when(ruleManager).removeGlobal("test");
        doAnswer(new Answer<Object>() {
            @Override
            public Object answer(InvocationOnMock invocation) {
                Object[] args = invocation.getArguments();
                globals.put((String) args[1], (String) args[0]);
View Full Code Here


        imports.add("aaaa.bbbb.ccc");
        imports.add("aaaa.bbbb.ddd");
        imports.add("aaaa.bbbb.eee");

        when(ruleManager.listImports()).thenReturn(imports);
        doThrow(new RuleBaseException()).when(ruleManager).addImport("test");
        doThrow(new RuleBaseException()).when(ruleManager).removeImport("test");

        doAnswer(new Answer<Object>() {
            @Override
            public Object answer(InvocationOnMock invocation) {
                Object[] args = invocation.getArguments();
View Full Code Here

    }

    @Test
    @SuppressWarnings("unchecked")
    public void testSubmitChangesWithErrors_shouldShowError() throws Exception {
        doThrow(new RuleBaseException("error")).when(ruleManager).update((RuleBaseElementId) anyObject(), anyString());

        enterText();
        tester.executeAjaxEvent("ruleEditor:form:save", "onclick");

        verify(ruleManager, times(1)).update(ruleBaseElementId, "modified source");
View Full Code Here

    }

    @Test
    @SuppressWarnings("unchecked")
    public void testSubmitNewWithErrors_shouldShowError() throws Exception {
        doThrow(new RuleBaseException("error")).when(ruleManager).add((RuleBaseElementId) anyObject(), anyString());
        tester.executeAjaxEvent("ruleEditor:form:new", "onclick");
        TextField<String> rulename = (TextField<String>) tester
            .getComponentFromLastRenderedPage("ruleEditor:form:ruleName");
        assertEquals("rulename", rulename.getModelObject());
        assertTrue(rulename.isVisible());
View Full Code Here

                Resource resource = ResourceFactory.newReaderResource(new StringReader(drf));
                builder.add(resource, ResourceType.DRF);
            }
        }
        if (builder.hasErrors()) {
            throw new RuleBaseException(builder.getErrors().toString());
        }
        return builder.getKnowledgePackages();
    }
View Full Code Here

    public void add(RuleBaseElementId name, String code) throws RuleBaseException {
        try {
            List<RuleBaseConfiguration> existingRules =
                rulePersistence.load(new RuleBaseElement(name).toMetadata());
            if (!existingRules.isEmpty()) {
                throw new RuleBaseException("rule already exists");
            }
        } catch (PersistenceException e1) {
            throw new RuleBaseException("could not load existing rules from persistence service", e1);
        }

        RuleBaseElement objectToPersist = new RuleBaseElement(name, code);
        Map<String, String> metaData = objectToPersist.toMetadata();
        RuleBaseConfiguration conf = new RuleBaseConfiguration(metaData, objectToPersist);

        try {
            rulePersistence.persist(conf);
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
        }
        try {
            builder.reloadPackage(name.getPackageName());
        } catch (RuleBaseException e) {
            try {
                rulePersistence.remove(metaData);
                throw e;
            } catch (PersistenceException e1) {
                throw new RuleBaseException("could not remove previously added rule, that broke the rulebase", e1);
            }
        }
    }
View Full Code Here

                return null;
            } else {
                return existingRules.get(0).getContent().getCode();
            }
        } catch (PersistenceException e) {
            throw new RuleBaseException("error reading rule from persistence", e);
        }
    }
View Full Code Here

        RuleBaseConfiguration conf = new RuleBaseConfiguration(newBean);

        try {
            rulePersistence.persist(conf);
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
        }
        builder.reloadPackage(name.getPackageName());
    }
View Full Code Here

    public void delete(RuleBaseElementId name) throws RuleBaseException {
        try {
            Map<String, String> metaData = new RuleBaseElement(name).toMetadata();
            rulePersistence.remove(metaData);
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
        }
        builder.reloadPackage(name.getPackageName());
    }
View Full Code Here

    private Collection<RuleBaseElementId> listByExample(RuleBaseElementId example) {
        List<RuleBaseConfiguration> queryResult;
        try {
            queryResult = rulePersistence.load(new RuleBaseElement(example).toMetadata());
        } catch (PersistenceException e) {
            throw new RuleBaseException("error reading rule from persistence", e);
        }

        Collection<RuleBaseElementId> result = new HashSet<RuleBaseElementId>();
        for (RuleBaseConfiguration element : queryResult) {
            result.add(element.getContent().generateId());
View Full Code Here

TOP

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

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.