cancel
Showing results for 
Search instead for 
Did you mean: 

@Deployment(resources = {'

campa
Champ in-the-making
Champ in-the-making
Hi guys,

I have


@Test
  @Deployment(resources = {"/diagrams/ControlloCrediti.GestioneSolleciti.CicloSollecito.bpmn20.xml"})
  public void simpleProcessTest() {

I obtain:

org.activiti.engine.ActivitiException: resource '/diagrams/ControlloCrediti.GestioneSolleciti.CicloSollecito.bpmn20.xml' not found
   at org.activiti.engine.impl.repository.DeploymentBuilderImpl.addClasspathResource(DeploymentBuilderImpl.java:58)

If I check in the classapth with:
getClass().getResource("/diagrams/ControlloCrediti.GestioneSolleciti.CicloSollecito.bpmn20.xml")
Ii find the resource , successfully .

What I need to do, How I'm in error ? Do you see.
Any Help ?

Thx in advance for the help and for the "activiti system" !!

Bye
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
Do you check the classpath in your test? Make sure the tests run with the diagrams folder on your classpath…

Do you run the tests in eclipse or maven?

campa
Champ in-the-making
Champ in-the-making
Do you check the classpath in your test? Make sure the tests run with the diagrams folder on your classpath…

Yes I checked, as I have written doing:

getClass().getResource("/diagrams/ControlloCrediti.GestioneSolleciti.CicloSollecito.bpmn20.xml")
in the same method works! It find the resource.

Do you run the tests in eclipse or maven?

Same result also in maven and Eclipse.

Any Ideas ?

campa
Champ in-the-making
Champ in-the-making
I found a working workaround, and I share it with you:

        @Before
public void init() throws IOException {
  URL pDef = getClass()
    .getResource(
      "/diagrams/xx.xx.bpmn20.xml");
  DeploymentBuilder db = repositoryService.createDeployment();
  InputStream in = pDef.openStream();
  try {
   db.addInputStream("xx.xx.bpmn20.xml",in);
  } finally {
   IOUtils.closeQuietly(in);
  }
  deploymentId = db.deploy().getId();
}
Using the follow code in place do not work:
@Before
public void init() throws IOException {
  DeploymentBuilder db = repositoryService.createDeployment();
  db.addClasspathResource("/diagrams/xx.xx.bpmn20.xml");
  deploymentId = db.deploy().getId();
}

It seems a problem in DeploymentBuilder.addClasspathResource  method , that is also used by @Deployment annotation processing.