As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
@Test @ContextConfiguration public class DemoProcessTest extends AbstractTestNGSpringContextTests { @Autowired private RepositoryService repositoryService; @Deployment(resources = {"workflow/demo.bpmn20.xml"}) public void simpleTest() { ProcessDefinition financialReport = repositoryService.createProcessDefinitionQuery() .processDefinitionKey("financialReport").latestVersion().singleResult(); Assert.assertNotNull(financialReport); } }
<br> * <p>You can declare a deployment with the {@link Deployment} annotation.<br> * This base class will make sure that this deployment gets deployed before the<br> * setUp and {@link RepositoryService#deleteDeployment(String, boolean) cascade deleted}<br> * after the tearDown.<br> * </p><br>
<br><br>deploymentId = TestHelper.annotationDeploymentSetUp(processEngine, method.getMethod().getDeclaringClass(), method.getName());<br><br>// … and later…<br><br>TestHelper.annotationDeploymentTearDown(processEngine, deploymentId, method.getMethod().getDeclaringClass(), method.getName());<br>
<br>@Test<br>@ContextConfiguration<br>public class DemoProcessTest extends AbstractTestNGSpringContextTests {<br><br> @Autowired<br> private ProcessEngine processEngine;<br><br> @Autowired<br> private RepositoryService repositoryService;<br><br> private ThreadLocal<String> deploymentId = new ThreadLocal<String>();<br><br> @BeforeMethod<br> public void setup(java.lang.reflect.Method method) {<br> String id = TestHelper.annotationDeploymentSetUp(processEngine, method.getDeclaringClass(), method.getName());<br> this.deploymentId.set(id);<br> }<br><br> @AfterMethod<br> public void tearDown(java.lang.reflect.Method method) {<br> TestHelper.annotationDeploymentTearDown(processEngine, this.deploymentId.get(), method<br> .getDeclaringClass(), method.getName());<br> this.deploymentId.remove();<br> }<br><br> @Deployment(resources = {"workflow/demo.bpmn20.xml"})<br> public void simpleTest() {<br> ProcessDefinition financialReport = repositoryService.createProcessDefinitionQuery()<br> .processDefinitionKey("financialReport").latestVersion().singleResult();<br> Assert.assertNotNull(financialReport);<br> }<br>}<br>