[java-identity-provider] 01/02: IDP-1181 Test FastFail behavior - Stored DataConnector
Rod Widdowson
rdw at steadingsoftware.com
Fri Sep 13 04:52:09 EDT 2019
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch master
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=911fdb0e253da856950c0dcaecace440c978117e
commit 911fdb0e253da856950c0dcaecace440c978117e
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Sep 10 16:02:23 2019 +0100
IDP-1181 Test FastFail behavior - Stored DataConnector
https://issues.shibboleth.net/jira/browse/IDP-1181
This has a fastfail attribute, so test that too
---
.../failfast/AttributeResolverFailFastTest.java | 57 +++++++++++++++++-----
.../idp/attribute/resolver/failfast/RdbmsStore.sql | 25 ++++++++++
.../resolver/failfast/attributeResolverStored.xml | 29 +++++++++++
3 files changed, 100 insertions(+), 11 deletions(-)
diff --git a/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/failfast/AttributeResolverFailFastTest.java b/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/failfast/AttributeResolverFailFastTest.java
index 8b7208c..c57ff34 100644
--- a/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/failfast/AttributeResolverFailFastTest.java
+++ b/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/failfast/AttributeResolverFailFastTest.java
@@ -81,23 +81,28 @@ public class AttributeResolverFailFastTest extends AbstractFailFastTest {
//
// RDBMS
//
- datasource = DatabaseTestingSupport.GetMockDataSource(RDBMSDataConnectorParserTest.INIT_FILE, "RDBMSDataConnectorStore");
+ datasource = DatabaseTestingSupport.GetMockDataSource(getPath() + "RdbmsStore.sql", "RDBMSDataConnectorStore");
DatabaseTestingSupport.InitializeDataSourceFromFile(RDBMSDataConnectorParserTest.DATA_FILE, datasource);
}
- @AfterTest(enabled = false) public void teardownDirectoryServer() {
- directoryServer.shutDown(true);
+ @AfterTest public void teardownDirectoryServer() {
+ if (directoryServer != null) {
+ directoryServer.shutDown(true);
+ }
System.clearProperty("org.ldaptive.provider");
}
-
- public void workingAttributeResolver(String file) throws IOException {
-
- final Object bean = getBean(propertySource("ServiceConfiguration", makePath(file)), "attributeResolverBeansDefaultFF.xml");
- final ReloadableService<AttributeResolver > service = (ReloadableService<AttributeResolver>) bean;
- assertNotNull(service);
- final AttributeResolver resolver = service.getServiceableComponent().getComponent();
- assertNotNull(resolver);
+
+ public void workingAttributeResolver(final String file, final MockPropertySource props) throws IOException {
+ final Object bean = getBean(props, "attributeResolverBeansDefaultFF.xml");
+ final ReloadableService<AttributeResolver > service = (ReloadableService<AttributeResolver>) bean;
+ assertNotNull(service);
+ final AttributeResolver resolver = service.getServiceableComponent().getComponent();
+ assertNotNull(resolver);
+ }
+
+ public void workingAttributeResolver(String file) throws IOException {
+ workingAttributeResolver(file, propertySource("ServiceConfiguration", makePath(file)));
}
@Test public void workingAttributeResolver() throws IOException {
@@ -180,4 +185,34 @@ public class AttributeResolverFailFastTest extends AbstractFailFastTest {
@Test public void failingRDBMSResolverNoFF() throws IOException {
failingRDBMSResolver(false);
}
+
+ @Test public void workingStoredResolver() throws IOException {
+ workingAttributeResolver("attributeResolverStored.xml");
+ }
+
+ @Test public void workingFailingStoredResolver() throws IOException {
+ final MockPropertySource props = propertySource("jdbcUserName", "SAD");
+ props.setProperty("dcfailfast", "false");
+ propertySource("ServiceConfiguration", makePath("attributeResolverStored.xml"));
+ workingAttributeResolver("attributeResolverStored.xml");
+ }
+
+ private void failingStoredResolver(final Boolean failFastService) throws IOException {
+ final MockPropertySource props = propertySource("jdbcUserName", "SAD");
+ props.setProperty("dcfailfast", "true");
+ badResolver(props, failFastService, "attributeResolverStored.xml");
+ }
+
+ @Test public void failingStoredFF() throws IOException {
+ failingStoredResolver(true);
+ }
+
+ @Test public void failingStoredNoFF() throws IOException {
+ failingStoredResolver(false);
+ }
+
+ @Test public void failingStoredDefaultFF() throws IOException {
+ failingStoredResolver(false);
+ }
+
}
diff --git a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/failfast/RdbmsStore.sql b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/failfast/RdbmsStore.sql
new file mode 100644
index 0000000..7394d48
--- /dev/null
+++ b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/failfast/RdbmsStore.sql
@@ -0,0 +1,25 @@
+CREATE TABLE people (
+ userid VARCHAR(50) NOT NULL,
+ name VARCHAR(50) NOT NULL,
+ password VARCHAR(50) NOT NULL,
+ homephone VARCHAR(15) NOT NULL,
+ mail VARCHAR(100),
+ description VARCHAR(250)
+ );
+
+CREATE TABLE groups (
+ userid VARCHAR(50) NOT NULL,
+ name VARCHAR(50) NOT NULL
+ );
+
+CREATE TABLE shibpid (
+ localEntity VARCHAR(255) NOT NULL,
+ peerEntity VARCHAR(255) NOT NULL,
+ persistentId VARCHAR(50) NOT NULL,
+ principalName VARCHAR(50) NOT NULL,
+ localId VARCHAR(50) NOT NULL,
+ peerProvidedId VARCHAR(50) NULL,
+ creationDate TIMESTAMP NOT NULL,
+ deactivationDate TIMESTAMP NULL,
+ PRIMARY KEY (localEntity, peerEntity, persistentId)
+ );
diff --git a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/failfast/attributeResolverStored.xml b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/failfast/attributeResolverStored.xml
new file mode 100644
index 0000000..7af424c
--- /dev/null
+++ b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/failfast/attributeResolverStored.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<AttributeResolver
+ xmlns="urn:mace:shibboleth:2.0:resolver"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:mace:shibboleth:2.0:resolver http://shibboleth.net/schema/idp/shibboleth-attribute-resolver.xsd">
+
+ <AttributeDefinition id="Uid" xsi:type="Simple">
+ <InputDataConnector ref="dataConnector" attributeNames="uid" />
+ </AttributeDefinition>
+
+<DataConnector id="dataConnector" xsi:type="StoredId" generatedAttributeID="Uid" failFast="%{dcfailfast:false}">
+ <SimpleManagedConnection
+ jdbcDriver="org.hsqldb.jdbc.JDBCDriver"
+ jdbcURL="jdbc:hsqldb:mem:RDBMSDataConnectorStore"
+ jdbcUserName="%{jdbcUserName:SA}"
+ jdbcPassword=""/>
+ <InputDataConnector ref="staticDataConnector" attributeNames="input"></InputDataConnector>
+</DataConnector>
+
+ <DataConnector id="staticDataConnector" xsi:type="Static">
+ <Attribute id="affiliation">
+ <Value>member</Value>
+ </Attribute>
+ <Attribute id="input">
+ <Value>diu</Value>
+ </Attribute>
+ </DataConnector>
+
+</AttributeResolver>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list