Skip to content
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

Open
wants to merge 5 commits into
base: development
Choose a base branch
from

Conversation

vargaeszter
Copy link

No description provided.

class StepResponseEvaluation {

private String getJsonValue(String path, String message) {
ObjectMapper objectMapper = new ObjectMapper();
Copy link
Member

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.

Copy link
Member

@borditamas borditamas left a 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.

@borditamas borditamas changed the base branch from master to development December 8, 2023 07:15
Copy link
Member

@borditamas borditamas left a 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;

Copy link
Member

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();
Copy link
Member

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);

Copy link
Member

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");
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants