Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge CheckSumPipe and HashPipe and add hashEncoding #7456

Merged
merged 8 commits into from
Sep 11, 2024

Conversation

evandongen
Copy link
Contributor

And add clear documentation and unit tests for HashPipe and ChecksumPipe

}
}

protected static class ZipChecksumGenerator implements ChecksumGenerator {

static class BasicGenerator implements ChecksumGenerator {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ik twijfelde nog een beetje over deze naam, maar 'zip' moest er iig vanaf wat mij betreft

checksum.reset();
}

@Override
public void update(int b){
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deze werd nergens gebruikt

@@ -80,7 +80,7 @@
* <pipe name="make unique message" className="org.frankframework.pipes.FixedResultPipe"
* returnString="&lt;msg mid=&quot;MID&quot; action=&quot;ACTION&quot; /&gt;" replaceFixedParams="true">
* <param name="MID" sessionKey="mid" />
* <param name="ACTION" xpathExpression="request/@action" />
* <param name="ACTION" xpathExpression="request/@action" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting fix voor wat we vanochtend zagen

@@ -21,41 +25,6 @@ public ChecksumPipe createPipe() {
return new ChecksumPipe();
}

@Test
public void rightChecksumGeneratedMD5() throws Exception {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deze testen waren vrij zinloos: check of je een md5 checksumgenerator aanmaakt als je een md5 generator aanmaakt. Qua coverage verliezen we hier ook niets. De enige relevant is cantCalculate hieronder wat mij betreft.

URL file = TestFileUtils.getTestFileURL("/Pipes/2.txt");
assertEquals(expected, calculateChecksum(file.getPath(), ChecksumType.MD5, true));
assertEquals(expected, calculateChecksum(file.openStream(), ChecksumType.MD5));
public static Stream<Arguments> values() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mooier als ParameterizedTest vond ik

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alleen formatting

@evandongen evandongen requested a review from nielsm5 September 6, 2024 17:42
* need to prove the authenticity of the message as well, please use the {@link HashPipe} which uses an algorithm and a secret to prove both
* integrity and authenticity.
* <p>
* The hash is generated based on the bytes of the given input message or on the bytes read from the file path if @{inputIsFile} is @{code true}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The hash is generated based on the bytes of the given input message or on the bytes read from the file path if @{inputIsFile} is @{code true}
* The hash is generated based on the bytes of the given input message or on the bytes read from the file path if {@code inputIsFile} is {@code true}

*
* CRC32 and Adler32 are {@link Checksum} implementations, the others are {@link MessageDigest} implementations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* CRC32 and Adler32 are {@link Checksum} implementations, the others are {@link MessageDigest} implementations.

Dit is veel te technisch.

Comment on lines 56 to 63
* Example usage:
* <pre>{@code
* <pipe className="org.frankframework.pipes.ChecksumPipe"
* name="SHA"
* algorithm="SHA">
* <forward name="success" path="READY"/>
* </pipe>
* }</pre>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dit gaan we later automatisch genereren, en de syntax klopt niet, dus dit kan ook beter weggelaten worden.

Comment on lines 51 to 60
* <p>
* Example usage:
* <pre>{@code
* <pipe className="org.frankframework.pipes.HashPipe"
* name="SHA"
* algorithm="HmacSHA1"
* secret="privateSecretString">
* <forward name="success" path="READY"/>
* </pipe>
* }</pre>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ook hier geldt het zelfde.

Comment on lines +47 to +51
* <li>MD5</li>
* <li>SHA</li>
* <li>SHA256</li>
* <li>SHA384</li>
* <li>SHA512</li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Als ik dit zo terugzie is het eigenlijk helemaal niet zo lastig om van deze 2 pipes 1 te maken. Misschien toch maandag even in de groep gooien?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, ik heb de rest aangepast

@evandongen evandongen requested a review from nielsm5 September 10, 2024 07:57
Comment on lines 60 to 62
public boolean isRequiresSecret() {
return requiresSecret;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stiekem vind ik dan requiresSecret mooier zonder de is er voor 😶‍🌫️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

na overleg aangepast naar isSecretRequired.

@nielsm5 nielsm5 linked an issue Sep 10, 2024 that may be closed by this pull request
@nielsm5 nielsm5 requested a review from tnleeuw September 10, 2024 15:16
@nielsm5 nielsm5 enabled auto-merge (squash) September 11, 2024 11:15
@nielsm5 nielsm5 changed the title Implement hashEncoding Merge CheckSumPipe and HashPipe and add hashEncoding Sep 11, 2024
Copy link

@nielsm5 nielsm5 merged commit 40970b7 into master Sep 11, 2024
20 of 21 checks passed
@nielsm5 nielsm5 deleted the issue/7047-checksumpipe branch September 11, 2024 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants