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

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


        LOGGER.debug("persisting global \"{}\"", config.getContent().getVariableName());
        Preconditions.checkArgument(supports((Class<? extends ConfigItem<?>>) config.getClass()),
            "Argument type not supported");

        Map<String, String> globals = readStorageFile();
        GlobalDeclaration global = config.getContent();
        globals.put(global.getVariableName(), global.getClassName());
        writeStorageFile(globals);
    }
View Full Code Here


        List<ConfigItem<GlobalDeclaration>> ret = new ArrayList<ConfigItem<GlobalDeclaration>>();
        Map<String, String> globals = readStorageFile();

        if (globals.containsKey(variableName)) {
            String className = globals.get(variableName);
            GlobalDeclaration global = new GlobalDeclaration(className, variableName);
            GlobalConfiguration cnf = new GlobalConfiguration(global.toMetadata(), global);
            ret.add(cnf);
        }
        return ret;
    }
View Full Code Here

        LOGGER.debug("Load all globals");
        List<ConfigItem<GlobalDeclaration>> ret = new ArrayList<ConfigItem<GlobalDeclaration>>();
        Map<String, String> globals = readStorageFile();

        for (Entry<String, String> entry : globals.entrySet()) {
            GlobalDeclaration global = new GlobalDeclaration(entry.getValue(), entry.getKey());
            GlobalConfiguration cnf = new GlobalConfiguration(global.toMetadata(), global);
            ret.add(cnf);
        }
        return ret;
    }
View Full Code Here

        assertFalse(service.supports(ImportConfiguration.class));
    }

    @Test
    public void testPersistGlobalConfiguration_shouldPersistAndLoadConfig() throws Exception {
        GlobalConfiguration conf = new GlobalConfiguration(new GlobalDeclaration("java.util.List", "list"));
        service.persist(conf);

        List<ConfigItem<GlobalDeclaration>> loaded = service.load(conf.getMetaData());
        assertEquals(1, loaded.size());
        GlobalConfiguration confLoaded = (GlobalConfiguration) loaded.get(0);
View Full Code Here

    @Test
    public void testPersistGlobalConfiguration_shouldCreateFileIfNoneExists() throws Exception {
        FileUtils.forceDelete(storageFile);
        assertFalse(storageFile.exists());
        GlobalConfiguration conf = new GlobalConfiguration(new GlobalDeclaration("java.util.List", "list"));
        service.persist(conf);
        assertTrue(storageFile.exists());
    }
View Full Code Here

        assertTrue(storageFile.exists());
    }

    @Test
    public void testPersistGlobalConfiguration_shouldUpdatePreviousConfiguration() throws Exception {
        GlobalConfiguration conf = new GlobalConfiguration(new GlobalDeclaration("java.util.List", "list"));
        service.persist(conf);

        conf.getContent().setClassName("java.util.ArrayList");
        service.persist(conf);
View Full Code Here

        assertEquals("java.util.ArrayList", confLoaded.getContent().getClassName());
    }

    @Test
    public void testLoadGlobalConfiguration_shouldOnlyLoadOneConfig() throws Exception {
        GlobalConfiguration conf1 = new GlobalConfiguration(new GlobalDeclaration("java.util.List", "list"));
        GlobalConfiguration conf2 = new GlobalConfiguration(new GlobalDeclaration("java.util.Map", "map"));
        GlobalConfiguration conf3 = new GlobalConfiguration(new GlobalDeclaration("java.util.Dictionary", "dict"));

        service.persist(conf1);
        service.persist(conf2);
        service.persist(conf3);
View Full Code Here

        assertEquals("map", confLoaded.getContent().getVariableName());
    }

    @Test
    public void testLoadGlobalConfiguration_shouldLoadAllConfig() throws Exception {
        GlobalConfiguration conf1 = new GlobalConfiguration(new GlobalDeclaration("java.util.List", "list"));
        GlobalConfiguration conf2 = new GlobalConfiguration(new GlobalDeclaration("java.util.Map", "map"));
        GlobalConfiguration conf3 = new GlobalConfiguration(new GlobalDeclaration("java.util.Dictionary", "dict"));

        service.persist(conf1);
        service.persist(conf2);
        service.persist(conf3);
View Full Code Here

        assertEquals(0, loaded.size());
    }

    @Test
    public void testRemoveGlobalConfiguration_ShouldDeleteConfiguration() throws Exception {
        GlobalConfiguration conf1 = new GlobalConfiguration(new GlobalDeclaration("java.util.List", "list"));
        GlobalConfiguration conf2 = new GlobalConfiguration(new GlobalDeclaration("java.util.Map", "map"));

        service.persist(conf1);
        service.persist(conf2);

        service.remove(conf1.getMetaData());
View Full Code Here

        return result;
    }

    @Override
    public void addGlobal(String className, String name) throws RuleBaseException {
        GlobalDeclaration globalDeclaration = new GlobalDeclaration(name);
        Map<String, String> metaData = globalDeclaration.toMetadata();
        List<GlobalConfiguration> queryResult;
        try {
            queryResult = globalPersistence.load(metaData);
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
        }
        if (!queryResult.isEmpty()) {
            throw new RuleBaseException(String.format("Global with name \"%s\" already exists", name));
        }
        globalDeclaration.setClassName(className);
        GlobalConfiguration cnf = new GlobalConfiguration(metaData, globalDeclaration);
        try {
            globalPersistence.persist(cnf);
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
View Full Code Here

TOP

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

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.