I just wanted to test the processors with local SNMP set-up and I noticed that modification of properties in my processor didn't have any effect. So I switched to debug, added a processor, started it, and stopped it just after. Conclusion: my close() method is never called. I correctly go through quietlyInvokeMethodsWithAnnotations() in ReflectionUtils but since the method is not seen as annotated, the close method is not called.
Thanks, Pierre 2016-02-28 22:24 GMT+01:00 Oleg Zhurakousky <ozhurakou...@hortonworks.com>: > I am puzzled as I can’t see how can it not work. > Are there steps to reproduce it? I am trying to read into your initial > email and suspecting you were doing some sort of testing, so want to make > sure I am doing the same thing. . . . > > Oleg > > On Feb 28, 2016, at 2:46 PM, Pierre Villard <pierre.villard...@gmail.com> > wrote: > > > > No I am not under testing framework, all my unit tests are OK. I wanted > to > > perform some additional tests and deployed Nifi with the new processors. > > > > You can find the method here [1] if you want to have a look. > > Thanks for your help. > > > > [1] > > > https://github.com/pvillard31/nifi/blob/NIFI-1537/nifi-nar-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/processors/AbstractSNMPProcessor.java#L212-L243 > > > > 2016-02-28 17:11 GMT+01:00 Oleg Zhurakousky < > ozhurakou...@hortonworks.com>: > > > >> Also, reading Aldrin’s response and assuming you are using Test mocks I > >> would probably recommend to not use them for tests that require full > >> lifecycle test of the component until we actually improve it. > >> Instead you can code straight agains FlowController essentially > executing > >> as a full blown NiFi minus UI. Here is an example: > >> > https://github.com/apache/nifi/pull/210/files#diff-7be646c38c5447f7824e444343633829R92 > >> > >> Cheers > >> Oleg > >> > >> On Feb 28, 2016, at 11:07 AM, Oleg Zhurakousky < > >> ozhurakou...@hortonworks.com<mailto:ozhurakou...@hortonworks.com>> > wrote: > >> > >> Pierre > >> Can you paste the method definition? Just want to look at the signature > >> and see if there is something obvious > >> > >> Sent from my iPhone > >> > >> On Feb 28, 2016, at 10:26, Pierre Villard <pierre.villard...@gmail.com > >> <mailto:pierre.villard...@gmail.com>> wrote: > >> > >> Hi, > >> > >> I am working on SNMP processors [1] and I'm almost ready for a PR... > but I > >> have an issue I can't explain. In my processors, I have implemented a > >> method close() with the @OnStopped annotation but it seems the > annotation > >> is not seen. When debugging and stopping my processor, I correctly go > >> through quietlyInvokeMethodsWithAnnotations() in ReflectionUtils and my > >> method close() appears without any annotation. I guess I am missing > >> something simple. Any idea? > >> > >> [1] https://issues.apache.org/jira/browse/NIFI-1537 > >> > >> > >> > >