aboutsummaryrefslogtreecommitdiff
path: root/spss.server/src/test/at/gv/egovernment/moa/spss
diff options
context:
space:
mode:
authorgregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d>2005-08-11 13:22:41 +0000
committergregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d>2005-08-11 13:22:41 +0000
commita67ed8406bb7f9d4bca48891308e7bfead90efe4 (patch)
treecd351f4a11be4c3ea9e3ecbf4b17da54353c2e35 /spss.server/src/test/at/gv/egovernment/moa/spss
parent8cf117a1d3ae7381c335e037a0a5b97daef08667 (diff)
downloadmoa-id-spss-a67ed8406bb7f9d4bca48891308e7bfead90efe4.tar.gz
moa-id-spss-a67ed8406bb7f9d4bca48891308e7bfead90efe4.tar.bz2
moa-id-spss-a67ed8406bb7f9d4bca48891308e7bfead90efe4.zip
Bug 271: Adpation auf neue Struktur des Konfigurationsfiles abgeschlossen. Modultests durchgeführt.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@436 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'spss.server/src/test/at/gv/egovernment/moa/spss')
-rw-r--r--spss.server/src/test/at/gv/egovernment/moa/spss/AllTests.java3
-rw-r--r--spss.server/src/test/at/gv/egovernment/moa/spss/server/config/AllTests.java20
-rw-r--r--spss.server/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java (renamed from spss.server/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest.java)144
-rw-r--r--spss.server/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java225
-rw-r--r--spss.server/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java166
5 files changed, 503 insertions, 55 deletions
diff --git a/spss.server/src/test/at/gv/egovernment/moa/spss/AllTests.java b/spss.server/src/test/at/gv/egovernment/moa/spss/AllTests.java
index 9935685d0..c670b5e55 100644
--- a/spss.server/src/test/at/gv/egovernment/moa/spss/AllTests.java
+++ b/spss.server/src/test/at/gv/egovernment/moa/spss/AllTests.java
@@ -1,6 +1,5 @@
package test.at.gv.egovernment.moa.spss;
-import test.at.gv.egovernment.moa.spss.server.config.ConfigurationProviderTest;
import test.at.gv.egovernment.moa.spss.server.iaik.config.ConfigurationDataImplTest;
import test.at.gv.egovernment.moa.spss.server.iaik.config.IaikConfiguratorTest;
import test.at.gv.egovernment.moa.spss.server.tools.CertToolTest;
@@ -20,7 +19,7 @@ public class AllTests {
public static Test suite() {
TestSuite suite = new TestSuite();
- suite.addTestSuite(ConfigurationProviderTest.class);
+ suite.addTestSuite(test.at.gv.egovernment.moa.spss.server.config.AllTests.class);
suite.addTestSuite(ConfigurationDataImplTest.class);
suite.addTestSuite(IaikConfiguratorTest.class);
suite.addTest(
diff --git a/spss.server/src/test/at/gv/egovernment/moa/spss/server/config/AllTests.java b/spss.server/src/test/at/gv/egovernment/moa/spss/server/config/AllTests.java
new file mode 100644
index 000000000..131f38c19
--- /dev/null
+++ b/spss.server/src/test/at/gv/egovernment/moa/spss/server/config/AllTests.java
@@ -0,0 +1,20 @@
+package test.at.gv.egovernment.moa.spss.server.config;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author Gregor Karlinger
+ * @version $Id$
+ */
+public class AllTests
+{
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTestSuite(ConfigurationProviderTest1.class);
+ suite.addTestSuite(ConfigurationProviderTest2.class);
+ suite.addTestSuite(ConfigurationProviderTest3.class);
+ return suite;
+ }
+}
diff --git a/spss.server/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest.java b/spss.server/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java
index 68191477e..08f0a9523 100644
--- a/spss.server/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest.java
+++ b/spss.server/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java
@@ -1,11 +1,13 @@
package test.at.gv.egovernment.moa.spss.server.config;
import iaik.asn1.structures.Name;
+import iaik.pki.pathvalidation.ChainingModes;
import iaik.utils.RFC2253NameParser;
import iaik.utils.RFC2253NameParserException;
import iaik.x509.X509Certificate;
import java.math.BigInteger;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -16,6 +18,8 @@ import org.w3c.dom.Element;
import at.gv.egovernment.moa.spss.MOAException;
import at.gv.egovernment.moa.spss.server.config.CRLDistributionPoint;
+import at.gv.egovernment.moa.spss.server.config.ConfigurationException;
+import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
import at.gv.egovernment.moa.spss.server.config.HardwareCryptoModule;
import at.gv.egovernment.moa.spss.server.config.HardwareKeyModule;
import at.gv.egovernment.moa.spss.server.config.KeyGroup;
@@ -23,31 +27,47 @@ import at.gv.egovernment.moa.spss.server.config.KeyGroupEntry;
import at.gv.egovernment.moa.spss.server.config.OCSPDistributionPoint;
import at.gv.egovernment.moa.spss.server.config.SoftwareKeyModule;
import at.gv.egovernment.moa.spss.server.config.TrustProfile;
+import at.gv.egovernment.moa.util.Constants;
/**
* @author Gregor Karlinger
* @version $Id$
*/
-public class ConfigurationProviderTest extends TestCase
+public class ConfigurationProviderTest1 extends TestCase
{
private static final String CONFIG_BASE_ =
"e:/cio/projekte/basismodule/wartung/projekt/spss.server/res/test/resources/config/";
- at.gv.egovernment.moa.spss.server.config.ConfigurationProvider provider_;
+ 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.spss.complete-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);
+ }
+ }
/**
* Constructor for ConfigurationProvider.
* @param arg0
*/
- public ConfigurationProviderTest() throws MOAException
+ public ConfigurationProviderTest1() throws MOAException
{
super("ConfigurationProvider");
- System.setProperty(
- at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.CONFIG_PROPERTY_NAME,
- CONFIG_BASE_ + "moa.spss.complete-config.xml");
- provider_ = at.gv.egovernment.moa.spss.server.config.ConfigurationProvider.getInstance();
}
-
+
public void testGetWarnings()
{
assertEquals(0, provider_.getWarnings().size());
@@ -56,15 +76,15 @@ public class ConfigurationProviderTest extends TestCase
public void testGetDigestMethodAlgorithmName()
{
assertEquals(
- "http://a.digest.method",
+ Constants.SHA1_URI,
provider_.getDigestMethodAlgorithmName());
}
public void testGetCanonicalizationAlgorithmName()
{
assertEquals(
- "http://an.c14n.alg",
- provider_.getDigestMethodAlgorithmName());
+ Constants.C14N_WITH_COMMENTS_URI,
+ provider_.getCanonicalizationAlgorithmName());
}
public void testGetHardwareCryptoModules()
@@ -79,7 +99,7 @@ public class ConfigurationProviderTest extends TestCase
HardwareCryptoModule hwc2 = (HardwareCryptoModule) hwcms.get(1);
assertEquals("HWC2_Name", hwc2.getName());
- assertNull(hwc1.getSlotID());
+ assertNull(hwc2.getSlotID());
assertEquals("HWC2_UserPIN", hwc2.getUserPIN());
}
@@ -108,12 +128,12 @@ public class ConfigurationProviderTest extends TestCase
SoftwareKeyModule swk1 = (SoftwareKeyModule) swkms.get(0);
assertEquals("SWK1_Id", swk1.getId());
- assertEquals("SWK1_FileName", swk1.getFileName());
+ assertEquals(CONFIG_BASE_ + "swk/SWK1_FileName.txt", swk1.getFileName().replace('\\', '/'));
assertEquals("SWK1_Password", swk1.getPassWord());
SoftwareKeyModule swk2 = (SoftwareKeyModule) swkms.get(1);
- assertEquals("HWK2_Id", swk2.getId());
- assertEquals("SWK1_FileName", swk2.getFileName());
+ assertEquals("SWK2_Id", swk2.getId());
+ assertEquals(CONFIG_BASE_ + "swk/SWK2_FileName.txt", swk2.getFileName().replace('\\', '/'));
assertNull(swk2.getPassWord());
}
@@ -129,15 +149,22 @@ public class ConfigurationProviderTest extends TestCase
Set kg1Entries = kg1.getKeyGroupEntries();
assertEquals(2, kg1Entries.size());
- KeyGroupEntry kg1Entry1 = (KeyGroupEntry) kg1Entries.toArray()[0];
- assertEquals("HWK1_Id", kg1Entry1.getModuleID());
- assertEquals("HWK1_Issuer", kg1Entry1.getIssuerDN());
- assertEquals(0, kg1Entry1.getSerialNumber().intValue());
-
- KeyGroupEntry kg1Entry2 = (KeyGroupEntry) kg1Entries.toArray()[1];
- assertEquals("HWK2_Id", kg1Entry1.getModuleID());
- assertEquals("HWK2_Issuer", kg1Entry1.getIssuerDN());
- assertEquals(1, kg1Entry2.getSerialNumber().intValue());
+ Iterator kg1EntriesIt = kg1Entries.iterator();
+ while(kg1EntriesIt.hasNext())
+ {
+ KeyGroupEntry currentEntry = (KeyGroupEntry)kg1EntriesIt.next();
+ if ("HWK1_Id".equals(currentEntry.getModuleID()))
+ {
+ assertEquals("CN=HWK1_Issuer", currentEntry.getIssuerDN());
+ assertEquals(0, currentEntry.getSerialNumber().intValue());
+ }
+ else if ("HWK2_Id".equals(currentEntry.getModuleID()))
+ {
+ assertEquals("CN=HWK2_Issuer", currentEntry.getIssuerDN());
+ assertEquals(1, currentEntry.getSerialNumber().intValue());
+ }
+ else fail("Invalid module identifer found.");
+ }
KeyGroup kg2 = (KeyGroup) keyGroups.get("KG2_Id");
assertNotNull(kg2);
@@ -146,15 +173,22 @@ public class ConfigurationProviderTest extends TestCase
Set kg2Entries = kg2.getKeyGroupEntries();
assertEquals(2, kg2Entries.size());
- KeyGroupEntry kg2Entry1 = (KeyGroupEntry) kg2Entries.toArray()[0];
- assertEquals("SWK1_Id", kg2Entry1.getModuleID());
- assertEquals("SWK1_Issuer", kg2Entry1.getIssuerDN());
- assertEquals(2, kg2Entry1.getSerialNumber().intValue());
-
- KeyGroupEntry kg2Entry2 = (KeyGroupEntry) kg2Entries.toArray()[1];
- assertEquals("SWK2_Id", kg2Entry2.getModuleID());
- assertEquals("SWK2_Issuer", kg2Entry2.getIssuerDN());
- assertEquals(3, kg2Entry2.getSerialNumber().intValue());
+ Iterator kg2EntriesIt = kg1Entries.iterator();
+ while(kg1EntriesIt.hasNext())
+ {
+ KeyGroupEntry currentEntry = (KeyGroupEntry)kg2EntriesIt.next();
+ if ("SWK1_Id".equals(currentEntry.getModuleID()))
+ {
+ assertEquals("CN=CN=SWK1_Issuer", currentEntry.getIssuerDN());
+ assertEquals(2, currentEntry.getSerialNumber().intValue());
+ }
+ else if ("SWK2_Id".equals(currentEntry.getModuleID()))
+ {
+ assertEquals("CN=SWK2_Issuer", currentEntry.getIssuerDN());
+ assertEquals(3, currentEntry.getSerialNumber().intValue());
+ }
+ else fail("Invalid module identifer found.");
+ }
}
public void testGetKeyGroupEntries() throws RFC2253NameParserException
@@ -164,11 +198,15 @@ public class ConfigurationProviderTest extends TestCase
Set kgEntries = provider_.getKeyGroupEntries(name, BigInteger.valueOf(4), "KG1_Id");
assertEquals(2, kgEntries.size());
- KeyGroupEntry kgEntry1 = (KeyGroupEntry) kgEntries.toArray()[0];
- assertEquals("HWK1_Id", kgEntry1.getModuleID());
-
- KeyGroupEntry kgEntry2 = (KeyGroupEntry) kgEntries.toArray()[1];
- assertEquals("HWK2_Id", kgEntry2.getModuleID());
+ Iterator kgEntriesIt = kgEntries.iterator();
+ while (kgEntriesIt.hasNext())
+ {
+ KeyGroupEntry currentEntry = (KeyGroupEntry) kgEntriesIt.next();
+ if (!"HWK1_Id".equals(currentEntry.getModuleID()) && !"HWK2_Id".equals(currentEntry.getModuleID()))
+ {
+ fail("Invalid module identifier found.");
+ }
+ }
}
public void testGetChainingMode() throws RFC2253NameParserException
@@ -178,13 +216,13 @@ public class ConfigurationProviderTest extends TestCase
Name name = parser.parse();
cert.setIssuerDN(name);
cert.setSerialNumber(BigInteger.valueOf(0));
- assertEquals("pkix", provider_.getChainingMode(cert)); // Default chaining mode
+ assertEquals(ChainingModes.PKIX_MODE, provider_.getChainingMode(cert)); // Default chaining mode
parser = new RFC2253NameParser("CN=TA1_Issuer");
name = parser.parse();
cert.setIssuerDN(name);
cert.setSerialNumber(BigInteger.valueOf(5));
- assertEquals("chaining", provider_.getChainingMode(cert));
+ assertEquals(ChainingModes.CHAIN_MODE, provider_.getChainingMode(cert));
}
public void testGetDistributionPoints() throws RFC2253NameParserException
@@ -212,7 +250,7 @@ public class ConfigurationProviderTest extends TestCase
assertEquals(reasonCodes, dp1.getReasonCodes());
CRLDistributionPoint dp2 = (CRLDistributionPoint) dps.toArray()[1];
- assertEquals("hhttp://crl.myotherca.org", dp2.getUri());
+ assertEquals("http://crl.myotherca.org", dp2.getUri());
reasonCodes =
iaik.asn1.structures.DistributionPoint.aACompromise |
iaik.asn1.structures.DistributionPoint.affiliationChanged;
@@ -242,45 +280,45 @@ public class ConfigurationProviderTest extends TestCase
public void testGetCertStoreLocation()
{
assertEquals(
- CONFIG_BASE_ + "certstore",
- provider_.getCertStoreLocation());
+ CONFIG_BASE_ + "certstore_test",
+ provider_.getCertStoreLocation().replace('\\', '/'));
}
public void testGetCreateTransformsInfoProfile()
{
Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1");
- assertEquals("CTIP1", ctip1.getLocalName());
+ assertEquals("CreateTransformsInfoProfile", ctip1.getLocalName());
Element ctip2 = provider_.getCreateTransformsInfoProfile("CTIP_2");
- assertEquals("CTIP2", ctip2.getLocalName());
+ assertEquals("CreateTransformsInfoProfile", ctip2.getLocalName());
}
public void testGetCreateSignatureEnvironmentProfile()
{
- Element csep = provider_.getCreateTransformsInfoProfile("CSEP_1");
- assertEquals("CSEP1", csep.getLocalName());
+ Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1");
+ assertEquals("CreateSignatureEnvironmentProfile", csep.getLocalName());
}
public void testGetVerifyTransformsInfoProfile()
{
- Element vtip = provider_.getCreateTransformsInfoProfile("VTIP_1");
- assertEquals("VTIP1", vtip.getLocalName());
+ Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1");
+ assertEquals("VerifyTransformsInfoProfile", vtip.getLocalName());
}
public void testGetSupplementProfile()
{
- Element sp = provider_.getCreateTransformsInfoProfile("SP_1");
- assertEquals("SP1", sp.getLocalName());
+ Element sp = provider_.getSupplementProfile("SP_1");
+ assertEquals("SupplementProfile", sp.getLocalName());
}
public void testGetTrustProfile()
{
TrustProfile tp1 = provider_.getTrustProfile("TP1_Id");
assertEquals(
- "file:" + CONFIG_BASE_ + "trustprofiles/tp1/anchors",
+ "file:/" + CONFIG_BASE_ + "trustprofiles/tp1/anchors",
tp1.getUri());
assertEquals(
- "file:" + CONFIG_BASE_ + "trustprofiles/tp1/signercerts",
+ "file:/" + CONFIG_BASE_ + "trustprofiles/tp1/signercerts",
tp1.getSignerCertsUri());
TrustProfile tp2 = provider_.getTrustProfile("TP2_Id");
diff --git a/spss.server/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java b/spss.server/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java
new file mode 100644
index 000000000..85515bce5
--- /dev/null
+++ b/spss.server/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java
@@ -0,0 +1,225 @@
+package test.at.gv.egovernment.moa.spss.server.config;
+
+import iaik.asn1.structures.Name;
+import iaik.pki.pathvalidation.ChainingModes;
+import iaik.utils.RFC2253NameParser;
+import iaik.utils.RFC2253NameParserException;
+import iaik.x509.X509Certificate;
+
+import java.math.BigInteger;
+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.spss.server.config.TrustProfile;
+import at.gv.egovernment.moa.util.Constants;
+
+/**
+ * @author Gregor Karlinger
+ * @version $Id$
+ */
+public class ConfigurationProviderTest2 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.ss.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);
+ }
+ }
+
+
+ /**
+ * Constructor for ConfigurationProvider.
+ * @param arg0
+ */
+ public ConfigurationProviderTest2() 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()
+ {
+ List hwkms = provider_.getHardwareKeyModules();
+ assertEquals(1, 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 testGetChainingMode() throws RFC2253NameParserException
+ {
+ // Default Chaining Mode not set in configuration, check for default value
+ X509Certificate cert = new X509Certificate();
+ RFC2253NameParser parser = new RFC2253NameParser("CN=Unknown");
+ Name name = parser.parse();
+ cert.setIssuerDN(name);
+ cert.setSerialNumber(BigInteger.valueOf(0));
+ assertEquals(ChainingModes.PKIX_MODE, provider_.getChainingMode(cert));
+ }
+
+ public void testGetDistributionPoints() throws RFC2253NameParserException
+ {
+ // Element is missing in config file, check if emty list is returned
+ 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()
+ {
+ // Element is missing in config file, check if default value is returned
+ assertEquals(0, provider_.getCRLArchiveDuration());
+ }
+
+ public void testGetEnableRevocationArchiving()
+ {
+ // Element is missing in config file, check if default value is returned
+ assertFalse(provider_.getEnableRevocationArchiving());
+ }
+
+ public void testGetCertStoreLocation()
+ {
+ // Element is missing in config file, check if default value is returned
+ assertEquals(
+ CONFIG_BASE_ + "certstore",
+ provider_.getCertStoreLocation().replace('\\', '/'));
+ }
+
+ 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 testGetTrustProfile()
+ {
+ // No trust profiles config file, check for null
+ TrustProfile tp1 = provider_.getTrustProfile("TP1_Id");
+ assertNull(tp1);
+ }
+
+ public void testGetRevocationArchiveJDBCURL()
+ {
+ // Element is missing in config file, check for null
+ assertNull(provider_.getRevocationArchiveJDBCURL());
+ }
+
+ public void testGetRevocationArchiveJDBCDriverClass()
+ {
+ // Element is missing in config file, check for null
+ assertNull(provider_.getRevocationArchiveJDBCDriverClass());
+ }
+
+ public void testGetEnableRevocationChecking()
+ {
+ // Element is missing in config file, check for default value
+ assertFalse(provider_.getEnableRevocationChecking());
+ }
+
+ public void testGetMaxRevocationAge()
+ {
+ // Element is missing in config file, check for default value
+ assertEquals(0, provider_.getMaxRevocationAge());
+ }
+
+ public void testGetServiceOrder()
+ {
+ // Element is missing in config file, check for empty array
+ String[] serviceOrder = provider_.getServiceOrder();
+ assertEquals(0, serviceOrder.length);
+ }
+
+ public void testGetAutoAddCertificates()
+ {
+ // Element is missing in config file, check for default value
+ assertFalse(provider_.getAutoAddCertificates());
+ }
+
+ public void testGetUseAuthorityInfoAccess()
+ {
+ // Element is missing in config file, check for default value
+ assertFalse(provider_.getUseAuthorityInfoAccess());
+ }
+}
diff --git a/spss.server/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java b/spss.server/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java
new file mode 100644
index 000000000..3416fcfb0
--- /dev/null
+++ b/spss.server/src/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java
@@ -0,0 +1,166 @@
+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);
+ }
+ }
+
+ /**
+ * 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);
+ }
+}