-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If else branching #449
base: development
Are you sure you want to change the base?
If else branching #449
Conversation
choreographer/src/main/java/eu/arrowhead/core/choreographer/service/ChoreographerService.java
Outdated
Show resolved
Hide resolved
choreographer/src/main/java/eu/arrowhead/core/choreographer/service/ChoreographerService.java
Outdated
Show resolved
Hide resolved
choreographer/src/main/java/eu/arrowhead/core/choreographer/service/StepResponseEvaluation.java
Show resolved
Hide resolved
class StepResponseEvaluation { | ||
|
||
private String getJsonValue(String path, String message) { | ||
ObjectMapper objectMapper = new ObjectMapper(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should @Autowire
the object mapper and not instatatiate it every time when the method is called.
choreographer/src/main/java/eu/arrowhead/core/choreographer/service/StepResponseEvaluation.java
Show resolved
Hide resolved
choreographer/src/main/java/eu/arrowhead/core/choreographer/service/StepResponseEvaluation.java
Outdated
Show resolved
Hide resolved
choreographer/src/main/java/eu/arrowhead/core/choreographer/service/StepResponseEvaluation.java
Outdated
Show resolved
Hide resolved
choreographer/src/main/java/eu/arrowhead/core/choreographer/service/StepResponseEvaluation.java
Outdated
Show resolved
Hide resolved
choreographer/src/main/java/eu/arrowhead/core/choreographer/service/StepResponseEvaluation.java
Outdated
Show resolved
Hide resolved
choreographer/src/main/java/eu/arrowhead/core/choreographer/service/StepResponseEvaluation.java
Outdated
Show resolved
Hide resolved
choreographer/src/main/java/eu/arrowhead/core/choreographer/service/StepResponseEvaluation.java
Outdated
Show resolved
Hide resolved
choreographer/src/main/java/eu/arrowhead/core/choreographer/service/StepResponseEvaluation.java
Outdated
Show resolved
Hide resolved
choreographer/src/main/java/eu/arrowhead/core/choreographer/service/StepResponseEvaluation.java
Outdated
Show resolved
Hide resolved
choreographer/src/main/java/eu/arrowhead/core/choreographer/service/StepResponseEvaluation.java
Outdated
Show resolved
Hide resolved
choreographer/src/main/java/eu/arrowhead/core/choreographer/service/StepResponseEvaluation.java
Outdated
Show resolved
Hide resolved
core-common/src/main/java/eu/arrowhead/common/database/entity/ChoreographerStep.java
Outdated
Show resolved
Hide resolved
core-common/src/main/java/eu/arrowhead/common/database/entity/ChoreographerStep.java
Outdated
Show resolved
Hide resolved
core-common/src/main/java/eu/arrowhead/common/database/entity/ChoreographerStep.java
Outdated
Show resolved
Hide resolved
core-common/src/main/java/eu/arrowhead/common/database/entity/ChoreographerStep.java
Outdated
Show resolved
Hide resolved
core-common/src/main/java/eu/arrowhead/common/dto/shared/ChoreographerStepRequestDTO.java
Show resolved
Hide resolved
core-common/src/main/java/eu/arrowhead/common/database/entity/ChoreographerStep.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See inline comments.
Also, unit tests will need to be updated/written later to cover this new feature and you need to become an Eclipse Contributor (wiki) for the offical release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still some suggestion, but looks good overall.
|
||
//------------------------------------------------------------------------------------------------- | ||
private ExecutorSelector executorSelector; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add here:
@Autowired
private StepResponseEvaluation evaluator;
|
||
boolean executable = true; | ||
|
||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete these stuffs:
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.scan("eu.arrowhead.core.choreographer.servic");
StepResponseEvaluation evaluator = new StepResponseEvaluation(); //context.getBean(StepResponseEvaluation.class);
// new StepResponseEvaluation();
'''
class StepResponseEvaluation { | ||
|
||
private final Logger logger = LogManager.getLogger(StepResponseEvaluation.class); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add:
@Autowired
private ObjectMapper mapper;
public Boolean stepOutputValue(String message, String path, String threshold) { | ||
// if sth used is null throw exception | ||
if (path == null || message == null || threshold == null) { | ||
throw new NullPointerException("The arguments cannot be null"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not throw programatically throw NullPointerException. It should be thrown only in runtime when it is not intentional.
No description provided.