Author: anil.saldhana(a)jboss.com
Date: 2009-10-27 13:27:20 -0400 (Tue, 27 Oct 2009)
New Revision: 874
Removed:
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/ConfigUnitTestCase.java
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-1.xml
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-2.xml
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-3.xml
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-4.xml
Log:
JBID-197: remove redundant test
Deleted:
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/ConfigUnitTestCase.java
===================================================================
---
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/ConfigUnitTestCase.java 2009-10-27
17:18:50 UTC (rev 873)
+++
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/config/ConfigUnitTestCase.java 2009-10-27
17:27:20 UTC (rev 874)
@@ -1,186 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.test.identity.federation.bindings.config;
-
-import java.io.InputStream;
-import java.util.List;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Unmarshaller;
-
-import junit.framework.TestCase;
-
-import org.jboss.identity.federation.core.config.AuthPropertyType;
-import org.jboss.identity.federation.core.config.IDPType;
-import org.jboss.identity.federation.core.config.KeyProviderType;
-import org.jboss.identity.federation.core.config.KeyValueType;
-import org.jboss.identity.federation.core.config.PropertyType;
-import org.jboss.identity.federation.core.config.SPType;
-import org.jboss.identity.federation.core.config.STSType;
-import org.jboss.identity.federation.core.config.ServiceProviderType;
-import org.jboss.identity.federation.core.config.ServiceProvidersType;
-import org.jboss.identity.federation.core.config.TokenProviderType;
-import org.jboss.identity.federation.core.config.TokenProvidersType;
-import org.jboss.identity.federation.core.config.TrustType;
-import org.jboss.identity.federation.core.util.JAXBUtil;
-
-/**
- * Unit Test the various config
- *
- * @author Anil.Saldhana(a)redhat.com
- * @since Jan 21, 2009
- */
-public class ConfigUnitTestCase extends TestCase
-{
- String config = "config/test-config-";
-
- @SuppressWarnings("unchecked")
- public void test01() throws Exception
- {
- Object object = this.unmarshall(config + "1.xml");
- assertNotNull("IDP is not null", object);
- assertTrue(object instanceof JAXBElement);
-
- IDPType idp = ((JAXBElement<IDPType>) object).getValue();
- assertEquals("300000", 300000L, idp.getAssertionValidity());
-
assertEquals("org.jboss.identity.federation.bindings.tomcat.TomcatRoleGenerator",
idp.getRoleGenerator());
-
- TrustType trust = idp.getTrust();
- assertNotNull("Trust is not null", trust);
- String domains = trust.getDomains();
- assertTrue("localhost trusted", domains.indexOf("localhost")
> -1);
-
assertTrue("jboss.com trusted", domains.indexOf("jboss.com")
> -1);
- }
-
- @SuppressWarnings("unchecked")
- public void test02() throws Exception
- {
- Object object = this.unmarshall(config + "2.xml");
- assertNotNull("IDP is not null", object);
- assertTrue(object instanceof JAXBElement);
-
- IDPType idp = ((JAXBElement<IDPType>) object).getValue();
- assertEquals("20000", 20000L, idp.getAssertionValidity());
- assertEquals("somefqn", idp.getRoleGenerator());
- assertTrue(idp.isEncrypt());
- KeyProviderType kp = idp.getKeyProvider();
- assertNotNull("KeyProvider is not null", kp);
- assertEquals("SomeClass", "SomeClass", kp.getClassName());
- List<AuthPropertyType> authProps = kp.getAuth();
- AuthPropertyType authProp = authProps.get(0);
- assertEquals("SomeKey", "SomeKey", authProp.getKey());
- assertEquals("SomeValue", "SomeValue", authProp.getValue());
-
- authProp = authProps.get(1);
- assertEquals("DBURL", "DBURL", authProp.getKey());
- assertEquals("SomeDBURL", "SomeDBURL", authProp.getValue());
-
- List<KeyValueType> validatingAliases = kp.getValidatingAlias();
- assertEquals("Validating Alias length is 2", 2,
validatingAliases.size());
-
- KeyValueType kv = validatingAliases.get(0);
- assertEquals("localhost", kv.getKey());
- assertEquals("localhostalias", kv.getValue());
-
- kv = validatingAliases.get(1);
- assertEquals("jboss.com", kv.getKey());
- assertEquals("jbossalias", kv.getValue());
-
- TrustType trust = idp.getTrust();
- assertNotNull("Trust is not null", trust);
- String domains = trust.getDomains();
- assertTrue("localhost trusted", domains.indexOf("localhost")
> -1);
-
assertTrue("jboss.com trusted", domains.indexOf("jboss.com")
> -1);
- }
-
- @SuppressWarnings("unchecked")
- public void test03() throws Exception
- {
- Object object = this.unmarshall(config + "3.xml");
- assertNotNull("SP is null", object);
- assertTrue(object instanceof JAXBElement);
-
- SPType sp = ((JAXBElement<SPType>) object).getValue();
- assertEquals("http://localhost:8080/idp", sp.getIdentityURL());
- assertEquals("http://localhost:8080/sales", sp.getServiceURL());
- }
-
- /**
- * <p>
- * Tests the parsing of a Security Token Service configuration.
- * </p>
- *
- * @throws Exception if an error occurs while running the test.
- */
- @SuppressWarnings("unchecked")
- public void test04() throws Exception
- {
- Object object = this.unmarshall(this.config + "4.xml");
- assertNotNull("Found a null STS configuration", object);
- assertTrue("Unexpected configuration type", object instanceof
JAXBElement);
-
- STSType stsType = ((JAXBElement<STSType>) object).getValue();
- // general STS configurations.
- assertEquals("Unexpected STS name", "Test STS",
stsType.getSTSName());
- assertEquals("Unexpected token timeout value", 7200,
stsType.getTokenTimeout());
- assertTrue("Encryption of tokens should have been enabled",
stsType.isEncryptToken());
- // we don't verify all values of the key provider config as it has been done in
the other test scenarios.
- assertNotNull("Unexpected null key provider", stsType.getKeyProvider());
- // request handler and configurations based on the token type.
- assertEquals("Unexpected request handler class",
"org.jboss.identity.federation.wstrust.Handler", stsType
- .getRequestHandler());
- // configuration of the token providers.
- TokenProvidersType tokenProviders = stsType.getTokenProviders();
- assertNotNull("Unexpected null list of token providers",
tokenProviders);
- assertEquals("Unexpected number of token providers", 1,
tokenProviders.getTokenProvider().size());
- TokenProviderType tokenProvider = tokenProviders.getTokenProvider().get(0);
- assertNotNull("Unexpected null token provider", tokenProvider);
- assertEquals("Unexpected provider class name",
"org.jboss.SpecialTokenProvider", tokenProvider.getProviderClass());
- assertEquals("Unexpected token type", "specialToken",
tokenProvider.getTokenType());
- assertEquals("Unexpected token element name", "SpecialToken",
tokenProvider.getTokenElement());
- assertEquals("Unexpected token namespace",
"http://www.tokens.org", tokenProvider.getTokenElementNS());
- List<PropertyType> properties = tokenProvider.getProperty();
- assertEquals("Invalid number of properties", 2, properties.size());
- // configuration of the service providers.
- ServiceProvidersType serviceProviders = stsType.getServiceProviders();
- assertNotNull("Unexpected null list of service providers",
serviceProviders);
- assertEquals("Unexpected number of service providers", 1,
serviceProviders.getServiceProvider().size());
- ServiceProviderType serviceProvider =
serviceProviders.getServiceProvider().get(0);
- assertNotNull("Unexpected null service provider", serviceProvider);
- assertEquals("Unexpected provider endpoint",
"http://provider.endpoint/provider", serviceProvider.getEndpoint());
- assertEquals("Unexpected truststore alias", "providerAlias",
serviceProvider.getTruststoreAlias());
- assertEquals("Unexpected token type", "specialToken",
serviceProvider.getTokenType());
- }
-
- private Object unmarshall(String configFile) throws Exception
- {
- String schema = "schema/config/jboss-identity-fed.xsd";
-
- ClassLoader tcl = Thread.currentThread().getContextClassLoader();
- InputStream is = tcl.getResourceAsStream(configFile);
- assertNotNull("Inputstream not null", is);
-
- Unmarshaller un =
JAXBUtil.getValidatingUnmarshaller("org.jboss.identity.federation.core.config",
- schema);
- return un.unmarshal(is);
- }
-}
\ No newline at end of file
Deleted:
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-1.xml
===================================================================
---
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-1.xml 2009-10-27
17:18:50 UTC (rev 873)
+++
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-1.xml 2009-10-27
17:27:20 UTC (rev 874)
@@ -1,6 +0,0 @@
-<JBossIDP xmlns="urn:jboss:identity-federation:config:1.0">
-<IdentityURL>http://localhost:8080/idp</IdentityURL>
-<Trust>
- <Domains>localhost,jboss.com,jboss.org</Domains>
-</Trust>
-</JBossIDP>
\ No newline at end of file
Deleted:
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-2.xml
===================================================================
---
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-2.xml 2009-10-27
17:18:50 UTC (rev 873)
+++
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-2.xml 2009-10-27
17:27:20 UTC (rev 874)
@@ -1,15 +0,0 @@
-<JBossIDP xmlns="urn:jboss:identity-federation:config:1.0"
- AssertionValidity="20000"
- RoleGenerator="somefqn"
- Encrypt="true">
-<IdentityURL>http://localhost:8080/idp</IdentityURL>
-<Trust>
- <Domains>localhost,jboss.com,jboss.org</Domains>
-</Trust>
-<KeyProvider ClassName="SomeClass">
- <Auth Key="SomeKey" Value="SomeValue" />
- <Auth Key="DBURL" Value="SomeDBURL" />
- <ValidatingAlias Key="localhost" Value="localhostalias"/>
- <ValidatingAlias Key="jboss.com" Value="jbossalias"/>
-</KeyProvider>
-</JBossIDP>
\ No newline at end of file
Deleted:
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-3.xml
===================================================================
---
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-3.xml 2009-10-27
17:18:50 UTC (rev 873)
+++
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-3.xml 2009-10-27
17:27:20 UTC (rev 874)
@@ -1,14 +0,0 @@
-<JBossSP xmlns="urn:jboss:identity-federation:config:1.0">
-<IdentityURL>http://localhost:8080/idp</IdentityURL>
-<Trust>
- <Domains>localhost,jboss.com,jboss.org</Domains>
-</Trust>
-<KeyProvider ClassName="SomeClass">
- <Auth Key="SomeKey" Value="SomeValue" />
- <Auth Key="DBURL" Value="SomeDBURL" />
- <ValidatingAlias Key="localhost" Value="localhostalias"/>
- <ValidatingAlias Key="jboss.com" Value="jbossalias"/>
-</KeyProvider>
-
-<ServiceURL>http://localhost:8080/sales</ServiceURL>
-</JBossSP>
\ No newline at end of file
Deleted:
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-4.xml
===================================================================
---
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-4.xml 2009-10-27
17:18:50 UTC (rev 873)
+++
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-4.xml 2009-10-27
17:27:20 UTC (rev 874)
@@ -1,24 +0,0 @@
-<JBossSTS xmlns="urn:jboss:identity-federation:config:1.0"
- STSName="Test STS" TokenTimeout="7200"
EncryptToken="true">
- <KeyProvider ClassName="SomeClass">
- <ValidatingAlias Key="localhost" Value="localhostalias"/>
- <ValidatingAlias Key="jboss.com" Value="jbossalias"/>
- <SigningAlias>issueralias</SigningAlias>
- </KeyProvider>
- <RequestHandler>org.jboss.identity.federation.wstrust.Handler</RequestHandler>
- <TokenProviders>
- <TokenProvider
- ProviderClass="org.jboss.SpecialTokenProvider"
- TokenType="specialToken"
- TokenElement="SpecialToken"
- TokenElementNS="http://www.tokens.org">
- <Property Name="Property1" Value="Value1"/>
- <Property Name="Property2" Value="Value2"/>
- </TokenProvider>
- </TokenProviders>
- <ServiceProviders>
- <ServiceProvider Endpoint="http://provider.endpoint/provider"
- TokenType="specialToken"
- TruststoreAlias="providerAlias"/>
- </ServiceProviders>
-</JBossSTS>
\ No newline at end of file