Github user mathiastiberghien commented on the issue:
https://github.com/apache/nifi/pull/1107
Hello,
Thanks for the comments.
I have a question about unit test: I need to test the method
createProcessor of the FlowController so I guess I need to update the
TestFlowController file adding a method that add some dummy processors and
check the behavior.
How do I proceed to add my dummy processors class to the system, because
createProcessor method requires the type and the identifier (which is?)
Iâve trie to create a dummy class processor and use class.forname method
but it didnât work
Mathias TIBERGHIEN
CTO
Cell. : +33(0)6 27 58 13 68
87 Bd Chanzy
93100 Montreuil
France
Tel : +33(0)1 42 87 16 57
www.code192.com <http://www.code192.com>
From: Pierre Villard [mailto:[email protected]]
Sent: mercredi 5 octobre 2016 23:11
To: apache/nifi <[email protected]>
Cc: Mathias Tiberghien <[email protected]>; Author
<[email protected]>
Subject: Re: [apache/nifi] origin/NIFI-1526 (#1107)
@pvillard31 requested changes on this pull request.
Few preliminary stylish remarks.
I would also love to see some unit tests in nifi-framework-core with dummy
processors to confirm the good behavior of the annotations.
In any case, this will be a useful improvement, thanks for contributing!
_____
In
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java
<https://github.com/apache/nifi/pull/1107#pullrequestreview-3003375> :
> @@ -1059,6 +1060,42 @@ public ProcessorNode createProcessor(final String
type, String id, final boolean
final LogRepository logRepository =
LogRepositoryFactory.getRepository(id);
logRepository.addObserver(StandardProcessorNode.BULLETIN_OBSERVER_ID,
LogLevel.WARN, new ProcessorLogObserver(getBulletinRepository(), procNode));
+ try {
+
+ final Class<?> procClass = processor.getClass();
+ if(procClass.isAnnotationPresent(DefaultSettings.class))
+ {
There are checkstyle violations to fix:
[WARNING]
src/main/java/org/apache/nifi/annotation/configuration/DefaultSchedule.java[5]
(imports) AvoidStarImport: Using the '.*' form of import should be avoided -
java.lang.annotation.*.
[WARNING]
src/main/java/org/apache/nifi/annotation/configuration/DefaultSettings.java[5]
(imports) AvoidStarImport: Using the '.*' form of import should be avoided -
java.lang.annotation.*.
[WARNING]
src/main/java/org/apache/nifi/controller/FlowController.java[1067:13] (blocks)
LeftCurly: '{' should be on the previous line.
[WARNING]
src/main/java/org/apache/nifi/controller/FlowController.java[1071:17] (blocks)
RightCurly: '}' should be on the same line.
[WARNING]
src/main/java/org/apache/nifi/controller/FlowController.java[1073:17] (blocks)
LeftCurly: '{' should be on the previous line.
[WARNING]
src/main/java/org/apache/nifi/controller/FlowController.java[1079:17] (blocks)
RightCurly: '}' should be on the same line.
[WARNING]
src/main/java/org/apache/nifi/controller/FlowController.java[1081:17] (blocks)
LeftCurly: '{' should be on the previous line.
[WARNING]
src/main/java/org/apache/nifi/controller/FlowController.java[1086:17] (blocks)
RightCurly: '}' should be on the same line.
[WARNING]
src/main/java/org/apache/nifi/controller/FlowController.java[1088:17] (blocks)
LeftCurly: '{' should be on the previous line.
[WARNING]
src/main/java/org/apache/nifi/controller/FlowController.java[1093:9] (blocks)
RightCurly: '}' should be on the same line.
[WARNING]
src/main/java/org/apache/nifi/controller/FlowController.java[1095:9] (blocks)
LeftCurly: '{' should be on the previous line.
[WARNING]
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[191:9]
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING]
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[194:13]
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING]
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[197:17]
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING]
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[199:17]
(blocks) RightCurly: '}' should be on the same line.
[WARNING]
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[201:17]
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING]
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[205:17]
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING]
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[207:17]
(blocks) RightCurly: '}' should be on the same line.
[WARNING]
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[209:17]
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING]
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[214:17]
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING]
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[216:21]
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING]
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[218:21]
(blocks) RightCurly: '}' should be on the same line.
[WARNING]
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[220:21]
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING]
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[226:9]
(blocks) RightCurly: '}' should be on the same line.
[WARNING]
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[228:9]
(blocks) LeftCurly: '{' should be on the previous line.
You can check it by yourself by running:
mvn clean install -Pcontrib-check
_____
In
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
<https://github.com/apache/nifi/pull/1107#pullrequestreview-3003375> :
> @@ -187,6 +187,50 @@ public StandardProcessorNode(final Processor
processor, final String uuid,
}
schedulingStrategy = SchedulingStrategy.TIMER_DRIVEN;
+ try
+ {
+
+ if(procClass.isAnnotationPresent(DefaultSchedule.class))
+ {
+ DefaultSchedule dsc =
procClass.getAnnotation(DefaultSchedule.class);
+ try
+ {
+ this.setSchedulingStrategy(dsc.Strategy());
+ }
+ catch (Throwable ex)
+ {
+ LOG.error(String.format("Error while setting
scheduling strategy from DefaultSchedule annotation: %s",ex.getMessage()));
When logging exceptions, you could add the exception as second argument of
the logging method, this will display the full stacktrace in the logs and that
can be quite useful.
LOG.error(String.format("Error while setting scheduling strategy from
DefaultSchedule annotation: %s",ex.getMessage()), ex);
â
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/apache/nifi/pull/1107#pullrequestreview-3003375> , or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AVbS_HsFJ9oa1YH_pr8ZD5dixmaLYNNdks5qxBJqgaJpZM4KO_Hp>
.
<https://github.com/notifications/beacon/AVbS_Pasi6KuBQPElhP34edZnUJ83rqZks5qxBJqgaJpZM4KO_Hp.gif>
---
L'absence de virus dans ce courrier électronique a été vérifiée par le
logiciel antivirus Avast.
https://www.avast.com/antivirus
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---