aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/config/proxy/MOAIDProxyConfigurationProviderTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/config/proxy/MOAIDProxyConfigurationProviderTest.java')
-rw-r--r--id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/config/proxy/MOAIDProxyConfigurationProviderTest.java142
1 files changed, 142 insertions, 0 deletions
diff --git a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/config/proxy/MOAIDProxyConfigurationProviderTest.java b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/config/proxy/MOAIDProxyConfigurationProviderTest.java
new file mode 100644
index 000000000..873dcca77
--- /dev/null
+++ b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/config/proxy/MOAIDProxyConfigurationProviderTest.java
@@ -0,0 +1,142 @@
+/*
+* Copyright 2003 Federal Chancellery Austria
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package test.at.gv.egovernment.moa.id.config.proxy;
+
+import java.util.Map;
+
+import at.gv.egovernment.moa.id.config.ConnectionParameter;
+import at.gv.egovernment.moa.id.config.proxy.OAConfiguration;
+import at.gv.egovernment.moa.id.config.proxy.ProxyConfigurationProvider;
+import at.gv.egovernment.moa.id.config.proxy.OAProxyParameter;
+
+import test.at.gv.egovernment.moa.id.UnitTestCase;
+
+
+
+/**
+ * @author Stefan Knirsch
+ * @version $Id$
+ */
+public class MOAIDProxyConfigurationProviderTest extends UnitTestCase {
+ private ProxyConfigurationProvider provider;
+
+ /**
+ * Constructor for MOAProxyConfigTest.
+ * @param name
+ */
+ public MOAIDProxyConfigurationProviderTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+
+ provider =
+// new ProxyConfigurationProvider(TESTDATA_ROOT + "conf/ConfigurationTest.xml");
+ new ProxyConfigurationProvider("data/deploy/conf/moa-id/ConfigurationTest.xml");
+ }
+ public void testGetAuthComponentConnectionParameter()
+ {
+ ConnectionParameter cp;
+ cp = provider.getAuthComponentConnectionParameter();
+ assertEquals(cp.getUrl(),"AuthComponentURL");
+ assertEquals( cp.getAcceptedServerCertificates(),"http://www.altova.com");
+ assertEquals(cp.getClientKeyStorePassword(),"String");
+ assertEquals(cp.getClientKeyStore(),"http://www.altova.com");
+ /* System.out.println();
+ System.out.println("getProxyComponentConnectionParameter :" + cp.getUrl());
+ System.out.println(
+ "getProxyComponentConnectionParameter :" + cp.getAcceptedServerCertificates());
+ System.out.println(
+ "getProxyComponentConnectionParameter :" + cp.getClientKeyStorePassword());
+ System.out.println(
+ "getProxyComponentConnectionParameter :" + cp.getClientKeyStore());*/
+}
+
+ public void testGetOAProxyParameter() {
+ OAProxyParameter[] result = provider.getOnlineApplicationParameters();
+
+ assertEquals("http://localhost:9080/", result[0].getPublicURLPrefix());
+ assertEquals("file:data/test/conf/OAConfParamAuth.xml", result[0].getConfigFileURL());
+ assertEquals(10, result[0].getSessionTimeOut());
+ assertEquals("StringloginParameterResolverImpl1", result[0].getLoginParameterResolverImpl());
+ assertEquals("StringconnectionBuilderImpl1", result[0].getConnectionBuilderImpl());
+
+ assertEquals("ProxyComponentURL", result[0].getConnectionParameter().getUrl());
+ assertEquals("url:AcceptedServerCertificates", result[0].getConnectionParameter().getAcceptedServerCertificates());
+ assertEquals("URL:toClientKeystoreOA", result[0].getConnectionParameter().getClientKeyStore());
+ assertEquals("ClientKeystoreOAPAss", result[0].getConnectionParameter().getClientKeyStorePassword());
+
+ assertEquals("StringOALoginURL2", result[1].getPublicURLPrefix());
+ assertEquals("file:data/test/conf/OAConfHeaderAuth.xml", result[1].getConfigFileURL());
+ assertEquals(20, result[1].getSessionTimeOut());
+ assertEquals("StringloginParameterResolverImpl2",result[1].getLoginParameterResolverImpl());
+ assertEquals("StringconnectionBuilderImpl2", result[1].getConnectionBuilderImpl());
+
+ assertEquals("ProxyComponentURL2", result[1].getConnectionParameter().getUrl());
+ assertEquals("url:AcceptedServerCertificates2", result[1].getConnectionParameter().getAcceptedServerCertificates());
+ assertEquals("URL:toClientKeystoreOA2", result[1].getConnectionParameter().getClientKeyStore());
+ assertEquals("ClientKeystoreOAPAss2", result[1].getConnectionParameter().getClientKeyStorePassword());
+
+ assertEquals("StringOALoginURL3", result[2].getPublicURLPrefix());
+ assertEquals("file:data/test/conf/OAConfBasicAuth.xml", result[2].getConfigFileURL());
+ assertEquals(20, result[2].getSessionTimeOut());
+ assertEquals("StringloginParameterResolverImpl3",result[2].getLoginParameterResolverImpl());
+ assertEquals("StringconnectionBuilderImpl3", result[2].getConnectionBuilderImpl());
+
+ assertEquals("ProxyComponentURL3", result[2].getConnectionParameter().getUrl());
+ assertEquals("url:AcceptedServerCertificates3", result[2].getConnectionParameter().getAcceptedServerCertificates());
+ assertEquals("URL:toClientKeystoreOA3", result[2].getConnectionParameter().getClientKeyStore());
+ assertEquals("ClientKeystoreOAPAss3", result[2].getConnectionParameter().getClientKeyStorePassword());
+ }
+
+ public void testGetGenericConfiguration() {
+ Map result = provider.getGenericConfiguration();
+ assertEquals(true, result.containsKey("authenticationSessionTimeOut"));
+ assertEquals(true, result.containsKey("authenticationDataTimeOut"));
+ assertEquals("600", result.get("authenticationSessionTimeOut"));
+ assertEquals("120", result.get("authenticationDataTimeOut"));
+ }
+
+ public void testOAConfigurationProvider() throws Exception
+ {
+ OAProxyParameter[] result = provider.getOnlineApplicationParameters();
+ // für jeden Parameter müsste theoretisch bereits ein Provider instanziiert worden sein,
+ // aus diesem Grund braucht man NICHT mehr die File-URL anzugeben, PublicURLPrefix reicht
+
+ // sollte ParamAuth sein
+ OAConfiguration oac1 = result[0].getOaConfiguration();
+ assertEquals(OAConfiguration.PARAM_AUTH, oac1.getAuthType());
+ assertEquals("MOADateOfBirth", oac1.getParamAuthMapping().get("Param1"));
+ assertEquals("MOABPK", oac1.getParamAuthMapping().get("Param2"));
+ // sollte HeaderAuth sein
+ OAConfiguration oac2 = result[1].getOaConfiguration();
+ assertEquals(OAConfiguration.HEADER_AUTH, oac2.getAuthType());
+ assertEquals("MOAPublicAuthority", oac2.getHeaderAuthMapping().get("Param1"));
+ assertEquals("MOABKZ", oac2.getHeaderAuthMapping().get("Param2"));
+ assertEquals("MOAQualifiedCertificate", oac2.getHeaderAuthMapping().get("Param3"));
+ assertEquals("MOAStammzahl", oac2.getHeaderAuthMapping().get("Param4"));
+ assertEquals("MOAIPAddress", oac2.getHeaderAuthMapping().get("Param5"));
+
+ // sollte BasicAuth sein
+ OAConfiguration oac3 = result[2].getOaConfiguration();
+ assertEquals(OAConfiguration.BASIC_AUTH, oac3.getAuthType());
+ assertEquals("MOAGivenName", oac3.getBasicAuthUserIDMapping());
+ assertEquals("MOAFamilyName", oac3.getBasicAuthPasswordMapping());
+ //Fehlerfall:
+
+
+ }
+}