Thanks a lot bryan , for helping me to identify proper UNIT testing.
I will go with ur suggestion, will write unit testing for custom
controlerservice and separate for custom processor service.
If possible Can u give me a example of mock the
AWSCredentialsProviderService interface.

Regards,
sanjeet

On Thu, Oct 17, 2019 at 9:41 PM Bryan Bende <[email protected]> wrote:

> Please only email one list, removing users...
>
> The AWS processors depend on an interface called
> AWSCredentialsProviderService.  The unit test of the processor should
> not need to depend on real implementations of this interface,
> otherwise it is really an integration test of multiple components.
>
> I would suggest testing your processor and service separately... the
> processor test can mock the AWSCredentialsProviderService interface.
>
>
> On Thu, Oct 17, 2019 at 11:50 AM sanjeet rath <[email protected]>
> wrote:
> >
> > Hi Team,
> >
> > I am new to this community, today i have joined and this is my first
> query.(already from last 15 days i got stuck here)
> >
> > I have build a nifi custom processor.to put a object in AWS s3
> bucket.(Just Modified Puts3Object processor in NIFI- AWS-PROCESSOR project)
> > In this processor  Awscredentialprovidercontrolerservice is the default
> one to connect AWS.
> >
> > But our project structure we have a custom controller service
> ,Awscredentialprovidercontrolerservice controller service  to connect AWS
> with our defined attributes.(This is present in a separate project
> NIFI-AWS-CUSTOM_PING_CONTROLER)
> > I want to use this custom controller service , instead of the default
> Awscredentialprovidercontrolerservice one which is present in the NIFI-
> AWS-PROCESSOR project
> >
> > My question is I want to do the unit testing (Using JUnit & Mockito)  to
> validate this custom Awscredentialprovidercontrolerservice is working or
> not like if I get invalid bucket name then test case should failed.
> >
> > My code structure:
> > @Test
> >     public void testRetryLogin() {
> >         final TestRunner runner = TestRunners.newTestRunner(new
> puts3Object);
> > final Awscredentialprovidercontrolerservice  serviceimpl= new
> Awscredentialprovidercontrolerservice()
> > Runner.setproperty(…)
> > Runner.enablecontrolerservice(serviceimpl)
> > runner.run();
> >        // will do assert  }
> >
> > This gives me compiler error in error in
> Awscredentialprovidercontrolerservice instance creation line as custom
> controller service project is not available to this processor service
> project. If we add dependency in pom file to make it available then it will
> be circular dependency.
> > Because  already in custom controlerservice pom file , custom processor
> is already added in dependency..
> >
> > Thanks in advance :)
> >
> > --
> > Sanjeet Kumar Rath,
> > mob- +91 8777577470
> >
>


-- 
Sanjeet Kumar Rath,
mob- +91 8777577470

Reply via email to