Package org.openengsb.core.workflow.drools.model

Examples of org.openengsb.core.workflow.drools.model.RuleBaseConfiguration


        element.setCode("code");
        element.setName("name");
        element.setPackageName("package.org");
        element.setType(RuleBaseElementType.Rule);

        RuleBaseConfiguration conf = new RuleBaseConfiguration(element);
        service.persist(conf);

        String expectedFilename =
            String.format("%s%s%s%s%s", element.getType(), separator, element.getName(), separator
                , encoder.encode(element.getPackageName()));
        File expectedTarget = new File(storageFolder, expectedFilename);
        assertTrue(expectedTarget.exists());
        String code = FileUtils.readFileToString(expectedTarget);
        assertEquals("code", code);

        List<ConfigItem<RuleBaseElement>> loaded = service.load(conf.getMetaData());
        assertEquals(1, loaded.size());
        RuleBaseElement loadedElement = loaded.get(0).getContent();
        assertEquals(element.getName(), loadedElement.getName());
        assertEquals(element.getCode(), loadedElement.getCode());
        assertEquals(element.getPackageName(), loadedElement.getPackageName());
View Full Code Here


        RuleBaseElement element = new RuleBaseElement();
        element.setCode("code");
        element.setName("name");
        element.setPackageName("package.org");
        element.setType(RuleBaseElementType.Rule);
        RuleBaseConfiguration conf = new RuleBaseConfiguration(element);
        service.persist(conf);

        conf.getContent().setCode("new code");
        service.persist(conf);

        List<ConfigItem<RuleBaseElement>> loaded = service.load(conf.getMetaData());
        assertEquals(1, loaded.size());
        RuleBaseElement loadedElement = loaded.get(0).getContent();
        assertEquals("new code", loadedElement.getCode());
    }
View Full Code Here

        RuleBaseElement element = new RuleBaseElement();
        element.setCode("code");
        element.setName("name");
        element.setPackageName("package.org");
        element.setType(RuleBaseElementType.Rule);
        RuleBaseConfiguration conf1 = new RuleBaseConfiguration(element);
        service.persist(conf1);

        element.setPackageName("org.openengsb");
        RuleBaseConfiguration conf2 = new RuleBaseConfiguration(element);
        service.persist(conf2);

        element.setType(RuleBaseElementType.Process);
        RuleBaseConfiguration conf3 = new RuleBaseConfiguration(element);
        service.persist(conf3);

        Map<String, String> metadata = new HashMap<String, String>();
        metadata.put(RuleBaseElement.META_RULE_TYPE, RuleBaseElementType.Rule.toString());

        List<ConfigItem<RuleBaseElement>> loadedList = service.load(metadata);
        assertEquals(2, loadedList.size());
        RuleBaseConfiguration loaded1 = (RuleBaseConfiguration) loadedList.get(0);
        RuleBaseConfiguration loaded2 = (RuleBaseConfiguration) loadedList.get(1);
        assertEquals(RuleBaseElementType.Rule, loaded1.getContent().getType());
        assertEquals(RuleBaseElementType.Rule, loaded2.getContent().getType());
    }
View Full Code Here

        RuleBaseElement element = new RuleBaseElement();
        element.setCode("code");
        element.setName("name");
        element.setPackageName("package.org");
        element.setType(RuleBaseElementType.Rule);
        RuleBaseConfiguration conf1 = new RuleBaseConfiguration(element);
        service.persist(conf1);

        element.setPackageName("org.openengsb");
        RuleBaseConfiguration conf2 = new RuleBaseConfiguration(element);
        service.persist(conf2);

        element.setType(RuleBaseElementType.Process);
        RuleBaseConfiguration conf3 = new RuleBaseConfiguration(element);
        service.persist(conf3);

        List<ConfigItem<RuleBaseElement>> loadedList = service.load(new HashMap<String, String>());
        assertEquals(3, loadedList.size());
    }
View Full Code Here

        element.setCode("code");
        element.setName("name");
        element.setPackageName("package.org");
        element.setType(RuleBaseElementType.Rule);

        RuleBaseConfiguration conf = new RuleBaseConfiguration(element);
        service.persist(conf);

        String expectedFilename =
            String.format("%s%s%s%s%s", element.getType(), separator, element.getName(), separator
                , encoder.encode(element.getPackageName()));
        File expectedTarget = new File(storageFolder, expectedFilename);
        assertTrue(expectedTarget.exists());
        service.remove(conf.getMetaData());
        assertFalse(expectedTarget.exists());

        assertEquals(0, service.load(conf.getMetaData()).size());
    }
View Full Code Here

        RuleBaseElement element = new RuleBaseElement();
        element.setCode("code");
        element.setName("name");
        element.setPackageName("package.org");
        element.setType(RuleBaseElementType.Rule);
        RuleBaseConfiguration conf1 = new RuleBaseConfiguration(element);
        service.persist(conf1);

        element.setPackageName("org.openengsb");
        RuleBaseConfiguration conf2 = new RuleBaseConfiguration(element);
        service.persist(conf2);

        element.setType(RuleBaseElementType.Process);
        RuleBaseConfiguration conf3 = new RuleBaseConfiguration(element);
        service.persist(conf3);

        Map<String, String> metadata = new HashMap<String, String>();
        metadata.put(RuleBaseElement.META_RULE_TYPE, RuleBaseElementType.Rule.toString());

        service.remove(metadata);

        List<ConfigItem<RuleBaseElement>> remainingList = service.load(new HashMap<String, String>());
        assertEquals(1, remainingList.size());
        RuleBaseConfiguration remainingElement = (RuleBaseConfiguration) remainingList.get(0);
        assertEquals(RuleBaseElementType.Process, remainingElement.getContent().getType());
    }
View Full Code Here

        } catch (IOException e) {
            throw new PersistenceException(e);
        } catch (DecoderException e) {
            throw new PersistenceException(e);
        }
        return new RuleBaseConfiguration(element.toMetadata(), element);
    }
View Full Code Here

            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);
View Full Code Here

    }

    @Override
    public void update(RuleBaseElementId name, String newCode) throws RuleBaseException {
        RuleBaseElement newBean = new RuleBaseElement(name, newCode);
        RuleBaseConfiguration conf = new RuleBaseConfiguration(newBean);

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

TOP

Related Classes of org.openengsb.core.workflow.drools.model.RuleBaseConfiguration

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.