[ 
https://issues.apache.org/jira/browse/MINIFICPP-1479?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Adam Hunyadi updated MINIFICPP-1479:
------------------------------------
    Description: 
*Background:*

HashContent is expected to add the hash value of the content of a flowfile to a 
flowfile attribute. Currently, neither the unit tests tests for the presence of 
such an attribute. While unit tests seem to test for logging, docker based 
integration test only test for the flowfile content being unmodified.

*Proposal:*

We should create proper integration tests for HashContent:
{code:python|title=Example feature definition}
  Scenario: HashContent adds hash attribute to flowfiles
    Given a GetFile processor with the "Input Directory" property set to 
"/tmp/input"
    And a file with the content <content> is present in "/tmp/input"
    And a HashContent processor with the "Hash Attribute" property set to "hash"
    And a HashContent processor with the "Hash Algorithm" property set to 
<hash_algorithm>
    And a PutFile processor with the "Directory" property set to "/tmp/output"
    And the "success" relationship of the GetFile processor is connected to the 
HashContent
    And the "success" relationship of the HashContent processor is connected to 
the PutFile
    When the MiNiFi instance starts up
    Then a flowfile with the content <content> is placed in the monitored 
directory in less than 10 seconds
    And the flowfile has an attribute called "hash" set to <hash_value>

  Examples:
   | content  | hash_algorithm | hash_value                                     
                  |
   | "test"   | MD5            | 098f6bcd4621d373cade4e832627b4f6               
                  |
   | "test"   | SHA1           | a94a8fe5ccb19ba61c4c0873d391e987982fbbd3       
                  |
   | "test"   | SHA256         | 
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 |
   | "coffee" | MD5            | 24eb05d18318ac2db8b2b959315d10f2               
                  |
   | "coffee" | SHA1           | 44213f9f4d59b557314fadcd233232eebcac8012       
                  |
   | "coffee" | SHA256         | 
37290d74ac4d186e3a8e5785d259d2ec04fac91ae28092e7620ec8bc99e830aa |
{code}

  was:
*Background:*

HashContent is expected to add the hash value of the content of a flowfile to a 
flowfile attribute. Currently, neither the unit tests tests for the presence of 
such an attribute. While unit tests seem to test for logging, docker based 
integration test only test for the flowfile content being unmodified.

*Proposal:*

We should create proper integration tests for HashContent:

{code:python|title=Example feature definition}
  Scenario: HashContent adds hash attribute to flowfiles
    Given a GetFile processor with the "Input Directory" property set to 
"/tmp/input"
    And a file with the content "<content>" is present in "/tmp/input"
    And a HashContent processor with the "Hash Attribute" property set to "hash"
    And a HashContent processor with the "Hash Algorithm" property set to 
<hash_algorithm>
    And a PutFile processor with the "Directory" property set to "/tmp/output"
    And the "success" relationship of the GetFile processor is connected to the 
HashContent
    And the "success" relationship of the HashContent processor is connected to 
the PutFile
    When the MiNiFi instance starts up
    Then a flowfile with the content "<content>" is placed in the monitored 
directory in less than 10 seconds
    And the flowfile has an attribute called "hash" set to <hash_value>

  Examples:
   | content | hash_algorithm | hash_value                                      
                 |
   | test    | MD5            | 098f6bcd4621d373cade4e832627b4f6                
                 |
   | test    | SHA1           | a94a8fe5ccb19ba61c4c0873d391e987982fbbd3        
                 |
   | test    | SHA256         | 
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 |
   | coffee  | MD5            | 24eb05d18318ac2db8b2b959315d10f2                
                 |
   | coffee  | SHA1           | 44213f9f4d59b557314fadcd233232eebcac8012        
                 |
   | coffee  | SHA256         | 
37290d74ac4d186e3a8e5785d259d2ec04fac91ae28092e7620ec8bc99e830aa |
{code}


> Rework integration tests for HashContent
> ----------------------------------------
>
>                 Key: MINIFICPP-1479
>                 URL: https://issues.apache.org/jira/browse/MINIFICPP-1479
>             Project: Apache NiFi MiNiFi C++
>          Issue Type: Bug
>    Affects Versions: 0.7.0
>            Reporter: Adam Hunyadi
>            Priority: Minor
>              Labels: MiNiFi-CPP-Hygiene
>             Fix For: 1.0.0
>
>
> *Background:*
> HashContent is expected to add the hash value of the content of a flowfile to 
> a flowfile attribute. Currently, neither the unit tests tests for the 
> presence of such an attribute. While unit tests seem to test for logging, 
> docker based integration test only test for the flowfile content being 
> unmodified.
> *Proposal:*
> We should create proper integration tests for HashContent:
> {code:python|title=Example feature definition}
>   Scenario: HashContent adds hash attribute to flowfiles
>     Given a GetFile processor with the "Input Directory" property set to 
> "/tmp/input"
>     And a file with the content <content> is present in "/tmp/input"
>     And a HashContent processor with the "Hash Attribute" property set to 
> "hash"
>     And a HashContent processor with the "Hash Algorithm" property set to 
> <hash_algorithm>
>     And a PutFile processor with the "Directory" property set to "/tmp/output"
>     And the "success" relationship of the GetFile processor is connected to 
> the HashContent
>     And the "success" relationship of the HashContent processor is connected 
> to the PutFile
>     When the MiNiFi instance starts up
>     Then a flowfile with the content <content> is placed in the monitored 
> directory in less than 10 seconds
>     And the flowfile has an attribute called "hash" set to <hash_value>
>   Examples:
>    | content  | hash_algorithm | hash_value                                   
>                     |
>    | "test"   | MD5            | 098f6bcd4621d373cade4e832627b4f6             
>                     |
>    | "test"   | SHA1           | a94a8fe5ccb19ba61c4c0873d391e987982fbbd3     
>                     |
>    | "test"   | SHA256         | 
> 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 |
>    | "coffee" | MD5            | 24eb05d18318ac2db8b2b959315d10f2             
>                     |
>    | "coffee" | SHA1           | 44213f9f4d59b557314fadcd233232eebcac8012     
>                     |
>    | "coffee" | SHA256         | 
> 37290d74ac4d186e3a8e5785d259d2ec04fac91ae28092e7620ec8bc99e830aa |
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to