<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unit test does not load test data in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/unit-test-does-not-load-test-data/m-p/156337#M110593</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;1) That what you want, right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) org.activiti.spring.ProcessEngineFactoryBean is just a factory-bean. If you know your way around spring, it will create an instance of a bean, when the "getInstance" is called. So it's a factory for other types of beens, and in this case, it creates ProcessEngine(Impl) beans. This is exactly what it's designed to do.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Spring will only call the init-method if the spring-context is started and the bean is created. The way the "default" activiti-configuration works is that it does NOT boot an application-context. Rather, it just uses the bean-definitions in the activiti.cfg.xml file to extract the processEngine itself. If you want to use activiti in a spring-context, you should boot up the engine USING the application-context and depend on that bean instance, instead of depending on the ProcessEngines.getDefault().&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Fortunatly, we have base spring-tests for that as well, so you can point to a valid spring-context file (which you already have). An example of this can be found in the org.activiti.spring.test.components.ProcessStartingBeanPostProcessorTest class:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;/**&lt;BR /&gt; * @author Josh Long&lt;BR /&gt; */&lt;BR /&gt;@RunWith(SpringJUnit4ClassRunner.class)&lt;BR /&gt;@ContextConfiguration("classpath:smileysurprised:rg/activiti/spring/test/components/ProcessStartingBeanPostProcessorTest-context.xml")&lt;BR /&gt;public class ProcessStartingBeanPostProcessorTest {&lt;BR /&gt;&lt;BR /&gt; private Logger log = LoggerFactory.getLogger(getClass());&lt;BR /&gt;&lt;BR /&gt; @Autowired &lt;BR /&gt; private ProcessEngine processEngine;&lt;BR /&gt; &lt;BR /&gt; @Autowired &lt;BR /&gt; private ProcessInitiatingPojo processInitiatingPojo;&lt;BR /&gt; &lt;BR /&gt; @Autowired&lt;BR /&gt; private RepositoryService repositoryService;&lt;BR /&gt; &lt;BR /&gt; @Before&lt;BR /&gt; public void before() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; repositoryService.createDeployment()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .addClasspathResource("org/activiti/spring/test/autodeployment/autodeploy.b.bpmn20.xml")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .addClasspathResource("org/activiti/spring/test/components/waiter.bpmn20.xml")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .deploy();&lt;BR /&gt; }&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;You can just used the injected process-engine, instead of depending on the base-class to do the initialisation.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Dec 2013 07:40:53 GMT</pubDate>
    <dc:creator>frederikherema1</dc:creator>
    <dc:date>2013-12-16T07:40:53Z</dc:date>
    <item>
      <title>Unit test does not load test data</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/unit-test-does-not-load-test-data/m-p/156336#M110592</link>
      <description>Hey all,I want to write a simple unit test in a standard maven directory structure. An activiti.cfg.xml file is located in src/main/resources with all relevant configuration (database, ldap, mail, etc). For the unit test, I want to replace several configuration, e.g. H2 in-memory as database.I also</description>
      <pubDate>Sat, 14 Dec 2013 23:18:56 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/unit-test-does-not-load-test-data/m-p/156336#M110592</guid>
      <dc:creator>kaihuener</dc:creator>
      <dc:date>2013-12-14T23:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: Unit test does not load test data</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/unit-test-does-not-load-test-data/m-p/156337#M110593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;1) That what you want, right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) org.activiti.spring.ProcessEngineFactoryBean is just a factory-bean. If you know your way around spring, it will create an instance of a bean, when the "getInstance" is called. So it's a factory for other types of beens, and in this case, it creates ProcessEngine(Impl) beans. This is exactly what it's designed to do.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Spring will only call the init-method if the spring-context is started and the bean is created. The way the "default" activiti-configuration works is that it does NOT boot an application-context. Rather, it just uses the bean-definitions in the activiti.cfg.xml file to extract the processEngine itself. If you want to use activiti in a spring-context, you should boot up the engine USING the application-context and depend on that bean instance, instead of depending on the ProcessEngines.getDefault().&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Fortunatly, we have base spring-tests for that as well, so you can point to a valid spring-context file (which you already have). An example of this can be found in the org.activiti.spring.test.components.ProcessStartingBeanPostProcessorTest class:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;/**&lt;BR /&gt; * @author Josh Long&lt;BR /&gt; */&lt;BR /&gt;@RunWith(SpringJUnit4ClassRunner.class)&lt;BR /&gt;@ContextConfiguration("classpath:smileysurprised:rg/activiti/spring/test/components/ProcessStartingBeanPostProcessorTest-context.xml")&lt;BR /&gt;public class ProcessStartingBeanPostProcessorTest {&lt;BR /&gt;&lt;BR /&gt; private Logger log = LoggerFactory.getLogger(getClass());&lt;BR /&gt;&lt;BR /&gt; @Autowired &lt;BR /&gt; private ProcessEngine processEngine;&lt;BR /&gt; &lt;BR /&gt; @Autowired &lt;BR /&gt; private ProcessInitiatingPojo processInitiatingPojo;&lt;BR /&gt; &lt;BR /&gt; @Autowired&lt;BR /&gt; private RepositoryService repositoryService;&lt;BR /&gt; &lt;BR /&gt; @Before&lt;BR /&gt; public void before() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; repositoryService.createDeployment()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .addClasspathResource("org/activiti/spring/test/autodeployment/autodeploy.b.bpmn20.xml")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .addClasspathResource("org/activiti/spring/test/components/waiter.bpmn20.xml")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .deploy();&lt;BR /&gt; }&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;You can just used the injected process-engine, instead of depending on the base-class to do the initialisation.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Dec 2013 07:40:53 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/unit-test-does-not-load-test-data/m-p/156337#M110593</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2013-12-16T07:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Unit test does not load test data</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/unit-test-does-not-load-test-data/m-p/156338#M110594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Frederik – again you, thank you so much! Will have to send you some christmas presents for all this great support, right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For those who have a similar question: I change the test as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;import static org.junit.Assert.assertTrue;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import org.activiti.engine.ProcessEngine;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import org.activiti.engine.test.ActivitiRule;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import org.junit.Rule;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import org.junit.Test;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import org.junit.runner.RunWith;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import org.springframework.beans.factory.annotation.Autowired;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import org.springframework.test.context.ContextConfiguration;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import cdq.cdl.bpr.shared.Constants;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@RunWith(SpringJUnit4ClassRunner.class)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;@ContextConfiguration("classpath:activiti.cfg.xml")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;public class TestBasic {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; @Rule&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; public ActivitiRule activitiRule = new ActivitiRule();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; @Autowired &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; private ProcessEngine processEngine;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; @Test&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; public void testLogin() {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; boolean check = activitiRule.getIdentityService().checkPassword("foo"; "bar");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; assertTrue(check);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I also had to explicitly add spring-context dependency with "3.2.5" version to the project's POM file because (in my case), only an older version was resolved by maven. But this may be due to my specific settings – here just as a hint.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So far – thank you and best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Kai&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Dec 2013 16:15:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/unit-test-does-not-load-test-data/m-p/156338#M110594</guid>
      <dc:creator>kaihuener</dc:creator>
      <dc:date>2013-12-19T16:15:23Z</dc:date>
    </item>
  </channel>
</rss>

