aboutsummaryrefslogtreecommitdiff
path: root/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java
diff options
context:
space:
mode:
Diffstat (limited to 'spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java')
-rw-r--r--spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java190
1 files changed, 190 insertions, 0 deletions
diff --git a/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java
new file mode 100644
index 000000000..59fa200ac
--- /dev/null
+++ b/spss/server/serverlib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2003 Federal Chancellery Austria
+ * MOA-SPSS has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+
+package test.at.gv.egovernment.moa.spss.server.config;
+
+import iaik.asn1.structures.Name;
+import iaik.utils.RFC2253NameParser;
+import iaik.utils.RFC2253NameParserException;
+import iaik.x509.X509Certificate;
+
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.w3c.dom.Element;
+
+import at.gv.egovernment.moa.spss.MOAException;
+import at.gv.egovernment.moa.spss.server.config.ConfigurationException;
+import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
+import at.gv.egovernment.moa.util.Constants;
+
+/**
+ * @author Gregor Karlinger
+ * @version $Id$
+ */
+public class ConfigurationProviderTest3 extends TestCase
+{
+ private static final String CONFIG_BASE_ =
+ "e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/";
+
+ static at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_;
+
+ static
+ {
+ System.setProperty(
+ "log4j.configuration",
+ "file:/" + CONFIG_BASE_ + "log4j.properties");
+ System.setProperty(
+ at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME,
+ CONFIG_BASE_ + "moa.sp.noopts-config.xml");
+ try
+ {
+ ConfigurationProvider.reload();
+ provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance();
+ }
+ catch (ConfigurationException e)
+ {
+ throw new RuntimeException("Fehler beim Setup des Tests: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Constructor for ConfigurationProvider.
+ * @param arg0
+ */
+ public ConfigurationProviderTest3() throws MOAException
+ {
+ super("ConfigurationProvider");
+ }
+
+ public void testGetWarnings()
+ {
+ // 3 Warnings should be collected: C14N not found, DigestMethod not found, ArchiveDuration not found
+ assertEquals(3, provider_.getWarnings().size());
+ }
+
+ public void testGetDigestMethodAlgorithmName()
+ {
+ // Element is missing in config file, check if default value is returned
+ assertEquals(
+ Constants.SHA1_URI,
+ provider_.getDigestMethodAlgorithmName());
+ }
+
+ public void testGetCanonicalizationAlgorithmName()
+ {
+ // Element is missing in config file, check if default value is returned
+ assertEquals(
+ Constants.C14N_URI,
+ provider_.getCanonicalizationAlgorithmName());
+ }
+
+ public void testGetHardwareCryptoModules()
+ {
+ // No hardware crypto modules in config file, check for empty list
+ List hwcms = provider_.getHardwareCryptoModules();
+ assertEquals(0, hwcms.size());
+ }
+
+ public void testGetHardwareKeyModules()
+ {
+ // No hardware key modules in config file, check for empty list
+ List hwkms = provider_.getHardwareKeyModules();
+ assertEquals(0, hwkms.size());
+ }
+
+ public void testGetSoftwareKeyModules()
+ {
+ // No software key modules in config file, check for empty list
+ List swkms = provider_.getSoftwareKeyModules();
+ assertEquals(0, swkms.size());
+ }
+
+ public void testGetDistributionPoints() throws RFC2253NameParserException
+ {
+ // No distribution points in config file, check for emtpy set
+ X509Certificate cert = new X509Certificate();
+ RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer");
+ Name name = parser.parse();
+ cert.setIssuerDN(name);
+
+ Set dps = provider_.getDistributionPoints(cert);
+ assertEquals(0, dps.size());
+ }
+
+ public void testGetCRLArchiveDuration()
+ {
+ // No archive duration in config file, check for default value
+ assertEquals(0, provider_.getCRLArchiveDuration());
+ }
+
+ public void testGetCreateTransformsInfoProfile()
+ {
+ // No profile in config file, check for null
+ Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1");
+ assertNull(ctip1);
+ }
+
+ public void testGetCreateSignatureEnvironmentProfile()
+ {
+ // No profile in config file, check for null
+ Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1");
+ assertNull(csep);
+ }
+
+ public void testGetVerifyTransformsInfoProfile()
+ {
+ // No profile in config file, check for null
+ Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1");
+ assertNull(vtip);
+ }
+
+ public void testGetSupplementProfile()
+ {
+ // No profile in config file, check for null
+ Element sp = provider_.getSupplementProfile("SP_1");
+ assertNull(sp);
+ }
+
+ public void testGetRevocationArchiveJDBCURL()
+ {
+ // No archive in config file, check for null
+ assertNull(provider_.getRevocationArchiveJDBCURL());
+ }
+
+ public void testGetRevocationArchiveJDBCDriverClass()
+ {
+ // No archive in config file, check for null
+ assertNull(provider_.getRevocationArchiveJDBCDriverClass());
+ }
+
+ public void testGetServiceOrder()
+ {
+ // Element is missing in config file, check for empty array
+ String[] serviceOrder = provider_.getServiceOrder();
+ assertEquals(0, serviceOrder.length);
+ }
+}