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

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


        List<ConfigItem<ImportDeclaration>> ret = new ArrayList<ConfigItem<ImportDeclaration>>();
        List<String> imports = readStorageFile();

        if (imports.contains(clazz)) {
            ImportDeclaration importDec = new ImportDeclaration(clazz);
            ImportConfiguration cnf = new ImportConfiguration(importDec.toMetadata(), importDec);
            ret.add(cnf);
        }
        return ret;
    }
View Full Code Here


        List<ConfigItem<ImportDeclaration>> ret = new ArrayList<ConfigItem<ImportDeclaration>>();
        List<String> imports = readStorageFile();

        for (String clazz : imports) {
            ImportDeclaration importDec = new ImportDeclaration(clazz);
            ImportConfiguration cnf = new ImportConfiguration(importDec.toMetadata(), importDec);
            ret.add(cnf);
        }
        return ret;
    }
View Full Code Here

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

    @Test
    public void testPersistImportConfiguration_shouldPersistAndLoadConfig() throws Exception {
        ImportConfiguration conf = new ImportConfiguration(new ImportDeclaration("java.util.List"));
        service.persist(conf);

        List<ConfigItem<ImportDeclaration>> loaded = service.load(conf.getMetaData());
        assertEquals(1, loaded.size());
        ImportConfiguration confLoaded = (ImportConfiguration) loaded.get(0);
        assertTrue(confLoaded.getContent().equals(conf.getContent()));
    }
View Full Code Here

    @Test
    public void testPersistImportConfiguration_shouldCreateFileIfNoneExists() throws Exception {
        FileUtils.forceDelete(storageFile);
        assertFalse(storageFile.exists());
        ImportConfiguration conf = new ImportConfiguration(new ImportDeclaration("java.util.List"));
        service.persist(conf);
        assertTrue(storageFile.exists());
    }
View Full Code Here

        assertTrue(storageFile.exists());
    }

    @Test
    public void testLoadImportConfiguration_shouldOnlyLoadOneConfig() throws Exception {
        ImportConfiguration conf1 = new ImportConfiguration(new ImportDeclaration("java.util.List"));
        ImportConfiguration conf2 = new ImportConfiguration(new ImportDeclaration("java.util.Map"));
        ImportConfiguration conf3 = new ImportConfiguration(new ImportDeclaration("java.util.Dictionary"));

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

        List<ConfigItem<ImportDeclaration>> loaded = service.load(conf2.getMetaData());
        assertEquals(1, loaded.size());
        ImportConfiguration confLoaded = (ImportConfiguration) loaded.get(0);
        assertEquals("java.util.Map", confLoaded.getContent().getClassName());
    }
View Full Code Here

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

    @Test
    public void testLoadImportConfiguration_shouldLoadAllConfig() throws Exception {
        ImportConfiguration conf1 = new ImportConfiguration(new ImportDeclaration("java.util.List"));
        ImportConfiguration conf2 = new ImportConfiguration(new ImportDeclaration("java.util.Map"));
        ImportConfiguration conf3 = new ImportConfiguration(new ImportDeclaration("java.util.Dictionary"));

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

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

    @Test
    public void testRemoveImportConfiguration_ShouldDeleteConfiguration() throws Exception {
        ImportConfiguration conf1 = new ImportConfiguration(new ImportDeclaration("java.util.List"));
        ImportConfiguration conf2 = new ImportConfiguration(new ImportDeclaration("java.util.Map"));

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

        service.remove(conf1.getMetaData());
        List<ConfigItem<ImportDeclaration>> loaded = service.load(new HashMap<String, String>());
        assertEquals(1, loaded.size());
        ImportConfiguration confLoaded = (ImportConfiguration) loaded.get(0);
        assertEquals("java.util.Map", confLoaded.getContent().getClassName());
    }
View Full Code Here

    @Override
    public void addImport(String className) throws RuleBaseException {
        ImportDeclaration imp = new ImportDeclaration(className);
        Map<String, String> metaData = imp.toMetadata();
        ImportConfiguration cnf = new ImportConfiguration(metaData, imp);
        try {
            if (importPersistence.load(metaData).isEmpty()) {
                importPersistence.persist(cnf);
            }
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
        }
        try {
            builder.reloadRulebase();
        } catch (RuleBaseException e) {
            importPersistence.remove(cnf.getMetaData());
            throw e;
        }
    }
View Full Code Here

TOP

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

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.