-
Notifications
You must be signed in to change notification settings - Fork 278
#1446: dispatch tests cases into Maven modules #1450
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
org.restlet.gwt/org.restlet.gwt/src/test/java/org/restlet/client/engine/EngineTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /** | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I forgot to add the tests for the GWT edition |
||
| * Copyright 2005-2024 Qlik | ||
| * | ||
| * The contents of this file is subject to the terms of the Apache 2.0 open | ||
| * source license available at http://www.opensource.org/licenses/apache-2.0 | ||
| * | ||
| * Restlet is a registered trademark of QlikTech International AB. | ||
| */ | ||
|
|
||
| package org.restlet.client.engine; | ||
|
|
||
| import org.junit.jupiter.api.Assertions; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.util.Properties; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
|
||
| public class EngineTest { | ||
|
|
||
| @Test | ||
| public void engineVersionShouldBeEqualToMavenProjectVersion() { | ||
| // When I retrieve the Maven project's version as stated in the pom file. | ||
| Properties properties = new Properties(); | ||
| try (InputStream resourceAsStream = EngineTest.class.getClassLoader().getResourceAsStream("maven-version.properties")) { | ||
| properties.load(resourceAsStream); | ||
| } catch (IOException e) { | ||
| Assertions.fail("Can't load the properties file that contain the Maven's project version"); | ||
| } | ||
|
|
||
| // Then the Maven project's version should be equal to the Engine's version. | ||
| assertEquals(Engine.VERSION, properties.getProperty("maven.version")); | ||
| } | ||
| } | ||
1 change: 1 addition & 0 deletions
1
org.restlet.gwt/org.restlet.gwt/src/test/resources/maven-version.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| maven.version=${project.version} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,21 @@ | ||
| /** | ||
| * Copyright 2005-2024 Qlik | ||
| * | ||
| * <p> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we'll have to take care of code formatting... |
||
| * The contents of this file is subject to the terms of the Apache 2.0 open | ||
| * source license available at http://www.opensource.org/licenses/apache-2.0 | ||
| * | ||
| * <p> | ||
| * Restlet is a registered trademark of QlikTech International AB. | ||
| */ | ||
|
|
||
| package org.restlet.ext.crypto; | ||
|
|
||
| import java.util.logging.Level; | ||
|
|
||
| import org.restlet.Context; | ||
| import org.restlet.data.Digest; | ||
| import org.restlet.security.LocalVerifier; | ||
| import org.restlet.security.SecretVerifier; | ||
|
|
||
| import java.util.logging.Level; | ||
|
|
||
| /** | ||
| * Wrapper verifier that can verify digested secrets. If the provided secret is | ||
| * a digest, then the local secret must either be a digest of the same algorithm | ||
|
|
@@ -24,7 +24,7 @@ | |
| * <br> | ||
| * If the provided secret is a regular secret, then the local secret can be in | ||
| * any digest algorithm or a regular secret. | ||
| * | ||
| * | ||
| * @see Digest | ||
| * @see DigestAuthenticator | ||
| * @author Jerome Louvel | ||
|
|
@@ -42,7 +42,7 @@ public class DigestVerifier<T extends SecretVerifier> extends SecretVerifier { | |
|
|
||
| /** | ||
| * Constructor. | ||
| * | ||
| * | ||
| * @param algorithm | ||
| * The digest algorithm of provided secrets. | ||
| * @param wrappedVerifier | ||
|
|
@@ -53,7 +53,7 @@ public class DigestVerifier<T extends SecretVerifier> extends SecretVerifier { | |
| * @see Digest | ||
| */ | ||
| public DigestVerifier(String algorithm, T wrappedVerifier, | ||
| String wrappedAlgorithm) { | ||
| String wrappedAlgorithm) { | ||
| this.algorithm = algorithm; | ||
| this.wrappedAlgorithm = wrappedAlgorithm; | ||
| this.wrappedVerifier = wrappedVerifier; | ||
|
|
@@ -64,7 +64,7 @@ public DigestVerifier(String algorithm, T wrappedVerifier, | |
| * default, MD5 hashes (represented as a sequence of 32 hexadecimal digits) | ||
| * and SHA-1 hashes are supported. For additional algorithm, override this | ||
| * method. | ||
| * | ||
| * | ||
| * @param identifier | ||
| * The user identifier. | ||
| * @param secret | ||
|
|
@@ -81,37 +81,62 @@ protected char[] digest(String identifier, char[] secret, String algorithm) { | |
| /** | ||
| * Returns the digest algorithm of provided secrets. Provided secrets are | ||
| * the ones sent by clients when attempting to authenticate. | ||
| * | ||
| * | ||
| * @return The digest algorithm of input secrets. | ||
| */ | ||
| public String getAlgorithm() { | ||
| return algorithm; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the digest algorithm of provided secrets. Provided secrets are the | ||
| * ones sent by clients when attempting to authenticate. | ||
| * | ||
| * @param algorithm | ||
| * The digest algorithm of secrets provided by the user. | ||
| * @see Digest | ||
| */ | ||
| public void setAlgorithm(String algorithm) { | ||
| this.algorithm = algorithm; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the digest algorithm of secrets returned by the wrapped verifier. | ||
| * The secrets from the wrapped verifier are the ones used by the verifier | ||
| * to compare those sent by clients when attempting to authenticate. | ||
| * | ||
| * | ||
| * @return The digest algorithm of secrets returned by the wrapped verifier. | ||
| */ | ||
| public String getWrappedAlgorithm() { | ||
| return wrappedAlgorithm; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the digest algorithm of secrets returned by the wrapped verifier. | ||
| * The secrets from the wrapped verifier are the ones used by the verifier | ||
| * to compare those sent by clients when attempting to authenticate. | ||
| * | ||
| * @param wrappedAlgorithm | ||
| * The digest algorithm of secrets returned by the wrapped | ||
| * verifier. | ||
| * @see Digest | ||
| */ | ||
| public void setWrappedAlgorithm(String wrappedAlgorithm) { | ||
| this.wrappedAlgorithm = wrappedAlgorithm; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the wrapped secret associated to a given identifier. This method | ||
| * can only be called if the wrapped verifier is a {@link LocalVerifier}. | ||
| * | ||
| * | ||
| * @param identifier | ||
| * The identifier to lookup. | ||
| * @return The secret associated to the identifier or null. | ||
| */ | ||
| public char[] getWrappedSecret(String identifier) { | ||
| char[] result = null; | ||
|
|
||
| if (getWrappedVerifier() instanceof LocalVerifier) { | ||
| LocalVerifier localVerifier = (LocalVerifier) getWrappedVerifier(); | ||
| if (getWrappedVerifier() instanceof LocalVerifier localVerifier) { | ||
| result = localVerifier.getLocalSecret(identifier); | ||
| } else { | ||
| Context.getCurrentLogger() | ||
|
|
@@ -127,7 +152,7 @@ public char[] getWrappedSecret(String identifier) { | |
| * identifier. If the wrapped algorithm is null it returns the digest of the | ||
| * wrapped secret, otherwise the algorithms must be identical. This method | ||
| * can only be called if the wrapped verifier is a {@link LocalVerifier}. | ||
| * | ||
| * | ||
| * @param identifier | ||
| * The identifier to lookup. | ||
| * @return The secret associated to the identifier or null. | ||
|
|
@@ -150,42 +175,16 @@ public char[] getWrappedSecretDigest(String identifier) { | |
|
|
||
| /** | ||
| * Returns the wrapped secret verifier. | ||
| * | ||
| * | ||
| * @return The wrapped secret verifier. | ||
| */ | ||
| public T getWrappedVerifier() { | ||
| return wrappedVerifier; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the digest algorithm of provided secrets. Provided secrets are the | ||
| * ones sent by clients when attempting to authenticate. | ||
| * | ||
| * @param algorithm | ||
| * The digest algorithm of secrets provided by the user. | ||
| * @see Digest | ||
| */ | ||
| public void setAlgorithm(String algorithm) { | ||
| this.algorithm = algorithm; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the digest algorithm of secrets returned by the wrapped verifier. | ||
| * The secrets from the wrapped verifier are the ones used by the verifier | ||
| * to compare those sent by clients when attempting to authenticate. | ||
| * | ||
| * @param wrappedAlgorithm | ||
| * The digest algorithm of secrets returned by the wrapped | ||
| * verifier. | ||
| * @see Digest | ||
| */ | ||
| public void setWrappedAlgorithm(String wrappedAlgorithm) { | ||
| this.wrappedAlgorithm = wrappedAlgorithm; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the wrapped secret verifier. | ||
| * | ||
| * | ||
| * @param wrappedVerifier | ||
| * The wrapped secret verifier. | ||
| */ | ||
|
|
@@ -208,8 +207,8 @@ public int verify(String identifier, char[] secret) { | |
| result = getWrappedVerifier().verify(identifier, secretDigest); | ||
| } else { | ||
| if (getWrappedAlgorithm() == null) { | ||
| result = compare(secretDigest, | ||
| getWrappedSecretDigest(identifier)) ? RESULT_VALID | ||
| result = compare(secretDigest, getWrappedSecretDigest(identifier)) | ||
| ? RESULT_VALID | ||
| : RESULT_INVALID; | ||
| } else if (getAlgorithm().equals(getWrappedAlgorithm())) { | ||
| result = getWrappedVerifier().verify(identifier, secretDigest); | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the word nonce was mispelled. I've deprecated the accessors and add new ones.