Skip to content

Commit c84baac

Browse files
thboileauThierry Boileau
andauthored
#1446: dispatch tests cases into Maven modules (#1450)
Co-authored-by: Thierry Boileau <thboileau@gmaiil.com>
1 parent 00dfe69 commit c84baac

File tree

479 files changed

+4695
-7029
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

479 files changed

+4695
-7029
lines changed

org.restlet.gwt/org.restlet.gwt/pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,20 @@
2525
<artifactId>gwt-dev</artifactId>
2626
<version>${lib-gwt-version}</version>
2727
</dependency>
28+
<dependency>
29+
<groupId>org.junit.jupiter</groupId>
30+
<artifactId>junit-jupiter-api</artifactId>
31+
<version>${lib-junit-version}</version>
32+
<scope>test</scope>
33+
</dependency>
2834
</dependencies>
2935
<build>
36+
<testResources>
37+
<testResource>
38+
<directory>src/test/resources</directory>
39+
<filtering>true</filtering>
40+
</testResource>
41+
</testResources>
3042
<plugins>
3143
<plugin>
3244
<groupId>net.ltgt.gwt.maven</groupId>

org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeResponse.java

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,13 @@ public final class ChallengeResponse extends ChallengeMessage {
5252
private volatile String secretAlgorithm;
5353

5454
/** The server nonce count. */
55-
private volatile int serverNounceCount;
55+
private volatile int serverNonceCount;
5656

5757
/**
5858
* The time when the response was issued, as returned by {@link System#currentTimeMillis()}.
5959
*/
6060
private volatile long timeIssued;
6161

62-
63-
64-
6562
/**
6663
* Constructor with no credentials.
6764
*
@@ -102,7 +99,7 @@ public ChallengeResponse(ChallengeScheme scheme) {
10299
* The client nonce value.
103100
* @param serverNonce
104101
* The server nonce.
105-
* @param serverNounceCount
102+
* @param serverNonceCount
106103
* The server nonce count.
107104
* @param timeIssued
108105
* The time when the response was issued, as returned by {@link System#currentTimeMillis()}.
@@ -111,7 +108,7 @@ public ChallengeResponse(ChallengeScheme scheme,
111108
Series<Parameter> parameters, String identifier, char[] secret,
112109
String secretAlgorithm, String realm, String quality,
113110
Reference digestRef, String digestAlgorithm, String opaque,
114-
String clientNonce, String serverNonce, int serverNounceCount,
111+
String clientNonce, String serverNonce, int serverNonceCount,
115112
long timeIssued) {
116113
super(scheme, realm, parameters, digestAlgorithm, opaque, serverNonce);
117114
this.clientNonce = clientNonce;
@@ -120,7 +117,7 @@ public ChallengeResponse(ChallengeScheme scheme,
120117
this.quality = quality;
121118
this.secret = secret;
122119
this.secretAlgorithm = secretAlgorithm;
123-
this.serverNounceCount = serverNounceCount;
120+
this.serverNonceCount = serverNonceCount;
124121
this.timeIssued = timeIssued;
125122
}
126123

@@ -284,13 +281,23 @@ public String getSecretAlgorithm() {
284281

285282
/**
286283
* Returns the server nonce count.
287-
*
284+
*
288285
* @return The server nonce count.
286+
* @deprecated Use {@code getServerNonceCount} instead.
289287
*/
288+
@Deprecated
290289
public int getServerNounceCount() {
291-
return serverNounceCount;
290+
return getServerNonceCount();
292291
}
293292

293+
/**
294+
* Returns the server nonce count.
295+
*
296+
* @return The server nonce count.
297+
*/
298+
public int getServerNonceCount() {
299+
return serverNonceCount;
300+
}
294301

295302
/**
296303
* Returns the time when the response was issued, as returned by {@link System#currentTimeMillis()}.
@@ -383,14 +390,23 @@ public void setSecretAlgorithm(String secretDigestAlgorithm) {
383390

384391
/**
385392
* Sets the server nonce count.
386-
*
387-
* @param serverNounceCount
388-
* The server nonce count.
393+
*
394+
* @param serverNonceCount The server nonce count.
395+
* @deprecated Use {@code setServerNonceCount} instead.
389396
*/
390-
public void setServerNounceCount(int serverNounceCount) {
391-
this.serverNounceCount = serverNounceCount;
397+
@Deprecated
398+
public void setServerNounceCount(int serverNonceCount) {
399+
setServerNonceCount(serverNonceCount);
392400
}
393401

402+
/**
403+
* Sets the server nonce count.
404+
*
405+
* @param serverNonceCount The server nonce count.
406+
*/
407+
public void setServerNonceCount(int serverNonceCount) {
408+
this.serverNonceCount = serverNonceCount;
409+
}
394410
/**
395411
* Sets the time when the response was issued, as returned by {@link System#currentTimeMillis()}.
396412
*

org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Status.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ public final class Status {
2121

2222
private static final String BASE_HTTP = "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html";
2323

24-
private static final String BASE_RESTLET = "http://restlet.org/learn/javadocs/"
25-
+ Engine.MAJOR_NUMBER
26-
+ '.'
27-
+ Engine.MINOR_NUMBER
28-
+ "/gwt/api/";
24+
private static final String BASE_RESTLET = "https://javadoc.io/static/org.restlet.gwt/org.restlet.gwt/" + Engine.VERSION + "/";
2925

3026
@Deprecated
3127
private static final String BASE_WEBDAV = "http://www.webdav.org/specs/rfc2518.html";
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* Copyright 2005-2024 Qlik
3+
*
4+
* The contents of this file is subject to the terms of the Apache 2.0 open
5+
* source license available at http://www.opensource.org/licenses/apache-2.0
6+
*
7+
* Restlet is a registered trademark of QlikTech International AB.
8+
*/
9+
10+
package org.restlet.client.engine;
11+
12+
import org.junit.jupiter.api.Assertions;
13+
import org.junit.jupiter.api.Test;
14+
15+
import java.io.IOException;
16+
import java.io.InputStream;
17+
import java.util.Properties;
18+
19+
import static org.junit.jupiter.api.Assertions.assertEquals;
20+
21+
public class EngineTest {
22+
23+
@Test
24+
public void engineVersionShouldBeEqualToMavenProjectVersion() {
25+
// When I retrieve the Maven project's version as stated in the pom file.
26+
Properties properties = new Properties();
27+
try (InputStream resourceAsStream = EngineTest.class.getClassLoader().getResourceAsStream("maven-version.properties")) {
28+
properties.load(resourceAsStream);
29+
} catch (IOException e) {
30+
Assertions.fail("Can't load the properties file that contain the Maven's project version");
31+
}
32+
33+
// Then the Maven project's version should be equal to the Engine's version.
34+
assertEquals(Engine.VERSION, properties.getProperty("maven.version"));
35+
}
36+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
maven.version=${project.version}

org.restlet.java/org.restlet.example/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
<description>Example projects including those from the tutorial</description>
1515

1616
<dependencies>
17-
<dependency>
18-
<groupId>org.testng</groupId>
19-
<artifactId>testng</artifactId>
20-
<version>${lib-testng-version}</version>
21-
</dependency>
2217
<dependency>
2318
<groupId>org.restlet</groupId>
2419
<artifactId>org.restlet</artifactId>

org.restlet.java/org.restlet.ext.crypto/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
<artifactId>org.restlet</artifactId>
2121
<version>${project.version}</version>
2222
</dependency>
23+
<dependency>
24+
<groupId>org.junit.jupiter</groupId>
25+
<artifactId>junit-jupiter-api</artifactId>
26+
<version>${lib-junit-version}</version>
27+
<scope>test</scope>
28+
</dependency>
2329
</dependencies>
2430
<build>
2531
<plugins>

org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/DigestVerifier.java

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/**
22
* Copyright 2005-2024 Qlik
3-
*
3+
* <p>
44
* The contents of this file is subject to the terms of the Apache 2.0 open
55
* source license available at http://www.opensource.org/licenses/apache-2.0
6-
*
6+
* <p>
77
* Restlet is a registered trademark of QlikTech International AB.
88
*/
99

1010
package org.restlet.ext.crypto;
1111

12-
import java.util.logging.Level;
13-
1412
import org.restlet.Context;
1513
import org.restlet.data.Digest;
1614
import org.restlet.security.LocalVerifier;
1715
import org.restlet.security.SecretVerifier;
1816

17+
import java.util.logging.Level;
18+
1919
/**
2020
* Wrapper verifier that can verify digested secrets. If the provided secret is
2121
* a digest, then the local secret must either be a digest of the same algorithm
@@ -24,7 +24,7 @@
2424
* <br>
2525
* If the provided secret is a regular secret, then the local secret can be in
2626
* any digest algorithm or a regular secret.
27-
*
27+
*
2828
* @see Digest
2929
* @see DigestAuthenticator
3030
* @author Jerome Louvel
@@ -42,7 +42,7 @@ public class DigestVerifier<T extends SecretVerifier> extends SecretVerifier {
4242

4343
/**
4444
* Constructor.
45-
*
45+
*
4646
* @param algorithm
4747
* The digest algorithm of provided secrets.
4848
* @param wrappedVerifier
@@ -53,7 +53,7 @@ public class DigestVerifier<T extends SecretVerifier> extends SecretVerifier {
5353
* @see Digest
5454
*/
5555
public DigestVerifier(String algorithm, T wrappedVerifier,
56-
String wrappedAlgorithm) {
56+
String wrappedAlgorithm) {
5757
this.algorithm = algorithm;
5858
this.wrappedAlgorithm = wrappedAlgorithm;
5959
this.wrappedVerifier = wrappedVerifier;
@@ -64,7 +64,7 @@ public DigestVerifier(String algorithm, T wrappedVerifier,
6464
* default, MD5 hashes (represented as a sequence of 32 hexadecimal digits)
6565
* and SHA-1 hashes are supported. For additional algorithm, override this
6666
* method.
67-
*
67+
*
6868
* @param identifier
6969
* The user identifier.
7070
* @param secret
@@ -81,37 +81,62 @@ protected char[] digest(String identifier, char[] secret, String algorithm) {
8181
/**
8282
* Returns the digest algorithm of provided secrets. Provided secrets are
8383
* the ones sent by clients when attempting to authenticate.
84-
*
84+
*
8585
* @return The digest algorithm of input secrets.
8686
*/
8787
public String getAlgorithm() {
8888
return algorithm;
8989
}
9090

91+
/**
92+
* Sets the digest algorithm of provided secrets. Provided secrets are the
93+
* ones sent by clients when attempting to authenticate.
94+
*
95+
* @param algorithm
96+
* The digest algorithm of secrets provided by the user.
97+
* @see Digest
98+
*/
99+
public void setAlgorithm(String algorithm) {
100+
this.algorithm = algorithm;
101+
}
102+
91103
/**
92104
* Returns the digest algorithm of secrets returned by the wrapped verifier.
93105
* The secrets from the wrapped verifier are the ones used by the verifier
94106
* to compare those sent by clients when attempting to authenticate.
95-
*
107+
*
96108
* @return The digest algorithm of secrets returned by the wrapped verifier.
97109
*/
98110
public String getWrappedAlgorithm() {
99111
return wrappedAlgorithm;
100112
}
101113

114+
/**
115+
* Sets the digest algorithm of secrets returned by the wrapped verifier.
116+
* The secrets from the wrapped verifier are the ones used by the verifier
117+
* to compare those sent by clients when attempting to authenticate.
118+
*
119+
* @param wrappedAlgorithm
120+
* The digest algorithm of secrets returned by the wrapped
121+
* verifier.
122+
* @see Digest
123+
*/
124+
public void setWrappedAlgorithm(String wrappedAlgorithm) {
125+
this.wrappedAlgorithm = wrappedAlgorithm;
126+
}
127+
102128
/**
103129
* Returns the wrapped secret associated to a given identifier. This method
104130
* can only be called if the wrapped verifier is a {@link LocalVerifier}.
105-
*
131+
*
106132
* @param identifier
107133
* The identifier to lookup.
108134
* @return The secret associated to the identifier or null.
109135
*/
110136
public char[] getWrappedSecret(String identifier) {
111137
char[] result = null;
112138

113-
if (getWrappedVerifier() instanceof LocalVerifier) {
114-
LocalVerifier localVerifier = (LocalVerifier) getWrappedVerifier();
139+
if (getWrappedVerifier() instanceof LocalVerifier localVerifier) {
115140
result = localVerifier.getLocalSecret(identifier);
116141
} else {
117142
Context.getCurrentLogger()
@@ -127,7 +152,7 @@ public char[] getWrappedSecret(String identifier) {
127152
* identifier. If the wrapped algorithm is null it returns the digest of the
128153
* wrapped secret, otherwise the algorithms must be identical. This method
129154
* can only be called if the wrapped verifier is a {@link LocalVerifier}.
130-
*
155+
*
131156
* @param identifier
132157
* The identifier to lookup.
133158
* @return The secret associated to the identifier or null.
@@ -150,42 +175,16 @@ public char[] getWrappedSecretDigest(String identifier) {
150175

151176
/**
152177
* Returns the wrapped secret verifier.
153-
*
178+
*
154179
* @return The wrapped secret verifier.
155180
*/
156181
public T getWrappedVerifier() {
157182
return wrappedVerifier;
158183
}
159184

160-
/**
161-
* Sets the digest algorithm of provided secrets. Provided secrets are the
162-
* ones sent by clients when attempting to authenticate.
163-
*
164-
* @param algorithm
165-
* The digest algorithm of secrets provided by the user.
166-
* @see Digest
167-
*/
168-
public void setAlgorithm(String algorithm) {
169-
this.algorithm = algorithm;
170-
}
171-
172-
/**
173-
* Sets the digest algorithm of secrets returned by the wrapped verifier.
174-
* The secrets from the wrapped verifier are the ones used by the verifier
175-
* to compare those sent by clients when attempting to authenticate.
176-
*
177-
* @param wrappedAlgorithm
178-
* The digest algorithm of secrets returned by the wrapped
179-
* verifier.
180-
* @see Digest
181-
*/
182-
public void setWrappedAlgorithm(String wrappedAlgorithm) {
183-
this.wrappedAlgorithm = wrappedAlgorithm;
184-
}
185-
186185
/**
187186
* Sets the wrapped secret verifier.
188-
*
187+
*
189188
* @param wrappedVerifier
190189
* The wrapped secret verifier.
191190
*/
@@ -208,8 +207,8 @@ public int verify(String identifier, char[] secret) {
208207
result = getWrappedVerifier().verify(identifier, secretDigest);
209208
} else {
210209
if (getWrappedAlgorithm() == null) {
211-
result = compare(secretDigest,
212-
getWrappedSecretDigest(identifier)) ? RESULT_VALID
210+
result = compare(secretDigest, getWrappedSecretDigest(identifier))
211+
? RESULT_VALID
213212
: RESULT_INVALID;
214213
} else if (getAlgorithm().equals(getWrappedAlgorithm())) {
215214
result = getWrappedVerifier().verify(identifier, secretDigest);

0 commit comments

Comments
 (0)