[
https://issues.apache.org/jira/browse/NIFI-1526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15554829#comment-15554829
]
ASF GitHub Bot commented on NIFI-1526:
--------------------------------------
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
> Allow components to provide default values for Yield Duration and Run Schedule
> ------------------------------------------------------------------------------
>
> Key: NIFI-1526
> URL: https://issues.apache.org/jira/browse/NIFI-1526
> Project: Apache NiFi
> Issue Type: Improvement
> Reporter: Bryan Bende
> Priority: Minor
>
> It would be nice for developers of processors (and maybe reporting tasks and
> controller services) to be able to specify a default value for Yield duration
> and Run Schedule.
> Currently Yield defaults to 1 second and Run Schedule defaults to 0 seconds.
> There may be cases where these are not the best default values and the
> developer wants to start off with better defaults, still allowing the user to
> tune as needed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)