提交 1559893a 编写于 作者: J Joram Barrez

Merge branch 'activiti6' into jbarrez-v6

/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.camel;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior;
import org.activiti.engine.impl.delegate.ActivityBehavior;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.util.ProcessDefinitionUtil;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.impl.DefaultExchange;
@Deprecated
public class CamelBehaviour extends BpmnActivityBehavior implements ActivityBehavior {
private static final long serialVersionUID = 1L;
private Collection<ContextProvider> contextProviders;
public CamelBehaviour(Collection<ContextProvider> camelContext) {
this.contextProviders = camelContext;
}
public void execute(DelegateExecution execution) {
ActivitiEndpoint ae = createEndpoint(execution);
Exchange ex = createExchange(execution, ae);
try {
ae.process(ex);
} catch (Exception e) {
throw new RuntimeException(e);
}
execution.setVariables(ExchangeUtils.prepareVariables(ex, ae));
performDefaultOutgoingBehavior((ExecutionEntity) execution);
}
private ActivitiEndpoint createEndpoint(DelegateExecution execution) {
String uri = "activiti://" + getProcessKey(execution) + ":" + execution.getCurrentActivityId();
return getEndpoint(getContext(execution), uri);
}
private ActivitiEndpoint getEndpoint(CamelContext ctx, String key) {
for (Endpoint e : ctx.getEndpoints()) {
if (e.getEndpointKey().equals(key) && (e instanceof ActivitiEndpoint)) {
return (ActivitiEndpoint) e;
}
}
throw new ActivitiException("Activiti endpoint not defined for " + key);
}
private CamelContext getContext(DelegateExecution execution) {
String processKey = getProcessKey(execution);
String names = "";
for (ContextProvider provider : contextProviders) {
CamelContext ctx = provider.getContext(processKey);
if (ctx != null) {
return ctx;
}
}
throw new ActivitiException("Could not find camel context for " + processKey + " names are " + names);
}
private Exchange createExchange(DelegateExecution activityExecution, ActivitiEndpoint endpoint) {
Exchange ex = new DefaultExchange(getContext(activityExecution));
Map<String, Object> variables = activityExecution.getVariables();
if (endpoint.isCopyVariablesToProperties()) {
for (Map.Entry<String, Object> var : variables.entrySet()) {
ex.setProperty(var.getKey(), var.getValue());
}
}
if (endpoint.isCopyVariablesToBodyAsMap()) {
ex.getIn().setBody(new HashMap<String, Object>(variables));
}
return ex;
}
private String getProcessKey(DelegateExecution execution) {
org.activiti.bpmn.model.Process process = ProcessDefinitionUtil.getProcess(execution.getProcessDefinitionId());
return process.getId();
}
}
......@@ -156,6 +156,8 @@ public interface Activiti5CompatibilityHandler {
Map<String, Object> getVariableValues(ProcessInstance processInstance);
Object getScriptingEngineValue(String payloadExpressionValue, String languageValue, DelegateExecution execution);
void addEventListener(Object listener);
void removeEventListener(Object listener);
......
......@@ -24,6 +24,7 @@ import org.activiti.engine.delegate.Expression;
import org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior;
import org.activiti.engine.impl.context.Context;
import org.activiti.engine.impl.scripting.ScriptingEngines;
import org.activiti.engine.impl.util.Activiti5Util;
import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
......@@ -64,8 +65,18 @@ public class MuleSendActivitiBehavior extends AbstractBpmnActivityBehavior {
String usernameValue = this.getStringFromField(this.username, execution);
String passwordValue = this.getStringFromField(this.password, execution);
ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines();
Object payload = scriptingEngines.evaluate(payloadExpressionValue, languageValue, execution);
boolean isActiviti5Execution = false;
Object payload = null;
if ((Context.getCommandContext() != null && Activiti5Util.isActiviti5ProcessDefinitionId(Context.getCommandContext(), execution.getProcessDefinitionId())) ||
(Context.getCommandContext() == null && Activiti5Util.getActiviti5CompatibilityHandler() != null)) {
payload = Activiti5Util.getActiviti5CompatibilityHandler().getScriptingEngineValue(payloadExpressionValue, languageValue, execution);
isActiviti5Execution = true;
} else {
ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines();
payload = scriptingEngines.evaluate(payloadExpressionValue, languageValue, execution);
}
if (endpointUrlValue.startsWith("vm:")) {
LocalMuleClient client = this.getMuleContext().getClient();
......@@ -136,7 +147,12 @@ public class MuleSendActivitiBehavior extends AbstractBpmnActivityBehavior {
}
}
this.leave(execution);
if (isActiviti5Execution) {
Activiti5Util.getActiviti5CompatibilityHandler().leaveExecution(execution);
} else {
this.leave(execution);
}
}
protected MuleContext getMuleContext() {
......
......@@ -70,6 +70,7 @@ import org.activiti5.engine.impl.persistence.deploy.DeploymentManager;
import org.activiti5.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti5.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.activiti5.engine.impl.pvm.delegate.ActivityExecution;
import org.activiti5.engine.impl.scripting.ScriptingEngines;
import org.activiti5.engine.repository.DeploymentBuilder;
/**
......@@ -763,6 +764,18 @@ public class DefaultActiviti5CompatibilityHandler implements Activiti5Compatibil
return ((ExecutionEntity) activiti5ProcessInstance).getVariableValues();
}
public Object getScriptingEngineValue(String payloadExpressionValue, String languageValue, DelegateExecution execution) {
try {
final ProcessEngineConfigurationImpl processEngineConfig = (ProcessEngineConfigurationImpl) getProcessEngine().getProcessEngineConfiguration();
ScriptingEngines scriptingEngines = processEngineConfig.getScriptingEngines();
return scriptingEngines.evaluate(payloadExpressionValue, languageValue, execution);
} catch (org.activiti5.engine.ActivitiException e) {
handleActivitiException(e);
return null;
}
}
public void addEventListener(Object listener) {
if (listener instanceof ActivitiEventListener == false) {
throw new ActivitiException("listener does not implement org.activiti5.engine.delegate.event.ActivitiEventListener interface");
......
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>Activiti5 - Mule - Compatibility tests</name>
<artifactId>activiti5-mule-test</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>6.0.0-SNAPSHOT</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.mule.version>3.2.10.RELEASE</spring.mule.version>
<activiti.artifact>
org.activiti.mule.test
</activiti.artifact>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<workingDirectory>${project.build.directory}</workingDirectory>
<systemPropertyVariables>
<propertyName>mule.workingDirectory</propertyName>
<buildDirectory>${project.build.directory}</buildDirectory>
</systemPropertyVariables>
<runOrder>alphabetical</runOrder>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.felix</groupId>
<artifactId>
maven-bundle-plugin
</artifactId>
<versionRange>
[2.1.0,)
</versionRange>
<goals>
<goal>cleanVersions</goal>
<goal>manifest</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti5-engine</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti5-spring</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-mule</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti5-compatibility</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti5-spring-compatibility</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.mule.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.mule.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.mule.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.mule.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.mule.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.mule.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>${spring.mule.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.mule.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.mule.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-http</artifactId>
<version>${mule.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-vm</artifactId>
<version>${mule.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-scripting</artifactId>
<version>${mule.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-spring-security</artifactId>
<version>${mule.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mule.tests</groupId>
<artifactId>mule-tests-functional</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
<id>distro</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<excludePackageNames>org.activiti.impl*,org.activiti.engine.impl*</excludePackageNames>
</configuration>
</plugin>
</plugins>
</reporting>
<repositories>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>https://repository-master.mulesoft.org/nexus/content/groups/public/</url>
<layout>default</layout>
</repository>
</repositories>
</project>
package org.activiti5.mule;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.impl.ProcessEngineImpl;
import org.activiti.engine.impl.db.DbSqlSession;
import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandConfig;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.interceptor.CommandExecutor;
import org.junit.Assert;
import org.mule.tck.junit4.FunctionalTestCase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class AbstractMuleTest extends FunctionalTestCase {
protected static Logger log = LoggerFactory.getLogger(AbstractMuleTest.class);
protected static final String EMPTY_LINE = " ";
private static final List<String> TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK = Arrays.asList("ACT_GE_PROPERTY");
/**
* Each test is assumed to clean up all DB content it entered. After a test method executed, this method scans all tables to see if the DB is completely clean. It throws AssertionFailed in case the
* DB is not clean. If the DB is not clean, it is cleaned by performing a create a drop.
*/
protected void assertAndEnsureCleanDb(ProcessEngine processEngine) throws Exception {
log.debug("verifying that db is clean after test");
Map<String, Long> tableCounts = processEngine.getManagementService().getTableCount();
StringBuilder outputMessage = new StringBuilder();
for (String tableName : tableCounts.keySet()) {
String tableNameWithoutPrefix = tableName.replace(processEngine.getProcessEngineConfiguration().getDatabaseTablePrefix(), "");
if (!TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK.contains(tableNameWithoutPrefix)) {
Long count = tableCounts.get(tableName);
if (count != 0L) {
outputMessage.append(" " + tableName + ": " + count + " record(s) ");
}
}
}
if (outputMessage.length() > 0) {
outputMessage.insert(0, "DB NOT CLEAN: \n");
log.error(EMPTY_LINE);
log.error(outputMessage.toString());
log.info("dropping and recreating db");
CommandExecutor commandExecutor = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration().getCommandExecutor();
CommandConfig config = new CommandConfig().transactionNotSupported();
commandExecutor.execute(config, new Command<Object>() {
public Object execute(CommandContext commandContext) {
DbSqlSession session = commandContext.getSession(DbSqlSession.class);
session.dbSchemaDrop();
session.dbSchemaCreate();
return null;
}
});
Assert.fail(outputMessage.toString());
} else {
log.info("database was clean");
}
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti5.mule;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.DeploymentProperties;
import org.activiti.engine.runtime.ProcessInstance;
import org.junit.Assert;
import org.junit.Test;
/**
* @author Esteban Robles Luna
* @author Tijs Rademakers
*/
public class MuleHttpBasicAuthTest extends AbstractMuleTest {
@Test
public void httpWithBasicAuth() throws Exception {
Assert.assertTrue(muleContext.isStarted());
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
Deployment deployment = processEngine.getRepositoryService()
.createDeployment()
.addClasspathResource("org/activiti5/mule/testHttpBasicAuth.bpmn20.xml")
.deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE)
.deploy();
RuntimeService runtimeService = processEngine.getRuntimeService();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
Assert.assertFalse(processInstance.isEnded());
Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
Assert.assertEquals(10, result);
runtimeService.deleteProcessInstance(processInstance.getId(), "test");
processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
processEngine.getRepositoryService().deleteDeployment(deployment.getId());
assertAndEnsureCleanDb(processEngine);
ProcessEngines.destroy();
}
@Override
protected String getConfigResources() {
return "mule-http-basicauth-config.xml";
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti5.mule;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.DeploymentProperties;
import org.activiti.engine.runtime.ProcessInstance;
import org.junit.Assert;
import org.junit.Test;
/**
* @author Esteban Robles Luna
* @author Tijs Rademakers
*/
public class MuleHttpTest extends AbstractMuleTest {
@Test
public void http() throws Exception {
Assert.assertTrue(muleContext.isStarted());
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
Deployment deployment = processEngine.getRepositoryService().createDeployment()
.addClasspathResource("org/activiti5/mule/testHttp.bpmn20.xml")
.deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE)
.deploy();
RuntimeService runtimeService = processEngine.getRuntimeService();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
Assert.assertFalse(processInstance.isEnded());
Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
Assert.assertEquals(20, result);
runtimeService.deleteProcessInstance(processInstance.getId(), "test");
processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
processEngine.getRepositoryService().deleteDeployment(deployment.getId());
assertAndEnsureCleanDb(processEngine);
ProcessEngines.destroy();
}
@Override
protected String getConfigResources() {
return "mule-http-config.xml";
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti5.mule;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.DeploymentProperties;
import org.activiti.engine.runtime.ProcessInstance;
import org.junit.Assert;
import org.junit.Test;
/**
* @author Esteban Robles Luna
* @author Tijs Rademakers
*/
public class MuleVMTest extends AbstractMuleTest {
@Test
public void send() throws Exception {
Assert.assertTrue(muleContext.isStarted());
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
Deployment deployment = repositoryService.createDeployment()
.addClasspathResource("org/activiti5/mule/testVM.bpmn20.xml")
.deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE)
.deploy();
RuntimeService runtimeService = processEngine.getRuntimeService();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
Assert.assertFalse(processInstance.isEnded());
Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
Assert.assertEquals(30, result);
runtimeService.deleteProcessInstance(processInstance.getId(), "test");
processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
repositoryService.deleteDeployment(deployment.getId());
assertAndEnsureCleanDb(processEngine);
ProcessEngines.destroy();
}
@Override
protected String getConfigResources() {
return "mule-config.xml";
}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<property name="jdbcUrl" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" />
<property name="jdbcDriver" value="org.h2.Driver" />
<property name="jdbcUsername" value="sa" />
<property name="jdbcPassword" value="" />
<!-- Database configurations -->
<property name="databaseSchemaUpdate" value="drop-create" />
<property name="activiti5CompatibilityEnabled" value="true" />
<!-- job executor configurations -->
<property name="jobExecutorActivate" value="false" />
<property name="history" value="full" />
</bean>
</beans>
\ No newline at end of file
log4j.rootLogger=INFO, CA
# ConsoleAppender
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern= %d{hh:mm:ss,SSS} [%t] %-5p %c %x - %m%n
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:script="http://www.mulesoft.org/schema/mule/scripting"
xmlns:test="http://www.mulesoft.org/schema/mule/test"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.3/mule.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/3.3/mule-scripting.xsd
http://www.mulesoft.org/schema/mule/test http://www.mulesoft.org/schema/mule/test/3.3/mule-test.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.3/mule-vm.xsd">
<spring:bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<spring:property name="driverClass" value="org.h2.Driver"/>
<spring:property name="url" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000"/>
<spring:property name="username" value="sa"/>
<spring:property name="password" value=""/>
</spring:bean>
<spring:bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<spring:property name="dataSource" ref="dataSource"/>
</spring:bean>
<spring:bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<spring:property name="dataSource" ref="dataSource"/>
<spring:property name="transactionManager" ref="transactionManager"/>
<spring:property name="databaseSchemaUpdate" value="true" />
<spring:property name="activiti5CompatibilityEnabled" value="true" />
<spring:property name="activiti5CompatibilityHandlerFactory" ref="activiti5CompabilityFactory" />
<spring:property name="jobExecutorActivate" value="false" />
<spring:property name="beans">
<spring:map>
<spring:entry key="muleContext" value-ref="_muleContext" />
</spring:map>
</spring:property>
</spring:bean>
<spring:bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
<spring:property name="processEngineConfiguration" ref="processEngineConfiguration" />
</spring:bean>
<spring:bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
<spring:bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
<spring:bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
<spring:bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
<spring:bean id="activiti5CompabilityFactory" class="org.activiti.compatibility.spring.SpringActiviti5CompatibilityHandlerFactory" />
<flow name="test">
<vm:inbound-endpoint path="in" exchange-pattern="request-response" />
<script:transformer>
<script:script engine="groovy">return 30</script:script>
</script:transformer>
</flow>
</mule>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<mule
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:script="http://www.mulesoft.org/schema/mule/scripting"
xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:ss="http://www.springframework.org/schema/security"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/current/mule-spring-security.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">
<spring:beans>
<ss:authentication-manager alias="authenticationManager">
<ss:authentication-provider>
<ss:user-service id="userService">
<ss:user name="test" password="password" authorities="ROLE_ADMIN" />
</ss:user-service>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<mule-ss:security-manager>
<mule-ss:delegate-security-provider name="memory-dao" delegate-ref="authenticationManager"/>
</mule-ss:security-manager>
<flow name="test">
<http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:9090/test" />
<http:basic-security-filter realm="mule-realm"/>
<script:transformer>
<script:script engine="groovy">return 10</script:script>
</script:transformer>
</flow>
</mule>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<mule
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:script="http://www.mulesoft.org/schema/mule/scripting"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<flow name="test">
<http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:9090/test" />
<script:transformer>
<script:script engine="groovy">return 20</script:script>
</script:transformer>
</flow>
</mule>
\ No newline at end of file
<definitions
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="Examples">
<process id="muleProcess" >
<startEvent id="theStart" />
<sequenceFlow sourceRef="theStart" targetRef="sendMule" />
<sendTask id="sendMule" activiti:type="mule">
<extensionElements>
<activiti:field name="endpointUrl">
<activiti:string>http://localhost:9090/test</activiti:string>
</activiti:field>
<activiti:field name="language">
<activiti:string>juel</activiti:string>
</activiti:field>
<activiti:field name="payloadExpression">
<activiti:string>"hi"</activiti:string>
</activiti:field>
<activiti:field name="resultVariable">
<activiti:string>theVariable</activiti:string>
</activiti:field>
</extensionElements>
</sendTask>
<sequenceFlow sourceRef="sendMule" targetRef="waitState" />
<receiveTask id="waitState" />
<sequenceFlow sourceRef="waitState" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
\ No newline at end of file
<definitions
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="Examples">
<process id="muleProcess" >
<startEvent id="theStart" />
<sequenceFlow sourceRef="theStart" targetRef="sendMule" />
<sendTask id="sendMule" activiti:type="mule">
<extensionElements>
<activiti:field name="endpointUrl">
<activiti:string>http://localhost:9090/test</activiti:string>
</activiti:field>
<activiti:field name="language">
<activiti:string>juel</activiti:string>
</activiti:field>
<activiti:field name="payloadExpression">
<activiti:string>"hi"</activiti:string>
</activiti:field>
<activiti:field name="resultVariable">
<activiti:string>theVariable</activiti:string>
</activiti:field>
<activiti:field name="username">
<activiti:string>test</activiti:string>
</activiti:field>
<activiti:field name="password">
<activiti:string>password</activiti:string>
</activiti:field>
</extensionElements>
</sendTask>
<sequenceFlow sourceRef="sendMule" targetRef="waitState" />
<receiveTask id="waitState" />
<sequenceFlow sourceRef="waitState" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
\ No newline at end of file
<definitions
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="Examples">
<process id="muleProcess" >
<startEvent id="theStart" />
<sequenceFlow sourceRef="theStart" targetRef="sendMule" />
<sendTask id="sendMule" activiti:type="mule">
<extensionElements>
<activiti:field name="endpointUrl">
<activiti:string>vm://in</activiti:string>
</activiti:field>
<activiti:field name="language">
<activiti:string>juel</activiti:string>
</activiti:field>
<activiti:field name="payloadExpression">
<activiti:string>"hi"</activiti:string>
</activiti:field>
<activiti:field name="resultVariable">
<activiti:string>theVariable</activiti:string>
</activiti:field>
</extensionElements>
</sendTask>
<sequenceFlow sourceRef="sendMule" targetRef="waitState" />
<receiveTask id="waitState" />
<sequenceFlow sourceRef="waitState" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
\ No newline at end of file
......@@ -237,6 +237,11 @@
<artifactId>activiti-camel</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-mule</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-crystalball</artifactId>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册