[java-identity-provider] branch main updated: Pre-clean for annotations Use the new test class ConstantSupplier rather than an inline instantiation (which would require annotation
Rod Widdowson
rdw at steadingsoftware.com
Thu Nov 24 16:00:32 UTC 2022
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=3ac7765a95d15f1ce98255df685a40dc903d1809
The following commit(s) were added to refs/heads/main by this push:
new 3ac7765a9 Pre-clean for annotations Use the new test class ConstantSupplier rather than an inline instantiation (which would require annotation
3ac7765a9 is described below
commit 3ac7765a95d15f1ce98255df685a40dc903d1809
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Nov 24 16:00:15 2022 +0000
Pre-clean for annotations
Use the new test class ConstantSupplier rather than an inline
instantiation (which would require annotation
---
idp-admin-impl/pom.xml | 5 +++++
.../java/net/shibboleth/idp/admin/impl/DoStorageOperationTest.java | 4 ++--
.../admin/impl/InitializeAdministrativeProfileContextTreeTest.java | 7 +++++--
.../authn/duo/impl/ExtractDuoAuthenticationFromHeadersTest.java | 7 +++----
.../java/net/shibboleth/idp/authn/impl/ExtractRemoteUserTest.java | 5 ++---
.../net/shibboleth/idp/authn/impl/ExtractUserAgentAddressTest.java | 5 ++---
.../shibboleth/idp/authn/impl/ExtractUserAgentIdentifierTest.java | 5 ++---
.../idp/authn/impl/ExtractUsernamePasswordFromBasicAuthTest.java | 6 +++---
.../idp/authn/impl/ExtractUsernamePasswordFromFormRequestTest.java | 5 ++---
.../idp/authn/impl/ExtractX509CertificateFromRequestTest.java | 5 ++---
10 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/idp-admin-impl/pom.xml b/idp-admin-impl/pom.xml
index 5a6d8cea0..ef3bf040f 100644
--- a/idp-admin-impl/pom.xml
+++ b/idp-admin-impl/pom.xml
@@ -141,6 +141,11 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>${shib-shared.groupId}</groupId>
+ <artifactId>shib-testing</artifactId>
+ <scope>test</scope>
+ </dependency>
<!-- Needed for XMLObject providers. -->
<dependency>
diff --git a/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/DoStorageOperationTest.java b/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/DoStorageOperationTest.java
index 064adc24a..ceaa36f78 100644
--- a/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/DoStorageOperationTest.java
+++ b/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/DoStorageOperationTest.java
@@ -39,13 +39,13 @@ import org.testng.annotations.Test;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;
-import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.idp.profile.testing.RequestContextBuilder;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.primitive.NonnullSupplier;
+import net.shibboleth.shared.testing.ConstantSupplier;
/**
* Unit test for {@link DoStorageOperation} action.
@@ -91,7 +91,7 @@ public class DoStorageOperationTest {
mapper.setSerializationInclusion(Include.NON_NULL);
action = new DoStorageOperation();
- action.setHttpServletRequestSupplier(new NonnullSupplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new ConstantSupplier<>(request));
action.setHttpServletResponseSupplier(new NonnullSupplier<> () {public HttpServletResponse get() {return response;}});
action.setStorageService(storageService);
action.setObjectMapper(mapper);
diff --git a/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTreeTest.java b/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTreeTest.java
index 36827763c..085e88380 100644
--- a/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTreeTest.java
+++ b/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTreeTest.java
@@ -19,6 +19,8 @@ package net.shibboleth.idp.admin.impl;
import java.util.Collections;
+import javax.annotation.Nonnull;
+
import org.opensaml.core.testing.OpenSAMLInitBaseTestCase;
import org.opensaml.profile.context.ProfileRequestContext;
import org.springframework.webflow.execution.Event;
@@ -66,8 +68,9 @@ public class InitializeAdministrativeProfileContextTreeTest extends OpenSAMLInit
action = new InitializeAdministrativeProfileContextTree();
action.setAdministrativeFlowDescriptor(descriptor);
- action.setHttpServletRequestSupplier(new NonnullSupplier<> () {public HttpServletRequest get() {
- return (HttpServletRequest) src.getExternalContext().getNativeRequest();
+ action.setHttpServletRequestSupplier(new NonnullSupplier<> () {
+ @Nonnull public HttpServletRequest get() {
+ return (HttpServletRequest) src.getExternalContext().getNativeRequest();
}
});
action.initialize();
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/duo/impl/ExtractDuoAuthenticationFromHeadersTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/duo/impl/ExtractDuoAuthenticationFromHeadersTest.java
index 15234db2f..a04928a3e 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/duo/impl/ExtractDuoAuthenticationFromHeadersTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/duo/impl/ExtractDuoAuthenticationFromHeadersTest.java
@@ -24,7 +24,6 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.duo.DuoAuthAPI;
@@ -32,7 +31,7 @@ import net.shibboleth.idp.authn.duo.context.DuoAuthenticationContext;
import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.primitive.NonnullSupplier;
+import net.shibboleth.shared.testing.ConstantSupplier;
/** {@link ExtractDuoAuthenticationFromHeaders} unit test. */
public class ExtractDuoAuthenticationFromHeadersTest extends BaseAuthenticationContextTest {
@@ -44,7 +43,7 @@ public class ExtractDuoAuthenticationFromHeadersTest extends BaseAuthenticationC
action = new ExtractDuoAuthenticationFromHeaders();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new NonnullSupplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new ConstantSupplier<>(request));
action.initialize();
}
@@ -64,7 +63,7 @@ public class ExtractDuoAuthenticationFromHeadersTest extends BaseAuthenticationC
@Test public void testNoAuto() throws ComponentInitializationException {
action = new ExtractDuoAuthenticationFromHeaders();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new NonnullSupplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new ConstantSupplier<>(request));
action.setAutoAuthenticationSupported(false);
action.initialize();
final Event event = action.execute(src);
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractRemoteUserTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractRemoteUserTest.java
index d2c5a0275..10e9e59ad 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractRemoteUserTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractRemoteUserTest.java
@@ -26,7 +26,6 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.UsernameContext;
@@ -34,7 +33,7 @@ import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.shared.collection.Pair;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.primitive.NonnullSupplier;
+import net.shibboleth.shared.testing.ConstantSupplier;
/** {@link ExtractRemoteUser} unit test. */
public class ExtractRemoteUserTest extends BaseAuthenticationContextTest {
@@ -46,7 +45,7 @@ public class ExtractRemoteUserTest extends BaseAuthenticationContextTest {
action = new ExtractRemoteUser();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new NonnullSupplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new ConstantSupplier<>(request));
}
@Test public void testNoConfig() {
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentAddressTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentAddressTest.java
index 5234bffe6..e3270f079 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentAddressTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentAddressTest.java
@@ -24,14 +24,13 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.UserAgentContext;
import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.primitive.NonnullSupplier;
+import net.shibboleth.shared.testing.ConstantSupplier;
/** {@link ExtractUserAgentAddress} unit test. */
public class ExtractUserAgentAddressTest extends BaseAuthenticationContextTest {
@@ -43,7 +42,7 @@ public class ExtractUserAgentAddressTest extends BaseAuthenticationContextTest {
action = new ExtractUserAgentAddress();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new NonnullSupplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new ConstantSupplier<>(request));
action.initialize();
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentIdentifierTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentIdentifierTest.java
index 015ef4c18..63a4fa563 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentIdentifierTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentIdentifierTest.java
@@ -24,14 +24,13 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.UserAgentContext;
import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.primitive.NonnullSupplier;
+import net.shibboleth.shared.testing.ConstantSupplier;
/** {@link ExtractUserAgentIdentifier} unit test. */
public class ExtractUserAgentIdentifierTest extends BaseAuthenticationContextTest {
@@ -43,7 +42,7 @@ public class ExtractUserAgentIdentifierTest extends BaseAuthenticationContextTes
action = new ExtractUserAgentIdentifier();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new NonnullSupplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new ConstantSupplier<>(request));
action.initialize();
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromBasicAuthTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromBasicAuthTest.java
index e1b458ae5..9945295f8 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromBasicAuthTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromBasicAuthTest.java
@@ -26,14 +26,13 @@ import org.testng.annotations.Test;
import com.google.common.net.HttpHeaders;
-import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.UsernamePasswordContext;
import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.primitive.NonnullSupplier;
+import net.shibboleth.shared.testing.ConstantSupplier;
/** {@link ExtractUsernamePasswordFromBasicAuth} unit test. */
public class ExtractUsernamePasswordFromBasicAuthTest extends BaseAuthenticationContextTest {
@@ -45,7 +44,8 @@ public class ExtractUsernamePasswordFromBasicAuthTest extends BaseAuthentication
action = new ExtractUsernamePasswordFromBasicAuth();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new NonnullSupplier<> () {public HttpServletRequest get() { return request;}}); action.initialize();
+ action.setHttpServletRequestSupplier(new ConstantSupplier<>(request));
+ action.initialize();
action.initialize();
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromFormRequestTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromFormRequestTest.java
index c55448f72..7439033cb 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromFormRequestTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromFormRequestTest.java
@@ -24,14 +24,13 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.UsernamePasswordContext;
import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.primitive.NonnullSupplier;
+import net.shibboleth.shared.testing.ConstantSupplier;
/** {@link ExtractUsernamePasswordFromFormRequest} unit test. */
public class ExtractUsernamePasswordFromFormRequestTest extends BaseAuthenticationContextTest {
@@ -45,7 +44,7 @@ public class ExtractUsernamePasswordFromFormRequestTest extends BaseAuthenticati
action.setUsernameFieldName("j_username");
action.setPasswordFieldName("j_password");
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new NonnullSupplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new ConstantSupplier<>(request));
action.initialize();
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractX509CertificateFromRequestTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractX509CertificateFromRequestTest.java
index 2bcc7f43b..3c1792933 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractX509CertificateFromRequestTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractX509CertificateFromRequestTest.java
@@ -28,14 +28,13 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.CertificateContext;
import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.primitive.NonnullSupplier;
+import net.shibboleth.shared.testing.ConstantSupplier;
/** {@link ExtractX509CertificateFromRequest} unit test. */
public class ExtractX509CertificateFromRequestTest extends BaseAuthenticationContextTest {
@@ -92,7 +91,7 @@ public class ExtractX509CertificateFromRequestTest extends BaseAuthenticationCon
action = new ExtractX509CertificateFromRequest();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new NonnullSupplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new ConstantSupplier<>(request));
action.initialize();
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list