Search in sources :

Example 1 with ChainedProperties

use of org.kie.internal.utils.ChainedProperties in project drools by kiegroup.

the class ClassLevel method findJavaVersion.

private static void findJavaVersion(ClassLoader classLoader) {
    ChainedProperties chainedProperties = ChainedProperties.getChainedProperties(classLoader);
    if (chainedProperties.getProperty("drools.dialect.java", null) == null) {
        chainedProperties = ChainedProperties.getChainedProperties(ClassGenerator.class.getClassLoader());
    }
    javaVersion = findJavaVersion(chainedProperties);
}
Also used : ChainedProperties(org.kie.internal.utils.ChainedProperties)

Example 2 with ChainedProperties

use of org.kie.internal.utils.ChainedProperties in project jbpm by kiegroup.

the class EmailNotificationPublisherTest method setUp.

@Before
public void setUp() throws Exception {
    System.setProperty("org.jbpm.email.templates.dir", new File("src/test/resources/templates").getAbsolutePath());
    TemplateManager.reset();
    ChainedProperties props = ChainedProperties.getChainedProperties("email.conf", ClassLoaderUtil.getClassLoader(null, getClass(), false));
    emailHost = props.getProperty("mail.smtp.host", "localhost");
    emailPort = props.getProperty("mail.smtp.port", "2345");
    wiser = new Wiser();
    wiser.setHostname(emailHost);
    wiser.setPort(Integer.parseInt(emailPort));
    wiser.start();
    Thread.sleep(200);
    connection = new Connection(emailHost, emailPort);
    userInfo = new DefaultUserInfo(true);
}
Also used : Wiser(org.subethamail.wiser.Wiser) ChainedProperties(org.kie.internal.utils.ChainedProperties) File(java.io.File) DefaultUserInfo(org.jbpm.services.task.identity.DefaultUserInfo) Before(org.junit.Before)

Example 3 with ChainedProperties

use of org.kie.internal.utils.ChainedProperties in project jbpm by kiegroup.

the class EmailWorkItemHandlerTest method setUp.

@Before
public void setUp() throws Exception {
    System.setProperty("org.jbpm.email.templates.dir", new File("src/test/resources/templates").getAbsolutePath());
    TemplateManager.reset();
    ChainedProperties props = ChainedProperties.getChainedProperties("email.conf", ClassLoaderUtil.getClassLoader(null, getClass(), false));
    emailHost = props.getProperty("mail.smtp.host", "localhost");
    emailPort = props.getProperty("mail.smtp.port", "2345");
    wiser = new Wiser();
    wiser.setHostname(emailHost);
    wiser.setPort(Integer.parseInt(emailPort));
    wiser.start();
    Thread.sleep(200);
}
Also used : Wiser(org.subethamail.wiser.Wiser) ChainedProperties(org.kie.internal.utils.ChainedProperties) File(java.io.File) Before(org.junit.Before)

Example 4 with ChainedProperties

use of org.kie.internal.utils.ChainedProperties in project jbpm by kiegroup.

the class TaskReminderTest method setup.

@Before
public void setup() {
    final ChainedProperties props = ChainedProperties.getChainedProperties("email.conf", ClassLoaderUtil.getClassLoader(null, getClass(), false));
    wiser = new Wiser();
    wiser.setHostname(props.getProperty("mail.smtp.host", "localhost"));
    wiser.setPort(Integer.parseInt(props.getProperty("mail.smtp.port", "2345")));
    wiser.start();
    try {
        Thread.sleep(1000);
    } catch (Throwable t) {
    // Do nothing
    }
    pds = setupPoolingDataSource();
    emf = Persistence.createEntityManagerFactory("org.jbpm.services.task");
    this.taskService = (InternalTaskService) HumanTaskServiceFactory.newTaskServiceConfigurator().entityManagerFactory(emf).getTaskService();
}
Also used : Wiser(org.subethamail.wiser.Wiser) ChainedProperties(org.kie.internal.utils.ChainedProperties) Before(org.junit.Before)

Example 5 with ChainedProperties

use of org.kie.internal.utils.ChainedProperties in project drools by kiegroup.

the class DMNAssemblerService method getDMNProfiles.

private List<DMNProfile> getDMNProfiles(KnowledgeBuilderImpl kbuilderImpl) {
    ChainedProperties chainedProperties = kbuilderImpl.getBuilderConfiguration().getChainedProperties();
    List<DMNProfile> dmnProfiles = new ArrayList<>();
    dmnProfiles.addAll(getDefaultDMNProfiles(chainedProperties));
    Map<String, String> dmnProfileProperties = new HashMap<>();
    chainedProperties.mapStartsWith(dmnProfileProperties, DMN_PROFILE_PREFIX, false);
    if (!dmnProfileProperties.isEmpty()) {
        try {
            for (Map.Entry<String, String> dmnProfileProperty : dmnProfileProperties.entrySet()) {
                DMNProfile dmnProfile = (DMNProfile) kbuilderImpl.getRootClassLoader().loadClass(dmnProfileProperty.getValue()).newInstance();
                dmnProfiles.add(dmnProfile);
            }
            return dmnProfiles;
        } catch (Exception e) {
            kbuilderImpl.addBuilderResult(new DMNKnowledgeBuilderError(ResultSeverity.WARNING, "Trying to load a non-existing Kie DMN profile " + e.getLocalizedMessage()));
            logger.error("Trying to load a non-existing Kie DMN profile {}", e.getLocalizedMessage(), e);
            kbuilderImpl.addBuilderResult(new DMNKnowledgeBuilderError(ResultSeverity.WARNING, "DMN Compiler configuration contained errors, will fall-back using empty-configuration compiler."));
            logger.warn("DMN Compiler configuration contained errors, will fall-back using empty-configuration compiler.");
        }
    }
    return dmnProfiles;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ChainedProperties(org.kie.internal.utils.ChainedProperties) DMNKnowledgeBuilderError(org.kie.dmn.core.impl.DMNKnowledgeBuilderError) HashMap(java.util.HashMap) Map(java.util.Map) DMNProfile(org.kie.dmn.core.compiler.DMNProfile) ExtendedDMNProfile(org.kie.dmn.core.compiler.profiles.ExtendedDMNProfile)

Aggregations

ChainedProperties (org.kie.internal.utils.ChainedProperties)6 Wiser (org.subethamail.wiser.Wiser)4 Before (org.junit.Before)3 File (java.io.File)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 DefaultUserInfo (org.jbpm.services.task.identity.DefaultUserInfo)1 DMNProfile (org.kie.dmn.core.compiler.DMNProfile)1 ExtendedDMNProfile (org.kie.dmn.core.compiler.profiles.ExtendedDMNProfile)1 DMNKnowledgeBuilderError (org.kie.dmn.core.impl.DMNKnowledgeBuilderError)1