cancel
Showing results for 
Search instead for 
Did you mean: 

Testing junit springway tests. Failure.

nikz2
Champ in-the-making
Champ in-the-making
At this point it works, and everything is fine, but…

If i do just like in the tutorial example with @Deployment annotation it produce this output:

<c>
INFO: Refreshing org.springframework.context.support.GenericApplicationContext@4ae69619: startup date [Thu Jun 11 10:07:04 AST 2015]; root of context hierarchy
июн 11, 2015 10:07:07 AM org.activiti.engine.impl.ProcessEngineImpl <init>
INFO: ProcessEngine default created
июн 11, 2015 10:07:07 AM org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource D:\Java\workspace\HelloWorld\target\classes\diagrams\autodeploy.HelloProcess.HelloProcessId.png
июн 11, 2015 10:07:07 AM org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource D:\Java\workspace\HelloWorld\target\classes\diagrams\autodeploy.HelloProcess.bpmn
Hello world
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.714 sec <<< FAILURE!

Results :

Tests in error:
  simpleProcessTest(HelloTest)

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO] ————————————————————————
[INFO] BUILD FAILURE
[INFO] ————————————————————————
</c>

And when i comment @deployment annotation everything runs fine.

My code:


import static org.junit.Assert.*;

import org.junit.runner.RunWith;
import org.junit.Test;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.test.ActivitiRule;
import org.activiti.engine.test.Deployment;
import org.junit.Rule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.ContextConfiguration;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:activiti-context.xml")
public class HelloTest {

  @Autowired
  private RuntimeService runtimeService;

  @Autowired
  @Rule
  public ActivitiRule activitiRule; 
 
  @Test
  @Deployment
  public void simpleProcessTest() {
    runtimeService.startProcessInstanceByKey("HelloProcessId");
    assertEquals(0,0);
  }
}


12 REPLIES 12

nikz2
Champ in-the-making
Champ in-the-making
So what could be the cause?

pom, context.xml in attach

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

I would guess that process is deployed twice.
delete

    <property name="deploymentResources"
    value="classpath*:diagrams/autodeploy.*.bpmn" />

from activiti context and uncomment deploy annotation.

Regards
Martin

nikz2
Champ in-the-making
Champ in-the-making
Hi. Thanks for your reply. At least it gave me a clue.

Still the same.
Maven still tells me:
<c>
июн 15, 2015 9:12:35 AM org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource D:\Java\workspace\HelloWorld\target\classes\diagrams\autodeploy.HelloProcess.HelloProcessId.png
июн 15, 2015 9:12:35 AM org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource D:\Java\workspace\HelloWorld\target\classes\diagrams\autodeploy.HelloProcess.bpmn
</c>
Even after i deleted that string, and made clean and then install. Even after i renamed autodeploy.HelloProcess.bpmn to autodeplo.HelloProcess.bpmn the output was the same. I used total commander to search "autodeploy." references in my project but found it only in context.xml and it's that string.

martin_grofcik
Confirmed Champ
Confirmed Champ

nikz2
Champ in-the-making
Champ in-the-making
Checked unit test project and used resource argument for deployment annotation, just like their.
@Deployment(resources = {"diagrams/autodeploy.HelloProcess.bpmn"})
Now it works.
Now i don't understand how it works without that argument, and why i found nothing about this in tutorial.
Anyway, thanks for your help. It was useful.

jbarrez
Star Contributor
Star Contributor
That sounds very odd, it should be the same behaviour with or without resources

Do you have a reproducible unit test I can try out?

nikz2
Champ in-the-making
Champ in-the-making
It's generating "Failure" again, when i run tests through maven.
When i execute test by eclipse everything is fine.
I am new to java, so i am learning all this stuff.
Anyway, here is my "project".

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

your test uses oracleDB.

[ERROR] Failed to execute goal on project hello-world-test: Could not resolve dependencies for project org.fbconsult:hello-world-test:jar:1.0: Could not find artifact com.oracleSmiley Surprisedjdbc6:jar:11.2.0 at specified path D:\Java\ojdbc6.jar

Could you create H2 jUnit test please?

Regards
Martin

nikz2
Champ in-the-making
Champ in-the-making
Sure.