I am trying to test a delegate class and I am getting an error describe in the header.
I am trying to create a war. file with maven install. I am using the camunda archetype to implement the delegate class.
Snippet:
package com.camunda.supportGroup17.ServiceTasks;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Logger;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.camunda.bpm.engine.variable.Variables;
import org.camunda.bpm.engine.variable.value.ObjectValue;
public class SetPriorityDelegate implements JavaDelegate {
private final static Logger LOGGER = Logger.getLogger(SetPriorityDelegate.class.getName());
@Override
public void execute(DelegateExecution execution) throws Exception {
String anfrage = (String) execution.getVariable("anfrage");
String email = (String) execution.getVariable("email");
String name = (String) execution.getVariable("name");
Long userid = (Long) execution.getVariable("userid");
int anfrageLength = 0;
int longRequest = 20;
int mediumsRequest = 10;
if (anfrage == null) {
anfrage = "init";
LOGGER.info("length of anfrage: " + anfrage);
anfrageLength = anfrage.length();
} else {
LOGGER.info("length of anfrage: " + anfrage);
}
List<Integer> priorityScore = new ArrayList<>(Arrays.asList(1, 2, 3));
// 1 = high priority
// 2 = medium priority
// 3 = low priority
ObjectValue priorityScoreObject = Variables.objectValue(execution).create();
if (anfrageLength >= longRequest) {
priorityScoreObject = Variables.objectValue(priorityScore.get(0)).create();
LOGGER.info("log has been created of process with regarded inquery: " + anfrage + " "
+ "with user info: " + email + "-" + name + "with high priority: "+ priorityScoreObject.getValue());
execution.setVariable("priority", priorityScoreObject.getValue());
} else if (anfrageLength < longRequest && anfrageLength >= mediumsRequest) {
priorityScoreObject = Variables.objectValue(priorityScore.get(1)).create();
LOGGER.info("log has been created of process with regarded inquery: " + anfrage + " "
+ "with user info: " + email + "-" + name + "with medium priority: "+ priorityScoreObject.getValue());
execution.setVariable("priority", priorityScoreObject.getValue());
} else if (anfrageLength < mediumsRequest) {
priorityScoreObject = Variables.objectValue(priorityScore.get(2)).create();
LOGGER.info("log has been created of process with regarded inquery: " + anfrage + " "
+ "with user info: " + email + "-" + name + "with low priority: "+ priorityScoreObject.getValue());
execution.setVariable("priority", priorityScoreObject.getValue());
}
}
}
Model:
process.bpmn (2.7 KB)
Error msg:
Tests in error:
testHappyPath(com.camunda.supportGroup17.ServiceTasks.ProcessUnitTest): ENGINE-09008 Exception while instantiating class ‘/ServiceTasks/src/main/java/com/camunda/supportGroup17/ServiceTasks/SetPriorityDelegate.java’: ENGINE-09017 Cannot load class ‘/ServiceTasks/src/main/java/com/camunda/supportGroup17/ServiceTasks/SetPriorityDelegate.java’: /ServiceTasks/src/main/java/com/camunda/supportGroup17/ServiceTasks/SetPriorityDelegate.java
What am I missing here?