clazz) {
+ T instance;
+
+ try {
+ instance = applicationContext.getBean(clazz);
+ } catch (NoSuchBeanDefinitionException ex) {
+ // fall back to using newInstance()
+ instance = defaultArtifactFactory.getArtifact(clazz);
+ }
+
+ return instance;
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/SpringBeansResolverFactory.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/SpringBeansResolverFactory.java
new file mode 100644
index 0000000000000000000000000000000000000000..27a4c2b78a582dc3deee7666c419c5cc9551abfe
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/SpringBeansResolverFactory.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import org.camunda.bpm.engine.delegate.VariableScope;
+import org.camunda.bpm.engine.impl.scripting.engine.Resolver;
+import org.camunda.bpm.engine.impl.scripting.engine.ResolverFactory;
+import org.springframework.beans.factory.BeanCreationException;
+import org.springframework.context.ApplicationContext;
+
+/**
+ *
+ * {@link ResolverFactory} and {@link Resolver} classes to make the beans
+ * managed by the Spring container available in scripting
+ *
+ *
+ *
+ * {@see org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration#initScripting()}
+ *
+ *
+ */
+public class SpringBeansResolverFactory implements ResolverFactory, Resolver {
+
+ protected static Logger LOG = Logger.getLogger(SpringBeansResolverFactory.class.getName());
+
+ protected static String SCOPE_NOT_ACTIVE_EXCEPTION = "org.springframework.beans.factory.support.ScopeNotActiveException";
+
+ private ApplicationContext applicationContext;
+ private Set keySet;
+
+ public SpringBeansResolverFactory(ApplicationContext applicationContext) {
+ this.applicationContext = applicationContext;
+
+ String[] beannames = applicationContext.getBeanDefinitionNames();
+ this.keySet = new HashSet<>(Arrays.asList(beannames));
+ }
+
+ @Override
+ public Resolver createResolver(VariableScope variableScope) {
+ return this;
+ }
+
+ @Override
+ public boolean containsKey(Object key) {
+ if (key instanceof String) {
+ return keySet.contains((String) key);
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public Object get(Object key) {
+ if (key instanceof String) {
+ try {
+ return applicationContext.getBean((String) key);
+ } catch (BeanCreationException ex) {
+ // Only swallow exceptions for beans with inactive scope.
+ // Unfortunately, we cannot use ScopeNotActiveException directly as
+ // it is only available starting with Spring 5.3, but we still support Spring 4.
+ if (SCOPE_NOT_ACTIVE_EXCEPTION.equals(ex.getClass().getName())) {
+ LOG.info("Bean '" + key + "' cannot be accessed since scope is not active. Instead, null is returned. "
+ + "Full exception message: " + ex.getMessage());
+ return null;
+
+ } else {
+ throw ex;
+
+ }
+ }
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public Set keySet() {
+ return keySet;
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/SpringConfigurationHelper.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/SpringConfigurationHelper.java
new file mode 100644
index 0000000000000000000000000000000000000000..2c6438438edf84a50851321991a27aa458ad82d7
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/SpringConfigurationHelper.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring;
+
+import java.net.URL;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import org.camunda.bpm.engine.ProcessEngineException;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.GenericXmlApplicationContext;
+import org.springframework.core.io.UrlResource;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SpringConfigurationHelper {
+
+ private static Logger log = Logger.getLogger(SpringConfigurationHelper.class.getName());
+
+ public static ProcessEngine buildProcessEngine(URL resource) {
+ log.fine("==== BUILDING SPRING APPLICATION CONTEXT AND PROCESS ENGINE =========================================");
+
+ ApplicationContext applicationContext = new GenericXmlApplicationContext(new UrlResource(resource));
+ Map beansOfType = applicationContext.getBeansOfType(ProcessEngine.class);
+ if ( (beansOfType==null)
+ || (beansOfType.isEmpty())
+ ) {
+ throw new ProcessEngineException("no "+ProcessEngine.class.getName()+" defined in the application context "+resource.toString());
+ }
+
+ ProcessEngine processEngine = beansOfType.values().iterator().next();
+
+ log.fine("==== SPRING PROCESS ENGINE CREATED ==================================================================");
+ return processEngine;
+ }
+
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/SpringExpressionManager.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/SpringExpressionManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..9ee76baabd9d0774aefb2277622bb944435ffd97
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/SpringExpressionManager.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring;
+
+import java.util.Map;
+import org.camunda.bpm.engine.impl.el.ExpressionManager;
+import org.camunda.bpm.engine.impl.el.JuelExpressionManager;
+import org.camunda.bpm.engine.impl.el.ReadOnlyMapELResolver;
+import org.camunda.bpm.engine.impl.el.VariableContextElResolver;
+import org.camunda.bpm.engine.impl.el.VariableScopeElResolver;
+import org.camunda.bpm.engine.test.mock.MockElResolver;
+import org.camunda.bpm.impl.juel.jakarta.el.ArrayELResolver;
+import org.camunda.bpm.impl.juel.jakarta.el.BeanELResolver;
+import org.camunda.bpm.impl.juel.jakarta.el.CompositeELResolver;
+import org.camunda.bpm.impl.juel.jakarta.el.ELResolver;
+import org.camunda.bpm.impl.juel.jakarta.el.ListELResolver;
+import org.camunda.bpm.impl.juel.jakarta.el.MapELResolver;
+import org.springframework.context.ApplicationContext;
+
+
+/**
+ * {@link ExpressionManager} that exposes the full application-context or a limited set
+ * of beans in expressions.
+ *
+ * @author Tom Baeyens
+ */
+public class SpringExpressionManager extends JuelExpressionManager {
+
+ protected ApplicationContext applicationContext;
+
+ /**
+ * @param applicationContext
+ * the applicationContext to use. Ignored when 'beans' parameter is
+ * not null.
+ * @param beans
+ * a map of custom beans to expose. If null, all beans in the
+ * application-context will be exposed.
+ */
+ public SpringExpressionManager(ApplicationContext applicationContext, Map
+ *
+ * Limitation: The {@link EjbProcessApplication} is currently unsupported.
+ *
+ * @author Daniel Meyer
+ *
+ */
+public class SpringProcessApplicationElResolver implements ProcessApplicationElResolver {
+
+ private final static Logger LOGGER = Logger.getLogger(SpringProcessApplicationElResolver.class.getName());
+
+ @Override
+ public Integer getPrecedence() {
+ return ProcessApplicationElResolver.SPRING_RESOLVER;
+ }
+
+ @Override
+ public ELResolver getElResolver(AbstractProcessApplication processApplication) {
+
+ if (processApplication instanceof SpringProcessApplication) {
+ SpringProcessApplication springProcessApplication = (SpringProcessApplication) processApplication;
+ return new ApplicationContextElResolver(springProcessApplication.getApplicationContext());
+
+ } else if (processApplication instanceof org.camunda.bpm.application.impl.ServletProcessApplication) {
+ // Using fully-qualified class name instead of import statement to allow for automatic transformation
+ org.camunda.bpm.application.impl.ServletProcessApplication servletProcessApplication = (org.camunda.bpm.application.impl.ServletProcessApplication) processApplication;
+
+ if(!ClassUtils.isPresent("org.springframework.web.context.support.WebApplicationContextUtils", processApplication.getProcessApplicationClassloader())) {
+ LOGGER.log(Level.FINE, "WebApplicationContextUtils must be present for SpringProcessApplicationElResolver to work");
+ return null;
+ }
+
+ ServletContext servletContext = servletProcessApplication.getServletContext();
+ WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
+ if(applicationContext != null) {
+ return new ApplicationContextElResolver(applicationContext);
+ }
+
+ }
+
+ LOGGER.log(Level.FINE, "Process application class {0} unsupported by SpringProcessApplicationElResolver", processApplication);
+ return null;
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/application/SpringServletProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/application/SpringServletProcessApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..9ef55650feb485c7854c98370149376dea22e8ee
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/application/SpringServletProcessApplication.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.application;
+
+import javax.servlet.ServletContext;
+
+import org.camunda.bpm.application.ProcessApplication;
+import org.camunda.bpm.application.ProcessApplicationInfo;
+import org.springframework.web.context.ServletContextAware;
+
+/**
+ * Process Application to be used in a Spring Web Application.
+ *
+ * Requires the spring-web module to be on the classpath
+ *
+ * In addition to the services provided by the {@link SpringProcessApplication},
+ * this {@link ProcessApplication} exposes the servlet context path of the web application
+ * which it is a part of (see {@link ProcessApplicationInfo#PROP_SERVLET_CONTEXT_PATH}).
+ *
+ * This implementation should be used with Spring Web Applications.
+ *
+ * @author Daniel Meyer
+ *
+ */
+public class SpringServletProcessApplication extends SpringProcessApplication implements ServletContextAware {
+
+ protected ServletContext servletContext;
+
+ public void setServletContext(ServletContext servletContext) {
+ this.servletContext = servletContext;
+ }
+
+ @Override
+ public void start() {
+ properties.put(ProcessApplicationInfo.PROP_SERVLET_CONTEXT_PATH, servletContext.getContextPath());
+ super.start();
+ }
+
+ @Override
+ public void afterPropertiesSet() throws Exception {
+ // for backwards compatibility
+ start();
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/ActivitiContextUtils.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/ActivitiContextUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..add4f6174f456a9f04808341c144d7e17356a22c
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/ActivitiContextUtils.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2010 the original author or authors
+ *
+ * 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.camunda.bpm.engine.spring.components;
+
+import org.camunda.bpm.engine.spring.components.config.xml.StateHandlerAnnotationBeanFactoryPostProcessor;
+
+/**
+ * simple place to stash the constants used throughout the code
+ *
+ * @author Josh Long
+ * @since 5.3
+ */
+public class ActivitiContextUtils {
+
+ public static final String ANNOTATION_STATE_HANDLER_BEAN_FACTORY_POST_PROCESSOR_BEAN_NAME= StateHandlerAnnotationBeanFactoryPostProcessor.class.getName().toLowerCase();
+ /**
+ * the name of the default registry used to store all state handling components
+ */
+ public final static String ACTIVITI_REGISTRY_BEAN_NAME = "activitiComponentRegistry" ;
+
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/ActivitiStateAnnotationBeanPostProcessor.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/ActivitiStateAnnotationBeanPostProcessor.java
new file mode 100644
index 0000000000000000000000000000000000000000..90907d9f6250a71ef6bb96f5405122697dc0b15d
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/ActivitiStateAnnotationBeanPostProcessor.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2010 the original author or authors
+ *
+ * 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.camunda.bpm.engine.spring.components.aop;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.camunda.bpm.engine.spring.annotations.ProcessId;
+import org.camunda.bpm.engine.spring.annotations.ProcessVariable;
+import org.camunda.bpm.engine.spring.annotations.ProcessVariables;
+import org.camunda.bpm.engine.spring.annotations.State;
+import org.camunda.bpm.engine.spring.components.registry.ActivitiStateHandlerRegistration;
+import org.camunda.bpm.engine.spring.components.registry.ActivitiStateHandlerRegistry;
+import org.springframework.aop.support.AopUtils;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanClassLoaderAware;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.BeanFactoryAware;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.core.Ordered;
+import org.springframework.core.annotation.AnnotationUtils;
+import org.springframework.util.Assert;
+import org.springframework.util.ClassUtils;
+import org.springframework.util.ReflectionUtils;
+import org.springframework.util.StringUtils;
+
+
+/**
+ * the idea is that this bean post processor is responsible for registering all beans
+ * that have the {@link org.camunda.bpm.engine.annotations.State} annotation.
+ *
+ * @author Josh Long
+ * @since 5.3
+ */
+@SuppressWarnings("unused") // registered through XML
+public class ActivitiStateAnnotationBeanPostProcessor implements BeanPostProcessor, BeanClassLoaderAware, BeanFactoryAware, InitializingBean, Ordered {
+
+ private volatile ActivitiStateHandlerRegistry registry;
+
+ private volatile int order = Ordered.LOWEST_PRECEDENCE;
+
+ private volatile BeanFactory beanFactory;
+
+ private volatile ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
+
+ public void setBeanFactory(BeanFactory beanFactory) {
+ this.beanFactory = beanFactory;
+ }
+
+ public void setBeanClassLoader(ClassLoader classLoader) {
+ this.beanClassLoader = classLoader;
+ }
+
+ public int getOrder() {
+ return this.order;
+ }
+
+ public void afterPropertiesSet() {
+ Assert.notNull(this.beanClassLoader, "beanClassLoader must not be null");
+ Assert.notNull(this.beanFactory, "beanFactory must not be null");
+ }
+
+ public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
+ return bean;
+ }
+
+ public void setRegistry(ActivitiStateHandlerRegistry registry) {
+ this.registry = registry;
+ }
+
+ public Object postProcessAfterInitialization(final Object bean,
+ final String beanName) throws BeansException {
+ // first sift through and get all the methods
+ // then get all the annotations
+ // then build the metadata and register the metadata
+ final Class> targetClass = AopUtils.getTargetClass(bean);
+ final org.camunda.bpm.engine.spring.annotations.ProcessEngineComponent component = targetClass.getAnnotation(org.camunda.bpm.engine.spring.annotations.ProcessEngineComponent.class);
+
+ ReflectionUtils.doWithMethods(targetClass,
+ new ReflectionUtils.MethodCallback() {
+ @SuppressWarnings("unchecked")
+ public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
+
+ State state = AnnotationUtils.getAnnotation(method, State.class);
+
+ String processName = component.processKey();
+
+ if (StringUtils.hasText(state.process())) {
+ processName = state.process();
+ }
+
+ String stateName = state.state();
+
+ if (!StringUtils.hasText(stateName)) {
+ stateName = state.value();
+ }
+
+ Assert.notNull(stateName, "You must provide a stateName!");
+
+ Map vars = new HashMap();
+ Annotation[][] paramAnnotationsArray = method.getParameterAnnotations();
+
+ int ctr = 0;
+ int pvMapIndex = -1;
+ int procIdIndex = -1;
+
+ for (Annotation[] paramAnnotations : paramAnnotationsArray) {
+ ctr += 1;
+
+ for (Annotation pa : paramAnnotations) {
+ if (pa instanceof ProcessVariable) {
+ ProcessVariable pv = (ProcessVariable) pa;
+ String pvName = pv.value();
+ vars.put(ctr, pvName);
+ } else if (pa instanceof ProcessVariables) {
+ pvMapIndex = ctr;
+ } else if (pa instanceof ProcessId ) {
+ procIdIndex = ctr;
+ }
+ }
+ }
+
+ ActivitiStateHandlerRegistration registration = new ActivitiStateHandlerRegistration(vars,
+ method, bean, stateName, beanName, pvMapIndex,
+ procIdIndex, processName);
+ registry.registerActivitiStateHandler(registration);
+ }
+ },
+ new ReflectionUtils.MethodFilter() {
+ public boolean matches(Method method) {
+ return null != AnnotationUtils.getAnnotation(method,
+ State.class);
+ }
+ });
+
+ return bean;
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/ProcessStartAnnotationBeanPostProcessor.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/ProcessStartAnnotationBeanPostProcessor.java
new file mode 100644
index 0000000000000000000000000000000000000000..d04d8d6412b2fa2c0a28eb18002a731ef670d402
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/ProcessStartAnnotationBeanPostProcessor.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2010 the original author or authors
+ *
+ * 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.camunda.bpm.engine.spring.components.aop;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.spring.annotations.ProcessVariable;
+import org.camunda.bpm.engine.spring.annotations.StartProcess;
+import org.springframework.aop.framework.Advised;
+import org.springframework.aop.framework.AopInfrastructureBean;
+import org.springframework.aop.framework.ProxyConfig;
+import org.springframework.aop.framework.ProxyFactory;
+import org.springframework.aop.support.AopUtils;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.util.ClassUtils;
+
+/**
+ * Proxies beans with methods annotated with {@link StartProcess}.
+ * If the method is invoked successfully, the process described by the annotaton is created.
+ * Parameters passed to the method annotated with {@link ProcessVariable}
+ * are passed to the business process.
+ *
+ * @author Josh Long
+ * @since 5,3
+ */
+public class ProcessStartAnnotationBeanPostProcessor extends ProxyConfig implements BeanPostProcessor, InitializingBean {
+
+ private Log log = LogFactory.getLog(getClass()) ;
+
+ /**
+ * the process engine as created by a {@link org.camunda.bpm.engine.spring.ProcessEngineFactoryBean}
+ */
+ private ProcessEngine processEngine;
+
+ private ProcessStartingPointcutAdvisor advisor;
+
+ private volatile ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
+
+ public void setProcessEngine(ProcessEngine processEngine) {
+ this.processEngine = processEngine;
+ }
+
+ public void afterPropertiesSet() throws Exception {
+ this.advisor = new ProcessStartingPointcutAdvisor(this.processEngine);
+ }
+
+ public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
+ if (bean instanceof AopInfrastructureBean) {
+ // Ignore AOP infrastructure such as scoped proxies.
+ return bean;
+ }
+ Class> targetClass = AopUtils.getTargetClass(bean);
+ if (AopUtils.canApply(this.advisor, targetClass)) {
+ if (bean instanceof Advised) {
+ ((Advised) bean).addAdvisor(0, this.advisor);
+ return bean;
+ }
+ else {
+ ProxyFactory proxyFactory = new ProxyFactory(bean);
+ // Copy our properties (proxyTargetClass etc) inherited from ProxyConfig.
+ proxyFactory.copyFrom(this);
+ proxyFactory.addAdvisor(this.advisor);
+ return proxyFactory.getProxy(this.beanClassLoader);
+ }
+ }
+ else {
+ // No async proxy needed.
+ return bean;
+ }
+ }
+
+ public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
+ return bean;
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/ProcessStartingMethodInterceptor.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/ProcessStartingMethodInterceptor.java
new file mode 100644
index 0000000000000000000000000000000000000000..cce36a3310065eb9639dd1433d9fce86ad194aef
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/ProcessStartingMethodInterceptor.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2010 the original author or authors
+ *
+ * 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.camunda.bpm.engine.spring.components.aop;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Future;
+import java.util.logging.Logger;
+
+import org.aopalliance.intercept.MethodInterceptor;
+import org.aopalliance.intercept.MethodInvocation;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.spring.annotations.BusinessKey;
+import org.camunda.bpm.engine.spring.annotations.ProcessVariable;
+import org.camunda.bpm.engine.spring.annotations.StartProcess;
+import org.springframework.core.annotation.AnnotationUtils;
+import org.springframework.scheduling.annotation.AsyncResult;
+import org.springframework.util.Assert;
+import org.springframework.util.StringUtils;
+
+/**
+ * {@link org.aopalliance.intercept.MethodInterceptor} that starts a business process
+ * as a result of a successful method invocation.
+ *
+ * @author Josh Long
+ */
+public class ProcessStartingMethodInterceptor implements MethodInterceptor {
+
+ private Logger log = Logger.getLogger(getClass().getName());
+
+ /**
+ * injected reference - can be obtained via a {@link org.camunda.bpm.engine.spring.ProcessEngineFactoryBean}
+ */
+ protected ProcessEngine processEngine;
+
+ /**
+ * @param processEngine takes a reference to a {@link org.camunda.bpm.engine.ProcessEngine}
+ */
+ public ProcessStartingMethodInterceptor(ProcessEngine processEngine) {
+ this.processEngine = processEngine;
+ }
+
+ boolean shouldReturnProcessInstance(StartProcess startProcess, MethodInvocation methodInvocation, Object result) {
+ return (result instanceof ProcessInstance || methodInvocation.getMethod().getReturnType().isAssignableFrom(ProcessInstance.class));
+ }
+
+ boolean shouldReturnProcessInstanceId(StartProcess startProcess, MethodInvocation methodInvocation, Object result) {
+ return startProcess.returnProcessInstanceId() && (result instanceof String || methodInvocation.getMethod().getReturnType().isAssignableFrom(String.class));
+ }
+
+ @SuppressWarnings("unused")
+ boolean shouldReturnAsyncResultWithProcessInstance(StartProcess startProcess, MethodInvocation methodInvocation, Object result) {
+ return (result instanceof Future || methodInvocation.getMethod().getReturnType().isAssignableFrom(Future.class));
+ }
+
+ public Object invoke(MethodInvocation invocation) throws Throwable {
+
+ Method method = invocation.getMethod();
+
+ StartProcess startProcess = AnnotationUtils.getAnnotation(method, StartProcess.class);
+
+ String processKey = startProcess.processKey();
+
+ Assert.hasText(processKey, "you must provide the name of process to start");
+
+ Object result;
+ try {
+ result = invocation.proceed();
+ Map vars = this.processVariablesFromAnnotations(invocation);
+
+ String businessKey = this.processBusinessKey(invocation);
+
+ log.info("variables for the started process: " + vars.toString());
+
+ RuntimeService runtimeService = this.processEngine.getRuntimeService();
+ ProcessInstance pi ;
+ if (null != businessKey && StringUtils.hasText(businessKey)) {
+ pi = runtimeService.startProcessInstanceByKey(processKey, businessKey, vars);
+ log.info("the business key for the started process is '" + businessKey + "' ");
+ } else {
+ pi = runtimeService.startProcessInstanceByKey(processKey, vars);
+ }
+
+ String pId = pi.getId();
+
+ if (invocation.getMethod().getReturnType().equals(void.class))
+ return null;
+
+ if (shouldReturnProcessInstance(startProcess, invocation, result))
+ return pi;
+
+ if (shouldReturnProcessInstanceId(startProcess, invocation, result))
+ return pId;
+
+ if (shouldReturnAsyncResultWithProcessInstance(startProcess, invocation, result)) {
+ return new AsyncResult(pi);
+ }
+
+ } catch (Throwable th) {
+ throw new RuntimeException(th);
+ }
+ return result;
+ }
+
+ protected String processBusinessKey(MethodInvocation invocation) throws Throwable {
+ Map businessKeyAnnotations = this.mapOfAnnotationValues( BusinessKey.class ,invocation);
+ if (businessKeyAnnotations.size() == 1) {
+ BusinessKey processId = businessKeyAnnotations.keySet().iterator().next();
+ return businessKeyAnnotations.get(processId);
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Map mapOfAnnotationValues(Class annotationType, MethodInvocation invocation) {
+ Method method = invocation.getMethod();
+ Annotation[][] annotations = method.getParameterAnnotations();
+ Map vars = new HashMap();
+ int paramIndx = 0;
+ for (Annotation[] annPerParam : annotations) {
+ for (Annotation annotation : annPerParam) {
+ if (!annotationType.isAssignableFrom(annotation.getClass())) {
+ continue;
+ }
+ K pv = (K) annotation;
+ V v = (V) invocation.getArguments()[paramIndx];
+ vars.put(pv, v);
+
+ }
+ paramIndx += 1;
+ }
+ return vars;
+ }
+
+
+ /**
+ * if there any arguments with the {@link org.camunda.bpm.engine.annotations.ProcessVariable} annotation,
+ * then we feed those parameters into the business process
+ *
+ * @param invocation the invocation of the method as passed to the {@link org.aopalliance.intercept.MethodInterceptor#invoke(org.aopalliance.intercept.MethodInvocation)} method
+ * @return returns the map of process variables extracted from the parameters
+ * @throws Throwable thrown anything goes wrong
+ */
+ protected Map processVariablesFromAnnotations(MethodInvocation invocation) throws Throwable {
+
+ Map vars = this.mapOfAnnotationValues(ProcessVariable.class, invocation);
+
+ Map varNameToValueMap = new HashMap();
+ for (ProcessVariable processVariable : vars.keySet()) {
+ varNameToValueMap.put(processVariable.value(), vars.get(processVariable));
+ }
+ return varNameToValueMap;
+
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/ProcessStartingPointcutAdvisor.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/ProcessStartingPointcutAdvisor.java
new file mode 100644
index 0000000000000000000000000000000000000000..60bbdff5f89a62e8f13c70d01ce93a2d468087dc
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/ProcessStartingPointcutAdvisor.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2010 the original author or authors
+ *
+ * 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.camunda.bpm.engine.spring.components.aop;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.aopalliance.aop.Advice;
+import org.aopalliance.intercept.MethodInterceptor;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.spring.annotations.StartProcess;
+import org.camunda.bpm.engine.spring.components.aop.util.MetaAnnotationMatchingPointcut;
+import org.springframework.aop.Pointcut;
+import org.springframework.aop.PointcutAdvisor;
+import org.springframework.aop.support.ComposablePointcut;
+
+/**
+ * AOP advice for methods annotated with (by default) {@link StartProcess}.
+ *
+ * Advised methods start a process after the method executes.
+ *
+ * Advised methods can declare a return
+ * type of {@link org.camunda.bpm.engine.runtime.ProcessInstance} and then subsequently
+ * return null. The real return ProcessInstance value will be given by the aspect.
+ *
+ *
+ * @author Josh Long
+ * @since 5.3
+ */
+public class ProcessStartingPointcutAdvisor implements PointcutAdvisor, Serializable {
+
+
+ /**
+ * annotations that shall be scanned
+ */
+ private Set> annotations = new HashSet>(Arrays.asList(StartProcess.class));
+
+ /**
+ * the {@link org.aopalliance.intercept.MethodInterceptor} that handles launching the business process.
+ */
+ protected MethodInterceptor advice;
+
+ /**
+ * matches any method containing the {@link StartProcess} annotation.
+ */
+ protected Pointcut pointcut;
+
+ /**
+ * the injected reference to the {@link org.camunda.bpm.engine.ProcessEngine}
+ */
+ protected ProcessEngine processEngine;
+
+ public ProcessStartingPointcutAdvisor(ProcessEngine pe) {
+ this.processEngine = pe;
+ this.pointcut = buildPointcut();
+ this.advice = buildAdvise();
+
+ }
+
+ protected MethodInterceptor buildAdvise() {
+ return new ProcessStartingMethodInterceptor(this.processEngine);
+ }
+
+ public Pointcut getPointcut() {
+ return pointcut;
+ }
+
+ public Advice getAdvice() {
+ return advice;
+ }
+
+ public boolean isPerInstance() {
+ return true;
+ }
+
+ private Pointcut buildPointcut() {
+ ComposablePointcut result = null;
+ for (Class extends Annotation> publisherAnnotationType : this.annotations) {
+ Pointcut mpc = new MetaAnnotationMatchingPointcut(null, publisherAnnotationType);
+ if (result == null) {
+ result = new ComposablePointcut(mpc);
+ } else {
+ result.union(mpc);
+ }
+ }
+ return result;
+ }
+
+
+}
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/util/MetaAnnotationMatchingPointcut.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/util/MetaAnnotationMatchingPointcut.java
new file mode 100644
index 0000000000000000000000000000000000000000..008dd16e92d4e8402379bc799f8ef328d1a1ee7b
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/util/MetaAnnotationMatchingPointcut.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2010 the original author or authors
+ *
+ * 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.camunda.bpm.engine.spring.components.aop.util;
+
+import org.springframework.aop.ClassFilter;
+import org.springframework.aop.MethodMatcher;
+import org.springframework.aop.Pointcut;
+import org.springframework.aop.support.annotation.AnnotationClassFilter;
+import org.springframework.util.Assert;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * this code is taken almost (99.99%) verbatim from the Spring Integration
+ * project's source code where it's a static
+ * private inner class.
+ *
+ * @author Mark Fisher
+ */
+public class MetaAnnotationMatchingPointcut implements Pointcut {
+
+ private final ClassFilter classFilter;
+
+ private final MethodMatcher methodMatcher;
+
+
+ /**
+ * Create a new MetaAnnotationMatchingPointcut for the given annotation type.
+ *
+ * @param classAnnotationType the annotation type to look for at the class level
+ * @param checkInherited whether to explicitly check the superclasses and
+ * interfaces for the annotation type as well (even if the annotation type
+ * is not marked as inherited itself)
+ */
+ public MetaAnnotationMatchingPointcut(Class extends Annotation> classAnnotationType, boolean checkInherited) {
+ this.classFilter = new AnnotationClassFilter(classAnnotationType, checkInherited);
+ this.methodMatcher = MethodMatcher.TRUE;
+ }
+
+ /**
+ * Create a new MetaAnnotationMatchingPointcut for the given annotation type.
+ *
+ * @param classAnnotationType the annotation type to look for at the class level
+ * (can be null)
+ * @param methodAnnotationType the annotation type to look for at the method level
+ * (can be null)
+ */
+ public MetaAnnotationMatchingPointcut(
+ Class extends Annotation> classAnnotationType, Class extends Annotation> methodAnnotationType) {
+
+ Assert.isTrue((classAnnotationType != null || methodAnnotationType != null),
+ "Either Class annotation type or Method annotation type needs to be specified (or both)");
+
+ if (classAnnotationType != null) {
+ this.classFilter = new AnnotationClassFilter(classAnnotationType);
+ } else {
+ this.classFilter = ClassFilter.TRUE;
+ }
+
+ if (methodAnnotationType != null) {
+ this.methodMatcher = new MetaAnnotationMethodMatcher(methodAnnotationType);
+ } else {
+ this.methodMatcher = MethodMatcher.TRUE;
+ }
+ }
+
+
+ public ClassFilter getClassFilter() {
+ return this.classFilter;
+ }
+
+ public MethodMatcher getMethodMatcher() {
+ return this.methodMatcher;
+ }
+}
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/util/MetaAnnotationMethodMatcher.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/util/MetaAnnotationMethodMatcher.java
new file mode 100644
index 0000000000000000000000000000000000000000..4a18d7efd5bb5a3f2049b42ad3adf3d9cb197dba
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/util/MetaAnnotationMethodMatcher.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2010 the original author or authors
+ *
+ * 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.camunda.bpm.engine.spring.components.aop.util;
+
+import org.springframework.aop.support.AopUtils;
+import org.springframework.aop.support.annotation.AnnotationMethodMatcher;
+import org.springframework.core.annotation.AnnotationUtils;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+/**
+ * this code is taken almost verbatim from the Spring Integration
+ * project's source code where it's a static
+ * private inner class.
+ *
+ * @author Mark Fisher
+ *
+ */
+public class MetaAnnotationMethodMatcher extends AnnotationMethodMatcher {
+
+ private final Class extends Annotation> annotationType;
+
+
+ /**
+ * Create a new AnnotationClassFilter for the given annotation type.
+ *
+ * @param annotationType the annotation type to look for
+ */
+ public MetaAnnotationMethodMatcher(Class extends Annotation> annotationType) {
+ super(annotationType);
+ this.annotationType = annotationType;
+ }
+
+
+ @Override
+ @SuppressWarnings("rawtypes")
+ public boolean matches(Method method, Class targetClass) {
+ if (AnnotationUtils.getAnnotation(method, this.annotationType) != null) {
+ return true;
+ }
+ // The method may be on an interface, so let's check on the target class as well.
+ Method specificMethod = AopUtils.getMostSpecificMethod(method, targetClass);
+ return (specificMethod != method &&
+ (AnnotationUtils.getAnnotation(specificMethod, this.annotationType) != null));
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/util/Scopifier.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/util/Scopifier.java
new file mode 100644
index 0000000000000000000000000000000000000000..0fcd4256139d77af2535d3c5d5e9f87ded7549c7
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/aop/util/Scopifier.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2010 the original author or authors
+ *
+ * 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.camunda.bpm.engine.spring.components.aop.util;
+
+import org.springframework.aop.scope.ScopedProxyUtils;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.BeanDefinitionHolder;
+import org.springframework.beans.factory.config.BeanDefinitionVisitor;
+import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.util.StringValueResolver;
+
+/**
+ * this class was copied wholesale from Spring 3.1's RefreshScope, which Dave Syer wrote.
+ *
+ * @author Dave Syer
+ */
+public class Scopifier extends BeanDefinitionVisitor {
+
+ private final boolean proxyTargetClass;
+
+ private final BeanDefinitionRegistry registry;
+
+ private final String scope;
+
+ private final boolean scoped;
+
+ public static BeanDefinitionHolder createScopedProxy(String beanName, BeanDefinition definition, BeanDefinitionRegistry registry, boolean proxyTargetClass) {
+ BeanDefinitionHolder proxyHolder = ScopedProxyUtils.createScopedProxy(new BeanDefinitionHolder(definition, beanName), registry, proxyTargetClass);
+ registry.registerBeanDefinition(beanName, proxyHolder.getBeanDefinition());
+ return proxyHolder;
+ }
+
+ public Scopifier(BeanDefinitionRegistry registry, String scope, boolean proxyTargetClass, boolean scoped) {
+ super(new StringValueResolver() {
+ public String resolveStringValue(String value) {
+ return value;
+ }
+ });
+ this.registry = registry;
+ this.proxyTargetClass = proxyTargetClass;
+ this.scope = scope;
+ this.scoped = scoped;
+ }
+
+ @Override
+ protected Object resolveValue(Object value) {
+
+ BeanDefinition definition = null;
+ String beanName = null;
+ if (value instanceof BeanDefinition) {
+ definition = (BeanDefinition) value;
+ beanName = BeanDefinitionReaderUtils.generateBeanName(definition, registry);
+ } else if (value instanceof BeanDefinitionHolder) {
+ BeanDefinitionHolder holder = (BeanDefinitionHolder) value;
+ definition = holder.getBeanDefinition();
+ beanName = holder.getBeanName();
+ }
+
+ if (definition != null) {
+ boolean nestedScoped = scope.equals(definition.getScope());
+ boolean scopeChangeRequiresProxy = !scoped && nestedScoped;
+ if (scopeChangeRequiresProxy) {
+ // Exit here so that nested inner bean definitions are not
+ // analysed
+ return createScopedProxy(beanName, definition, registry, proxyTargetClass);
+ }
+ }
+
+ // Nested inner bean definitions are recursively analysed here
+ value = super.resolveValue(value);
+ return value;
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/config/xml/ActivitiAnnotationDrivenBeanDefinitionParser.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/config/xml/ActivitiAnnotationDrivenBeanDefinitionParser.java
new file mode 100644
index 0000000000000000000000000000000000000000..fdbe94adaf484cdac75aa0f6f7cf6403a50537e4
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/config/xml/ActivitiAnnotationDrivenBeanDefinitionParser.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2010 the original author or authors
+ *
+ * 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.camunda.bpm.engine.spring.components.config.xml;
+
+
+import org.camunda.bpm.engine.spring.components.ActivitiContextUtils;
+import org.camunda.bpm.engine.spring.components.aop.ProcessStartAnnotationBeanPostProcessor;
+import org.camunda.bpm.engine.spring.components.scope.ProcessScope;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.BeanDefinitionHolder;
+import org.springframework.beans.factory.config.RuntimeBeanReference;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
+import org.springframework.beans.factory.xml.BeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.core.Conventions;
+import org.springframework.util.StringUtils;
+import org.w3c.dom.Element;
+
+/**
+ * registers support for handling the annotations in the org.camunda.bpm.engine.annotations package.
+ *
+ * The first major component is the state handlers. For this to work, a BeanFactoryPostProcessor is registered which in turn registers a
+ * {@link org.camunda.bpm.engine.test.spring.components.registry.ActivitiStateHandlerRegistry} if none exists.
+ *
+ * @author Josh Long
+ * @since 5.3
+ */
+public class ActivitiAnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
+
+ private final String processEngineAttribute = "process-engine";
+
+ public BeanDefinition parse(Element element, ParserContext parserContext) {
+ registerProcessScope(element, parserContext);
+ registerStateHandlerAnnotationBeanFactoryPostProcessor(element, parserContext);
+ registerProcessStartAnnotationBeanPostProcessor(element, parserContext);
+ return null;
+ }
+
+ private void configureProcessEngine(AbstractBeanDefinition abstractBeanDefinition, Element element) {
+ String procEngineRef = element.getAttribute(processEngineAttribute);
+ if (StringUtils.hasText(procEngineRef))
+ abstractBeanDefinition.getPropertyValues().add(Conventions.attributeNameToPropertyName(processEngineAttribute), new RuntimeBeanReference(procEngineRef));
+ }
+
+ private void registerStateHandlerAnnotationBeanFactoryPostProcessor(Element element, ParserContext context) {
+ Class clz = StateHandlerAnnotationBeanFactoryPostProcessor.class;
+ BeanDefinitionBuilder postProcessorBuilder = BeanDefinitionBuilder.genericBeanDefinition(clz.getName());
+
+ BeanDefinitionHolder postProcessorHolder = new BeanDefinitionHolder(
+ postProcessorBuilder.getBeanDefinition(),
+ ActivitiContextUtils.ANNOTATION_STATE_HANDLER_BEAN_FACTORY_POST_PROCESSOR_BEAN_NAME);
+ configureProcessEngine(postProcessorBuilder.getBeanDefinition(), element);
+ BeanDefinitionReaderUtils.registerBeanDefinition(postProcessorHolder, context.getRegistry());
+
+ }
+
+ private void registerProcessScope(Element element, ParserContext parserContext) {
+ Class clz = ProcessScope.class;
+ BeanDefinitionBuilder processScopeBDBuilder = BeanDefinitionBuilder.genericBeanDefinition(clz);
+ AbstractBeanDefinition scopeBeanDefinition = processScopeBDBuilder.getBeanDefinition();
+ scopeBeanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
+ configureProcessEngine(scopeBeanDefinition, element);
+ String beanName = baseBeanName(clz);
+ parserContext.getRegistry().registerBeanDefinition(beanName, scopeBeanDefinition);
+ }
+
+ private void registerProcessStartAnnotationBeanPostProcessor(Element element, ParserContext parserContext) {
+ Class clz = ProcessStartAnnotationBeanPostProcessor.class;
+
+ BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(clz);
+ AbstractBeanDefinition beanDefinition = beanDefinitionBuilder.getBeanDefinition();
+ beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
+ configureProcessEngine(beanDefinition, element);
+
+ String beanName = baseBeanName(clz);
+ parserContext.getRegistry().registerBeanDefinition(beanName, beanDefinition);
+ }
+
+ private String baseBeanName(Class cl) {
+ return cl.getName().toLowerCase();
+ }
+}
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/config/xml/ActivitiNamespaceHandler.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/config/xml/ActivitiNamespaceHandler.java
new file mode 100644
index 0000000000000000000000000000000000000000..11d56633933206f7bccf9f2fdefac6b46e24d181
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/config/xml/ActivitiNamespaceHandler.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2010 the original author or authors
+ *
+ * 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.camunda.bpm.engine.spring.components.config.xml;
+
+import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+
+/**
+ * responsible for providing support.
+ *
+ * @author Josh Long
+ * @since 5.3
+ */
+public class ActivitiNamespaceHandler extends NamespaceHandlerSupport {
+ public void init() {
+ registerBeanDefinitionParser("annotation-driven", new ActivitiAnnotationDrivenBeanDefinitionParser());
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/config/xml/StateHandlerAnnotationBeanFactoryPostProcessor.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/config/xml/StateHandlerAnnotationBeanFactoryPostProcessor.java
new file mode 100644
index 0000000000000000000000000000000000000000..b30859976993baef11f23d656c3770f7d85db2c0
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/config/xml/StateHandlerAnnotationBeanFactoryPostProcessor.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2010 the original author or authors
+ *
+ * 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.camunda.bpm.engine.spring.components.config.xml;
+
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.spring.components.ActivitiContextUtils;
+import org.camunda.bpm.engine.spring.components.registry.ActivitiStateHandlerRegistry;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.BeanDefinitionHolder;
+import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.RootBeanDefinition;
+
+import java.util.logging.Logger;
+
+/**
+ * this class is responsible for registering the other {@link org.springframework.beans.factory.config.BeanFactoryPostProcessor}s
+ * and {@link BeanFactoryPostProcessor}s.
+ *
+ * Particularly, this will register the {@link ActivitiStateHandlerRegistry} which is used to react to states.
+ *
+ * @author Josh Long
+ */
+public class StateHandlerAnnotationBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
+
+ private ProcessEngine processEngine ;
+ private Logger log = Logger.getLogger(getClass().getName());
+
+ public void setProcessEngine(ProcessEngine processEngine) {
+ this.processEngine = processEngine;
+ }
+
+ private void configureDefaultActivitiRegistry(String registryBeanName, BeanDefinitionRegistry registry) {
+
+
+ if (!beanAlreadyConfigured(registry, registryBeanName, ActivitiStateHandlerRegistry.class)) {
+ String registryName =ActivitiStateHandlerRegistry.class.getName();
+ log.info( "registering a " + registryName + " instance under bean name "+ ActivitiContextUtils.ACTIVITI_REGISTRY_BEAN_NAME+ ".");
+
+ RootBeanDefinition rootBeanDefinition = new RootBeanDefinition();
+ rootBeanDefinition.setBeanClassName( registryName );
+ rootBeanDefinition.getPropertyValues().addPropertyValue("processEngine", this.processEngine);
+
+ BeanDefinitionHolder holder = new BeanDefinitionHolder(rootBeanDefinition, registryBeanName);
+ BeanDefinitionReaderUtils.registerBeanDefinition(holder, registry);
+ }
+ }
+
+ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
+ if (beanFactory instanceof BeanDefinitionRegistry) {
+ BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;
+ configureDefaultActivitiRegistry(ActivitiContextUtils.ACTIVITI_REGISTRY_BEAN_NAME, registry);
+
+
+ } else {
+ log.info("BeanFactory is not a BeanDefinitionRegistry. The default '"
+ + ActivitiContextUtils.ACTIVITI_REGISTRY_BEAN_NAME + "' cannot be configured.");
+ }
+ }
+
+ private boolean beanAlreadyConfigured(BeanDefinitionRegistry registry, String beanName, Class clz) {
+ if (registry.isBeanNameInUse(beanName)) {
+ BeanDefinition bDef = registry.getBeanDefinition(beanName);
+ if (bDef.getBeanClassName().equals(clz.getName())) {
+ return true; // so the beans already registered, and of the right type. so we assume the user is overriding our configuration
+ } else {
+ throw new IllegalStateException("The bean name '" + beanName + "' is reserved.");
+ }
+ }
+ return false;
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/jobexecutor/SpringJobExecutor.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/jobexecutor/SpringJobExecutor.java
new file mode 100644
index 0000000000000000000000000000000000000000..f4a18643f0f2322008250c6a2f3fc8315c506a49
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/jobexecutor/SpringJobExecutor.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.components.jobexecutor;
+
+import java.util.List;
+import java.util.concurrent.RejectedExecutionException;
+
+import org.camunda.bpm.engine.impl.ProcessEngineImpl;
+import org.camunda.bpm.engine.impl.jobexecutor.JobExecutor;
+import org.springframework.core.task.TaskExecutor;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+/**
+ *
+ *
+ * This is a spring based implementation of the {@link JobExecutor} using spring abstraction {@link TaskExecutor}
+ * for performing background task execution.
+ *
+ *
+ * The idea behind this implementation is to externalize the configuration of the task executor, so it can leverage to
+ * Application servers controller thread pools, for example using the commonj API. The use of unmanaged thread in application servers
+ * is discouraged by the Java EE spec.
+ *
+ *
+ * @author Pablo Ganga
+ */
+public class SpringJobExecutor extends JobExecutor {
+
+ private TaskExecutor taskExecutor;
+
+ public TaskExecutor getTaskExecutor() {
+ return taskExecutor;
+ }
+
+ /**
+ * Required spring injected {@link TaskExecutor}} implementation that will be used to execute runnable jobs.
+ *
+ * @param taskExecutor
+ */
+ public void setTaskExecutor(TaskExecutor taskExecutor) {
+ this.taskExecutor = taskExecutor;
+ }
+
+ public void executeJobs(List jobIds, ProcessEngineImpl processEngine) {
+ try {
+ taskExecutor.execute(getExecuteJobsRunnable(jobIds, processEngine));
+ } catch (RejectedExecutionException e) {
+ logRejectedExecution(processEngine, jobIds.size());
+ rejectedJobsHandler.jobsRejected(jobIds, processEngine, this);
+ } finally {
+ if (taskExecutor instanceof ThreadPoolTaskExecutor) {
+ logJobExecutionInfo(processEngine, ((ThreadPoolTaskExecutor) taskExecutor).getQueueSize(),
+ ((ThreadPoolTaskExecutor) taskExecutor).getQueueCapacity(),
+ ((ThreadPoolTaskExecutor) taskExecutor).getMaxPoolSize(),
+ ((ThreadPoolTaskExecutor) taskExecutor).getActiveCount());
+ }
+ }
+ }
+
+ @Override
+ protected void startExecutingJobs() {
+ startJobAcquisitionThread();
+ }
+
+ @Override
+ protected void stopExecutingJobs() {
+ stopJobAcquisitionThread();
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/registry/ActivitiStateHandlerRegistration.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/registry/ActivitiStateHandlerRegistration.java
new file mode 100644
index 0000000000000000000000000000000000000000..577458bb8f9e61a3690b066764380dcaaa00be12
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/registry/ActivitiStateHandlerRegistration.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2010 the original author or authors
+ *
+ * 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.camunda.bpm.engine.spring.components.registry;
+
+
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+
+/**
+ * an instance of a bean discovered to both have an {@link org.camunda.bpm.engine.ProcessEngineComponent.ActivitiComponent}
+ * and one or more {@link org.camunda.bpm.engine.ProcessEngineComponent.ActivitiComponent} annotations present.
+ *
+ * Describes the metadata extracted from the bean at configuration time
+ *
+ * @author Josh Long
+ * @since 1.0
+ */
+public class ActivitiStateHandlerRegistration {
+ private Map processVariablesExpected = new ConcurrentHashMap();
+ private Method handlerMethod;
+ private Object handler;
+ private String stateName;
+ private String beanName;
+ private int processVariablesIndex = -1;
+ private int processIdIndex = -1;
+ private String processName;
+
+ public ActivitiStateHandlerRegistration(
+ Map processVariablesExpected, Method handlerMethod,
+ Object handler, String stateName, String beanName,
+ int processVariablesIndex, int processIdIndex, String processName) {
+ this.processVariablesExpected = processVariablesExpected;
+ this.handlerMethod = handlerMethod;
+ this.handler = handler;
+ this.stateName = stateName;
+ this.beanName = beanName;
+ this.processVariablesIndex = processVariablesIndex;
+ this.processIdIndex = processIdIndex;
+ this.processName = processName;
+ }
+
+ public int getProcessVariablesIndex() {
+ return processVariablesIndex;
+ }
+
+ public int getProcessIdIndex() {
+ return processIdIndex;
+ }
+
+ public boolean requiresProcessId() {
+ return this.processIdIndex > -1;
+ }
+
+ public boolean requiresProcessVariablesMap() {
+ return processVariablesIndex > -1;
+ }
+
+ public String getBeanName() {
+ return beanName;
+ }
+
+ public Map getProcessVariablesExpected() {
+ return processVariablesExpected;
+ }
+
+ public Method getHandlerMethod() {
+ return handlerMethod;
+ }
+
+ public Object getHandler() {
+ return handler;
+ }
+
+ public String getStateName() {
+ return stateName;
+ }
+
+ public String getProcessName() {
+ return processName;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + "["
+ + "processVariablesExpected=" + processVariablesExpected + ", "
+ + "handlerMethod=" + handlerMethod + ", "
+ + "handler=" + handler + ", "
+ + "stateName=" + stateName + ", "
+ + "beanName=" + beanName + ", "
+ + "processVariablesIndex=" + processVariablesIndex + ", "
+ + "processIdIndex=" + processIdIndex + ", "
+ + "processName=" + processName + "]";
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/registry/ActivitiStateHandlerRegistry.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/registry/ActivitiStateHandlerRegistry.java
new file mode 100644
index 0000000000000000000000000000000000000000..a35dc56e5f62b8b0736d1f9314ce9fce97630dc0
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/registry/ActivitiStateHandlerRegistry.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2010 the original author or authors
+ *
+ * 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.camunda.bpm.engine.spring.components.registry;
+
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.impl.bpmn.behavior.ReceiveTaskActivityBehavior;
+import org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior;
+import org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.BeanFactoryAware;
+import org.springframework.beans.factory.BeanNameAware;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.util.Assert;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Logger;
+
+
+/**
+ * this class records and manages all known {@link org.camunda.bpm.engine.annotations.State} - responding
+ * beans in the JVM. It should have metadata on all methods, and what
+ * those methods expect from a given invocation (ie: which process, which process variables).
+ *
+ * @author Josh Long
+ * @since 1.0
+ */
+public class ActivitiStateHandlerRegistry extends ReceiveTaskActivityBehavior implements BeanFactoryAware, BeanNameAware, ActivityBehavior, InitializingBean {
+
+ private Logger logger = Logger.getLogger(getClass().getName());
+
+ private String beanName;
+
+ private BeanFactory beanFactory;
+
+ private volatile ConcurrentHashMap registrations = new ConcurrentHashMap();
+
+ private ProcessEngine processEngine;
+
+ public void setProcessEngine(ProcessEngine processEngine) {
+ this.processEngine = processEngine;
+ }
+
+ @Override
+ public void execute(ActivityExecution execution) throws Exception {
+
+ }
+
+ @Override
+ public void signal(ActivityExecution execution, String signalName, Object data) throws Exception {
+ leave(execution);
+ }
+
+ protected String registrationKey(String stateName, String processName) {
+ return (org.camunda.commons.utils.StringUtil.defaultString(processName) +
+ ":" + org.camunda.commons.utils.StringUtil.defaultString(stateName)).toLowerCase();
+ }
+
+ /**
+ * used at runtime to register state handlers as they are registered with the spring context
+ *
+ * @param registration the {@link org.camunda.bpm.engine.test.spring.components.registry.ActivitiStateHandlerRegistration}
+ */
+ public void registerActivitiStateHandler(
+ ActivitiStateHandlerRegistration registration) {
+ String regKey = registrationKey(registration.getProcessName(),
+ registration.getStateName());
+ this.registrations.put(regKey, registration);
+ }
+
+ /**
+ * this is responsible for looking up components in the registry and returning the appropriate handler based
+ * on specificity of the {@link org.camunda.bpm.engine.test.spring.components.registry.ActivitiStateHandlerRegistration}
+ *
+ * @param processName the process name to look for (optional)
+ * @param stateName the state name to look for (not optional)
+ * @return all matching options
+ */
+ public Collection findRegistrationsForProcessAndState(
+ String processName, String stateName) {
+ Collection registrationCollection = new ArrayList();
+ String regKeyFull = registrationKey(processName, stateName);
+ String regKeyWithJustState = registrationKey(null, stateName);
+
+ for (String k : this.registrations.keySet())
+ if (k.contains(regKeyFull)) {
+ registrationCollection.add(this.registrations.get(k));
+ }
+
+ if (registrationCollection.size() == 0) {
+ for (String k : this.registrations.keySet())
+ if (k.contains(regKeyWithJustState)) {
+ registrationCollection.add(this.registrations.get(k));
+ }
+ }
+
+ return registrationCollection;
+ }
+
+ /**
+ * this scours the registry looking for candidate registrations that match a given process name and/ or state nanme
+ *
+ * @param processName the name of the process
+ * @param stateName the name of the state
+ * @return an unambiguous {@link org.camunda.bpm.engine.test.spring.components.registry.ActivitiStateHandlerRegistry} or null
+ */
+ public ActivitiStateHandlerRegistration findRegistrationForProcessAndState(String processName, String stateName) {
+
+ ActivitiStateHandlerRegistration r = null;
+
+ String key = registrationKey(processName, stateName);
+
+ Collection rs = this.findRegistrationsForProcessAndState(
+ processName, stateName);
+
+ for (ActivitiStateHandlerRegistration sr : rs) {
+ String kName = registrationKey(sr.getProcessName(), sr.getStateName());
+ if (key.equalsIgnoreCase(kName)) {
+ r = sr;
+ break;
+ }
+ }
+
+ for (ActivitiStateHandlerRegistration sr : rs) {
+ String kName = registrationKey(null, sr.getStateName());
+ if (key.equalsIgnoreCase(kName)) {
+ r = sr;
+ break;
+ }
+ }
+
+ if ((r == null) && (rs.size() > 0)) {
+ r = rs.iterator().next();
+ }
+
+ return r;
+ }
+
+ public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
+ this.beanFactory = beanFactory;
+ }
+
+ public void setBeanName(String name) {
+ this.beanName = name;
+ }
+
+ public void afterPropertiesSet() throws Exception {
+ Assert.notNull(this.processEngine, "the 'processEngine' can't be null");
+ logger.info( "this bean contains a processEngine reference. "+ this.processEngine);
+ logger.info("starting " + getClass().getName());
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/scope/ProcessScope.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/scope/ProcessScope.java
new file mode 100644
index 0000000000000000000000000000000000000000..5e76ecce9d836c9c52c544b95cd89d8062003e4e
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/components/scope/ProcessScope.java
@@ -0,0 +1,240 @@
+/*
+ * Copyright 2010 the original author or authors
+ *
+ * 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.camunda.bpm.engine.spring.components.scope;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Logger;
+
+import org.aopalliance.intercept.MethodInterceptor;
+import org.aopalliance.intercept.MethodInvocation;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.impl.context.Context;
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.spring.components.aop.util.Scopifier;
+import org.camunda.commons.utils.StringUtil;
+import org.springframework.aop.framework.ProxyFactory;
+import org.springframework.aop.scope.ScopedObject;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.ObjectFactory;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.config.Scope;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.util.Assert;
+import org.springframework.util.ClassUtils;
+
+/**
+ * binds variables to a currently executing Activiti business process (a {@link org.camunda.bpm.engine.runtime.ProcessInstance}).
+ *
+ * Parts of this code are lifted wholesale from Dave Syer's work on the Spring 3.1 RefreshScope.
+ *
+ * @author Josh Long
+ * @since 5.3
+ */
+public class ProcessScope implements Scope, InitializingBean, BeanFactoryPostProcessor, DisposableBean {
+
+ /**
+ * Map of the processVariables. Supports correct, scoped access to process variables so that
+ *
+ *
+ * @Value("#{ processVariables['customerId'] }") long customerId;
+ *
+ *
+ * works in any bean - scoped or not
+ */
+ public final static String PROCESS_SCOPE_PROCESS_VARIABLES_SINGLETON = "processVariables";
+ public final static String PROCESS_SCOPE_NAME = "process";
+
+ private ClassLoader classLoader = ClassUtils.getDefaultClassLoader();
+
+ private boolean proxyTargetClass = true;
+
+ private Logger logger = Logger.getLogger(getClass().getName());
+
+ private ProcessEngine processEngine;
+
+ private RuntimeService runtimeService;
+
+ // set through Namespace reflection if nothing else
+ @SuppressWarnings("unused")
+ public void setProcessEngine(ProcessEngine processEngine) {
+ this.processEngine = processEngine;
+ }
+
+ public Object get(String name, ObjectFactory> objectFactory) {
+
+ ExecutionEntity executionEntity = null;
+ try {
+ logger.fine("returning scoped object having beanName '" + name + "' for conversation ID '" + this.getConversationId() + "'. ");
+
+ ProcessInstance processInstance = Context.getExecutionContext().getProcessInstance();
+ executionEntity = (ExecutionEntity) processInstance;
+
+ Object scopedObject = executionEntity.getVariable(name);
+ if (scopedObject == null) {
+ scopedObject = objectFactory.getObject();
+ if (scopedObject instanceof ScopedObject) {
+ ScopedObject sc = (ScopedObject) scopedObject;
+ scopedObject = sc.getTargetObject();
+ logger.fine("de-referencing " + ScopedObject.class.getName() + "#targetObject before persisting variable");
+ }
+ persistVariable(name, scopedObject);
+ }
+ return createDirtyCheckingProxy(name, scopedObject);
+ } catch (Throwable th) {
+ logger.warning("couldn't return value from process scope! " + StringUtil.getStackTrace(th));
+ } finally {
+ if (executionEntity != null) {
+ logger.fine("set variable '" + name + "' on executionEntity# " + executionEntity.getId());
+ }
+ }
+ return null;
+ }
+
+ public void registerDestructionCallback(String name, Runnable callback) {
+ logger.fine("no support for registering descruction callbacks implemented currently. registerDestructionCallback('" + name + "',callback) will do nothing.");
+ }
+
+ private String getExecutionId() {
+ return Context.getExecutionContext().getExecution().getId();
+ }
+
+ public Object remove(String name) {
+
+ logger.fine("remove '" + name + "'");
+ return runtimeService.getVariable(getExecutionId(), name);
+ }
+
+ public Object resolveContextualObject(String key) {
+
+ if ("executionId".equalsIgnoreCase(key))
+ return Context.getExecutionContext().getExecution().getId();
+
+ if ("processInstance".equalsIgnoreCase(key))
+ return Context.getExecutionContext().getProcessInstance();
+
+ if ("processInstanceId".equalsIgnoreCase(key))
+ return Context.getExecutionContext().getProcessInstance().getId();
+
+ return null;
+ }
+
+ /**
+ * creates a proxy that dispatches invocations to the currently bound {@link ProcessInstance}
+ *
+ * @return shareable {@link ProcessInstance}
+ */
+ private Object createSharedProcessInstance() {
+ ProxyFactory proxyFactoryBean = new ProxyFactory(ProcessInstance.class, new MethodInterceptor() {
+ public Object invoke(MethodInvocation methodInvocation) throws Throwable {
+ String methodName = methodInvocation.getMethod().getName() ;
+
+ logger.info("method invocation for " + methodName+ ".");
+ if(methodName.equals("toString"))
+ return "SharedProcessInstance";
+
+
+ ProcessInstance processInstance = Context.getExecutionContext().getProcessInstance();
+ Method method = methodInvocation.getMethod();
+ Object[] args = methodInvocation.getArguments();
+ Object result = method.invoke(processInstance, args);
+ return result;
+ }
+ });
+ return proxyFactoryBean.getProxy(this.classLoader);
+ }
+
+ public String getConversationId() {
+ return getExecutionId();
+ }
+
+ private final ConcurrentHashMap processVariablesMap = new ConcurrentHashMap() {
+ @Override
+ public java.lang.Object get(java.lang.Object o) {
+
+ Assert.isInstanceOf(String.class, o, "the 'key' must be a String");
+
+ String varName = (String) o;
+
+ ProcessInstance processInstance = Context.getExecutionContext().getProcessInstance();
+ ExecutionEntity executionEntity = (ExecutionEntity) processInstance;
+ if (executionEntity.getVariableNames().contains(varName)) {
+ return executionEntity.getVariable(varName);
+ }
+ throw new RuntimeException("no processVariable by the name of '" + varName + "' is available!");
+ }
+ };
+
+ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
+
+ beanFactory.registerScope(ProcessScope.PROCESS_SCOPE_NAME, this);
+
+ Assert.isInstanceOf(BeanDefinitionRegistry.class, beanFactory, "BeanFactory was not a BeanDefinitionRegistry, so ProcessScope cannot be used.");
+
+ BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;
+
+ for (String beanName : beanFactory.getBeanDefinitionNames()) {
+ BeanDefinition definition = beanFactory.getBeanDefinition(beanName);
+ // Replace this or any of its inner beans with scoped proxy if it has this scope
+ boolean scoped = PROCESS_SCOPE_NAME.equals(definition.getScope());
+ Scopifier scopifier = new Scopifier(registry, PROCESS_SCOPE_NAME, proxyTargetClass, scoped);
+ scopifier.visitBeanDefinition(definition);
+ if (scoped) {
+ Scopifier.createScopedProxy(beanName, definition, registry, proxyTargetClass);
+ }
+ }
+
+ beanFactory.registerSingleton(ProcessScope.PROCESS_SCOPE_PROCESS_VARIABLES_SINGLETON, this.processVariablesMap);
+ beanFactory.registerResolvableDependency(ProcessInstance.class, createSharedProcessInstance());
+ }
+
+ public void destroy() throws Exception {
+ logger.info(ProcessScope.class.getName() + "#destroy() called ...");
+ }
+
+ public void afterPropertiesSet() throws Exception {
+ Assert.notNull(this.processEngine, "the 'processEngine' must not be null!");
+ this.runtimeService = this.processEngine.getRuntimeService();
+ }
+
+ private Object createDirtyCheckingProxy(final String name, final Object scopedObject) throws Throwable {
+ ProxyFactory proxyFactoryBean = new ProxyFactory(scopedObject);
+ proxyFactoryBean.setProxyTargetClass(this.proxyTargetClass);
+ proxyFactoryBean.addAdvice(new MethodInterceptor() {
+ public Object invoke(MethodInvocation methodInvocation) throws Throwable {
+ Object result = methodInvocation.proceed();
+ persistVariable(name, scopedObject);
+ return result;
+ }
+ });
+ return proxyFactoryBean.getProxy(this.classLoader);
+ }
+
+ private void persistVariable(String variableName, Object scopedObject) {
+ ProcessInstance processInstance = Context.getExecutionContext().getProcessInstance();
+ ExecutionEntity executionEntity = (ExecutionEntity) processInstance;
+ Assert.isTrue(scopedObject instanceof Serializable, "the scopedObject is not " + Serializable.class.getName() + "!");
+ executionEntity.setVariable(variableName, scopedObject);
+ }
+}
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/container/ManagedProcessEngineFactoryBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/container/ManagedProcessEngineFactoryBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..2730055d737f8e9aa01f0fd08277e20c3191c4a9
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/java/org/camunda/bpm/engine/spring/container/ManagedProcessEngineFactoryBean.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.container;
+
+import org.camunda.bpm.BpmPlatform;
+import org.camunda.bpm.container.RuntimeContainerDelegate;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.spring.ProcessEngineFactoryBean;
+
+/**
+ * Factory bean registering a spring-managed process engine with the {@link BpmPlatform}.
+ *
+ * Replacement for {@link ProcessEngineFactoryBean}. Use this implementation if you want to
+ * register a process engine configured in a spring application context with the {@link BpmPlatform}.
+ *
+ * @author Daniel Meyer
+ *
+ */
+public class ManagedProcessEngineFactoryBean extends ProcessEngineFactoryBean {
+
+ public ProcessEngine getObject() throws Exception {
+ ProcessEngine processEngine = super.getObject();
+
+ RuntimeContainerDelegate runtimeContainerDelegate = getRuntimeContainerDelegate();
+ runtimeContainerDelegate.registerProcessEngine(processEngine);
+
+ return processEngine;
+ }
+
+ protected RuntimeContainerDelegate getRuntimeContainerDelegate() {
+ return RuntimeContainerDelegate.INSTANCE.get();
+ }
+
+ public void destroy() throws Exception {
+
+ if(processEngine != null) {
+ getRuntimeContainerDelegate().unregisterProcessEngine(processEngine);
+ }
+
+ super.destroy();
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/resources/META-INF/services/org.camunda.bpm.application.ProcessApplicationElResolver b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/resources/META-INF/services/org.camunda.bpm.application.ProcessApplicationElResolver
new file mode 100644
index 0000000000000000000000000000000000000000..e95e6a85890c3aa892fee5bf98d1ab98676442a5
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/resources/META-INF/services/org.camunda.bpm.application.ProcessApplicationElResolver
@@ -0,0 +1 @@
+org.camunda.bpm.engine.spring.application.SpringProcessApplicationElResolver
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/resources/META-INF/spring.handlers b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/resources/META-INF/spring.handlers
new file mode 100644
index 0000000000000000000000000000000000000000..1716b7b3a8001a215bf92b03d8db9a41e73c19c6
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/resources/META-INF/spring.handlers
@@ -0,0 +1 @@
+http\://www.activiti.org/schema/spring/components=org.camunda.bpm.engine.spring.components.config.xml.ActivitiNamespaceHandler
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/resources/META-INF/spring.schemas b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/resources/META-INF/spring.schemas
new file mode 100644
index 0000000000000000000000000000000000000000..c3e9f380966711374185504948f98316cd7aa511
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/resources/META-INF/spring.schemas
@@ -0,0 +1,2 @@
+http\://www.activiti.org/schema/spring/components/activiti-5.0.xsd=org/camunda/bpm/engine/spring/components/config/xml/camunda-7.0.xsd
+http\://www.activiti.org/schema/spring/components/activiti.xsd=org/camunda/bpm/engine/spring/components/config/xml/camunda-7.0.xsd
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/resources/org/camunda/bpm/engine/spring/components/config/xml/camunda-7.0.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/resources/org/camunda/bpm/engine/spring/components/config/xml/camunda-7.0.xsd
new file mode 100644
index 0000000000000000000000000000000000000000..ae28180ee281ca9bd5e1e9df9e8cf0a0edca8785
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/main/resources/org/camunda/bpm/engine/spring/components/config/xml/camunda-7.0.xsd
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Enables annotation support
+
+
+
+
+
+
+ Reference to the ProcessEngine instance
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/ExampleConfiguration.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/ExampleConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..ec282e1a6d31b39157e32c739d210e813fde4c9f
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/ExampleConfiguration.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test;
+
+import org.camunda.bpm.engine.ProcessEngineConfiguration;
+import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
+import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration;
+import org.camunda.bpm.engine.spring.ProcessEngineFactoryBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @author Thorben Lindhauer
+ *
+ */
+@Configuration
+public class ExampleConfiguration {
+
+ @Bean
+ public ProcessEngineConfiguration processEngineConfiguration() {
+ return new StandaloneInMemProcessEngineConfiguration()
+ .setJobExecutorDeploymentAware(true)
+ .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
+ }
+
+ @Bean
+ public ProcessEngineFactoryBean processEngine() throws Exception {
+ ProcessEngineFactoryBean engineFactoryBean = new ProcessEngineFactoryBean();
+ engineFactoryBean.setProcessEngineConfiguration((ProcessEngineConfigurationImpl) processEngineConfiguration());
+
+ return engineFactoryBean;
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/Spring5TestHelper.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/Spring5TestHelper.java
new file mode 100644
index 0000000000000000000000000000000000000000..57c8b930ceb953fff059ce2dd5572a0bd23e5434
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/Spring5TestHelper.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test;
+
+import org.springframework.test.annotation.DirtiesContext.HierarchyMode;
+import org.springframework.test.context.TestContext;
+import org.springframework.test.context.TestContextManager;
+import org.springframework.test.context.TestExecutionListener;
+
+public class Spring5TestHelper implements SpringTestHelper {
+
+ @Override
+ public void beforeTestClass(TestContextManager testContextManager) {
+ testContextManager.registerTestExecutionListeners(new TestExecutionListener() {
+
+ @Override
+ public void prepareTestInstance(TestContext testContext) throws Exception {
+ }
+
+ @Override
+ public void beforeTestMethod(TestContext testContext) throws Exception {
+ }
+
+ @Override
+ public void beforeTestClass(TestContext testContext) throws Exception {
+ }
+
+ @Override
+ public void afterTestMethod(TestContext testContext) throws Exception {
+ }
+
+ @Override
+ public void afterTestClass(TestContext testContext) throws Exception {
+ testContext.markApplicationContextDirty(HierarchyMode.EXHAUSTIVE);
+ }
+ });
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/SpringProcessEngineTestCase.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/SpringProcessEngineTestCase.java
new file mode 100644
index 0000000000000000000000000000000000000000..9a522fe7607d2eec4a014789098ba9891fbfd41d
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/SpringProcessEngineTestCase.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test;
+
+import java.util.ServiceLoader;
+
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.impl.test.AbstractProcessEngineTestCase;
+import org.springframework.beans.CachedIntrospectionResults;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestContextManager;
+import org.springframework.test.context.TestExecutionListeners;
+import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
+
+
+/**
+ * @author Joram Barrez
+ */
+@TestExecutionListeners(DependencyInjectionTestExecutionListener.class)
+public abstract class SpringProcessEngineTestCase extends AbstractProcessEngineTestCase implements ApplicationContextAware {
+
+ protected TestContextManager testContextManager;
+
+ @Autowired
+ protected ConfigurableApplicationContext applicationContext;
+
+ public SpringProcessEngineTestCase() {
+ super();
+ this.testContextManager = new TestContextManager(getClass());
+
+ SpringTestHelper testHelper = lookupTestHelper();
+ testHelper.beforeTestClass(testContextManager);
+ }
+
+ protected SpringTestHelper lookupTestHelper()
+ {
+ ServiceLoader serviceLoader = ServiceLoader.load(SpringTestHelper.class);
+ return serviceLoader.iterator().next();
+ }
+
+ @Override
+ public void runBare() throws Throwable {
+ testContextManager.prepareTestInstance(this); // this will initialize all dependencies
+ try {
+ super.runBare();
+ }
+ finally {
+ testContextManager.afterTestClass();
+ applicationContext.close();
+ applicationContext = null;
+ processEngine = null;
+ testContextManager = null;
+ CachedIntrospectionResults.clearClassLoader(getClass().getClassLoader());
+ }
+ }
+
+ @Override
+ protected void initializeProcessEngine() {
+ ContextConfiguration contextConfiguration = getClass().getAnnotation(ContextConfiguration.class);
+ processEngine = applicationContext.getBean(ProcessEngine.class);
+ }
+
+ public void setApplicationContext(ApplicationContext applicationContext) {
+ this.applicationContext = (ConfigurableApplicationContext) applicationContext;
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/SpringProcessEngineTestCaseTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/SpringProcessEngineTestCaseTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..f0bca4dc11d44d9ed94f468173024990bf23df42
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/SpringProcessEngineTestCaseTest.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test;
+
+import org.camunda.bpm.engine.impl.ProcessEngineImpl;
+import org.springframework.test.context.ContextConfiguration;
+
+/**
+ * @author Thorben Lindhauer
+ *
+ */
+@ContextConfiguration(classes = ExampleConfiguration.class)
+public class SpringProcessEngineTestCaseTest extends SpringProcessEngineTestCase {
+
+ public void testProgrammaticContextConfiguration() {
+ assertNotNull(processEngine);
+ assertTrue(((ProcessEngineImpl) processEngine).getProcessEngineConfiguration().isJobExecutorDeploymentAware());
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/SpringTestHelper.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/SpringTestHelper.java
new file mode 100644
index 0000000000000000000000000000000000000000..936840469eb2b197f1c332878ac18645da7f64ba
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/SpringTestHelper.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test;
+
+import org.springframework.test.context.TestContextManager;
+
+/**
+ * Contains Spring-version-specific test code
+ */
+public interface SpringTestHelper {
+
+ public void beforeTestClass(TestContextManager testContextManager);
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/application/CustomSpringProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/application/CustomSpringProcessApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..db4cdb71b6de08f18285263104096c7ad3150b9d
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/application/CustomSpringProcessApplication.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.application;
+
+import org.camunda.bpm.application.ProcessApplication;
+import org.camunda.bpm.engine.spring.application.SpringProcessApplication;
+
+/**
+ * @author Daniel Meyer
+ *
+ */
+@ProcessApplication(deploymentDescriptors={"org/camunda/bpm/engine/spring/test/application/processes.xml"})
+public class CustomSpringProcessApplication extends SpringProcessApplication {
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/application/PostDeployRegistrationPa.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/application/PostDeployRegistrationPa.java
new file mode 100644
index 0000000000000000000000000000000000000000..e566b88daf190948484b17a286a55f685788c499
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/application/PostDeployRegistrationPa.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.application;
+
+import java.util.concurrent.Callable;
+
+import org.camunda.bpm.application.PostDeploy;
+import org.camunda.bpm.application.PreUndeploy;
+import org.camunda.bpm.application.ProcessApplicationExecutionException;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.repository.ProcessDefinition;
+import org.camunda.bpm.engine.spring.application.SpringProcessApplication;
+
+/**
+ * @author Daniel Meyer
+ *
+ */
+public class PostDeployRegistrationPa extends SpringProcessApplication {
+
+ protected boolean isPostDeployInvoked = false;
+ protected boolean isPreUndeployInvoked = false;
+ protected String deploymentId;
+
+ @PostDeploy
+ public void registerProcessApplication(ProcessEngine processEngine) {
+
+ // lookup existing deployment
+ ProcessDefinition processDefinition = processEngine.getRepositoryService()
+ .createProcessDefinitionQuery()
+ .processDefinitionKey("startToEnd")
+ .latestVersion()
+ .singleResult();
+
+ deploymentId = processDefinition.getDeploymentId();
+
+ // register with the process engine
+ processEngine.getManagementService()
+ .registerProcessApplication(deploymentId, getReference());
+
+
+ isPostDeployInvoked = true;
+ }
+
+ @PreUndeploy
+ public void unregisterProcessApplicaiton(ProcessEngine processEngine) {
+
+ // unregister with the process engine
+ processEngine.getManagementService()
+ .unregisterProcessApplication(deploymentId, true);
+
+ isPreUndeployInvoked = true;
+
+ }
+
+
+ // customization of Process Application for unit test ////////////////////////////
+
+ protected boolean isInvoked = false;
+
+ @Override
+ public void start() {
+ // do not auto-deploy the process application : we want to manually deploy
+ // from the test-case
+ }
+
+ /** override execute to intercept calls from process engine and record that we are invoked. */
+ @Override
+ public T execute(Callable callable) throws ProcessApplicationExecutionException {
+ T result = super.execute(callable);
+ isInvoked = true;
+ return result;
+ }
+
+ public boolean isInvoked() {
+ return isInvoked;
+ }
+
+ public boolean isPostDeployInvoked() {
+ return isPostDeployInvoked;
+ }
+
+ public boolean isPreUndeployInvoked() {
+ return isPreUndeployInvoked;
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/application/PostDeployWithNestedContext.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/application/PostDeployWithNestedContext.java
new file mode 100644
index 0000000000000000000000000000000000000000..5b7f0867dc0d3424131b10f5d6b56c8a676bc31b
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/application/PostDeployWithNestedContext.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.application;
+
+import org.camunda.bpm.application.PostDeploy;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.spring.application.SpringProcessApplication;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.support.AbstractApplicationContext;
+
+public class PostDeployWithNestedContext extends SpringProcessApplication {
+
+ public class MyEvent extends ApplicationEvent {
+ private static final long serialVersionUID = 1L;
+
+ public MyEvent(Object source) {
+ super(source);
+ }
+ }
+
+ boolean deployCalled = false;
+ boolean triggered = false;
+ boolean deployOnChildRefresh;
+
+ @Override
+ public void setApplicationContext(ApplicationContext mainContext) throws BeansException {
+ super.setApplicationContext(mainContext);
+
+ AnnotationConfigApplicationContext nestedContext = new AnnotationConfigApplicationContext();
+ nestedContext.setParent(mainContext);
+
+ deployCalled = false;
+ nestedContext.refresh();
+ deployOnChildRefresh = deployCalled;
+
+ ((AbstractApplicationContext) mainContext).addApplicationListener(new ApplicationListener() {
+
+ @Override
+ public void onApplicationEvent(MyEvent event) {
+ triggered = true;
+ }
+ });
+ }
+
+ @PostDeploy
+ public void registerProcessApplication(ProcessEngine processEngine) {
+ deployCalled = true;
+ applicationContext.publishEvent(new MyEvent(this));
+ }
+
+ public boolean isDeployOnChildRefresh() {
+ return deployOnChildRefresh;
+ }
+
+ public boolean isLateEventTriggered() {
+ return triggered;
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/application/SpringProcessApplicationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/application/SpringProcessApplicationTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..ba32f54eec2e431acf19279bc28a3ff933bf7f77
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/application/SpringProcessApplicationTest.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.application;
+
+import org.camunda.bpm.BpmPlatform;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.repository.Deployment;
+import org.camunda.bpm.engine.spring.application.SpringProcessApplication;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * Testcases for {@link SpringProcessApplication}
+ *
+ * @author Daniel Meyer
+ *
+ */
+public class SpringProcessApplicationTest {
+
+ @Test
+ public void testProcessApplicationDeployment() {
+
+ // initially no applications are deployed:
+ Assert.assertEquals(0, BpmPlatform.getProcessApplicationService().getProcessApplicationNames().size());
+
+ // start a spring application context
+ AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/camunda/bpm/engine/spring/test/application/SpringProcessApplicationDeploymentTest-context.xml");
+ applicationContext.start();
+
+ // assert that there is a process application deployed with the name of the process application bean
+ Assert.assertNotNull(BpmPlatform.getProcessApplicationService()
+ .getProcessApplicationInfo("myProcessApplication"));
+
+ // close the spring application context
+ applicationContext.close();
+
+ // after closing the application context, the process application is undeployed.
+ Assert.assertNull(BpmPlatform.getProcessApplicationService()
+ .getProcessApplicationInfo("myProcessApplication"));
+
+ }
+
+ @Test
+ public void testDeployProcessArchive() {
+
+ // start a spring application context
+ AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/camunda/bpm/engine/spring/test/application/SpringProcessArchiveDeploymentTest-context.xml");
+ applicationContext.start();
+
+ // assert the process archive is deployed:
+ ProcessEngine processEngine = BpmPlatform.getDefaultProcessEngine();
+ Assert.assertNotNull(processEngine.getRepositoryService().createDeploymentQuery().deploymentName("pa").singleResult());
+
+ applicationContext.close();
+
+ // assert the process is undeployed
+ Assert.assertNull(processEngine.getRepositoryService().createDeploymentQuery().deploymentName("pa").singleResult());
+
+ }
+
+ @Test
+ public void testPostDeployRegistrationPa() {
+ // this test verifies that a process application is able to register a deployment from the @PostDeploy callback:
+
+ AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/camunda/bpm/engine/spring/test/application/PostDeployRegistrationPaTest-context.xml");
+ applicationContext.start();
+
+ ProcessEngine processEngine = BpmPlatform.getDefaultProcessEngine();
+
+ // create a manual deployment:
+ Deployment deployment = processEngine.getRepositoryService()
+ .createDeployment()
+ .addClasspathResource("org/camunda/bpm/engine/spring/test/application/process.bpmn20.xml")
+ .deploy();
+
+ // lookup the process application spring bean:
+ PostDeployRegistrationPa processApplication = applicationContext.getBean("customProcessApplicaiton", PostDeployRegistrationPa.class);
+
+ Assert.assertFalse(processApplication.isPostDeployInvoked());
+ processApplication.deploy();
+ Assert.assertTrue(processApplication.isPostDeployInvoked());
+
+ // the process application was not invoked
+ Assert.assertFalse(processApplication.isInvoked());
+
+ // start process instance:
+ processEngine.getRuntimeService()
+ .startProcessInstanceByKey("startToEnd");
+
+ // now the process application was invoked:
+ Assert.assertTrue(processApplication.isInvoked());
+
+ // undeploy PA
+ Assert.assertFalse(processApplication.isPreUndeployInvoked());
+ processApplication.undeploy();
+ Assert.assertTrue(processApplication.isPreUndeployInvoked());
+
+ // manually undeploy the process
+ processEngine.getRepositoryService()
+ .deleteDeployment(deployment.getId(), true);
+
+ applicationContext.close();
+
+ }
+
+ @Test
+ public void testPostDeployWithNestedContext() {
+ /*
+ * This test case checks if the process application deployment is done when
+ * application context is refreshed, but not when child contexts are
+ * refreshed.
+ *
+ * As a side test it checks if events thrown in the PostDeploy-method are
+ * catched by the main application context.
+ */
+
+ AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext(
+ "org/camunda/bpm/engine/spring/test/application/PostDeployWithNestedContext-context.xml");
+ applicationContext.start();
+
+ // lookup the process application spring bean:
+ PostDeployWithNestedContext processApplication = applicationContext.getBean("customProcessApplicaiton", PostDeployWithNestedContext.class);
+
+ Assert.assertFalse(processApplication.isDeployOnChildRefresh());
+ Assert.assertTrue(processApplication.isLateEventTriggered());
+
+ processApplication.undeploy();
+ applicationContext.close();
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/autodeployment/CustomNameSpringEngineConfiguration.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/autodeployment/CustomNameSpringEngineConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..d1eecb1bf88bc0971eb1383697949e54719e3198
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/autodeployment/CustomNameSpringEngineConfiguration.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.autodeployment;
+
+import org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration;
+import org.springframework.core.io.Resource;
+
+/**
+ * @author Tobias Metzke
+ *
+ */
+public class CustomNameSpringEngineConfiguration extends SpringProcessEngineConfiguration {
+ @Override
+ protected String getFileResourceName(Resource resource) {
+ return resource.getFilename();
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/autodeployment/DynamicResourceEngineConfiguration.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/autodeployment/DynamicResourceEngineConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..4b1bd6dc51e1c1e12969c945544a8114889a7963
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/autodeployment/DynamicResourceEngineConfiguration.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.autodeployment;
+
+import org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration;
+
+public class DynamicResourceEngineConfiguration extends SpringProcessEngineConfiguration {
+
+ public DynamicResourceEngineConfiguration()
+ {
+ this.deploymentResources = DynamicResourceProducer.getResources();
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/autodeployment/DynamicResourceProducer.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/autodeployment/DynamicResourceProducer.java
new file mode 100644
index 0000000000000000000000000000000000000000..dbe2cef909f414171dbe4072d764d5e35018bcd6
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/autodeployment/DynamicResourceProducer.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.autodeployment;
+
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.camunda.bpm.model.bpmn.Bpmn;
+import org.camunda.bpm.model.bpmn.BpmnModelInstance;
+import org.springframework.core.io.ByteArrayResource;
+import org.springframework.core.io.Resource;
+
+public class DynamicResourceProducer {
+
+ private static List resources = new ArrayList<>();
+
+ public static void clearResources()
+ {
+ resources.clear();
+ }
+
+ public static void addResource(String name, BpmnModelInstance modelInstance)
+ {
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ Bpmn.writeModelToStream(outStream, modelInstance);
+
+ resources.add(new NamedByteArrayResource(outStream.toByteArray(), name));
+ }
+
+ public static Resource[] getResources()
+ {
+ return resources.toArray(new Resource[resources.size()]);
+ }
+
+ /*
+ * In Spring 5, #getDescription is implemented differently
+ */
+ public static class NamedByteArrayResource extends ByteArrayResource
+ {
+ private String description;
+ public NamedByteArrayResource(byte[] byteArray, String description) {
+ super(byteArray, description);
+ this.description = description;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..aa9c420db8d9c7c7deb0887262e8778015febb1b
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTest.java
@@ -0,0 +1,226 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.autodeployment;
+
+import org.camunda.bpm.engine.RepositoryService;
+import org.camunda.bpm.engine.impl.test.PvmTestCase;
+import org.camunda.bpm.engine.repository.CaseDefinition;
+import org.camunda.bpm.engine.repository.Deployment;
+import org.camunda.bpm.engine.repository.DeploymentQuery;
+import org.camunda.bpm.engine.repository.ProcessDefinition;
+import org.camunda.bpm.engine.repository.ProcessDefinitionQuery;
+import org.camunda.bpm.model.bpmn.Bpmn;
+import org.camunda.bpm.model.bpmn.BpmnModelInstance;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Tom Baeyens
+ * @author Joram Barrez
+ */
+public class SpringAutoDeployTest extends PvmTestCase {
+
+ protected static final String CTX_PATH
+ = "org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTest-context.xml";
+ protected static final String CTX_CREATE_DROP_CLEAN_DB
+ = "org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTest-create-drop-clean-db-context.xml";
+ protected static final String CTX_DYNAMIC_DEPLOY_PATH
+ = "org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTest-dynamic-deployment-context.xml";
+
+ protected static final String CTX_CMMN_PATH
+ = "org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployCmmnTest-context.xml";
+
+ protected static final String CTX_CMMN_BPMN_TOGETHER_PATH
+ = "org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployCmmnBpmnTest-context.xml";
+
+ protected static final String CTX_DEPLOY_CHANGE_ONLY_PATH
+ = "org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployDeployChangeOnlyTest-context.xml";
+
+ protected static final String CTX_TENANT_ID_PATH
+ = "org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTenantIdTest-context.xml";
+
+ protected static final String CTX_CUSTOM_NAME_PATH
+ = "org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployCustomNameTest-context.xml";
+
+
+ protected ClassPathXmlApplicationContext applicationContext;
+ protected RepositoryService repositoryService;
+
+ protected void createAppContext(String path) {
+ this.applicationContext = new ClassPathXmlApplicationContext(path);
+ this.repositoryService = applicationContext.getBean(RepositoryService.class);
+ }
+
+ protected void tearDown() throws Exception {
+ DynamicResourceProducer.clearResources();
+ removeAllDeployments();
+ this.applicationContext.close();
+ this.applicationContext = null;
+ this.repositoryService = null;
+ super.tearDown();
+ }
+
+ public void testBasicActivitiSpringIntegration() {
+ createAppContext(CTX_PATH);
+ List processDefinitions = repositoryService
+ .createProcessDefinitionQuery()
+ .list();
+
+ Set processDefinitionKeys = new HashSet<>();
+ for (ProcessDefinition processDefinition: processDefinitions) {
+ processDefinitionKeys.add(processDefinition.getKey());
+ }
+
+ Set expectedProcessDefinitionKeys = new HashSet<>();
+ expectedProcessDefinitionKeys.add("a");
+ expectedProcessDefinitionKeys.add("b");
+ expectedProcessDefinitionKeys.add("c");
+
+ assertEquals(expectedProcessDefinitionKeys, processDefinitionKeys);
+ }
+
+ public void testNoRedeploymentForSpringContainerRestart() throws Exception {
+ createAppContext(CTX_PATH);
+ DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();
+ assertEquals(1, deploymentQuery.count());
+ ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
+ assertEquals(3, processDefinitionQuery.count());
+
+ // Creating a new app context with same resources doesn't lead to more deployments
+ ((AbstractXmlApplicationContext) applicationContext).close();
+ applicationContext = new ClassPathXmlApplicationContext(CTX_PATH);
+ assertEquals(1, deploymentQuery.count());
+ assertEquals(3, processDefinitionQuery.count());
+ }
+
+ public void testAutoDeployCmmn() {
+ createAppContext(CTX_CMMN_PATH);
+
+ List definitions = repositoryService.createCaseDefinitionQuery().list();
+
+ assertEquals(1, definitions.size());
+ }
+
+ public void testAutoDeployCmmnAndBpmnTogether() {
+ createAppContext(CTX_CMMN_BPMN_TOGETHER_PATH);
+
+ long caseDefs = repositoryService.createCaseDefinitionQuery().count();
+ long procDefs = repositoryService.createProcessDefinitionQuery().count();
+
+ assertEquals(1, caseDefs);
+ assertEquals(3, procDefs);
+ }
+
+ // when deployChangeOnly=true, new deployment should be created only for the changed resources
+ public void testDeployChangeOnly() throws Exception {
+ // given
+ BpmnModelInstance model1 = Bpmn.createExecutableProcess("model1").startEvent("oldId").endEvent().done();
+ BpmnModelInstance model2 = Bpmn.createExecutableProcess("model1").startEvent("newId").endEvent().done();
+ BpmnModelInstance model3 = Bpmn.createExecutableProcess("model2").startEvent().endEvent().done();
+
+ DynamicResourceProducer.addResource("a.bpmn", model1);
+ DynamicResourceProducer.addResource("b.bpmn", model3);
+
+ createAppContext(CTX_DEPLOY_CHANGE_ONLY_PATH);
+
+ // assume
+ assertEquals(1, repositoryService.createDeploymentQuery().count());
+
+ // when
+ ((AbstractXmlApplicationContext) applicationContext).close();
+
+ DynamicResourceProducer.clearResources();
+ DynamicResourceProducer.addResource("a.bpmn", model2);
+ DynamicResourceProducer.addResource("b.bpmn", model3);
+
+ applicationContext = new ClassPathXmlApplicationContext(CTX_DEPLOY_CHANGE_ONLY_PATH);
+ repositoryService = (RepositoryService) applicationContext.getBean("repositoryService");
+
+ // then
+ assertEquals(2, repositoryService.createDeploymentQuery().count());
+ assertEquals(3, repositoryService.createProcessDefinitionQuery().count());
+ }
+
+ // Updating the bpmn20 file should lead to a new deployment when restarting the Spring container
+ public void testResourceRedeploymentAfterProcessDefinitionChange() throws Exception {
+ // given
+ BpmnModelInstance model1 = Bpmn.createExecutableProcess("model1").startEvent("oldId").endEvent().done();
+ BpmnModelInstance model2 = Bpmn.createExecutableProcess("model1").startEvent("newId").endEvent().done();
+ BpmnModelInstance model3 = Bpmn.createExecutableProcess("model2").startEvent().endEvent().done();
+
+ DynamicResourceProducer.addResource("a.bpmn", model1);
+ DynamicResourceProducer.addResource("b.bpmn", model3);
+
+ createAppContext(CTX_DYNAMIC_DEPLOY_PATH);
+ assertEquals(1, repositoryService.createDeploymentQuery().count());
+ ((AbstractXmlApplicationContext)applicationContext).close();
+
+ // when
+ DynamicResourceProducer.clearResources();
+ DynamicResourceProducer.addResource("a.bpmn", model2);
+ DynamicResourceProducer.addResource("b.bpmn", model3);
+
+ applicationContext = new ClassPathXmlApplicationContext(CTX_DYNAMIC_DEPLOY_PATH);
+ repositoryService = (RepositoryService) applicationContext.getBean("repositoryService");
+
+ // then
+ // Assertions come AFTER the file write! Otherwise the process file is messed up if the assertions fail.
+ assertEquals(2, repositoryService.createDeploymentQuery().count());
+ assertEquals(4, repositoryService.createProcessDefinitionQuery().count());
+ }
+
+ public void testAutoDeployWithCreateDropOnCleanDb() {
+ createAppContext(CTX_CREATE_DROP_CLEAN_DB);
+ assertEquals(1, repositoryService.createDeploymentQuery().count());
+ assertEquals(3, repositoryService.createProcessDefinitionQuery().count());
+ }
+
+ public void testAutoDeployTenantId() {
+ createAppContext(CTX_TENANT_ID_PATH);
+
+ DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();
+
+ assertEquals(1, deploymentQuery.tenantIdIn("tenant1").count());
+ }
+
+ public void testAutoDeployWithoutTenantId() {
+ createAppContext(CTX_CMMN_BPMN_TOGETHER_PATH);
+
+ DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();
+
+ assertEquals(1, deploymentQuery.withoutTenantId().count());
+ }
+
+ public void testAutoDeployCustomName() {
+ createAppContext(CTX_CUSTOM_NAME_PATH);
+
+ assertEquals(1, repositoryService.createProcessDefinitionQuery().count());
+ }
+
+ // --Helper methods ----------------------------------------------------------
+
+ private void removeAllDeployments() {
+ for (Deployment deployment : repositoryService.createDeploymentQuery().list()) {
+ repositoryService.deleteDeployment(deployment.getId(), true);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/ProcessInitiatingPojo.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/ProcessInitiatingPojo.java
new file mode 100644
index 0000000000000000000000000000000000000000..92aa708f4e6960e5b143baa22a83626fc8702c19
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/ProcessInitiatingPojo.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.components;
+
+
+import java.util.logging.Logger;
+
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.spring.annotations.BusinessKey;
+import org.camunda.bpm.engine.spring.annotations.ProcessVariable;
+import org.camunda.bpm.engine.spring.annotations.StartProcess;
+
+/**
+ * simple class that demonstrates the annotations to implicitly handle annotation-driven process managment
+ *
+ * @author Josh Long
+ * @since 5.3
+ */
+public class ProcessInitiatingPojo {
+
+ private Logger log = Logger.getLogger(getClass().getName());
+
+ private int methodState = 0;
+
+ public void reset() {
+ this.methodState = 0;
+ }
+
+ public void setCustomer(ScopedCustomer customer) {
+ this.customer = customer;
+ }
+
+ private ScopedCustomer customer ;
+
+ public void logScopedCustomer( ProcessInstance processInstance ){
+ System.out.println( "ProcessInstance ID:" + processInstance.getId() +"; Name: " + this.customer.getName() ) ;
+ }
+
+ @StartProcess(processKey = "b")
+ public void startProcess(@ProcessVariable("customerId") long customerId) {
+ log.info("starting 'b' with customerId # " + customerId);
+ this.methodState += 1;
+ log.info("up'd the method state");
+ }
+
+ public int getMethodState() {
+ return methodState;
+ }
+
+ @StartProcess(processKey = "waiter", returnProcessInstanceId = true)
+ public String startProcessA(@ProcessVariable("customerId") long cId) {
+ return null;
+ }
+
+ @StartProcess(processKey = "waiter")
+ public ProcessInstance enrollCustomer(@BusinessKey String key, @ProcessVariable("customerId") long customerId) {
+ return null;
+ }
+
+ @StartProcess(processKey = "component-waiter")
+ public void startScopedProcess( @ProcessVariable("customerId") long customerId){
+ log.info(" start scoped 'component-waiter' process.") ;
+ }
+
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/ProcessStartingBeanPostProcessorTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/ProcessStartingBeanPostProcessorTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..a9717b8dfc473508f4c778bf03de9f130ad72d7c
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/ProcessStartingBeanPostProcessorTest.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.components;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.logging.Logger;
+
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.RepositoryService;
+import org.camunda.bpm.engine.repository.Deployment;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * @author Josh Long
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("classpath:org/camunda/bpm/engine/spring/test/components/ProcessStartingBeanPostProcessorTest-context.xml")
+public class ProcessStartingBeanPostProcessorTest {
+
+ private Logger log = Logger.getLogger(getClass().getName());
+
+ @Autowired
+ private ProcessEngine processEngine;
+
+ @Autowired
+ private ProcessInitiatingPojo processInitiatingPojo;
+
+ @Autowired
+ private RepositoryService repositoryService;
+
+ @Before
+ public void before() {
+ repositoryService.createDeployment()
+ .addClasspathResource("org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.b.bpmn20.xml")
+ .addClasspathResource("org/camunda/bpm/engine/spring/test/components/waiter.bpmn20.xml")
+ .deploy();
+ }
+
+ @After
+ public void after() {
+ for (Deployment deployment : repositoryService.createDeploymentQuery().list()) {
+ repositoryService.deleteDeployment(deployment.getId(), true);
+ }
+ processEngine.close();
+ processEngine = null;
+ processInitiatingPojo = null;
+ repositoryService = null;
+ }
+
+ @Test
+ public void testReturnedProcessInstance() throws Throwable {
+ String processInstanceId = this.processInitiatingPojo.startProcessA(22);
+ assertNotNull("the process instance id should not be null", processInstanceId);
+ }
+
+ @Test
+ public void testReflectingSideEffects() throws Throwable {
+ assertNotNull("the processInitiatingPojo mustn't be null.", this.processInitiatingPojo);
+
+ this.processInitiatingPojo.reset();
+
+ assertEquals(this.processInitiatingPojo.getMethodState(), 0);
+
+ this.processInitiatingPojo.startProcess(53);
+
+ assertEquals(this.processInitiatingPojo.getMethodState(), 1);
+ }
+
+ @Test
+ public void testUsingBusinessKey() throws Throwable {
+ long id = 5;
+ String businessKey = "usersKey" + System.currentTimeMillis();
+ ProcessInstance pi = processInitiatingPojo.enrollCustomer(businessKey, id);
+ assertEquals("the business key of the resultant ProcessInstance should match " +
+ "the one specified through the AOP-intercepted method" ,businessKey, pi.getBusinessKey());
+
+ }
+
+ @Test
+ public void testLaunchingProcessInstance() {
+ long id = 343;
+ String processInstance = processInitiatingPojo.startProcessA(id);
+ Long customerId = (Long) processEngine.getRuntimeService().getVariable(processInstance, "customerId");
+ assertEquals("the process variable should both exist and be equal to the value given, " + id, customerId, (Long) id);
+ log.info("the customerId from the ProcessInstance is " + customerId);
+ assertNotNull("processInstanc can't be null", processInstance);
+ assertNotNull("the variable should be non-null", customerId);
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/ScopedCustomer.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/ScopedCustomer.java
new file mode 100644
index 0000000000000000000000000000000000000000..8f0cd0243e34bbd92fdfcee9daa2adef4b988e72
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/ScopedCustomer.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.components;
+
+import org.camunda.bpm.engine.spring.components.scope.ProcessScope;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+import java.io.Serializable;
+
+
+@Scope(ProcessScope.PROCESS_SCOPE_NAME)
+public class ScopedCustomer implements Serializable, InitializingBean{
+ public ScopedCustomer() {
+ }
+ public ScopedCustomer(String name) {
+ this.name = name;
+ }
+
+ private String name = Thread.currentThread().getId()+":" +System.currentTimeMillis();
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void afterPropertiesSet() throws Exception {
+ System.out.println("starting ..." + this.name) ;
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/jobexecutor/ForcedRollbackExecutionListener.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/jobexecutor/ForcedRollbackExecutionListener.java
new file mode 100644
index 0000000000000000000000000000000000000000..540af7031ec6306c6945a741be54db2f212385c4
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/jobexecutor/ForcedRollbackExecutionListener.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.components.jobexecutor;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.ExecutionListener;
+
+/**
+ *
+ * @author Pablo Ganga
+ */
+public class ForcedRollbackExecutionListener implements ExecutionListener {
+
+ public void notify(DelegateExecution delegateExecution) throws Exception {
+ throw new RuntimeException("Forcing transaction rollback");
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/jobexecutor/SpringJobExecutorTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/jobexecutor/SpringJobExecutorTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..fe976a06e8c21617ac2762508bfdb1bd6a8f24f7
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/jobexecutor/SpringJobExecutorTest.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.components.jobexecutor;
+
+import java.util.List;
+
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.spring.test.SpringProcessEngineTestCase;
+import org.camunda.bpm.engine.task.Task;
+import org.camunda.bpm.engine.test.Deployment;
+import org.springframework.test.context.ContextConfiguration;
+
+
+/**
+ * @author Pablo Ganga
+ */
+@ContextConfiguration("classpath:org/camunda/bpm/engine/spring/test/components/SpringjobExecutorTest-context.xml")
+public class SpringJobExecutorTest extends SpringProcessEngineTestCase {
+
+ @Deployment(resources={"org/camunda/bpm/engine/spring/test/components/SpringTimersProcess.bpmn20.xml",
+ "org/camunda/bpm/engine/spring/test/components/SpringJobExecutorRollBack.bpmn20.xml"})
+ public void testHappyJobExecutorPath()throws Exception {
+
+ ProcessInstance instance = runtimeService.startProcessInstanceByKey("process1");
+
+ assertNotNull(instance);
+
+ waitForJobExecutorToProcessAllJobs(10000);
+
+ List activeTasks = taskService.createTaskQuery().processInstanceId(instance.getId()).list();
+ assertTrue(activeTasks.size() == 0);
+ }
+
+ @Deployment(resources={"org/camunda/bpm/engine/spring/test/components/SpringTimersProcess.bpmn20.xml",
+ "org/camunda/bpm/engine/spring/test/components/SpringJobExecutorRollBack.bpmn20.xml"})
+ public void testRollbackJobExecutorPath()throws Exception {
+
+ // shutdown job executor first, otherwise waitForJobExecutorToProcessAllJobs will not actually start it....
+ processEngineConfiguration.getJobExecutor().shutdown();
+
+ ProcessInstance instance = runtimeService.startProcessInstanceByKey("errorProcess1");
+
+ assertNotNull(instance);
+
+ waitForJobExecutorToProcessAllJobs(10000);
+
+ List activeTasks = taskService.createTaskQuery().processInstanceId(instance.getId()).list();
+ assertTrue(activeTasks.size() == 1);
+ }
+
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/registry/ActivitiStateHandlerRegistrationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/registry/ActivitiStateHandlerRegistrationTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..c808a3b00d97808dc7dd721c1460be7848a91a93
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/registry/ActivitiStateHandlerRegistrationTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.components.registry;
+
+import static org.junit.Assert.assertEquals;
+
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.Map;
+
+import org.camunda.bpm.engine.spring.components.registry.ActivitiStateHandlerRegistration;
+import org.junit.Test;
+
+/**
+ * @author Tobias Metzke
+ *
+ */
+public class ActivitiStateHandlerRegistrationTest {
+
+ @Test
+ public void shouldHaveDetailledStringRepresentation() throws Exception {
+ Map processVariablesExpected = Collections.singletonMap(34, "testValue");
+ Method handlerMethod = this.getClass().getMethod("shouldHaveDetailledStringRepresentation");
+ Object handler = new Object() { public Integer testValue; {testValue = 76; testValue++; }};
+ String stateName = "running";
+ String beanName = "testBean";
+ int processVariablesIndex = 4;
+ int processIdIndex = 2;
+ String processName = "testProcess";
+ ActivitiStateHandlerRegistration registration = new ActivitiStateHandlerRegistration(processVariablesExpected,
+ handlerMethod, handler, stateName, beanName,
+ processVariablesIndex, processIdIndex, processName);
+ assertEquals("org.camunda.bpm.engine.spring.components.registry.ActivitiStateHandlerRegistration@" + Integer.toHexString(registration.hashCode()) + "["
+ + "processVariablesExpected={34=testValue}, "
+ + "handlerMethod=public void org.camunda.bpm.engine.spring.test.components.registry.ActivitiStateHandlerRegistrationTest.shouldHaveDetailledStringRepresentation() throws java.lang.Exception, "
+ + "handler=org.camunda.bpm.engine.spring.test.components.registry.ActivitiStateHandlerRegistrationTest$1@" + Integer.toHexString(handler.hashCode()) + ", "
+ + "stateName=running, "
+ + "beanName=testBean, "
+ + "processVariablesIndex=4, "
+ + "processIdIndex=2, "
+ + "processName=testProcess]", registration.toString());
+ }
+
+ @Test
+ public void shouldHaveDetailledStringRepresentationWithNullValues() throws Exception {
+ Map processVariablesExpected = Collections.singletonMap(34, "testValue");
+ Method handlerMethod = null;
+ Object handler = null;
+ String stateName = "running";
+ String beanName = "testBean";
+ int processVariablesIndex = 4;
+ int processIdIndex = 2;
+ String processName = "testProcess";
+ ActivitiStateHandlerRegistration registration = new ActivitiStateHandlerRegistration(processVariablesExpected,
+ handlerMethod, handler, stateName, beanName,
+ processVariablesIndex, processIdIndex, processName);
+ assertEquals("org.camunda.bpm.engine.spring.components.registry.ActivitiStateHandlerRegistration@" + Integer.toHexString(registration.hashCode()) + "["
+ + "processVariablesExpected={34=testValue}, "
+ + "handlerMethod=null, "
+ + "handler=null, "
+ + "stateName=running, "
+ + "beanName=testBean, "
+ + "processVariablesIndex=4, "
+ + "processIdIndex=2, "
+ + "processName=testProcess]", registration.toString());
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/scope/Delegate1.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/scope/Delegate1.java
new file mode 100644
index 0000000000000000000000000000000000000000..a0fb0f32cb6d50d1e98996cea1d9dfb16f0d7114
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/scope/Delegate1.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.components.scope;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Assert;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+
+import java.util.UUID;
+import java.util.logging.Logger;
+
+/**
+ * @author Josh Long
+ * @since 5,3
+ */
+
+public class Delegate1 implements JavaDelegate,InitializingBean {
+
+ private Logger log = Logger.getLogger( getClass().getName());
+
+ @Autowired private ProcessInstance processInstance ;
+
+ @Autowired private StatefulObject statefulObject;
+
+ public void execute(DelegateExecution execution) throws Exception {
+
+ String pid = this.processInstance.getId();
+
+ log.info("the processInstance#id is "+ pid) ;
+
+ Assert.assertNotNull("the 'scopedCustomer' reference can't be null", statefulObject);
+ String uuid = UUID.randomUUID().toString();
+ statefulObject.setName(uuid);
+ log.info("the 'uuid' value given to the ScopedCustomer#name property is '" + uuid + "' in " + getClass().getName());
+
+ this.statefulObject.increment();
+ }
+
+ public void afterPropertiesSet() throws Exception {
+ Assert.assertNotNull("the processInstance must not be null", this.processInstance) ;
+
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/scope/Delegate2.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/scope/Delegate2.java
new file mode 100644
index 0000000000000000000000000000000000000000..2dc95569e0480d76690570edea5242659ae9976a
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/scope/Delegate2.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.components.scope;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.junit.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.logging.Logger;
+
+/**
+ * @author Josh Long
+ * @since 5,3
+ */
+
+public class Delegate2 implements JavaDelegate {
+
+ private Logger log = Logger.getLogger( getClass().getName());
+
+ @Autowired private StatefulObject statefulObject;
+
+ public void execute(DelegateExecution execution) throws Exception {
+
+ this.statefulObject.increment();
+
+ Assert.assertNotNull( "the 'scopedCustomer' reference can't be null", this.statefulObject);
+ Assert.assertNotNull( "the 'scopedCustomer.name' property should be non-null, since it was set in a previous delegate bound to this very thread", this.statefulObject.getName() );
+ log.info( "the 'uuid' value retrieved from the ScopedCustomer#name property is '" + this.statefulObject.getName()+ "' in "+getClass().getName());
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/scope/ProcessScopeTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/scope/ProcessScopeTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..830ddedcf3cb38ae3606a9c6dabe81f8b80fad74
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/scope/ProcessScopeTest.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.components.scope;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.logging.Handler;
+import java.util.logging.Logger;
+import java.util.logging.SimpleFormatter;
+import java.util.logging.StreamHandler;
+
+import org.camunda.bpm.engine.spring.components.scope.ProcessScope;
+import org.junit.Test;
+
+/**
+ * @author Tobias Metzke
+ *
+ */
+public class ProcessScopeTest {
+
+ @Test
+ public void shouldLogExceptionStacktrace() throws IOException {
+ Logger logger = Logger.getLogger(ProcessScope.class.getName());
+ try (ByteArrayOutputStream out = new ByteArrayOutputStream();) {
+ Handler handler = new StreamHandler(out, new SimpleFormatter());
+ logger.addHandler(handler);
+ try {
+ ProcessScope scope = new ProcessScope();
+ Object variable = scope.get("testObject", null);
+ assertNull(variable);
+ } finally {
+ handler.flush();
+ handler.close();
+ logger.removeHandler(handler);
+ }
+ // test for logged exception
+ String message = new String(out.toByteArray(), StandardCharsets.UTF_8);
+ assertTrue(!message.isEmpty());
+ assertTrue(message.contains("org.camunda.bpm.engine.spring.components.scope.ProcessScope get"));
+ assertTrue(message.contains("couldn't return value from process scope! java.lang.NullPointerException"));
+ assertTrue(message.contains("at org.camunda.bpm.engine.spring.components.scope.ProcessScope.getExecutionId(ProcessScope.java:"));
+ assertTrue(message.contains("at org.camunda.bpm.engine.spring.components.scope.ProcessScope.getConversationId(ProcessScope.java:"));
+ assertTrue(message.contains("at org.camunda.bpm.engine.spring.components.scope.ProcessScope.get(ProcessScope.java:"));
+ assertTrue(message.contains("at org.camunda.bpm.engine.spring.test.components.scope.ProcessScopeTest.shouldLogExceptionStacktrace(ProcessScopeTest.java:"));
+ }
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/scope/ScopingTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/scope/ScopingTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..4397d70db4d0989df390e0b744b21d0158d4d531
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/scope/ScopingTest.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.components.scope;
+
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.RepositoryService;
+import org.camunda.bpm.engine.TaskService;
+import org.camunda.bpm.engine.repository.Deployment;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.spring.test.components.ProcessInitiatingPojo;
+import org.camunda.bpm.engine.task.Task;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.util.StringUtils;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
+/**
+ * tests the scoped beans
+ *
+ * @author Josh Long
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("classpath:org/camunda/bpm/engine/spring/test/components/ScopingTests-context.xml")
+public class ScopingTest {
+
+ @Autowired
+ private ProcessInitiatingPojo processInitiatingPojo;
+
+ private Logger logger = Logger.getLogger(getClass().getName());
+
+ @Autowired
+ private ProcessEngine processEngine;
+
+ private RepositoryService repositoryService;
+ private TaskService taskService;
+
+ @Before
+ public void before() throws Throwable {
+ this.repositoryService = this.processEngine.getRepositoryService();
+ this.taskService = this.processEngine.getTaskService();
+
+ repositoryService.createDeployment()
+ .addClasspathResource("org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.b.bpmn20.xml")
+ .addClasspathResource("org/camunda/bpm/engine/spring/test/components/waiter.bpmn20.xml")
+ .addClasspathResource("org/camunda/bpm/engine/spring/test/components/spring-component-waiter.bpmn20.xml")
+ .deploy();
+ }
+
+ @After
+ public void after() {
+ for (Deployment deployment : repositoryService.createDeploymentQuery().list()) {
+ repositoryService.deleteDeployment(deployment.getId(), true);
+ }
+ processEngine.close();
+ processEngine = null;
+ repositoryService = null;
+ taskService = null;
+ processInitiatingPojo = null;
+ }
+
+ static public long CUSTOMER_ID_PROC_VAR_VALUE = 343;
+
+ static public String customerIdProcVarName = "customerId";
+
+ /**
+ * this code instantiates a business process that in turn delegates to a few Spring beans that in turn inject a process scoped object, {@link StatefulObject}.
+ *
+ * @return the StatefulObject that was injected across different components, that all share the same state.
+ * @throws Throwable if anythign goes wrong
+ */
+ private StatefulObject run() throws Throwable {
+ logger.info("----------------------------------------------");
+ Map vars = new HashMap();
+ vars.put(customerIdProcVarName, CUSTOMER_ID_PROC_VAR_VALUE);
+ ProcessInstance processInstance = processEngine.getRuntimeService().startProcessInstanceByKey("component-waiter", vars);
+ StatefulObject scopedObject = (StatefulObject) processEngine.getRuntimeService().getVariable(processInstance.getId(), "scopedTarget.c1");
+ Assert.assertNotNull("the scopedObject can't be null", scopedObject);
+ Assert.assertTrue("the 'name' property can't be null.", StringUtils.hasText(scopedObject.getName()));
+ Assert.assertEquals(scopedObject.getVisitedCount(), 2);
+
+ // the process has paused
+ String procId = processInstance.getProcessInstanceId();
+
+ List tasks = taskService.createTaskQuery().executionId(procId).list();
+
+ Assert.assertEquals("there should be 1 (one) task enqueued at this point.", tasks.size(), 1);
+
+ Task t = tasks.iterator().next();
+
+ this.taskService.claim(t.getId(), "me");
+
+ logger.info("sleeping for 10 seconds while a user performs his task. " +
+ "The first transaction has committed. A new one will start in 10 seconds");
+
+ Thread.sleep(1000 * 5);
+
+ this.taskService.complete(t.getId());
+
+ scopedObject = (StatefulObject) processEngine.getRuntimeService().getVariable(processInstance.getId(), "scopedTarget.c1");
+ Assert.assertEquals(scopedObject.getVisitedCount(), 3);
+
+ Assert.assertEquals( "the customerId injected should " +
+ "be what was given as a processVariable parameter." ,
+ ScopingTest.CUSTOMER_ID_PROC_VAR_VALUE, scopedObject.getCustomerId()) ;
+ return scopedObject;
+ }
+
+ @Test
+ public void testUsingAnInjectedScopedProxy() throws Throwable {
+ logger.info("Running 'component-waiter' process instance with scoped beans.");
+ StatefulObject one = run();
+ StatefulObject two = run();
+ Assert.assertNotSame(one.getName(), two.getName());
+ Assert.assertEquals(one.getVisitedCount(), two.getVisitedCount());
+ }
+
+ @Test
+ public void testStartingAProcessWithScopedBeans() throws Throwable {
+ this.processInitiatingPojo.startScopedProcess(3243);
+ }
+
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/scope/StatefulObject.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/scope/StatefulObject.java
new file mode 100644
index 0000000000000000000000000000000000000000..52d1e08cac6d0c1e7c97b2e6b6cb5e78bfd08b4a
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/components/scope/StatefulObject.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.components.scope;
+
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.Assert;
+
+import java.io.Serializable;
+import java.util.logging.Logger;
+
+/**
+ * dumb object to demonstrate holding scoped state for the duration of a business process
+ *
+ * @author Josh Long
+ */
+public class StatefulObject implements Serializable,InitializingBean {
+
+ private transient Logger logger = Logger.getLogger(getClass().getName());
+
+ public static final long serialVersionUID = 1L;
+
+ private String name;
+ private int visitedCount = 0;
+
+ private long customerId;
+
+ public long getCustomerId() {
+ return customerId;
+ }
+
+ @Value("#{processInstance}") transient ProcessInstance processInstance ;
+
+ @Value("#{executionId}") String executionId;
+
+ @Value("#{processVariables['customerId']}")
+ public void setCustomerId(long customerId) {
+
+ this.customerId = customerId;
+
+ logger.info("setting this " + StatefulObject.class.getName() + " instances 'customerId' to "
+ + this.customerId +". The current executionId is "+ this.executionId);
+
+ }
+
+ public StatefulObject() {
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ StatefulObject that = (StatefulObject) o;
+
+ if (visitedCount != that.visitedCount) return false;
+ if (name != null ? !name.equals(that.name) : that.name != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = name != null ? name.hashCode() : 0;
+ result = 31 * result + visitedCount;
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "StatefulObject{" +
+ "name='" + name + '\'' +
+ ", visitedCount=" + visitedCount +
+ '}';
+ }
+
+ public void increment() {
+ this.visitedCount += 1;
+ }
+
+ public int getVisitedCount() {
+ return this.visitedCount;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void afterPropertiesSet() throws Exception {
+ Assert.notNull(this.processInstance, "the processInstance should be equal to the currently active processInstance!");
+ logger.info("the 'processInstance' property is non-null: PI ID# "+ this.processInstance.getId());
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/Counter.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/Counter.java
new file mode 100644
index 0000000000000000000000000000000000000000..f594a0f565cc9351742d48af0b8fef8ffe58db47
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/Counter.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.configuration;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class Counter {
+
+ private AtomicInteger counter = new AtomicInteger(0);
+
+ public int getCount() {
+ return counter.get();
+ }
+
+ public void increment() {
+ counter.getAndIncrement();
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/InMemProcessEngineConfiguration.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/InMemProcessEngineConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..83d0456e1b5603fe2f54babf2238f1d79eff22e1
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/InMemProcessEngineConfiguration.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.configuration;
+
+import javax.sql.DataSource;
+
+import org.camunda.bpm.engine.spring.ProcessEngineFactoryBean;
+import org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.jdbc.datasource.SimpleDriverDataSource;
+import org.springframework.transaction.PlatformTransactionManager;
+
+/**
+ * Base Java Config for the process engine that uses In-Memory database.
+ *
+ * @author Philipp Ossler
+ */
+@Configuration
+@ComponentScan("org.camunda.bpm.engine.spring.test.configuration")
+public class InMemProcessEngineConfiguration {
+
+ @Bean
+ public DataSource dataSource() {
+ SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
+ dataSource.setDriverClass(org.h2.Driver.class);
+ dataSource.setUrl("jdbc:h2:mem:camunda-test;DB_CLOSE_DELAY=-1");
+ dataSource.setUsername("sa");
+ dataSource.setPassword("");
+ return dataSource;
+ }
+
+ @Bean
+ public PlatformTransactionManager transactionManager() {
+ return new DataSourceTransactionManager(dataSource());
+ }
+
+ @Bean
+ public SpringProcessEngineConfiguration processEngineConfiguration() {
+ SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
+
+ config.setDataSource(dataSource());
+ config.setDatabaseSchemaUpdate("true");
+
+ config.setTransactionManager(transactionManager());
+
+ config.setHistory("audit");
+ config.setJobExecutorActivate(false);
+ config.setDbMetricsReporterActivate(false);
+ config.setEnforceHistoryTimeToLive(false);
+
+ return config;
+ }
+
+ @Bean
+ public ProcessEngineFactoryBean processEngine() {
+ ProcessEngineFactoryBean factoryBean = new ProcessEngineFactoryBean();
+ factoryBean.setProcessEngineConfiguration(processEngineConfiguration());
+ return factoryBean;
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/IncrementBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/IncrementBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..21737a9179f76ce75da0f74b852c91240a06c746
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/IncrementBean.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.configuration;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class IncrementBean {
+
+ @Autowired
+ private Counter counter;
+
+ public void increment() {
+ counter.increment();
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/IncrementTask.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/IncrementTask.java
new file mode 100644
index 0000000000000000000000000000000000000000..06adf76ea3d14d47e11d5cf9a37b58c582230540
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/IncrementTask.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.configuration;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class IncrementTask implements JavaDelegate {
+
+ @Autowired
+ private Counter counter;
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ counter.increment();
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/JavaBasedProcessEngineConfigTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/JavaBasedProcessEngineConfigTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..66058fb87e556e8f8dcdf6b3055b0dc9e6e5d570
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/JavaBasedProcessEngineConfigTest.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.configuration;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.spring.SpringProcessEngineServicesConfiguration;
+import org.camunda.bpm.engine.spring.test.SpringProcessEngineTestCase;
+import org.camunda.bpm.engine.test.Deployment;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+
+/**
+ * @author Philipp Ossler
+ */
+@ContextConfiguration(classes = { InMemProcessEngineConfiguration.class, SpringProcessEngineServicesConfiguration.class })
+public class JavaBasedProcessEngineConfigTest extends SpringProcessEngineTestCase {
+
+ @Autowired
+ private Counter couter;
+
+ @Autowired
+ protected RuntimeService runtimeService;
+
+ @Deployment
+ public void testDelegateExpression() {
+ runtimeService.startProcessInstanceByKey("SpringProcess");
+
+ assertThat(couter.getCount(), is(1));
+ }
+
+ @Deployment
+ public void testExpression() {
+ runtimeService.startProcessInstanceByKey("SpringProcess");
+
+ assertThat(couter.getCount(), is(1));
+ }
+
+ @Deployment
+ public void testDelegateExpressionWithProcessServices() {
+ String processInstanceId = runtimeService.startProcessInstanceByKey("SpringProcess").getId();
+
+ assertThat(couter.getCount(), is(1));
+ assertThat((Integer) runtimeService.getVariable(processInstanceId, "count"), is(1));
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/SetCounterVariableTask.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/SetCounterVariableTask.java
new file mode 100644
index 0000000000000000000000000000000000000000..e027800ab92818ff3dac757b56e378b43ceb6533
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/SetCounterVariableTask.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.configuration;
+
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SetCounterVariableTask implements JavaDelegate {
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+ @Autowired
+ private Counter counter;
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ int count = counter.getCount();
+
+ runtimeService.setVariable(execution.getId(), "count", count);
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/SpringProcessEngineInitializationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/SpringProcessEngineInitializationTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..edfb55d106f83f847701e4152fbc538b7e3891de
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/configuration/SpringProcessEngineInitializationTest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.configuration;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.net.URL;
+
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.ProcessEngines;
+import org.camunda.bpm.engine.impl.util.ReflectUtil;
+import org.junit.After;
+import org.junit.Test;
+
+public class SpringProcessEngineInitializationTest {
+
+ @After
+ public void tearDown() {
+ ProcessEngines.destroy();
+ }
+
+ @Test
+ public void shouldInitializeProcessEngineFromActivitiContext() {
+ // given
+ existActivitiContext();
+ // when
+ ProcessEngine processEngine = ProcessEngines.getProcessEngine("activitiContextProcessName");
+ // then
+ assertThat(processEngine).isNotNull();
+ assertThat(processEngine.getName()).isEqualTo("activitiContextProcessName");
+ }
+
+ private URL existActivitiContext() {
+ URL resource = ReflectUtil.getClassLoader().getResource("activiti-context.xml");
+ assertThat(resource)
+ .withFailMessage("activiti-context.xml not found on the classpath: " + System.getProperty("java.class.path"))
+ .isNotNull();
+ return resource;
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/container/ManagedProcessEngineFactoryBeanTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/container/ManagedProcessEngineFactoryBeanTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..db1616976f24f140fb51650b29eede06527122b1
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/container/ManagedProcessEngineFactoryBeanTest.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.container;
+
+import org.camunda.bpm.BpmPlatform;
+import org.camunda.bpm.engine.spring.container.ManagedProcessEngineFactoryBean;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * Testcase for {@link ManagedProcessEngineFactoryBean}
+ *
+ * @author Daniel Meyer
+ *
+ */
+public class ManagedProcessEngineFactoryBeanTest {
+
+ @Test
+ public void testProcessApplicationDeployment() {
+
+ // initially, no process engine is registered:
+ Assert.assertNull(BpmPlatform.getDefaultProcessEngine());
+ Assert.assertEquals(0, BpmPlatform.getProcessEngineService().getProcessEngines().size());
+
+ // start spring application context
+ AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/camunda/bpm/engine/spring/test/container/ManagedProcessEngineFactoryBean-context.xml");
+ applicationContext.start();
+
+ // assert that now the process engine is registered:
+ Assert.assertNotNull(BpmPlatform.getDefaultProcessEngine());
+
+ // close the spring application context
+ applicationContext.close();
+
+ // after closing the application context, the process engine is gone
+ Assert.assertNull(BpmPlatform.getDefaultProcessEngine());
+ Assert.assertEquals(0, BpmPlatform.getProcessEngineService().getProcessEngines().size());
+
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/dmn/DmnJuelTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/dmn/DmnJuelTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..cc3f59adfa15813cf6d1857de9861017b9a80bb0
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/dmn/DmnJuelTest.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.dmn;
+
+import org.camunda.bpm.dmn.engine.DmnDecisionResult;
+import org.camunda.bpm.engine.DecisionService;
+import org.camunda.bpm.engine.RepositoryService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {
+ "classpath:org/camunda/bpm/engine/spring/test/dmn/DmnJuelTest-applicationContext.xml" })
+public class DmnJuelTest {
+
+ @Autowired
+ protected RepositoryService repositoryService;
+
+ @Autowired
+ protected DecisionService decisionService;
+
+ protected String deploymentId;
+
+ @Before
+ public void deploy() {
+ deploymentId = repositoryService.createDeployment()
+ .addClasspathResource("org/camunda/bpm/engine/spring/test/dmn/JuelTest.dmn")
+ .deploy()
+ .getId();
+ }
+
+ @After
+ public void clean() {
+ repositoryService.deleteDeployment(deploymentId, true);
+ }
+
+ @Test
+ public void shouldResolveBean() {
+ // given
+
+ // when
+ DmnDecisionResult result = decisionService.evaluateDecisionByKey("drg-with-bean-expression")
+ .evaluate();
+
+ // then
+ assertThat((String)result.getSingleEntry()).isEqualTo("bar");
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/dmn/Testbean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/dmn/Testbean.java
new file mode 100644
index 0000000000000000000000000000000000000000..8dcb0aebe2532c3b4aed38cbfbb9a7733a907232
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/dmn/Testbean.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.dmn;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class Testbean {
+
+ protected String bar = "baz";
+
+ public String getBar() {
+ return bar;
+ }
+
+}
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/expression/SpringLimitedExpressionsTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/expression/SpringLimitedExpressionsTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..3c594e6f7207beb3447c1385cc381341ac4a7a55
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/expression/SpringLimitedExpressionsTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.expression;
+
+import org.camunda.bpm.engine.ProcessEngineException;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.spring.test.SpringProcessEngineTestCase;
+import org.camunda.bpm.engine.task.Task;
+import org.camunda.bpm.engine.test.Deployment;
+import org.springframework.test.context.ContextConfiguration;
+
+
+/**
+ * Test limiting the exposed beans in expressions.
+ *
+ * @author Frederik Heremans
+ */
+@ContextConfiguration("classpath:org/camunda/bpm/engine/spring/test/expression/expressionLimitedBeans-context.xml")
+public class SpringLimitedExpressionsTest extends SpringProcessEngineTestCase {
+
+ @Deployment
+ public void testLimitedBeansExposed() throws Exception {
+ // Start process, which has a service-task which calls 'bean1', which is exposed
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("limitedExpressionProcess");
+
+ String beanOutput = (String) runtimeService.getVariable(processInstance.getId(), "beanOutput");
+ assertNotNull(beanOutput);
+ assertEquals("Activiti BPMN 2.0 process engine", beanOutput);
+
+ // Finish the task, should continue to serviceTask which uses a bean that is present
+ // in application-context, but not exposed explicitly in "beans", should throw error!
+ Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
+ assertNotNull(task);
+
+ try {
+ taskService.complete(task.getId());
+ fail("Exception should have been thrown");
+ } catch(ProcessEngineException ae) {
+ assertTextPresent("Unknown property used in expression", ae.getMessage());
+ }
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/expression/callactivity/CallActivityBasedOnSpringBeansExpressionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/expression/callactivity/CallActivityBasedOnSpringBeansExpressionTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..d460dc1c1ee1f82f5a98d87cd05946cc8b590d0e
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/expression/callactivity/CallActivityBasedOnSpringBeansExpressionTest.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.expression.callactivity;
+
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.spring.test.SpringProcessEngineTestCase;
+import org.camunda.bpm.engine.task.Task;
+import org.camunda.bpm.engine.task.TaskQuery;
+import org.camunda.bpm.engine.test.Deployment;
+import org.springframework.test.context.ContextConfiguration;
+
+/**
+ * The CallActivityBasedOnSpringBeansExpressionTest is used to test dynamically wiring in the calledElement
+ * in the callActivity task. This test case helps verify that we do not have to hard code the sub process
+ * definition key within the process.
+ *
+ * @author Sang Venkatraman
+ */
+@ContextConfiguration("classpath:org/camunda/bpm/engine/spring/test/expression/callactivity/testCallActivityByExpression-context.xml")
+public class CallActivityBasedOnSpringBeansExpressionTest extends SpringProcessEngineTestCase {
+
+ @Deployment(resources = {
+ "org/camunda/bpm/engine/spring/test/expression/callactivity/CallActivityBasedOnSpringBeansExpressionTest.testCallActivityByExpression.bpmn20.xml",
+ "org/camunda/bpm/engine/spring/test/expression/callactivity/simpleSubProcess.bpmn20.xml" })
+ public void testCallActivityByExpression() throws Exception {
+ // Start process (main)
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testCallActivityByExpression");
+
+ // one task in the subprocess should be active after starting the process instance
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ Task taskBeforeSubProcess = taskQuery.singleResult();
+ assertEquals("Task before subprocess", taskBeforeSubProcess.getName());
+
+ // Completing the task continues the process which leads to calling the subprocess. The sub process we want to
+ // call is passed in as a variable into this task
+ taskService.complete(taskBeforeSubProcess.getId());
+ Task taskInSubProcess = taskQuery.singleResult();
+ assertEquals("Task in subprocess", taskInSubProcess.getName());
+
+ // Completing the task in the subprocess, finishes the subprocess
+ taskService.complete(taskInSubProcess.getId());
+ Task taskAfterSubProcess = taskQuery.singleResult();
+ assertEquals("Task after subprocess", taskAfterSubProcess.getName());
+
+ // Completing this task end the process instance
+ taskService.complete(taskAfterSubProcess.getId());
+ assertProcessEnded(processInstance.getId());
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/expression/callactivity/NextProcessExecutionEvaluator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/expression/callactivity/NextProcessExecutionEvaluator.java
new file mode 100644
index 0000000000000000000000000000000000000000..1af039eb7237ba5097ef9f1c091542b44ff0eaa4
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/expression/callactivity/NextProcessExecutionEvaluator.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.expression.callactivity;
+
+/**
+ * The NextProcessExecutionEvaluator class provides the name of the sub process to be executed next. This allows
+ * us to test dynamically wire in the calledElement in the callActivity task. In an actual implementation there would
+ * be business logic here to determine which process to execute in the callActivity task.
+ *
+ * @author Sang Venkatraman
+ *
+ */
+public class NextProcessExecutionEvaluator {
+
+ public String returnProcessDefinitionToCall() {
+ //some business logic here
+ return "simpleSubProcess";
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/junit4/SpringJunit4Test.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/junit4/SpringJunit4Test.java
new file mode 100644
index 0000000000000000000000000000000000000000..88ca26b802787b65f9b69f39913cd9aa55e94678
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/junit4/SpringJunit4Test.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.junit4;
+
+import static org.junit.Assert.assertEquals;
+
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.TaskService;
+import org.camunda.bpm.engine.task.Task;
+import org.camunda.bpm.engine.test.ProcessEngineRule;
+import org.camunda.bpm.engine.test.Deployment;
+import org.junit.After;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+
+/**
+ * @author Joram Barrez
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("classpath:org/camunda/bpm/engine/spring/test/junit4/springTypicalUsageTest-context.xml")
+public class SpringJunit4Test {
+
+ @Autowired
+ private ProcessEngine processEngine;
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+ @Autowired
+ private TaskService taskService;
+
+ @Autowired
+ @Rule
+ public ProcessEngineRule activitiSpringRule;
+
+ @After
+ public void closeProcessEngine() {
+ // Required, since all the other tests seem to do a specific drop on the end
+ processEngine.close();
+ processEngine = null;
+ runtimeService = null;
+ taskService = null;
+ activitiSpringRule = null;
+ }
+
+ @Test
+ @Deployment
+ public void simpleProcessTest() {
+ runtimeService.startProcessInstanceByKey("simpleProcess");
+ Task task = taskService.createTaskQuery().singleResult();
+ assertEquals("My Task", task.getName());
+
+ taskService.complete(task.getId());
+ assertEquals(0, runtimeService.createProcessInstanceQuery().count());
+
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/plugin/SpringProcessEnginePluginTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/plugin/SpringProcessEnginePluginTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..aa36ec4b51395b8b911a6938bde52e6df2870161
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/plugin/SpringProcessEnginePluginTest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.plugin;
+
+import org.camunda.bpm.engine.spring.SpringProcessEnginePlugin;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = SpringProcessEnginePluginTest.TestConfig.class)
+public class SpringProcessEnginePluginTest {
+
+ public static class TestConfig {
+
+ @Bean
+ public SpringProcessEnginePlugin theBeanName() {
+ return new SpringProcessEnginePlugin(){};
+ }
+ }
+
+ @Autowired
+ private SpringProcessEnginePlugin plugin;
+
+ @Test
+ public void verifyToString() throws Exception {
+ Assert.assertEquals(plugin.toString(), "theBeanName");
+ }
+}
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/AbstractScriptTaskTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/AbstractScriptTaskTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..d3d93824dc10350db022ec5864f00980bae3fbc3
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/AbstractScriptTaskTest.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.scripttask;
+
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.camunda.bpm.engine.RepositoryService;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.ScriptEvaluationException;
+import org.camunda.bpm.engine.repository.Deployment;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.model.bpmn.Bpmn;
+import org.camunda.bpm.model.bpmn.BpmnModelInstance;
+import org.junit.After;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public abstract class AbstractScriptTaskTest {
+
+ @Autowired
+ private RuntimeService runtimeService;
+
+ @Autowired
+ private RepositoryService repositoryService;
+
+ private static final String TEST_BEAN_NAME = "name property of testbean";
+
+ private List deploymentIds = new ArrayList<>();
+
+ @After
+ public void after() {
+ for (String deploymentId : deploymentIds) {
+ repositoryService.deleteDeployment(deploymentId, true);
+ }
+ }
+
+ protected void deployProcess(BpmnModelInstance process) {
+ Deployment deployment = repositoryService.createDeployment().addModelInstance("testProcess.bpmn", process).deploy();
+ deploymentIds.add(deployment.getId());
+ }
+
+ protected void deployProcess(String scriptFormat, String scriptText) {
+ BpmnModelInstance process = createProcess(scriptFormat, scriptText);
+ deployProcess(process);
+ }
+
+ protected BpmnModelInstance createProcess(String scriptFormat, String scriptText) {
+ return Bpmn.createExecutableProcess("testProcess")
+ .startEvent()
+ .scriptTask()
+ .scriptFormat(scriptFormat)
+ .scriptText(scriptText).userTask().endEvent().done();
+ }
+
+ /**
+ * Test if a Spring bean is visible for scripting for the scripftormat
+ *
+ * @param scriptFormat
+ * the scriptformat like 'javascript', 'groovy', etc.
+ * @param scriptText
+ * sets execution variable 'foo' to the testbean's name property
+ */
+ protected void testSpringBeanVisibility(String scriptFormat, String scriptText) {
+ testSpringBeanVisibility(scriptFormat, scriptText, true);
+ }
+
+ protected void testSpringBeanVisibility(String scriptFormat, String scriptText, boolean visible) {
+
+ // GIVEN
+ // execution variable 'foo' is set the testbean's name property (by the
+ // scriptText code)
+ deployProcess(scriptFormat, scriptText);
+
+ // WHEN
+ // we start an instance of this process
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess");
+
+ // THEN
+ // the script task can be executed without exceptions
+ // the execution variable is stored and has the correct value
+ Object variableValue = runtimeService.getVariable(pi.getId(), "foo");
+ if (visible) {
+ assertEquals(TEST_BEAN_NAME, variableValue);
+ } else {
+ assertNull(variableValue);
+ }
+ }
+
+ protected void testNoSpringBean(String scriptFormat, String scriptText) {
+ // GIVEN
+ // accessing a bean that cannot be resolved in a script
+ deployProcess(scriptFormat, scriptText);
+
+ // THEN
+ // an exception is thrown
+ assertThatThrownBy(() -> {
+ // WHEN
+ // we start an instance of this process
+ runtimeService.startProcessInstanceByKey("testProcess");})
+ .isInstanceOf(ScriptEvaluationException.class)
+ .hasMessageContaining("testbean");
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskGraalJsTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskGraalJsTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..e51f44d2b53ec5008146b9510addd21e38f02b81
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskGraalJsTest.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.scripttask;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {
+ "classpath:org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskTest-applicationContext.xml" })
+public class ScriptTaskGraalJsTest extends AbstractScriptTaskTest {
+
+ private static final String GRAALJS = "graal.js";
+
+ @Test
+ public void shouldFindPublicSpringBeanMethodWithJavascriptGraalJs() {
+ testSpringBeanVisibility(GRAALJS, "execution.setVariable('foo', testbean.getName());");
+ }
+
+ @Test
+ public void shouldNotFindPrivateSpringBeanAttributeWithJavascriptGraalJs() {
+ testSpringBeanVisibility(GRAALJS, "execution.setVariable('foo', testbean.name);", false);
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskLimitedBeansTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskLimitedBeansTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..3fa198ddddeca1244cd92d9d1c7aa8fc773b5ae5
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskLimitedBeansTest.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.scripttask;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {
+ "classpath:org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskLimitedBeansTest-applicationContext.xml" })
+public class ScriptTaskLimitedBeansTest extends AbstractScriptTaskTest {
+
+ private static final String JAVASCRIPT = "javascript";
+ private static final String PYTHON = "python";
+ private static final String GROOVY = "groovy";
+ private static final String JUEL = "juel";
+
+ @Test
+ public void shouldNotFindGeneralSpringBeanWithJavascript() {
+ testSpringBeanVisibility(JAVASCRIPT, "execution.setVariable('foo', testbean.getName());", false);
+ }
+
+ @Test
+ public void shouldNotFindGeneralSpringBeanWithPython() {
+ testSpringBeanVisibility(PYTHON, "execution.setVariable('foo', testbean.getName())", false);
+ }
+
+ @Test
+ public void shouldNotFindGeneralSpringBeanWithGroovy() {
+ testSpringBeanVisibility(GROOVY, "execution.setVariable('foo', testbean.getName())", false);
+ }
+
+ @Test
+ public void shouldNotFindGeneralSpringBeanWithJuel() {
+ testSpringBeanVisibility(JUEL, "${execution.setVariable('foo', testbean.getName())}", false);
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskNashornTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskNashornTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..7ac210f083189a079462eb2c19a4f25611ee2a77
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskNashornTest.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.scripttask;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {
+ "classpath:org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskTest-applicationContext.xml" })
+public class ScriptTaskNashornTest extends AbstractScriptTaskTest {
+
+ private static final String NASHORN = "nashorn";
+
+ @Test
+ public void shouldFindPublicSpringBeanMethodWithJavascriptNashorn() {
+ testSpringBeanVisibility(NASHORN, "execution.setVariable('foo', testbean.getName());");
+ }
+
+ @Test
+ public void shouldFindPrivateSpringBeanAttributeWithJavascriptNashorn() {
+ testSpringBeanVisibility(NASHORN, "execution.setVariable('foo', testbean.name);");
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskNoBeansTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskNoBeansTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..5d4ca09177ceea7b87af8cc2a71e36640d0e2808
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskNoBeansTest.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.scripttask;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {
+ "classpath:org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskNoBeansTest-applicationContext.xml" })
+public class ScriptTaskNoBeansTest extends AbstractScriptTaskTest {
+
+ private static final String JAVASCRIPT = "javascript";
+ private static final String PYTHON = "python";
+ private static final String GROOVY = "groovy";
+ private static final String JUEL = "juel";
+
+ @Test
+ public void shouldNotFindGeneralSpringBeanWithJavascript() {
+ testNoSpringBean(JAVASCRIPT, "execution.setVariable('foo', testbean.getName());");
+ }
+
+ @Test
+ public void shouldNotFindGeneralSpringBeanWithPython() {
+ testNoSpringBean(PYTHON, "execution.setVariable('foo', testbean.getName())");
+ }
+
+ @Test
+ public void shouldNotFindGeneralSpringBeanWithGroovy() {
+ testNoSpringBean(GROOVY, "execution.setVariable('foo', testbean.getName())");
+ }
+
+ @Test
+ public void shouldNotFindGeneralSpringBeanWithJuel() {
+ testNoSpringBean(JUEL, "${execution.setVariable('foo', testbean.getName())}");
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..144198fef94832afdcd39a05b8ca35cbec32dd11
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskTest.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.scripttask;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {
+ "classpath:org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskTest-applicationContext.xml" })
+public class ScriptTaskTest extends AbstractScriptTaskTest {
+
+ private static final String JAVASCRIPT = "javascript";
+ private static final String PYTHON = "python";
+ private static final String GROOVY = "groovy";
+ private static final String JUEL = "juel";
+
+ @Test
+ public void shouldFindPublicSpringBeanMethodWithJavascriptGraalJs() {
+ testSpringBeanVisibility(JAVASCRIPT, "execution.setVariable('foo', testbean.getName());");
+ }
+
+ @Test
+ public void shouldFindPublicSpringBeanMethodWithGroovy() {
+ testSpringBeanVisibility(GROOVY, "execution.setVariable('foo', testbean.getName())\n");
+ }
+
+ @Test
+ public void shouldFindPublicSpringBeanMethodWithPython() {
+ testSpringBeanVisibility(PYTHON, "execution.setVariable('foo', testbean.getName())\n");
+ }
+
+ @Test
+ public void shouldFindPublicSpringBeanMethodWithJuel() {
+ testSpringBeanVisibility(JUEL, "${execution.setVariable('foo', testbean.getName())}");
+ }
+
+ @Test
+ public void shouldNotFindPrivateSpringBeanAttributeWithJavascriptGraalJs() {
+ testSpringBeanVisibility(JAVASCRIPT, "execution.setVariable('foo', testbean.name);", false);
+ }
+
+ @Test
+ public void shouldFindPrivateSpringBeanAttributeWithWithGroovy() {
+ testSpringBeanVisibility(GROOVY, "execution.setVariable('foo', testbean.name)\n");
+ }
+
+ @Test
+ public void shouldFindPrivateSpringBeanAttributeWithPython() {
+ testSpringBeanVisibility(PYTHON, "execution.setVariable('foo', testbean.name)\n");
+ }
+
+ @Test
+ public void shouldFindPrivateSpringBeanAttributeWithJuel() {
+ testSpringBeanVisibility(JUEL, "${execution.setVariable('foo', testbean.name)}");
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/Testbean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/Testbean.java
new file mode 100644
index 0000000000000000000000000000000000000000..33267311bc6cf4fce0ca19f5e85df1ad349f6ef0
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/Testbean.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.scripttask;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class Testbean {
+ private String name = "name property of testbean";
+
+ public String getName() {
+ return name;
+ }
+}
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/TestbeanNoName.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/TestbeanNoName.java
new file mode 100644
index 0000000000000000000000000000000000000000..7f6aaa624f34bac88dc5acf01383af345e1fe8e4
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/scripttask/TestbeanNoName.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.scripttask;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class TestbeanNoName {
+ private String name = null;
+
+ public String getName() {
+ return name;
+ }
+}
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/BoundaryErrorEventSpringTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/BoundaryErrorEventSpringTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..edb740e5745ee4a6419357ad316658dcde48250c
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/BoundaryErrorEventSpringTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.servicetask;
+
+import org.camunda.bpm.engine.spring.test.SpringProcessEngineTestCase;
+import org.camunda.bpm.engine.task.Task;
+import org.camunda.bpm.engine.test.Deployment;
+import org.springframework.test.context.ContextConfiguration;
+
+/**
+ * @see http://jira.codehaus.org/browse/ACT-1166
+ * @author Angel López Cima
+ * @author Falko Menge
+ */
+@ContextConfiguration("classpath:org/camunda/bpm/engine/spring/test/servicetask/serviceraskSpringTestCatchError-context.xml")
+public class BoundaryErrorEventSpringTest extends SpringProcessEngineTestCase {
+
+ @Deployment
+ public void testCatchErrorThrownByJavaDelegateOnServiceTask() {
+ String procId = runtimeService.startProcessInstanceByKey("catchErrorThrownByExpressionDelegateOnServiceTask").getId();
+ assertThatErrorHasBeenCaught(procId);
+ }
+
+ private void assertThatErrorHasBeenCaught(String procId) {
+ // The service task will throw an error event,
+ // which is caught on the service task boundary
+ assertEquals("No tasks found in task list.", 1, taskService.createTaskQuery().count());
+ Task task = taskService.createTaskQuery().singleResult();
+ assertEquals("Escalated Task", task.getName());
+
+ // Completing the task will end the process instance
+ taskService.complete(task.getId());
+ assertProcessEnded(procId);
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/DelegateClassNotABean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/DelegateClassNotABean.java
new file mode 100644
index 0000000000000000000000000000000000000000..f0d7c16903d17e640bb8a0ad5d93c8190876e338
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/DelegateClassNotABean.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.servicetask;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+
+public class DelegateClassNotABean implements JavaDelegate {
+
+ private SentenceGenerator sentenceGenerator;
+
+ public void execute(DelegateExecution execution) throws Exception {
+ execution.setVariable("message", "DelegateClassNotABean was called");
+ execution.setVariable("injectedFieldIsNull", sentenceGenerator == null);
+ }
+
+ public void setSentenceGenerator(SentenceGenerator sentenceGenerator) {
+ this.sentenceGenerator = sentenceGenerator;
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/DelegateExpressionBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/DelegateExpressionBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..cba16267e13687c6efb98552335347c8f4a983a4
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/DelegateExpressionBean.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.servicetask;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.camunda.bpm.engine.impl.el.FixedValue;
+
+/**
+ * @author Joram Barrez
+ * @author Bernd Ruecker (camunda)
+ */
+public class DelegateExpressionBean implements JavaDelegate {
+
+ private SentenceGenerator sentenceGenerator;
+
+ private FixedValue someField;
+
+ public void execute(DelegateExecution execution) throws Exception {
+ execution.setVariable("myVar", sentenceGenerator.getSentence());
+ if (someField != null) {
+ execution.setVariable("fieldInjection", someField.getValue(execution));
+ }
+ }
+
+ public void setSentenceGenerator(SentenceGenerator sentenceGenerator) {
+ this.sentenceGenerator = sentenceGenerator;
+ }
+
+ public FixedValue getSomeField() {
+ return someField;
+ }
+
+ public void setSomeField(FixedValue someField) {
+ this.someField = someField;
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/MyExecutionListenerBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/MyExecutionListenerBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..b2693a20b87e593490f8562e289d133a3a346702
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/MyExecutionListenerBean.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.servicetask;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.ExecutionListener;
+import org.camunda.bpm.engine.impl.el.FixedValue;
+
+/**
+ * @author Joram Barrez
+ * @author Bernd Ruecker (camunda)
+ */
+public class MyExecutionListenerBean implements ExecutionListener {
+
+ private FixedValue someField;
+
+ public void notify(DelegateExecution execution) throws Exception {
+ execution.setVariable("executionListenerVar", "working");
+ if (someField!=null) {
+ execution.setVariable("executionListenerField", someField.getValue(execution));
+ }
+ }
+
+ public FixedValue getSomeField() {
+ return someField;
+ }
+
+ public void setSomeField(FixedValue someField) {
+ this.someField = someField;
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/MyTaskListenerBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/MyTaskListenerBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..fc97ecfbbb644ca0f7586747fbf6a17573a37694
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/MyTaskListenerBean.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.servicetask;
+
+import org.camunda.bpm.engine.delegate.DelegateTask;
+import org.camunda.bpm.engine.delegate.TaskListener;
+import org.camunda.bpm.engine.impl.el.FixedValue;
+
+
+/**
+ * @author Joram Barrez
+ * @author Bernd Ruecker (camunda)
+ */
+public class MyTaskListenerBean implements TaskListener {
+
+ private FixedValue someField;
+
+ public void notify(DelegateTask delegateTask) {
+ delegateTask.getExecution().setVariable("taskListenerVar", "working");
+ if (someField!=null) {
+ delegateTask.getExecution().setVariable("taskListenerField", someField.getValue(delegateTask));
+ }
+ }
+
+ public FixedValue getSomeField() {
+ return someField;
+ }
+
+ public void setSomeField(FixedValue someField) {
+ this.someField = someField;
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/SentenceGenerator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/SentenceGenerator.java
new file mode 100644
index 0000000000000000000000000000000000000000..1241a8bea5df7ca3a61b75e95dd22b91c261dda4
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/SentenceGenerator.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.servicetask;
+
+
+/**
+ * @author Joram Barrez
+ */
+public class SentenceGenerator {
+
+ public String getSentence() {
+ return "Activiti BPMN 2.0 process engine";
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/SentenceToUpperCaseBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/SentenceToUpperCaseBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..67d4aa9601ea2764bc2c6e5193882d40c418abcb
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/SentenceToUpperCaseBean.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.servicetask;
+
+import org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution;
+
+
+/**
+ * @author Joram Barrez
+ */
+public class SentenceToUpperCaseBean {
+
+ protected SentenceGenerator sentenceGenerator;
+
+ public void setSentence(ActivityExecution execution) {
+ execution.setVariable("myVar", sentenceGenerator.getSentence().toUpperCase());
+ }
+
+ public void setSentenceGenerator(SentenceGenerator sentenceGenerator) {
+ this.sentenceGenerator = sentenceGenerator;
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..43071aae369ec49954debd87b0d4eb60e8823b91
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.servicetask;
+
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.spring.test.SpringProcessEngineTestCase;
+import org.camunda.bpm.engine.test.Deployment;
+import org.springframework.test.context.ContextConfiguration;
+
+
+/**
+ * @author Joram Barrez
+ */
+@ContextConfiguration("classpath:org/camunda/bpm/engine/spring/test/servicetask/servicetaskSpringTest-context.xml")
+public class ServiceTaskSpringDelegationTest extends SpringProcessEngineTestCase {
+
+ @Deployment
+ public void testDelegateExpression() {
+ ProcessInstance procInst = runtimeService.startProcessInstanceByKey("delegateExpressionToSpringBean");
+ assertEquals("Activiti BPMN 2.0 process engine", runtimeService.getVariable(procInst.getId(), "myVar"));
+ assertEquals("fieldInjectionWorking", runtimeService.getVariable(procInst.getId(), "fieldInjection"));
+ }
+
+ @Deployment
+ public void testDelegateClass() {
+ ProcessInstance procInst = runtimeService.startProcessInstanceByKey("delegateClassToSpringBean");
+ assertEquals("Activiti BPMN 2.0 process engine", runtimeService.getVariable(procInst.getId(), "myVar"));
+ assertEquals("fieldInjectionWorking", runtimeService.getVariable(procInst.getId(), "fieldInjection"));
+ }
+
+ @Deployment
+ public void testDelegateClassNotABean() {
+ ProcessInstance procInst = runtimeService.startProcessInstanceByKey("delegateClassToSpringBean");
+ assertEquals("DelegateClassNotABean was called", runtimeService.getVariable(procInst.getId(), "message"));
+ assertTrue((Boolean)runtimeService.getVariable(procInst.getId(), "injectedFieldIsNull"));
+ }
+
+ @Deployment
+ public void testMethodExpressionOnSpringBean() {
+ ProcessInstance procInst = runtimeService.startProcessInstanceByKey("methodExpressionOnSpringBean");
+ assertEquals("ACTIVITI BPMN 2.0 PROCESS ENGINE", runtimeService.getVariable(procInst.getId(), "myVar"));
+ }
+
+ @Deployment
+ public void testExecutionAndTaskListenerDelegationExpression() {
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("executionAndTaskListenerDelegation");
+ assertEquals("working", runtimeService.getVariable(processInstance.getId(), "executionListenerVar"));
+ assertEquals("working", runtimeService.getVariable(processInstance.getId(), "taskListenerVar"));
+
+ assertEquals("executionListenerInjection", runtimeService.getVariable(processInstance.getId(), "executionListenerField"));
+ assertEquals("taskListenerInjection", runtimeService.getVariable(processInstance.getId(), "taskListenerField"));
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/ThrowBpmnErrorDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/ThrowBpmnErrorDelegate.java
new file mode 100644
index 0000000000000000000000000000000000000000..a8ff1eb225ce33220f9a6c21aaa8273e2f7c9b37
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/servicetask/ThrowBpmnErrorDelegate.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.servicetask;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+
+
+/**
+ * @author Falko Menge
+ */
+public class ThrowBpmnErrorDelegate implements JavaDelegate {
+
+ public void execute(DelegateExecution execution) throws Exception {
+ Integer executionsBeforeError = (Integer) execution.getVariable("executionsBeforeError");
+ Integer executions = (Integer) execution.getVariable("executions");
+ if (executions == null) {
+ executions = 0;
+ }
+ executions++;
+ if (executionsBeforeError == null || executionsBeforeError < executions) {
+ throw new BpmnError("23", "This is a business fault, which can be caught by a BPMN Error Event.");
+ } else {
+ execution.setVariable("executions", executions);
+ }
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/taskListener/MyTaskListener.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/taskListener/MyTaskListener.java
new file mode 100644
index 0000000000000000000000000000000000000000..a0a725b4ee268318c97eb5ae0a0d230baf8daac5
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/taskListener/MyTaskListener.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.taskListener;
+
+import org.camunda.bpm.engine.delegate.DelegateTask;
+import org.camunda.bpm.engine.delegate.TaskListener;
+
+
+/**
+ * @author Joram Barrez
+ */
+public class MyTaskListener implements TaskListener {
+
+ public void notify(DelegateTask delegateTask) {
+ delegateTask.setVariable("calledThroughNotify", delegateTask.getName() + "-notify");
+ }
+
+ public void calledInExpression(DelegateTask task, String eventName) {
+ task.setVariable("calledInExpression", task.getName() + "-" + eventName);
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/taskListener/TaskListenerSpringTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/taskListener/TaskListenerSpringTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..302a60be6974047035d79822492cdaa745427260
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/taskListener/TaskListenerSpringTest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.taskListener;
+
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.spring.test.SpringProcessEngineTestCase;
+import org.camunda.bpm.engine.task.Task;
+import org.camunda.bpm.engine.test.Deployment;
+import org.springframework.test.context.ContextConfiguration;
+
+
+/**
+ * @author Joram Barrez
+ */
+@ContextConfiguration("classpath:org/camunda/bpm/engine/spring/test/taskListener/TaskListenerDelegateExpressionTest-context.xml")
+public class TaskListenerSpringTest extends SpringProcessEngineTestCase {
+
+ @Deployment
+ public void testTaskListenerDelegateExpression() {
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("taskListenerDelegateExpression");
+
+ // Completing first task will set variable on process instance
+ Task task = taskService.createTaskQuery().singleResult();
+ taskService.complete(task.getId());
+ assertEquals("task1-complete", runtimeService.getVariable(processInstance.getId(), "calledInExpression"));
+
+ // Completing second task will set variable on process instance
+ task = taskService.createTaskQuery().singleResult();
+ taskService.complete(task.getId());
+ assertEquals("task2-notify", runtimeService.getVariable(processInstance.getId(), "calledThroughNotify"));
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/taskassignment/CustomTaskAssignmentTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/taskassignment/CustomTaskAssignmentTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..c6134dccb16d1a1414309bace6d3d97aef0fcd65
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/taskassignment/CustomTaskAssignmentTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.taskassignment;
+
+import org.camunda.bpm.engine.impl.util.CollectionUtil;
+import org.camunda.bpm.engine.spring.test.SpringProcessEngineTestCase;
+import org.camunda.bpm.engine.test.Deployment;
+import org.springframework.test.context.ContextConfiguration;
+
+
+/**
+ * @author Joram Barrez
+ */
+@ContextConfiguration("classpath:org/camunda/bpm/engine/spring/test/taskassignment/taskassignment-context.xml")
+public class CustomTaskAssignmentTest extends SpringProcessEngineTestCase {
+
+ @Deployment
+ public void testSetAssigneeThroughSpringService() {
+ runtimeService.startProcessInstanceByKey("assigneeThroughSpringService", CollectionUtil.singletonMap("emp", "fozzie"));
+ assertEquals(1, taskService.createTaskQuery().taskAssignee("Kermit The Frog").count());
+ }
+
+ @Deployment
+ public void testSetCandidateUsersThroughSpringService() {
+ runtimeService.startProcessInstanceByKey("candidateUsersThroughSpringService", CollectionUtil.singletonMap("emp", "fozzie"));
+ assertEquals(1, taskService.createTaskQuery().taskCandidateUser("kermit").count());
+ assertEquals(1, taskService.createTaskQuery().taskCandidateUser("fozzie").count());
+ assertEquals(1, taskService.createTaskQuery().taskCandidateUser("gonzo").count());
+ assertEquals(0, taskService.createTaskQuery().taskCandidateUser("mispiggy").count());
+ }
+
+
+ @Deployment
+ public void testSetCandidateGroupsThroughSpringService() {
+ runtimeService.startProcessInstanceByKey("candidateUsersThroughSpringService", CollectionUtil.singletonMap("emp", "fozzie"));
+ assertEquals(1, taskService.createTaskQuery().taskCandidateGroup("management").count());
+ assertEquals(1, taskService.createTaskQuery().taskCandidateGroup("directors").count());
+ assertEquals(1, taskService.createTaskQuery().taskCandidateGroup("accountancy").count());
+ assertEquals(0, taskService.createTaskQuery().taskCandidateGroup("sales").count());
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/taskassignment/FakeLdapService.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/taskassignment/FakeLdapService.java
new file mode 100644
index 0000000000000000000000000000000000000000..b5b5bef073b647af538e152f5aac4df1eff1f5d6
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/taskassignment/FakeLdapService.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.taskassignment;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+
+
+/**
+ * @author Joram Barrez
+ */
+public class FakeLdapService {
+
+ public String findManagerForEmployee(String employee) {
+ // Pretty useless LDAP service ...
+ return "Kermit The Frog";
+ }
+
+ public List findAllSales() {
+ return Arrays.asList("kermit", "gonzo", "fozzie");
+ }
+
+ public List findManagers(DelegateExecution execution, String emp) {
+ if (execution == null) {
+ throw new RuntimeException("Execution parameter is null");
+ }
+
+ if (emp == null || "".equals(emp)) {
+ throw new RuntimeException("emp parameter is null or empty");
+ }
+
+ return Arrays.asList("management", "directors");
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/BeanWithException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/BeanWithException.java
new file mode 100644
index 0000000000000000000000000000000000000000..15cf7ad156d8da25187fcca7778a512b3c74aa31
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/BeanWithException.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction;
+
+
+public class BeanWithException {
+
+ public void doSomething(){
+ throw new MyRuntimeException();
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/FailDeleteDeploymentCommandInterceptor.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/FailDeleteDeploymentCommandInterceptor.java
new file mode 100644
index 0000000000000000000000000000000000000000..e6e4aede39ef61d2f4c6fcb6ef410b85f3fba960
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/FailDeleteDeploymentCommandInterceptor.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction;
+
+import org.camunda.bpm.engine.impl.cmd.DeleteDeploymentCmd;
+import org.camunda.bpm.engine.impl.interceptor.Command;
+import org.camunda.bpm.engine.impl.interceptor.CommandInterceptor;
+
+/**
+ * @author Svetlana Dorokhova
+ *
+ */
+public class FailDeleteDeploymentCommandInterceptor extends CommandInterceptor {
+
+ @Override
+ public T execute(Command command) {
+
+ T result = next.execute(command);
+
+ if (command instanceof DeleteDeploymentCmd) {
+ throw new RuntimeException("roll back transaction");
+ }
+
+ return result;
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/FailDeleteDeploymentsPlugin.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/FailDeleteDeploymentsPlugin.java
new file mode 100644
index 0000000000000000000000000000000000000000..982d49e001b8bddaaa52d3d5555274a1445f6c8e
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/FailDeleteDeploymentsPlugin.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction;
+
+import java.util.Arrays;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
+import org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin;
+import org.camunda.bpm.engine.impl.interceptor.CommandInterceptor;
+
+/**
+ * @author Svetlana Dorokhova
+ *
+ */
+public class FailDeleteDeploymentsPlugin implements ProcessEnginePlugin {
+
+ @Override
+ public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
+ processEngineConfiguration.setCustomPostCommandInterceptorsTxRequired(Arrays.asList(new FailDeleteDeploymentCommandInterceptor()));
+ processEngineConfiguration.setCustomPostCommandInterceptorsTxRequiresNew(Arrays.asList(new FailDeleteDeploymentCommandInterceptor()));
+ }
+
+ @Override
+ public void postInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
+ }
+
+ @Override
+ public void postProcessEngineBuild(ProcessEngine processEngine) {
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/FailDeploymentCommandInterceptor.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/FailDeploymentCommandInterceptor.java
new file mode 100644
index 0000000000000000000000000000000000000000..8a501e8939fe2ce7d18c87c4d4bd59a55304e00a
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/FailDeploymentCommandInterceptor.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction;
+
+import org.camunda.bpm.engine.impl.cmd.DeleteDeploymentCmd;
+import org.camunda.bpm.engine.impl.cmd.DeployCmd;
+import org.camunda.bpm.engine.impl.interceptor.Command;
+import org.camunda.bpm.engine.impl.interceptor.CommandInterceptor;
+
+/**
+ * @author Thorben Lindhauer
+ *
+ */
+public class FailDeploymentCommandInterceptor extends CommandInterceptor {
+
+ @Override
+ public T execute(Command command) {
+
+ T result = next.execute(command);
+
+ if (command instanceof DeployCmd) {
+ throw new RuntimeException("roll back transaction");
+ }
+
+ return result;
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/FailDeploymentsPlugin.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/FailDeploymentsPlugin.java
new file mode 100644
index 0000000000000000000000000000000000000000..9edad6451894bde9c13c053f91f4f469d611561a
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/FailDeploymentsPlugin.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction;
+
+import java.util.Arrays;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
+import org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin;
+import org.camunda.bpm.engine.impl.interceptor.CommandInterceptor;
+
+/**
+ * @author Thorben Lindhauer
+ *
+ */
+public class FailDeploymentsPlugin implements ProcessEnginePlugin {
+
+ @Override
+ public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
+ processEngineConfiguration.setCustomPostCommandInterceptorsTxRequired(Arrays.asList(new FailDeploymentCommandInterceptor()));
+ processEngineConfiguration.setCustomPostCommandInterceptorsTxRequiresNew(Arrays.asList(new FailDeploymentCommandInterceptor()));
+ }
+
+ @Override
+ public void postInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
+ }
+
+ @Override
+ public void postProcessEngineBuild(ProcessEngine processEngine) {
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/FailingTransactionListenerDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/FailingTransactionListenerDelegate.java
new file mode 100644
index 0000000000000000000000000000000000000000..7b53f95cd3031177cf14b89b6f708e69dbb68918
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/FailingTransactionListenerDelegate.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.camunda.bpm.engine.impl.cfg.TransactionListener;
+import org.camunda.bpm.engine.impl.cfg.TransactionState;
+import org.camunda.bpm.engine.impl.context.Context;
+import org.camunda.bpm.engine.impl.interceptor.CommandContext;
+
+public class FailingTransactionListenerDelegate implements JavaDelegate {
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+
+ Context.getCommandContext().getTransactionContext().addTransactionListener(TransactionState.COMMITTING, new TransactionListener() {
+
+ @Override
+ public void execute(CommandContext context) {
+ throw new RuntimeException("exception in transaction listener");
+ }
+ });
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/MyRuntimeException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/MyRuntimeException.java
new file mode 100644
index 0000000000000000000000000000000000000000..294586036c18f8aa09347bc91a62f14a5ee0c1b7
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/MyRuntimeException.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction;
+
+public class MyRuntimeException extends RuntimeException {
+
+ public MyRuntimeException(){
+ super("error");
+ }
+
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/Printer.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/Printer.java
new file mode 100644
index 0000000000000000000000000000000000000000..f0b1cd51847c04cb46aecd3a9c1738baa003cc47
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/Printer.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction;
+
+import org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class Printer {
+
+ public void printMessage(ActivityExecution execution) {
+ execution.setVariable("myVar", "Hello from Printer!");
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/ServiceTaskBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/ServiceTaskBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..6bb36dfc35b4f950b3d30241c1c9196c57107ad0
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/ServiceTaskBean.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.springframework.transaction.annotation.Transactional;
+
+
+public class ServiceTaskBean implements JavaDelegate{
+
+ private BeanWithException beanWithException;
+
+ public void setBeanWithException(BeanWithException bean){
+ this.beanWithException = bean;
+ }
+
+ @Transactional
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ beanWithException.doSomething();
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationDeleteDeploymentFailTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationDeleteDeploymentFailTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..9abff0b3d097d0ce91f6bb33234cf61adb2fefd6
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationDeleteDeploymentFailTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction;
+
+import org.camunda.bpm.engine.impl.interceptor.Command;
+import org.camunda.bpm.engine.impl.interceptor.CommandContext;
+import org.camunda.bpm.engine.spring.test.SpringProcessEngineTestCase;
+import org.camunda.bpm.model.bpmn.Bpmn;
+import org.camunda.bpm.model.bpmn.BpmnModelInstance;
+import org.springframework.test.context.ContextConfiguration;
+
+/**
+ * @author Svetlana Dorokhova
+ */
+
+@ContextConfiguration("classpath:org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationDeleteDeploymentFailTest-context.xml")
+public class SpringTransactionIntegrationDeleteDeploymentFailTest extends SpringProcessEngineTestCase {
+
+ private String deploymentId;
+
+ @Override
+ protected void tearDown() throws Exception {
+ processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command() {
+ public Void execute(CommandContext commandContext) {
+ commandContext
+ .getDeploymentManager()
+ .deleteDeployment(deploymentId, false, false, false);
+ return null;
+ }
+ });
+
+
+ super.tearDown();
+ }
+
+ public void testFailingAfterDeleteDeployment() {
+ //given
+ final BpmnModelInstance model = Bpmn.createExecutableProcess().startEvent().userTask().endEvent().done();
+ deploymentId = processEngine.getRepositoryService().createDeployment().addModelInstance("model.bpmn", model).deploy().getId();
+
+ //when
+ // 1. delete deployment
+ // 2. it fails in post command interceptor (see FailDeleteDeploymentsPlugin)
+ // 3. transaction is rolling back
+ // 4. DeleteDeploymentFailListener is called
+ try {
+ processEngine.getRepositoryService().deleteDeployment(deploymentId);
+ } catch (Exception ex) {
+ //expected exception
+ }
+
+ //then
+ // DeleteDeploymentFailListener succeeded to registered deployments back
+ assertEquals(1, processEngineConfiguration.getRegisteredDeployments().size());
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationDeploymentFailTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationDeploymentFailTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..7e473d0635281849a28a2df14de447ee5ec1eb85
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationDeploymentFailTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction;
+
+import org.camunda.bpm.engine.spring.test.SpringProcessEngineTestCase;
+import org.camunda.bpm.model.bpmn.Bpmn;
+import org.camunda.bpm.model.bpmn.BpmnModelInstance;
+import org.springframework.test.context.ContextConfiguration;
+
+/**
+ * @author Svetlana Dorokhova
+ */
+
+@ContextConfiguration("classpath:org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationDeploymentFailTest-context.xml")
+public class SpringTransactionIntegrationDeploymentFailTest extends SpringProcessEngineTestCase {
+
+ @Override
+ protected void tearDown() throws Exception {
+ //must not be needed after CAM-4250 is fixed
+ processEngineConfiguration.getDeploymentCache().discardProcessDefinitionCache();
+ super.tearDown();
+ }
+
+ public void testFailingAfterDeployment() {
+// given
+ final BpmnModelInstance model = Bpmn.createExecutableProcess().startEvent().userTask().endEvent().done();
+
+ //when
+ // 1. deploy the process
+ // 2. it fails in post command interceptor (see FailDeploymentsPlugin)
+ // 3. transaction is rolling back
+ // 4. DeploymentFailListener is called
+ try {
+ processEngine.getRepositoryService().createDeployment().addModelInstance("model.bpmn", model).deploy();
+ } catch (Exception ex) {
+ //expected exception
+ }
+
+ //then
+ // DeploymentFailListener succeeded to remove registered deployments
+ assertEquals(0, processEngineConfiguration.getRegisteredDeployments().size());
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..c2053e1490fc6c444237188000854e928e74f02d
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.concurrent.TimeUnit;
+
+import javax.sql.DataSource;
+
+import org.camunda.bpm.engine.runtime.Incident;
+import org.camunda.bpm.engine.runtime.Job;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.spring.test.SpringProcessEngineTestCase;
+import org.camunda.bpm.engine.test.Deployment;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.test.context.ContextConfiguration;
+
+
+/**
+ * @author Tom Baeyens
+ */
+@ContextConfiguration("classpath:org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest-context.xml")
+public class SpringTransactionIntegrationTest extends SpringProcessEngineTestCase {
+
+ @Autowired
+ protected UserBean userBean;
+
+ @Autowired
+ protected DataSource dataSource;
+
+ private static long WAIT_TIME_MILLIS = TimeUnit.MILLISECONDS.convert(20L, TimeUnit.SECONDS);
+
+ @Deployment
+ public void testBasicActivitiSpringIntegration() {
+ userBean.hello();
+
+ ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().singleResult();
+ assertEquals("Hello from Printer!", runtimeService.getVariable(processInstance.getId(), "myVar"));
+ }
+
+ @Deployment
+ public void testRollbackTransactionOnActivitiException() {
+
+ // Create a table that the userBean is supposed to fill with some data
+ JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
+ jdbcTemplate.execute("create table MY_TABLE (MY_TEXT varchar);");
+
+ // The hello() method will start the process. The process will wait in a user task
+ userBean.hello();
+
+ jdbcTemplate.update("insert into MY_TABLE values ('test');");
+ int results = jdbcTemplate.queryForObject("select count(*) from MY_TABLE", Integer.class);
+ assertEquals(1, results);
+
+ // The completeTask() method will write a record to the 'MY_TABLE' table and complete the user task
+ try {
+ userBean.completeTask(taskService.createTaskQuery().singleResult().getId());
+ fail();
+ } catch (Exception e) { }
+
+ // Since the service task after the user tasks throws an exception, both
+ // the record and the process must be rolled back !
+ assertEquals("My Task", taskService.createTaskQuery().singleResult().getName());
+ results = jdbcTemplate.queryForObject("select count(*) from MY_TABLE", Integer.class);
+ assertEquals(1, results);
+
+ // Cleanup
+ jdbcTemplate.execute("drop table MY_TABLE if exists;");
+ }
+
+ @Deployment(resources={
+ "org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testErrorPropagationOnExceptionInTransaction.bpmn20.xml",
+ "org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.throwExceptionProcess.bpmn20.xml"
+ })
+ public void testErrorPropagationOnExceptionInTransaction(){
+ runtimeService.startProcessInstanceByKey("process");
+ waitForJobExecutorToProcessAllJobs(WAIT_TIME_MILLIS);
+ Incident incident = runtimeService.createIncidentQuery().activityId("servicetask").singleResult();
+ assertThat(incident.getIncidentMessage(), is("error"));
+ }
+
+ @Deployment
+ public void testTransactionRollbackInServiceTask() throws Exception {
+
+ runtimeService.startProcessInstanceByKey("txRollbackServiceTask");
+
+ waitForJobExecutorToProcessAllJobs(WAIT_TIME_MILLIS);
+
+ Job job = managementService.createJobQuery().singleResult();
+
+ assertNotNull(job);
+ assertEquals(0, job.getRetries());
+ assertEquals("Transaction rolled back because it has been marked as rollback-only", job.getExceptionMessage());
+
+ String stacktrace = managementService.getJobExceptionStacktrace(job.getId());
+ assertNotNull(stacktrace);
+ assertTrue("unexpected stacktrace, was <" + stacktrace + ">", stacktrace.contains("Transaction rolled back because it has been marked as rollback-only"));
+ }
+
+ @Deployment
+ public void testTransactionRollbackInServiceTaskWithCustomRetryCycle() throws Exception {
+
+ runtimeService.startProcessInstanceByKey("txRollbackServiceTaskWithCustomRetryCycle");
+
+ waitForJobExecutorToProcessAllJobs(WAIT_TIME_MILLIS);
+
+ Job job = managementService.createJobQuery().singleResult();
+
+ assertNotNull(job);
+ assertEquals(0, job.getRetries());
+ assertEquals("Transaction rolled back because it has been marked as rollback-only", job.getExceptionMessage());
+
+ String stacktrace = managementService.getJobExceptionStacktrace(job.getId());
+ assertNotNull(stacktrace);
+ assertTrue("unexpected stacktrace, was <" + stacktrace + ">", stacktrace.contains("Transaction rolled back because it has been marked as rollback-only"));
+ }
+
+ @Deployment
+ public void testFailingTransactionListener() throws Exception {
+
+ runtimeService.startProcessInstanceByKey("failingTransactionListener");
+
+ waitForJobExecutorToProcessAllJobs(WAIT_TIME_MILLIS);
+
+ Job job = managementService.createJobQuery().singleResult();
+
+ assertNotNull(job);
+ assertEquals(0, job.getRetries());
+ assertEquals("exception in transaction listener", job.getExceptionMessage());
+
+ String stacktrace = managementService.getJobExceptionStacktrace(job.getId());
+ assertNotNull(stacktrace);
+ assertTrue("unexpected stacktrace, was <" + stacktrace + ">", stacktrace.contains("java.lang.RuntimeException: exception in transaction listener"));
+ }
+
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/TransactionRollbackDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/TransactionRollbackDelegate.java
new file mode 100644
index 0000000000000000000000000000000000000000..172d27ebcfa36907951666ceacd501ff62d6a57d
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/TransactionRollbackDelegate.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.TransactionCallback;
+import org.springframework.transaction.support.TransactionTemplate;
+
+public class TransactionRollbackDelegate implements JavaDelegate {
+
+ private PlatformTransactionManager transactionManager;
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager);
+ transactionTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRED);
+
+ transactionTemplate.execute(new TransactionCallback() {
+
+ @Override
+ public Void doInTransaction(TransactionStatus status) {
+
+ // simulate a failure that triggers the transaction rollback
+ status.setRollbackOnly();
+
+ return null;
+ }
+ });
+ }
+
+ public void setTransactionManager(PlatformTransactionManager transactionManager) {
+ this.transactionManager = transactionManager;
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/UserBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/UserBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..9e967d22b6826902ff96646219be74b85d7c3e07
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/UserBean.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.sql.DataSource;
+
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.TaskService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author Tom Baeyens
+ */
+public class UserBean {
+
+ /** injected by Spring */
+ private RuntimeService runtimeService;
+
+ /** injected by Spring */
+ private TaskService taskService;
+
+ /** injected by Spring */
+ private DataSource dataSource;
+
+ @Transactional
+ public void hello() {
+ // here you can do transactional stuff in your domain model
+ // and it will be combined in the same transaction as
+ // the startProcessInstanceByKey to the Activiti RuntimeService
+ runtimeService.startProcessInstanceByKey("helloProcess");
+ }
+
+ @Transactional
+ public void completeTask(String taskId) {
+
+ // First insert a record in the MY_TABLE table
+ JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
+ int results = jdbcTemplate.queryForObject("select count(*) from MY_TABLE", Integer.class);
+ assertEquals(1, results);
+ int nrOfRows = jdbcTemplate.update("insert into MY_TABLE values ('test');");
+ if (nrOfRows != 1) {
+ throw new RuntimeException("Insert into MY_TABLE failed");
+ }
+
+ results = jdbcTemplate.queryForObject("select count(*) from MY_TABLE", Integer.class);
+ assertEquals(2, results);
+ taskService.complete(taskId);
+ }
+
+ // getters and setters //////////////////////////////////////////////////////
+
+ @Autowired
+ public void setRuntimeService(RuntimeService runtimeService) {
+ this.runtimeService = runtimeService;
+ }
+
+ @Autowired
+ public void setTaskService(TaskService taskService) {
+ this.taskService = taskService;
+ }
+
+ @Autowired
+ public void setDataSource(DataSource dataSource) {
+ this.dataSource = dataSource;
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/inner/rollback/InnerProcessService.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/inner/rollback/InnerProcessService.java
new file mode 100644
index 0000000000000000000000000000000000000000..84734e951ee163804228e728d2e68327ebabcf52
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/inner/rollback/InnerProcessService.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction.inner.rollback;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+
+
+public interface InnerProcessService {
+
+ void startInnerProcess(DelegateExecution execution);
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/inner/rollback/InnerProcessServiceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/inner/rollback/InnerProcessServiceImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..dcd9fc5fa0c468f7170889711ccdfecb51d694b1
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/inner/rollback/InnerProcessServiceImpl.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction.inner.rollback;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.context.ProcessEngineContext;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+public class InnerProcessServiceImpl implements InnerProcessService {
+
+ @Override
+ @Transactional(value = "transactionManager", propagation = Propagation.REQUIRES_NEW, rollbackFor = {Throwable.class})
+ public void startInnerProcess(DelegateExecution execution) {
+
+ try {
+ ProcessEngineContext.requiresNew();
+ execution.getProcessEngineServices().getRuntimeService()
+ .startProcessInstanceByKey("InnerTxNestedTransactionTest");
+ } finally {
+ ProcessEngineContext.clear();
+ }
+
+ throw new RuntimeException("Inner Transaction Fails and Rolls back error!");
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/inner/rollback/SpringInnerTransactionRollbackTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/inner/rollback/SpringInnerTransactionRollbackTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..5d2eaa99187d68fd48984699ececae981c9f7976
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/inner/rollback/SpringInnerTransactionRollbackTest.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction.inner.rollback;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.camunda.bpm.engine.HistoryService;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.history.HistoricProcessInstance;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.test.Deployment;
+import org.camunda.bpm.engine.test.ProcessEngineRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import java.util.List;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {"classpath:org/camunda/bpm/engine/spring/test/transaction/"
+ + "SpringInnerTransactionRollbackTest-applicationContext.xml"})
+public class SpringInnerTransactionRollbackTest {
+
+ @Rule
+ @Autowired
+ public ProcessEngineRule rule;
+
+ @Autowired
+ public ProcessEngine processEngine;
+
+ @Autowired
+ RuntimeService runtimeService;
+
+ @Autowired
+ HistoryService historyService;
+
+ @Test
+ @Deployment(resources = {
+ "org/camunda/bpm/engine/spring/test/transaction/"
+ + "SpringInnerTransactionRollbackTest.shouldRollbackProcessData-outer.bpmn20.xml",
+ "org/camunda/bpm/engine/spring/test/transaction/"
+ + "SpringInnerTransactionRollbackTest.shouldRollbackProcessData-inner.bpmn20.xml"
+ })
+ public void shouldRollbackProcessData() {
+ // given
+
+ // when
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("OuterTxNestedTransactionTest");
+
+ // then
+
+ // outer process instance should be finished
+ ProcessInstance outerProcessInstance = runtimeService.createProcessInstanceQuery()
+ .processInstanceId(processInstance.getId())
+ .singleResult();
+ assertThat(outerProcessInstance).isNull();
+
+ // inner process instance shouldn't exist
+ List innerProcessInstances = runtimeService.createProcessInstanceQuery()
+ .processDefinitionKey("InnerTxNestedTransactionTest")
+ .list();
+ assertThat(innerProcessInstances).isEmpty();
+
+
+ // historic inner PI shouldn't be available
+ List innerProcessinstances = historyService
+ .createHistoricProcessInstanceQuery()
+ .processDefinitionKey("InnerTxNestedTransactionTest")
+ .list();
+ assertThat(innerProcessinstances).isEmpty();
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/inner/rollback/TransactionTestDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/inner/rollback/TransactionTestDelegate.java
new file mode 100644
index 0000000000000000000000000000000000000000..ee7b12ccf7b500f97a6e627888acd8cfd133590d
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/inner/rollback/TransactionTestDelegate.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction.inner.rollback;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service("transactionTestDelegate")
+@Transactional(value = "transactionManager", propagation = Propagation.REQUIRED)
+public class TransactionTestDelegate implements JavaDelegate {
+
+ @Autowired
+ InnerProcessService innerProcessService;
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+
+ try {
+ innerProcessService.startInnerProcess(execution);
+ } catch (Exception ex) {
+ // noop
+ }
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/modification/CalculateTimerDate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/modification/CalculateTimerDate.java
new file mode 100644
index 0000000000000000000000000000000000000000..f14d47e438a047c0372ea943110f7c923a34afdb
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/modification/CalculateTimerDate.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction.modification;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+
+public class CalculateTimerDate {
+
+ public Date execute(DelegateExecution execution) {
+ execution.setVariable("createDate", new Date());
+
+ final Calendar calendar = Calendar.getInstance();
+ calendar.setTime(new Date());
+ calendar.add(Calendar.DAY_OF_MONTH, 1);
+ return calendar.getTime();
+ }
+
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/modification/DeleteVariableListener.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/modification/DeleteVariableListener.java
new file mode 100644
index 0000000000000000000000000000000000000000..88608093fa6484bffd4d9e433ec4c7633b829b00
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/modification/DeleteVariableListener.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction.modification;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.ExecutionListener;
+
+public class DeleteVariableListener implements ExecutionListener {
+ public void notify(DelegateExecution delegateExecution) throws Exception {
+ delegateExecution.removeVariable("createDate");
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/modification/ProcessInstanceModificationInTransactionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/modification/ProcessInstanceModificationInTransactionTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..baa66f9c9a087fb431fdbd970efe7540ae581dcb
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/modification/ProcessInstanceModificationInTransactionTest.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction.modification;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.ibatis.logging.LogFactory;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.RepositoryService;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.history.HistoricVariableInstance;
+import org.camunda.bpm.engine.repository.Deployment;
+import org.camunda.bpm.engine.repository.DeploymentBuilder;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.runtime.VariableInstance;
+import org.camunda.bpm.engine.test.ProcessEngineRule;
+import org.camunda.bpm.model.bpmn.Bpmn;
+import org.camunda.bpm.model.bpmn.BpmnModelInstance;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {"classpath:org/camunda/bpm/engine/spring/test/transaction/ProcessInstanceModificationInTransactionTest-applicationContext.xml"})
+public class ProcessInstanceModificationInTransactionTest {
+
+ @Autowired
+ @Rule
+ public ProcessEngineRule rule;
+
+ @Autowired
+ public ProcessEngine processEngine;
+
+ @Autowired
+ RuntimeService runtimeService;
+
+ @Autowired
+ RepositoryService repositoryService;
+
+ @Autowired
+ UserBean userBean;
+
+ @Before
+ public void init() {
+ LogFactory.useSlf4jLogging();
+ }
+
+ @Test
+ public void shouldBeAbleToPerformModification() {
+
+ // given
+ BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("TestProcess")
+ .startEvent()
+ .intermediateCatchEvent("TimerEvent")
+ .timerWithDate("${calculateTimerDate.execute(execution)}")
+ .camundaExecutionListenerDelegateExpression("end", "${deleteVariableListener}")
+ .endEvent()
+ .done();
+
+ deployModelInstance(modelInstance);
+ final ProcessInstance procInst = runtimeService.startProcessInstanceByKey("TestProcess");
+
+ // when
+ userBean.completeUserTaskAndModifyInstanceInOneTransaction(procInst);
+
+ // then
+ VariableInstance variable = rule.getRuntimeService().createVariableInstanceQuery().processInstanceIdIn(procInst.getId()).variableName("createDate").singleResult();
+ assertNotNull(variable);
+ HistoricVariableInstance historicVariable = rule.getHistoryService().createHistoricVariableInstanceQuery().singleResult();
+ assertEquals(variable.getName(), historicVariable.getName());
+ assertEquals(HistoricVariableInstance.STATE_CREATED, historicVariable.getState());
+ }
+
+ private void deployModelInstance(BpmnModelInstance modelInstance) {
+ DeploymentBuilder deploymentbuilder = repositoryService.createDeployment();
+ deploymentbuilder.addModelInstance("process0.bpmn", modelInstance);
+ Deployment deployment = deploymentbuilder.deploy();
+ rule.manageDeployment(deployment);
+ }
+}
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/modification/UserBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/modification/UserBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..c36c924f7263ccc57cd50f9da8864ae5e1e843dd
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/java/org/camunda/bpm/engine/spring/test/transaction/modification/UserBean.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.engine.spring.test.transaction.modification;
+
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.RepositoryService;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+@Component
+public class UserBean {
+
+ @Autowired
+ public ProcessEngine processEngine;
+
+ @Autowired
+ RuntimeService runtimeService;
+
+ @Autowired
+ RepositoryService repositoryService;
+
+ @Transactional
+ public void completeUserTaskAndModifyInstanceInOneTransaction(ProcessInstance procInst) {
+ // this method assures that the execution the process instance
+ // modification is done in one transaction.
+
+ // reset the process instance before the timer
+ runtimeService.createProcessInstanceModification(procInst.getId())
+ .cancelAllForActivity("TimerEvent")
+ .startBeforeActivity("TimerEvent")
+ .execute();
+ }
+
+}
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/META-INF/services/org.camunda.bpm.engine.spring.test.SpringTestHelper b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/META-INF/services/org.camunda.bpm.engine.spring.test.SpringTestHelper
new file mode 100644
index 0000000000000000000000000000000000000000..d444b3582b0588f778d39c2903596b63dfa78370
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/META-INF/services/org.camunda.bpm.engine.spring.test.SpringTestHelper
@@ -0,0 +1 @@
+org.camunda.bpm.engine.spring.test.Spring5TestHelper
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/activiti-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/activiti-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d560b125e59750bcfe5ca958221a805b66c4faca
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/activiti-context.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/camunda.cfg.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/camunda.cfg.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9006b545f2701bcdcec6cb8b55fa3a2436d187d1
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/camunda.cfg.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/logback-test.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/logback-test.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c802227c380dc198a355d164484beaa14b5b6763
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/logback-test.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/logging.properties b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/logging.properties
new file mode 100644
index 0000000000000000000000000000000000000000..4941c55971f365781be2c0903a6f00af84a1a74f
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/logging.properties
@@ -0,0 +1,2 @@
+#register SLF4JBridgeHandler as handler for the j.u.l. root logger
+handlers = org.slf4j.bridge.SLF4JBridgeHandler
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/PostDeployRegistrationPaTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/PostDeployRegistrationPaTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..15fb03bf813468ba085b877522c4783fbd4926c0
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/PostDeployRegistrationPaTest-context.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/PostDeployWithNestedContext-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/PostDeployWithNestedContext-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5d871b25e65521ba41f364d209aa7621b122c9a8
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/PostDeployWithNestedContext-context.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/SpringProcessApplicationDeploymentTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/SpringProcessApplicationDeploymentTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c1a74177861c38a7c964fe2c2a341c68917db68d
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/SpringProcessApplicationDeploymentTest-context.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/SpringProcessArchiveDeploymentTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/SpringProcessArchiveDeploymentTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9cfbea1088d604cbc45c54b771d0fab9c5b6ebaa
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/SpringProcessArchiveDeploymentTest-context.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/process.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/process.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..0e0d935fd051f60fc2388f1cd76fe77bbca3edf0
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/process.bpmn20.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/processes.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/processes.xml
new file mode 100644
index 0000000000000000000000000000000000000000..775579d0e717d7455a608f4bc1be54a5c4c1c922
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/application/processes.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+ org/camunda/bpm/engine/spring/test/application/process.bpmn20.xml
+
+
+ false
+ true
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployCmmnBpmnTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployCmmnBpmnTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f83d7c3864ba69db21546612d28e84d75f25c51a
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployCmmnBpmnTest-context.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ classpath*:/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.*.cmmn
+ classpath*:/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.*.bpmn20.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployCmmnTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployCmmnTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3fee2ae3fad310558d536cf8d7c5ea2353ac6896
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployCmmnTest-context.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployCustomNameTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployCustomNameTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..63fbb51c411699cf811c41fcb11c30121770008a
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployCustomNameTest-context.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployDeployChangeOnlyTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployDeployChangeOnlyTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..faa0afc11ec455ea22a62dcc7da21bccf6ae0734
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployDeployChangeOnlyTest-context.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTenantIdTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTenantIdTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..0560c74c4dd2d8158abfa3fd1194ae710e511075
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTenantIdTest-context.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ classpath*:/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.*.cmmn
+ classpath*:/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.*.bpmn20.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..22865d5a4a3efdac0d72eda311f33b9d5da3b629
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTest-context.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTest-create-drop-clean-db-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTest-create-drop-clean-db-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b0562a824bfb5643273d30b26fb8ed536c40ff34
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTest-create-drop-clean-db-context.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTest-dynamic-deployment-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTest-dynamic-deployment-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ddc3e758e7e2e3125ebf4213c1b74fe42a0ce111
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/SpringAutoDeployTest-dynamic-deployment-context.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.a.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.a.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e4b1aec04e219a946589f0920f1e93b1659a6f5a
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.a.bpmn20.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.b.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.b.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d705c8b24779d9625d37a361be28e08a6da874cf
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.b.bpmn20.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.c.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.c.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..12a1e147960b9c80cd574bd4b02602c8022c1f52
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.c.bpmn20.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.d.cmmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.d.cmmn
new file mode 100644
index 0000000000000000000000000000000000000000..64e2b6626dab7b44859ce23c63e9b9bad1c4c863
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.d.cmmn
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/customName/a/autodeploy.a.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/customName/a/autodeploy.a.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e4b1aec04e219a946589f0920f1e93b1659a6f5a
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/customName/a/autodeploy.a.bpmn20.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/customName/b/autodeploy.a.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/customName/b/autodeploy.a.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e4b1aec04e219a946589f0920f1e93b1659a6f5a
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/autodeployment/customName/b/autodeploy.a.bpmn20.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/ProcessStartingBeanPostProcessorTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/ProcessStartingBeanPostProcessorTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3611437412b2bc747f17fbe66922733521d91775
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/ProcessStartingBeanPostProcessorTest-context.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/ScopingTests-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/ScopingTests-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6c5339cb38350144acdb58cf13f3213e3a2a8f40
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/ScopingTests-context.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/SpringJobExecutorRollBack.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/SpringJobExecutorRollBack.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7d1a528b5d7a9521aa577f43753b2ad14dbe1ca8
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/SpringJobExecutorRollBack.bpmn20.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+ PT1S
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/SpringTimersProcess.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/SpringTimersProcess.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b3c2da518b40404ee8e6177d5aa5e48c11e22560
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/SpringTimersProcess.bpmn20.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+ PT0S
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/SpringjobExecutorTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/SpringjobExecutorTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..68998541acad8b2cf4d3df3195133f1b2beab7bc
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/SpringjobExecutorTest-context.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/StateHandlerTests-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/StateHandlerTests-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e1a3cd1aa9690e0ffb3eff6d8df4565b15762790
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/StateHandlerTests-context.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ classpath:/org/camunda/bpm/engine/spring/test/autodeployment/autodeploy.*.bpmn20.xml
+ classpath:/org/activiti/spring/test/components/waiter.bpmn20.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/spring-component-waiter.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/spring-component-waiter.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1d215c7376041cca4a6b4d89aeaafcc1759a0d81
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/spring-component-waiter.bpmn20.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/waiter.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/waiter.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b869177b05cc93bf7c4046ad4e603ebd5a15a91c
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/components/waiter.bpmn20.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/configuration/JavaBasedProcessEngineConfigTest.testDelegateExpression.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/configuration/JavaBasedProcessEngineConfigTest.testDelegateExpression.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ebc4cc8bfcf0f069d28702774fd8e81d8659d351
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/configuration/JavaBasedProcessEngineConfigTest.testDelegateExpression.bpmn20.xml
@@ -0,0 +1,47 @@
+
+
+
+
+ SequenceFlow_1shqv2t
+
+
+
+ SequenceFlow_1shqv2t
+ SequenceFlow_0rehehw
+
+
+ SequenceFlow_0rehehw
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/configuration/JavaBasedProcessEngineConfigTest.testDelegateExpressionWithProcessServices.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/configuration/JavaBasedProcessEngineConfigTest.testDelegateExpressionWithProcessServices.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5c3e60c7824f82c58bd10e5532fc16e338598e40
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/configuration/JavaBasedProcessEngineConfigTest.testDelegateExpressionWithProcessServices.bpmn20.xml
@@ -0,0 +1,62 @@
+
+
+
+
+ SequenceFlow_1shqv2t
+
+
+
+ SequenceFlow_1shqv2t
+ SequenceFlow_0zie8v5
+
+
+ SequenceFlow_00601zm
+
+
+
+ SequenceFlow_0zie8v5
+ SequenceFlow_00601zm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/configuration/JavaBasedProcessEngineConfigTest.testExpression.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/configuration/JavaBasedProcessEngineConfigTest.testExpression.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3731b53ebbe71d0be8beefadae7fa47e1a5ca183
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/configuration/JavaBasedProcessEngineConfigTest.testExpression.bpmn20.xml
@@ -0,0 +1,47 @@
+
+
+
+
+ SequenceFlow_1shqv2t
+
+
+
+ SequenceFlow_1shqv2t
+ SequenceFlow_0rehehw
+
+
+ SequenceFlow_0rehehw
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/container/ManagedProcessEngineFactoryBean-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/container/ManagedProcessEngineFactoryBean-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ac6b05f0fb8d0e86d9760a593566c1765715f26f
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/container/ManagedProcessEngineFactoryBean-context.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/dmn/DmnJuelTest-applicationContext.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/dmn/DmnJuelTest-applicationContext.xml
new file mode 100644
index 0000000000000000000000000000000000000000..04c8c78989081bda86ae5584c9f4e7bea535ce46
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/dmn/DmnJuelTest-applicationContext.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/dmn/JuelTest.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/dmn/JuelTest.dmn
new file mode 100644
index 0000000000000000000000000000000000000000..654773e81e9083cab22ef79526cb5c37059d6666
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/dmn/JuelTest.dmn
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+ ${testbean.getBar()}
+
+
+
+
+
+ "baz"
+
+
+ "bar"
+
+
+
+
+ "bar"
+
+
+ "foo"
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/expression/SpringLimitedExpressionsTest.testLimitedBeansExposed.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/expression/SpringLimitedExpressionsTest.testLimitedBeansExposed.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4bebd9fcc75453b4b85b46bf6e4ac45bd7093fab
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/expression/SpringLimitedExpressionsTest.testLimitedBeansExposed.bpmn20.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/expression/callactivity/CallActivityBasedOnSpringBeansExpressionTest.testCallActivityByExpression.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/expression/callactivity/CallActivityBasedOnSpringBeansExpressionTest.testCallActivityByExpression.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..61288e79ad084b143aa07100d2585041bfa2d5b9
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/expression/callactivity/CallActivityBasedOnSpringBeansExpressionTest.testCallActivityByExpression.bpmn20.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/expression/callactivity/simpleSubProcess.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/expression/callactivity/simpleSubProcess.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..999ee01d2bab28d5c75a484838df4af3c40b5e7a
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/expression/callactivity/simpleSubProcess.bpmn20.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/expression/callactivity/testCallActivityByExpression-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/expression/callactivity/testCallActivityByExpression-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d3bafee3b3ea6f899e9be4e9184f74f3a20fbbef
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/expression/callactivity/testCallActivityByExpression-context.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/expression/expressionLimitedBeans-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/expression/expressionLimitedBeans-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..cb090fadf0481eed605a61e4827b1c8c562bcb88
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/expression/expressionLimitedBeans-context.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/jpa/custom-persistence.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/jpa/custom-persistence.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5d7a28ccc3ae9a8bd1291991ea0a57c2d91e0fe5
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/jpa/custom-persistence.xml
@@ -0,0 +1,13 @@
+
+
+ org.hibernate.jpa.HibernatePersistenceProvider
+ true
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/junit4/SpringJunit4Test.simpleProcessTest.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/junit4/SpringJunit4Test.simpleProcessTest.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..014d0142e8839143ea29558c288fceec39ce106d
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/junit4/SpringJunit4Test.simpleProcessTest.bpmn20.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/junit4/springTypicalUsageTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/junit4/springTypicalUsageTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1da45c801ed0cb55354b2009fe0342b42d0e8585
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/junit4/springTypicalUsageTest-context.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskLimitedBeansTest-applicationContext.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskLimitedBeansTest-applicationContext.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7593474e10a3e8e0b96ba2a578c9ca33204853f4
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskLimitedBeansTest-applicationContext.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskNoBeansTest-applicationContext.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskNoBeansTest-applicationContext.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b89de3c5e642e833fb2863449c46a3cf2c57225e
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskNoBeansTest-applicationContext.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskTest-applicationContext.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskTest-applicationContext.xml
new file mode 100644
index 0000000000000000000000000000000000000000..dfaa6d834792c366d4ecce0fb0aac6a21b60c00d
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/scripttask/ScriptTaskTest-applicationContext.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/BoundaryErrorEventSpringTest.testCatchErrorThrownByJavaDelegateOnServiceTask.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/BoundaryErrorEventSpringTest.testCatchErrorThrownByJavaDelegateOnServiceTask.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..09a41a68f3126b7881ba2cc64031cba39b4005ba
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/BoundaryErrorEventSpringTest.testCatchErrorThrownByJavaDelegateOnServiceTask.bpmn20.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.testDelegateClass.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.testDelegateClass.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6be7a71b08be8490aacecbf130617311000061dc
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.testDelegateClass.bpmn20.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.testDelegateClassNotABean.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.testDelegateClassNotABean.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e0c34c883418bc7550dad7f5929b41aa93ffb0a4
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.testDelegateClassNotABean.bpmn20.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.testDelegateExpression.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.testDelegateExpression.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a968aea148eaddcf10ebcd9ad9d40b2cbabd7db6
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.testDelegateExpression.bpmn20.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.testExecutionAndTaskListenerDelegationExpression.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.testExecutionAndTaskListenerDelegationExpression.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..be253b783ee591935e99ec5763bc8b6cdabb2333
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.testExecutionAndTaskListenerDelegationExpression.bpmn20.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.testMethodExpressionOnSpringBean.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.testMethodExpressionOnSpringBean.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..91db518aaf116d0486366b5e5635281135c40e63
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/ServiceTaskSpringDelegationTest.testMethodExpressionOnSpringBean.bpmn20.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/serviceraskSpringTestCatchError-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/serviceraskSpringTestCatchError-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..0560a2a0f756dca664d15e7746d7aa6794ef262b
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/serviceraskSpringTestCatchError-context.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/servicetaskSpringTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/servicetaskSpringTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9c7542560a99b8bd34f228569b1e8ed80a60b3ad
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/servicetask/servicetaskSpringTest-context.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskListener/TaskListenerDelegateExpressionTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskListener/TaskListenerDelegateExpressionTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..44efd653095ea34aca5f90d1cbeef93e13974f74
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskListener/TaskListenerDelegateExpressionTest-context.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskListener/TaskListenerSpringTest.testTaskListenerDelegateExpression.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskListener/TaskListenerSpringTest.testTaskListenerDelegateExpression.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e8733b67c703917c9becb6e09fa39c32e7174bd8
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskListener/TaskListenerSpringTest.testTaskListenerDelegateExpression.bpmn20.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskassignment/CustomTaskAssignmentTest.testSetAssigneeThroughSpringService.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskassignment/CustomTaskAssignmentTest.testSetAssigneeThroughSpringService.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..338bc9a7bfd345bf3648af71ca858d490f923546
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskassignment/CustomTaskAssignmentTest.testSetAssigneeThroughSpringService.bpmn20.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskassignment/CustomTaskAssignmentTest.testSetCandidateGroupsThroughSpringService.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskassignment/CustomTaskAssignmentTest.testSetCandidateGroupsThroughSpringService.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..74d08421aaaa6dbe02623439fb33ed0d7e552396
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskassignment/CustomTaskAssignmentTest.testSetCandidateGroupsThroughSpringService.bpmn20.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskassignment/CustomTaskAssignmentTest.testSetCandidateUsersThroughSpringService.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskassignment/CustomTaskAssignmentTest.testSetCandidateUsersThroughSpringService.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e2d904265e6533db2b741a618f232c404e75dd2d
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskassignment/CustomTaskAssignmentTest.testSetCandidateUsersThroughSpringService.bpmn20.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskassignment/taskassignment-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskassignment/taskassignment-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ee596e48d1a6b1c290acb1c5ce5248201f1850ab
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/taskassignment/taskassignment-context.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/ProcessInstanceModificationInTransactionTest-applicationContext.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/ProcessInstanceModificationInTransactionTest-applicationContext.xml
new file mode 100644
index 0000000000000000000000000000000000000000..fd55c0bbcd35284b2c211c96f4a39da63c316bac
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/ProcessInstanceModificationInTransactionTest-applicationContext.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringInnerTransactionRollbackTest-applicationContext.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringInnerTransactionRollbackTest-applicationContext.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ba8732829e8151585126c7cf87c78b5a1886892f
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringInnerTransactionRollbackTest-applicationContext.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ classpath:/org/camunda/bpm/engine/spring/test/jpa/custom-persistence.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringInnerTransactionRollbackTest.shouldRollbackProcessData-inner.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringInnerTransactionRollbackTest.shouldRollbackProcessData-inner.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d155fd014569e5eba12c16e3befeecfda4effb31
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringInnerTransactionRollbackTest.shouldRollbackProcessData-inner.bpmn20.xml
@@ -0,0 +1,44 @@
+
+
+
+
+ SequenceFlow_0xcnqy3
+
+
+
+ SequenceFlow_0q610er
+
+
+
+ SequenceFlow_0xcnqy3
+ SequenceFlow_0q610er
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringInnerTransactionRollbackTest.shouldRollbackProcessData-outer.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringInnerTransactionRollbackTest.shouldRollbackProcessData-outer.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b5925cbd5a48903f454d8adac61e28981ef68e52
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringInnerTransactionRollbackTest.shouldRollbackProcessData-outer.bpmn20.xml
@@ -0,0 +1,44 @@
+
+
+
+
+ SequenceFlow_1xrn9u3
+
+
+
+ SequenceFlow_0n3vfv0
+
+
+
+ SequenceFlow_1xrn9u3
+ SequenceFlow_0n3vfv0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationDeleteDeploymentFailTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationDeleteDeploymentFailTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7c88841aae34cb6f1e799fd6deb619d7ccc909f8
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationDeleteDeploymentFailTest-context.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationDeploymentFailTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationDeploymentFailTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..434a59fd7ba7b021448c2b6b3355b9bcae696105
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationDeploymentFailTest-context.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest-context.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c72ae11e87ff1a3ae3bd086855935c3c312df846
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest-context.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testBasicActivitiSpringIntegration.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testBasicActivitiSpringIntegration.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4d0c5fb969e13eaf8940449714b260bc1e2bb141
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testBasicActivitiSpringIntegration.bpmn20.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testErrorPropagationOnExceptionInTransaction.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testErrorPropagationOnExceptionInTransaction.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..80e3e87fba683462986ceef9210c5bf9a5fae59f
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testErrorPropagationOnExceptionInTransaction.bpmn20.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testFailingTransactionListener.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testFailingTransactionListener.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..71a3c32c6d67904ab6b2de9fe923348c60393f08
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testFailingTransactionListener.bpmn20.xml
@@ -0,0 +1,47 @@
+
+
+
+
+ SequenceFlow_1j3od4f
+
+
+
+ SequenceFlow_1j3od4f
+ SequenceFlow_0zpkb9t
+
+
+ SequenceFlow_0zpkb9t
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testRollbackTransactionOnActivitiException.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testRollbackTransactionOnActivitiException.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..35f0cff66df823bac52f35920c077e2f12817bdb
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testRollbackTransactionOnActivitiException.bpmn20.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testTransactionRollbackInServiceTask.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testTransactionRollbackInServiceTask.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b9b7fc80fa099e7766d221a305f7e3db756ff3d4
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testTransactionRollbackInServiceTask.bpmn20.xml
@@ -0,0 +1,47 @@
+
+
+
+
+ SequenceFlow_1j3od4f
+
+
+
+ SequenceFlow_1j3od4f
+ SequenceFlow_0zpkb9t
+
+
+ SequenceFlow_0zpkb9t
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testTransactionRollbackInServiceTaskWithCustomRetryCycle.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testTransactionRollbackInServiceTaskWithCustomRetryCycle.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..bd2f4ed7007ef603ac44731100b5332e73f8b4dd
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testTransactionRollbackInServiceTaskWithCustomRetryCycle.bpmn20.xml
@@ -0,0 +1,50 @@
+
+
+
+
+ SequenceFlow_1j3od4f
+
+
+
+
+ R5/PT0S
+
+ SequenceFlow_1j3od4f
+ SequenceFlow_0zpkb9t
+
+
+ SequenceFlow_0zpkb9t
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.throwExceptionProcess.bpmn20.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.throwExceptionProcess.bpmn20.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d34f15cb85326a001caae2a991b965f5f17150b3
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/core/src/test/resources/org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.throwExceptionProcess.bpmn20.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/pom.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/pom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..0ba338a6b6f79e74fe9c6ba507e7e65cba3ec322
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/engine-spring/pom.xml
@@ -0,0 +1,37 @@
+
+ 4.0.0
+
+
+ org.camunda.bpm
+ camunda-database-settings
+ ../database
+ 7.24.0-SNAPSHOT
+
+
+ camunda-spring-compatibility-root
+
+ pom
+
+
+ Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/
+
+ Camunda Platform - engine - Spring - Root
+
+
+ core
+
+
+
+
+ jdk17
+
+ [17,)
+
+
+ core-6
+
+
+
+
+
+
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/examples/invoice-jakarta/README.md b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/examples/invoice-jakarta/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..37309071daf8e00856a8f33f62041f581baf692b
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/examples/invoice-jakarta/README.md
@@ -0,0 +1,5 @@
+# The Invoice Jakarta Demo Application
+
+This is the invoice demo application which is shipped with the full distributions that use the Jakarta namespace.
+
+> This module copies and transforms the source code of the `camunda-example-invoice` module.
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/examples/invoice-jakarta/pom.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/examples/invoice-jakarta/pom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a7e4a4a129085f5195579b6737268f1d3254dc32
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/examples/invoice-jakarta/pom.xml
@@ -0,0 +1,226 @@
+
+ 4.0.0
+
+ camunda-example-invoice-jakarta
+ war
+
+
+ Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/
+
+ Camunda Platform - Example - Invoice Jakarta
+
+
+ org.camunda.bpm.example
+ camunda-example-root
+ ../
+ 7.24.0-SNAPSHOT
+
+
+
+
+
+ jakarta.platform
+ jakarta.jakartaee-bom
+ ${version.jakarta-ee-spec}
+ pom
+ import
+
+
+
+
+
+
+ jakarta.servlet
+ jakarta.servlet-api
+ provided
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ initialize
+
+ properties
+
+
+
+
+
+ maven-resources-plugin
+
+
+ copy-main-sources
+ generate-sources
+
+ copy-resources
+
+
+ ${project.build.directory}/generated-sources/jakarta
+
+
+ ${basedir}/../invoice/src/main/java
+ false
+
+ **/EmptyBodyFilter.java
+
+
+
+
+
+
+ copy-main-resources
+ generate-resources
+
+ copy-resources
+
+
+ ${project.build.directory}/generated-resources/jakarta
+
+
+ ${basedir}/../invoice/src/main/resources
+ false
+
+
+
+
+
+ copy-webapp-resources
+ generate-resources
+
+ copy-resources
+
+
+ ${project.build.directory}/generated-resources/jakarta-webapp
+
+
+ ${basedir}/../invoice/src/main/webapp
+ false
+
+
+
+
+
+ copy-test-sources
+ generate-test-sources
+
+ copy-resources
+
+
+ ${project.build.directory}/generated-test-sources/jakarta
+
+
+ ${basedir}/../invoice/src/test/java
+ false
+
+
+
+
+
+ copy-test-resources
+ generate-test-resources
+
+ copy-resources
+
+
+ ${project.build.directory}/generated-test-resources/jakarta
+
+
+ ${basedir}/../invoice/src/test/resources
+ true
+
+
+
+
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+
+
+ transform-jakarta-sources
+ generate-sources
+
+ transform
+
+
+ ${project.build.directory}/generated-sources/jakarta
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+
+
+ add-jakarta-source
+ generate-sources
+
+ add-source
+
+
+
+ ${project.build.directory}/generated-sources/jakarta
+
+
+
+
+ add-jakarta-resource
+ generate-resources
+
+ add-resource
+
+
+
+
+ ${project.build.directory}/generated-resources/jakarta
+
+
+
+
+
+ add-jakarta-test-source
+ generate-test-sources
+
+ add-test-source
+
+
+
+ ${project.build.directory}/generated-test-sources/jakarta
+
+
+
+
+ add-jakarta-test-resource
+ generate-test-resources
+
+ add-test-resource
+
+
+
+
+ ${project.build.directory}/generated-test-resources/jakarta
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
+ ${project.build.directory}/generated-resources/jakarta-webapp
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/examples/invoice/README.md b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/examples/invoice/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..633f8009ae7420d2bdbe89f4d5fdb5a9ae15ccb5
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/examples/invoice/README.md
@@ -0,0 +1,3 @@
+# The Invoice Demo Application
+
+This is the invoice demo application which is shipped with the full distributions.
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/examples/invoice/pom.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/examples/invoice/pom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8ae4633b95c86ae9ed406a48691db98d1e8fb424
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/examples/invoice/pom.xml
@@ -0,0 +1,37 @@
+
+ 4.0.0
+
+ camunda-example-invoice
+ war
+
+
+ Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/
+
+ Camunda Platform - Example - Invoice
+
+
+ org.camunda.bpm.example
+ camunda-example-root
+ ../
+ 7.24.0-SNAPSHOT
+
+
+
+
+ javax.servlet
+ javax.servlet-api
+ 3.0.1
+ provided
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
+
+
+
+
\ No newline at end of file
diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/examples/invoice/src/main/java/org/camunda/bpm/example/invoice/DemoDataGenerator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/examples/invoice/src/main/java/org/camunda/bpm/example/invoice/DemoDataGenerator.java
new file mode 100644
index 0000000000000000000000000000000000000000..31ff10ac9c328bd7046efd75629c3788d3fd1cf4
--- /dev/null
+++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/examples/invoice/src/main/java/org/camunda/bpm/example/invoice/DemoDataGenerator.java
@@ -0,0 +1,364 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.camunda.bpm.example.invoice;
+
+import static org.camunda.bpm.engine.authorization.Authorization.ANY;
+import static org.camunda.bpm.engine.authorization.Authorization.AUTH_TYPE_GRANT;
+import static org.camunda.bpm.engine.authorization.Permissions.ACCESS;
+import static org.camunda.bpm.engine.authorization.Permissions.ALL;
+import static org.camunda.bpm.engine.authorization.Permissions.READ;
+import static org.camunda.bpm.engine.authorization.Permissions.UPDATE;
+import static org.camunda.bpm.engine.authorization.Resources.APPLICATION;
+import static org.camunda.bpm.engine.authorization.Resources.FILTER;
+import static org.camunda.bpm.engine.authorization.Resources.TASK;
+import static org.camunda.bpm.engine.authorization.Resources.USER;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import org.camunda.bpm.engine.AuthorizationService;
+import org.camunda.bpm.engine.FilterService;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.TaskService;
+import org.camunda.bpm.engine.authorization.Authorization;
+import org.camunda.bpm.engine.authorization.Groups;
+import org.camunda.bpm.engine.authorization.Permissions;
+import org.camunda.bpm.engine.authorization.Resource;
+import org.camunda.bpm.engine.authorization.Resources;
+import org.camunda.bpm.engine.filter.Filter;
+import org.camunda.bpm.engine.identity.Group;
+import org.camunda.bpm.engine.identity.User;
+import org.camunda.bpm.engine.impl.IdentityServiceImpl;
+import org.camunda.bpm.engine.impl.persistence.entity.AuthorizationEntity;
+import org.camunda.bpm.engine.task.TaskQuery;
+
+/**
+ * Creates demo credentials to be used in the invoice showcase.
+ *
+ * @author drobisch
+ */
+public class DemoDataGenerator {
+
+ private final static Logger LOGGER = Logger.getLogger(DemoDataGenerator.class.getName());
+
+ public void createUsers(ProcessEngine engine) {
+
+ final IdentityServiceImpl identityService = (IdentityServiceImpl) engine.getIdentityService();
+
+ if(identityService.isReadOnly()) {
+ LOGGER.info("Identity service provider is Read Only, not creating any demo users.");
+ return;
+ }
+
+ User singleResult = identityService.createUserQuery().userId("demo").singleResult();
+ if (singleResult != null) {
+ return;
+ }
+
+ LOGGER.info("Generating demo data for invoice showcase");
+
+ User user = identityService.newUser("demo");
+ user.setFirstName("Demo");
+ user.setLastName("Demo");
+ user.setPassword("demo");
+ user.setEmail("demo@camunda.org");
+ identityService.saveUser(user, true);
+
+ User user2 = identityService.newUser("john");
+ user2.setFirstName("John");
+ user2.setLastName("Doe");
+ user2.setPassword("john");
+ user2.setEmail("john@camunda.org");
+ identityService.saveUser(user2, true);
+
+ User user3 = identityService.newUser("mary");
+ user3.setFirstName("Mary");
+ user3.setLastName("Anne");
+ user3.setPassword("mary");
+ user3.setEmail("mary@camunda.org");
+ identityService.saveUser(user3, true);
+
+ User user4 = identityService.newUser("peter");
+ user4.setFirstName("Peter");
+ user4.setLastName("Meter");
+ user4.setPassword("peter");
+ user4.setEmail("peter@camunda.org");
+ identityService.saveUser(user4, true);
+
+ Group salesGroup = identityService.newGroup("sales");
+ salesGroup.setName("Sales");
+ salesGroup.setType("WORKFLOW");
+ identityService.saveGroup(salesGroup);
+
+ Group accountingGroup = identityService.newGroup("accounting");
+ accountingGroup.setName("Accounting");
+ accountingGroup.setType("WORKFLOW");
+ identityService.saveGroup(accountingGroup);
+
+ Group managementGroup = identityService.newGroup("management");
+ managementGroup.setName("Management");
+ managementGroup.setType("WORKFLOW");
+ identityService.saveGroup(managementGroup);
+
+ final AuthorizationService authorizationService = engine.getAuthorizationService();
+
+ // create group
+ if(identityService.createGroupQuery().groupId(Groups.CAMUNDA_ADMIN).count() == 0) {
+ Group camundaAdminGroup = identityService.newGroup(Groups.CAMUNDA_ADMIN);
+ camundaAdminGroup.setName("camunda BPM Administrators");
+ camundaAdminGroup.setType(Groups.GROUP_TYPE_SYSTEM);
+ identityService.saveGroup(camundaAdminGroup);
+ }
+
+ // create ADMIN authorizations on all built-in resources
+ for (Resource resource : Resources.values()) {
+ if(authorizationService.createAuthorizationQuery().groupIdIn(Groups.CAMUNDA_ADMIN).resourceType(resource).resourceId(ANY).count() == 0) {
+ AuthorizationEntity userAdminAuth = new AuthorizationEntity(AUTH_TYPE_GRANT);
+ userAdminAuth.setGroupId(Groups.CAMUNDA_ADMIN);
+ userAdminAuth.setResource(resource);
+ userAdminAuth.setResourceId(ANY);
+ userAdminAuth.addPermission(ALL);
+ authorizationService.saveAuthorization(userAdminAuth);
+ }
+ }
+
+ identityService.createMembership("demo", "sales");
+ identityService.createMembership("demo", "accounting");
+ identityService.createMembership("demo", "management");
+ identityService.createMembership("demo", "camunda-admin");
+
+ identityService.createMembership("john", "sales");
+ identityService.createMembership("mary", "accounting");
+ identityService.createMembership("peter", "management");
+
+
+ // authorize groups for tasklist only:
+
+ Authorization salesTasklistAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
+ salesTasklistAuth.setGroupId("sales");
+ salesTasklistAuth.addPermission(ACCESS);
+ salesTasklistAuth.setResourceId("tasklist");
+ salesTasklistAuth.setResource(APPLICATION);
+ authorizationService.saveAuthorization(salesTasklistAuth);
+
+ Authorization salesReadProcessDefinition = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
+ salesReadProcessDefinition.setGroupId("sales");
+ salesReadProcessDefinition.addPermission(Permissions.READ);
+ salesReadProcessDefinition.addPermission(Permissions.READ_HISTORY);
+ salesReadProcessDefinition.setResource(Resources.PROCESS_DEFINITION);
+ // restrict to invoice process definition only
+ salesReadProcessDefinition.setResourceId("invoice");
+ authorizationService.saveAuthorization(salesReadProcessDefinition);
+
+ Authorization accountingTasklistAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
+ accountingTasklistAuth.setGroupId("accounting");
+ accountingTasklistAuth.addPermission(ACCESS);
+ accountingTasklistAuth.setResourceId("tasklist");
+ accountingTasklistAuth.setResource(APPLICATION);
+ authorizationService.saveAuthorization(accountingTasklistAuth);
+
+ Authorization accountingReadProcessDefinition = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
+ accountingReadProcessDefinition.setGroupId("accounting");
+ accountingReadProcessDefinition.addPermission(Permissions.READ);
+ accountingReadProcessDefinition.addPermission(Permissions.READ_HISTORY);
+ accountingReadProcessDefinition.setResource(Resources.PROCESS_DEFINITION);
+ // restrict to invoice process definition only
+ accountingReadProcessDefinition.setResourceId("invoice");
+ authorizationService.saveAuthorization(accountingReadProcessDefinition);
+
+ Authorization managementTasklistAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
+ managementTasklistAuth.setGroupId("management");
+ managementTasklistAuth.addPermission(ACCESS);
+ managementTasklistAuth.setResourceId("tasklist");
+ managementTasklistAuth.setResource(APPLICATION);
+ authorizationService.saveAuthorization(managementTasklistAuth);
+
+ Authorization managementReadProcessDefinition = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
+ managementReadProcessDefinition.setGroupId("management");
+ managementReadProcessDefinition.addPermission(Permissions.READ);
+ managementReadProcessDefinition.addPermission(Permissions.READ_HISTORY);
+ managementReadProcessDefinition.setResource(Resources.PROCESS_DEFINITION);
+ // restrict to invoice process definition only
+ managementReadProcessDefinition.setResourceId("invoice");
+ authorizationService.saveAuthorization(managementReadProcessDefinition);
+
+ Authorization salesDemoAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
+ salesDemoAuth.setGroupId("sales");
+ salesDemoAuth.setResource(USER);
+ salesDemoAuth.setResourceId("demo");
+ salesDemoAuth.addPermission(READ);
+ authorizationService.saveAuthorization(salesDemoAuth);
+
+ Authorization salesJohnAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
+ salesJohnAuth.setGroupId("sales");
+ salesJohnAuth.setResource(USER);
+ salesJohnAuth.setResourceId("john");
+ salesJohnAuth.addPermission(READ);
+ authorizationService.saveAuthorization(salesJohnAuth);
+
+ Authorization manDemoAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
+ manDemoAuth.setGroupId("management");
+ manDemoAuth.setResource(USER);
+ manDemoAuth.setResourceId("demo");
+ manDemoAuth.addPermission(READ);
+ authorizationService.saveAuthorization(manDemoAuth);
+
+ Authorization manPeterAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
+ manPeterAuth.setGroupId("management");
+ manPeterAuth.setResource(USER);
+ manPeterAuth.setResourceId("peter");
+ manPeterAuth.addPermission(READ);
+ authorizationService.saveAuthorization(manPeterAuth);
+
+ Authorization accDemoAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
+ accDemoAuth.setGroupId("accounting");
+ accDemoAuth.setResource(USER);
+ accDemoAuth.setResourceId("demo");
+ accDemoAuth.addPermission(READ);
+ authorizationService.saveAuthorization(accDemoAuth);
+
+ Authorization accMaryAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
+ accMaryAuth.setGroupId("accounting");
+ accMaryAuth.setResource(USER);
+ accMaryAuth.setResourceId("mary");
+ accMaryAuth.addPermission(READ);
+ authorizationService.saveAuthorization(accMaryAuth);
+
+ Authorization taskMaryAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
+ taskMaryAuth.setUserId("mary");
+ taskMaryAuth.setResource(TASK);
+ taskMaryAuth.setResourceId(ANY);
+ taskMaryAuth.addPermission(READ);
+ taskMaryAuth.addPermission(UPDATE);
+ authorizationService.saveAuthorization(taskMaryAuth);
+
+ // create default filters
+
+ FilterService filterService = engine.getFilterService();
+
+ Map filterProperties = new HashMap();
+ filterProperties.put("description", "Tasks assigned to me");
+ filterProperties.put("priority", -10);
+ addVariables(filterProperties);
+ TaskService taskService = engine.getTaskService();
+ TaskQuery query = taskService.createTaskQuery().taskAssigneeExpression("${currentUser()}");
+ Filter myTasksFilter = filterService.newTaskFilter().setName("My Tasks").setProperties(filterProperties).setOwner("demo").setQuery(query);
+ filterService.saveFilter(myTasksFilter);
+
+ filterProperties.clear();
+ filterProperties.put("description", "Tasks assigned to my Groups");
+ filterProperties.put("priority", -5);
+ addVariables(filterProperties);
+ query = taskService.createTaskQuery().taskCandidateGroupInExpression("${currentUserGroups()}").taskUnassigned();
+ Filter groupTasksFilter = filterService.newTaskFilter().setName("My Group Tasks").setProperties(filterProperties).setOwner("demo").setQuery(query);
+ filterService.saveFilter(groupTasksFilter);
+
+ // global read authorizations for these filters
+
+ Authorization globalMyTaskFilterRead = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GLOBAL);
+ globalMyTaskFilterRead.setResource(FILTER);
+ globalMyTaskFilterRead.setResourceId(myTasksFilter.getId());
+ globalMyTaskFilterRead.addPermission(READ);
+ authorizationService.saveAuthorization(globalMyTaskFilterRead);
+
+ Authorization globalGroupFilterRead = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GLOBAL);
+ globalGroupFilterRead.setResource(FILTER);
+ globalGroupFilterRead.setResourceId(groupTasksFilter.getId());
+ globalGroupFilterRead.addPermission(READ);
+ authorizationService.saveAuthorization(globalGroupFilterRead);
+
+ // management filter
+
+ filterProperties.clear();
+ filterProperties.put("description", "Tasks for Group Accounting");
+ filterProperties.put("priority", -3);
+ addVariables(filterProperties);
+ query = taskService.createTaskQuery().taskCandidateGroupIn(Arrays.asList("accounting")).taskUnassigned();
+ Filter candidateGroupTasksFilter = filterService.newTaskFilter().setName("Accounting").setProperties(filterProperties).setOwner("demo").setQuery(query);
+ filterService.saveFilter(candidateGroupTasksFilter);
+
+ Authorization managementGroupFilterRead = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT);
+ managementGroupFilterRead.setResource(FILTER);
+ managementGroupFilterRead.setResourceId(candidateGroupTasksFilter.getId());
+ managementGroupFilterRead.addPermission(READ);
+ managementGroupFilterRead.setGroupId("accounting");
+ authorizationService.saveAuthorization(managementGroupFilterRead);
+
+ // john's tasks
+
+ filterProperties.clear();
+ filterProperties.put("description", "Tasks assigned to John");
+ filterProperties.put("priority", -1);
+ addVariables(filterProperties);
+ query = taskService.createTaskQuery().taskAssignee("john");
+ Filter johnsTasksFilter = filterService.newTaskFilter().setName("John's Tasks").setProperties(filterProperties).setOwner("demo").setQuery(query);
+ filterService.saveFilter(johnsTasksFilter);
+
+ // mary's tasks
+
+ filterProperties.clear();
+ filterProperties.put("description", "Tasks assigned to Mary");
+ filterProperties.put("priority", -1);
+ addVariables(filterProperties);
+ query = taskService.createTaskQuery().taskAssignee("mary");
+ Filter marysTasksFilter = filterService.newTaskFilter().setName("Mary's Tasks").setProperties(filterProperties).setOwner("demo").setQuery(query);
+ filterService.saveFilter(marysTasksFilter);
+
+ // peter's tasks
+
+ filterProperties.clear();
+ filterProperties.put("description", "Tasks assigned to Peter");
+ filterProperties.put("priority", -1);
+ addVariables(filterProperties);
+ query = taskService.createTaskQuery().taskAssignee("peter");
+ Filter petersTasksFilter = filterService.newTaskFilter().setName("Peter's Tasks").setProperties(filterProperties).setOwner("demo").setQuery(query);
+ filterService.saveFilter(petersTasksFilter);
+
+ // all tasks
+
+ filterProperties.clear();
+ filterProperties.put("description", "All Tasks - Not recommended to be used in production :)");
+ filterProperties.put("priority", 10);
+ addVariables(filterProperties);
+ query = taskService.createTaskQuery();
+ Filter allTasksFilter = filterService.newTaskFilter().setName("All Tasks").setProperties(filterProperties).setOwner("demo").setQuery(query);
+ filterService.saveFilter(allTasksFilter);
+
+ }
+
+ protected void addVariables(Map filterProperties) {
+ List