[ 
https://issues.apache.org/jira/browse/NIFI-1516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15167537#comment-15167537
 ] 

James Wing commented on NIFI-1516:
----------------------------------

[~mans2singh], I also have some suggestions about the test situation for 
DynamoDB processors.  I published a [commit illustrating my 
suggestions|https://github.com/jvwing/nifi/commit/e0568acee307e98220d3a97f0e5caf9c5a56f8db]
 to show the concepts, I'm not sure this is exactly the right code.

# Many of the existing tests look like they could be unit tests, especially 
tests for hash/range key validation where I don't believe any communication 
with AWS is required.  In my commit, I was able to convert all of the 
integration tests from ITPutDynamoDBTest.java to unit tests in 
PutDynamoDBTest.java.
# Many unit tests could be written using mocks.  I've written a crude sample of 
what this might look like to intercept the outgoing request object model and 
mock the response. My sample changes AbstractDynamoDBProcessor to provide 
accessor methods for Amazon's BatchWriteItemApi interface rather than the 
DynamoDB class. I then wrote a mock implementation of the interfact for tests.  
Of course, this is not a substitute for integration tests actually hitting AWS, 
but it may be better than nothing.

* PutDynamoDBTest.java, which is copy/paste/modified IPutDynamoDBTest.java to 
run as local unit tests.
* MockBactchWriteItemApi.java, a mock implementation of BatchWriteItemApi
* PutDynamoDBWithMockTest.java, a simple illustration of using mocking to run 
the processor, evaluating the request object model and faking a response.

Please let me know if this is of any interest to you, I'd be happy to help 
build this out.

> Provide AWS DynamoDB Delete/Put/Get processors
> ----------------------------------------------
>
>                 Key: NIFI-1516
>                 URL: https://issues.apache.org/jira/browse/NIFI-1516
>             Project: Apache NiFi
>          Issue Type: New Feature
>          Components: Extensions
>    Affects Versions: 0.5.0
>         Environment: all
>            Reporter: Mans Singh
>            Assignee: Mans Singh
>            Priority: Minor
>              Labels: aws, delete,, dynamodb,, get,, insert,, put,
>             Fix For: 0.6.0
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> Implement AWS DynamoDB Get/Put/Delete processors.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to