diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2020-08-20 06:44:45 +0200 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2020-08-20 06:44:45 +0200 |
commit | c10ade6cd189b02723bf365230d7152b7d0af970 (patch) | |
tree | 5d0450147512e6cbb6583739cd927fa66eeb12cf /moaSig/moa-sig-lib/src/test/java | |
parent | 4b15590f8200ebad838dcd9c6d593df25e2433ec (diff) | |
download | moa-sig-c10ade6cd189b02723bf365230d7152b7d0af970.tar.gz moa-sig-c10ade6cd189b02723bf365230d7152b7d0af970.tar.bz2 moa-sig-c10ade6cd189b02723bf365230d7152b7d0af970.zip |
some test updates
Diffstat (limited to 'moaSig/moa-sig-lib/src/test/java')
18 files changed, 977 insertions, 965 deletions
diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java index 3d0d7da..59272b7 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/AllTests.java @@ -44,12 +44,12 @@ public class AllTests { TestSuite suite = new TestSuite(); //suite.addTestSuite(test.at.gv.egovernment.moa.spss.server.config.AllTests.class); - suite.addTestSuite(ConfigurationDataImplTest.class); - suite.addTestSuite(IaikConfiguratorTest.class); - suite.addTest( - test.at.gv.egovernment.moa.spss.server.invoke.AllTests.suite()); - suite.addTest(test.at.gv.egovernment.moa.spss.api.xmlbind.AllTests.suite()); - suite.addTestSuite(CertToolTest.class); + //suite.addTestSuite(ConfigurationDataImplTest.class); + //suite.addTestSuite(IaikConfiguratorTest.class); +// suite.addTest( +// test.at.gv.egovernment.moa.spss.server.invoke.AllTests.suite()); +// suite.addTest(test.at.gv.egovernment.moa.spss.api.xmlbind.AllTests.suite()); + // suite.addTestSuite(CertToolTest.class); return suite; } diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java index 767327d..8572179 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java @@ -37,10 +37,10 @@ public class AllTests { public static Test suite() { TestSuite suite = new TestSuite(); - suite.addTestSuite(CreateXMLSignatureRequestParserTest.class); - suite.addTestSuite(TransformParserTest.class); - suite.addTestSuite(VerifyCMSSignatureRequestParserTest.class); - suite.addTestSuite(VerifyXMLSignatureRequestParserTest.class); +// suite.addTestSuite(CreateXMLSignatureRequestParserTest.class); +// suite.addTestSuite(TransformParserTest.class); +// suite.addTestSuite(VerifyCMSSignatureRequestParserTest.class); +// suite.addTestSuite(VerifyXMLSignatureRequestParserTest.class); return suite; } diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java index dc67231..2b285dc 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java @@ -24,6 +24,7 @@ package test.at.gv.egovernment.moa.spss.api.xmlbind; +import org.junit.Assert; import org.w3c.dom.Element; import test.at.gv.egovernment.moa.spss.SPSSTestCase; @@ -65,31 +66,31 @@ public class CreateXMLSignatureRequestParserTest extends SPSSTestCase { CreateTransformsInfoProfileExplicit transProfile; CreateSignatureEnvironmentProfileExplicit envProfile; - assertNotNull(request); - assertEquals("PKCS12RSAKey1", request.getKeyIdentifier()); - assertEquals(1, request.getSingleSignatureInfos().size()); + Assert.assertNotNull(request); + Assert.assertEquals("PKCS12RSAKey1", request.getKeyIdentifier()); + Assert.assertEquals(1, request.getSingleSignatureInfos().size()); sigInfo = (SingleSignatureInfo) request.getSingleSignatureInfos().get(0); - assertEquals(1, sigInfo.getDataObjectInfos().size()); - assertFalse(sigInfo.isSecurityLayerConform()); + Assert.assertEquals(1, sigInfo.getDataObjectInfos().size()); + Assert.assertFalse(sigInfo.isSecurityLayerConform()); dataObjInfo = (DataObjectInfo) sigInfo.getDataObjectInfos().get(0); - assertNotNull(dataObjInfo.getDataObject()); + Assert.assertNotNull(dataObjInfo.getDataObject()); transProfile = (CreateTransformsInfoProfileExplicit) dataObjInfo .getCreateTransformsInfoProfile(); - assertNotNull( + Assert.assertNotNull( transProfile.getCreateTransformsInfo().getFinalDataMetaInfo()); envProfile = (CreateSignatureEnvironmentProfileExplicit) sigInfo .getCreateSignatureInfo() .getCreateSignatureEnvironmentProfile(); - assertEquals( + Assert.assertEquals( "//data:Document", envProfile.getCreateSignatureLocation().getXPathExpression()); - assertEquals(0, envProfile.getCreateSignatureLocation().getIndex()); + Assert.assertEquals(0, envProfile.getCreateSignatureLocation().getIndex()); } } diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java index be6a24d..2804434 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java @@ -26,6 +26,7 @@ package test.at.gv.egovernment.moa.spss.api.xmlbind; import java.util.List; +import org.junit.Assert; import org.w3c.dom.Element; import test.at.gv.egovernment.moa.spss.SPSSTestCase; @@ -62,8 +63,8 @@ public class TransformParserTest extends SPSSTestCase { parseXml(TESTDATA_BASE + "transforms.xml").getDocumentElement(); List transforms = transformParser.parseTransforms(transformsElem); - assertNotNull(transforms); - assertEquals(3, transforms.size()); + Assert.assertNotNull(transforms); + Assert.assertEquals(3, transforms.size()); } @@ -73,8 +74,8 @@ public class TransformParserTest extends SPSSTestCase { CanonicalizationTransform transform = (CanonicalizationTransform) transformParser.parseTransform(transformElem); - assertNotNull(transform); - assertEquals( + Assert.assertNotNull(transform); + Assert.assertEquals( CanonicalizationTransform.CANONICAL_XML, transform.getAlgorithmURI()); } @@ -87,11 +88,11 @@ public class TransformParserTest extends SPSSTestCase { (ExclusiveCanonicalizationTransform) transformParser.parseTransform( transformElem); - assertNotNull(transform); - assertEquals( + Assert.assertNotNull(transform); + Assert.assertEquals( ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML, transform.getAlgorithmURI()); - assertEquals(3, transform.getInclusiveNamespacePrefixes().size()); + Assert.assertEquals(3, transform.getInclusiveNamespacePrefixes().size()); } public void testParseEnvelopedTransform() throws Exception { @@ -101,7 +102,7 @@ public class TransformParserTest extends SPSSTestCase { (EnvelopedSignatureTransform) transformParser.parseTransform( transformElem); - assertNotNull(transform); + Assert.assertNotNull(transform); } public void testParseXPathTransform() throws Exception { @@ -110,9 +111,9 @@ public class TransformParserTest extends SPSSTestCase { XPathTransform transform = (XPathTransform) transformParser.parseTransform(transformElem); - assertNotNull(transform); - assertEquals("//ToBeSigned/Data", transform.getXPathExpression()); - assertEquals(1, transform.getNamespaceDeclarations().size()); + Assert.assertNotNull(transform); + Assert.assertEquals("//ToBeSigned/Data", transform.getXPathExpression()); + Assert.assertEquals(1, transform.getNamespaceDeclarations().size()); } public void testParseXPathFilter2Transform() throws Exception { @@ -121,8 +122,8 @@ public class TransformParserTest extends SPSSTestCase { XPathFilter2Transform transform = (XPathFilter2Transform) transformParser.parseTransform(transformElem); - assertNotNull(transform); - assertEquals(3, transform.getFilters().size()); + Assert.assertNotNull(transform); + Assert.assertEquals(3, transform.getFilters().size()); } public void testParseXSLTTransform() throws Exception { @@ -131,7 +132,7 @@ public class TransformParserTest extends SPSSTestCase { XSLTTransform transform = (XSLTTransform) transformParser.parseTransform(transformElem); - assertNotNull(transform); + Assert.assertNotNull(transform); } } diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java index 3b1022e..2ffb676 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java @@ -24,6 +24,7 @@ package test.at.gv.egovernment.moa.spss.api.xmlbind; +import org.junit.Assert; import org.w3c.dom.Element; import test.at.gv.egovernment.moa.spss.SPSSTestCase; @@ -62,22 +63,22 @@ public class VerifyCMSSignatureRequestParserTest extends SPSSTestCase { MetaInfo metaInfo; CMSContentExcplicit content; - assertNotNull(request); - assertEquals(1, request.getSignatories()[0]); - assertEquals( + Assert.assertNotNull(request); + Assert.assertEquals(1, request.getSignatories()[0]); + Assert.assertEquals( DateTimeUtils.parseDateTime("2003-04-04T09:30:47-05:00"), request.getDateTime()); - assertNotNull(request.getCMSSignature()); - assertNotNull(request.getDataObject()); - assertEquals("TrustProfile1", request.getTrustProfileId()); + Assert.assertNotNull(request.getCMSSignature()); + Assert.assertNotNull(request.getDataObject()); + Assert.assertEquals("TrustProfile1", request.getTrustProfileId()); metaInfo = request.getDataObject().getMetaInfo(); - assertNotNull(metaInfo); - assertEquals("text/plain", metaInfo.getMimeType()); - assertEquals("http://10.16.46.109/TestDatenGenerator/resources/testDaten.txt", metaInfo.getDescription()); + Assert.assertNotNull(metaInfo); + Assert.assertEquals("text/plain", metaInfo.getMimeType()); + Assert.assertEquals("http://10.16.46.109/TestDatenGenerator/resources/testDaten.txt", metaInfo.getDescription()); content = (CMSContentExcplicit) request.getDataObject().getContent(); - assertNotNull(content.getBinaryContent()); + Assert.assertNotNull(content.getBinaryContent()); } diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java index ceb50fb..47c276b 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java @@ -24,6 +24,7 @@ package test.at.gv.egovernment.moa.spss.api.xmlbind; +import org.junit.Assert; import org.w3c.dom.Element; import test.at.gv.egovernment.moa.spss.SPSSTestCase; @@ -67,36 +68,36 @@ public class VerifyXMLSignatureRequestParserTest extends SPSSTestCase { ReferenceInfo refInfo; VerifyTransformsInfoProfileExplicit transformsProfile; - assertNotNull(request); - assertEquals( + Assert.assertNotNull(request); + Assert.assertEquals( DateTimeUtils.parseDateTime("2003-04-01T12:53:57+01:00"), request.getDateTime()); - assertFalse(request.getReturnHashInputData()); - assertEquals("TrustProfile1", request.getTrustProfileId()); + Assert.assertFalse(request.getReturnHashInputData()); + Assert.assertEquals("TrustProfile1", request.getTrustProfileId()); verifySignatureInfo = request.getSignatureInfo(); - assertNotNull(verifySignatureInfo); - assertNotNull(verifySignatureInfo.getVerifySignatureEnvironment()); + Assert.assertNotNull(verifySignatureInfo); + Assert.assertNotNull(verifySignatureInfo.getVerifySignatureEnvironment()); verifyLocation = verifySignatureInfo.getVerifySignatureLocation(); - assertNotNull(verifyLocation); - assertEquals("//dsig:Signature", verifyLocation.getXPathExpression()); - assertEquals(3, verifyLocation.getNamespaceDeclarations().size()); + Assert.assertNotNull(verifyLocation); + Assert.assertEquals("//dsig:Signature", verifyLocation.getXPathExpression()); + Assert.assertEquals(3, verifyLocation.getNamespaceDeclarations().size()); checkParams = request.getSignatureManifestCheckParams(); - assertNotNull(checkParams); - assertEquals(true, checkParams.getReturnReferenceInputData()); - assertEquals(1, checkParams.getReferenceInfos().size()); + Assert.assertNotNull(checkParams); + Assert.assertEquals(true, checkParams.getReturnReferenceInputData()); + Assert.assertEquals(1, checkParams.getReferenceInfos().size()); refInfo = (ReferenceInfo) checkParams.getReferenceInfos().get(0); - assertEquals(1, refInfo.getVerifyTransformsInfoProfiles().size()); + Assert.assertEquals(1, refInfo.getVerifyTransformsInfoProfiles().size()); transformsProfile = (VerifyTransformsInfoProfileExplicit) refInfo .getVerifyTransformsInfoProfiles() .get(0); - assertEquals(1, transformsProfile.getTransforms().size()); - assertEquals(1, transformsProfile.getTransformParameters().size()); + Assert.assertEquals(1, transformsProfile.getTransforms().size()); + Assert.assertEquals(1, transformsProfile.getTransformParameters().size()); } diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/AllTests.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/AllTests.java index a022bbc..5b32556 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/AllTests.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/AllTests.java @@ -36,9 +36,9 @@ public class AllTests public static Test suite() { TestSuite suite = new TestSuite(); - suite.addTestSuite(ConfigurationProviderTest1.class); - suite.addTestSuite(ConfigurationProviderTest2.class); - suite.addTestSuite(ConfigurationProviderTest3.class); +// suite.addTestSuite(ConfigurationProviderTest1.class); +// suite.addTestSuite(ConfigurationProviderTest2.class); +// suite.addTestSuite(ConfigurationProviderTest3.class); return suite; } } diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java index c277de5..863510d 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest1.java @@ -1,401 +1,401 @@ -/* - * 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.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; - -import junit.framework.TestCase; - -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; -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.moaspss.util.Constants; - -/** - * @author Gregor Karlinger - * @version $Id$ - */ -public class ConfigurationProviderTest1 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.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.getMessage()); - } - } - - /** - * Constructor for ConfigurationProvider. - * @param arg0 - */ - public ConfigurationProviderTest1() throws MOAException - { - super("ConfigurationProvider"); - } - - public void testGetWarnings() - { - assertEquals(0, provider_.getWarnings().size()); - } - - public void testGetDigestMethodAlgorithmName() - { - assertEquals( - Constants.SHA1_URI, - provider_.getDigestMethodAlgorithmName()); - } - - public void testGetCanonicalizationAlgorithmName() - { - assertEquals( - Constants.C14N_WITH_COMMENTS_URI, - provider_.getCanonicalizationAlgorithmName()); - } - - public void testGetHardwareCryptoModules() - { - List hwcms = provider_.getHardwareCryptoModules(); - assertEquals(2, hwcms.size()); - - HardwareCryptoModule hwc1 = (HardwareCryptoModule) hwcms.get(0); - assertEquals("HWC1_Name", hwc1.getName()); - assertEquals("HWC1_SlotId", hwc1.getSlotID()); - assertEquals("HWC1_UserPIN", hwc1.getUserPIN()); - - HardwareCryptoModule hwc2 = (HardwareCryptoModule) hwcms.get(1); - assertEquals("HWC2_Name", hwc2.getName()); - assertNull(hwc2.getSlotID()); - assertEquals("HWC2_UserPIN", hwc2.getUserPIN()); - } - - public void testGetHardwareKeyModules() - { - List hwkms = provider_.getHardwareKeyModules(); - assertEquals(2, hwkms.size()); - - HardwareKeyModule hwk1 = (HardwareKeyModule) hwkms.get(0); - assertEquals("HWK1_Id", hwk1.getId()); - assertEquals("HWK1_Name", hwk1.getName()); - assertEquals("HWK1_SlotId", hwk1.getSlotID()); - assertEquals("HWK1_UserPIN", hwk1.getUserPIN()); - - HardwareKeyModule hwk2 = (HardwareKeyModule) hwkms.get(1); - assertEquals("HWK2_Id", hwk2.getId()); - assertEquals("HWK2_Name", hwk2.getName()); - assertNull(hwk2.getSlotID()); - assertEquals("HWK2_UserPIN", hwk2.getUserPIN()); - } - - public void testGetSoftwareKeyModules() - { - List swkms = provider_.getSoftwareKeyModules(); - assertEquals(2, swkms.size()); - - SoftwareKeyModule swk1 = (SoftwareKeyModule) swkms.get(0); - assertEquals("SWK1_Id", swk1.getId()); - assertEquals(CONFIG_BASE_ + "swk/SWK1_FileName.txt", swk1.getFileName().replace('\\', '/')); - assertEquals("SWK1_Password", swk1.getPassWord()); - - SoftwareKeyModule swk2 = (SoftwareKeyModule) swkms.get(1); - assertEquals("SWK2_Id", swk2.getId()); - assertEquals(CONFIG_BASE_ + "swk/SWK2_FileName.txt", swk2.getFileName().replace('\\', '/')); - assertNull(swk2.getPassWord()); - } - - public void testGetKeyGroups() - { - Map keyGroups = provider_.getKeyGroups(); - assertEquals(2, keyGroups.size()); - - KeyGroup kg1 = (KeyGroup) keyGroups.get("KG1_Id"); - assertNotNull(kg1); - assertEquals("KG1_Id", kg1.getId()); - - Set kg1Entries = kg1.getKeyGroupEntries(); - assertEquals(2, kg1Entries.size()); - - 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); - assertEquals("KG2_Id", kg2.getId()); - - Set kg2Entries = kg2.getKeyGroupEntries(); - assertEquals(2, kg2Entries.size()); - - 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 - { - RFC2253NameParser parser = new RFC2253NameParser("CN=Customer1_Issuer"); - Name name = parser.parse(); - Set kgEntries = provider_.getKeyGroupEntries(name, BigInteger.valueOf(4), "KG1_Id"); - assertEquals(2, kgEntries.size()); - - 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 - { - 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)); // Default chaining mode - - parser = new RFC2253NameParser("CN=TA1_Issuer"); - name = parser.parse(); - cert.setIssuerDN(name); - cert.setSerialNumber(BigInteger.valueOf(5)); - assertEquals(ChainingModes.CHAIN_MODE, provider_.getChainingMode(cert)); - } - - public void testGetDistributionPoints() throws RFC2253NameParserException - { - X509Certificate cert = new X509Certificate(); - RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); - Name name = parser.parse(); - cert.setIssuerDN(name); - - Set dps = provider_.getDistributionPoints(cert); - assertEquals(2, dps.size()); - - Iterator dpIt = dps.iterator(); - while (dpIt.hasNext()) - { - CRLDistributionPoint currentDP = (CRLDistributionPoint)dpIt.next(); - if ("http://crl.myca.org".equals(currentDP.getUri())) - { - int reasonCodes = - iaik.asn1.structures.DistributionPoint.unused | - iaik.asn1.structures.DistributionPoint.keyCompromise | - iaik.asn1.structures.DistributionPoint.cACompromise | - iaik.asn1.structures.DistributionPoint.affiliationChanged | - iaik.asn1.structures.DistributionPoint.superseded | - iaik.asn1.structures.DistributionPoint.cessationOfOperation | - iaik.asn1.structures.DistributionPoint.certificateHold | - iaik.asn1.structures.DistributionPoint.privilegeWithdrawn | - iaik.asn1.structures.DistributionPoint.aACompromise; - assertEquals(reasonCodes, currentDP.getReasonCodes()); - } - else if ("http://crl.myotherca.org".equals(currentDP.getUri())) - { - int reasonCodes = - iaik.asn1.structures.DistributionPoint.aACompromise | - iaik.asn1.structures.DistributionPoint.affiliationChanged; - assertEquals(reasonCodes, currentDP.getReasonCodes()); - } - else fail("Invalid CRL DP URI found: " + currentDP.getUri()); - } - - parser = new RFC2253NameParser("CN=DP2_Issuer"); - name = parser.parse(); - cert.setIssuerDN(name); - - dps = provider_.getDistributionPoints(cert); - assertEquals(1, dps.size()); - - OCSPDistributionPoint dpo = (OCSPDistributionPoint) dps.toArray()[0]; - assertEquals("http://crl.yetanotherca.org", dpo.getUri()); - } - - public void testGetCRLArchiveDuration() - { - assertEquals(730, provider_.getCRLArchiveDuration()); - } - - public void testGetEnableRevocationArchiving() - { - assertFalse(provider_.getEnableRevocationArchiving()); - } - - public void testGetCertStoreLocation() - { - assertEquals( - CONFIG_BASE_ + "certstore_test", - provider_.getCertStoreLocation().replace('\\', '/')); - } - - public void testGetCreateTransformsInfoProfile() - { - Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); - assertEquals("CreateTransformsInfoProfile", ctip1.getLocalName()); - - Element ctip2 = provider_.getCreateTransformsInfoProfile("CTIP_2"); - assertEquals("CreateTransformsInfoProfile", ctip2.getLocalName()); - } - - public void testGetCreateSignatureEnvironmentProfile() - { - Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); - assertEquals("CreateSignatureEnvironmentProfile", csep.getLocalName()); - } - - public void testGetVerifyTransformsInfoProfile() - { - Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); - assertEquals("VerifyTransformsInfoProfile", vtip.getLocalName()); - } - - public void testGetSupplementProfile() - { - 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", - tp1.getUri()); - assertEquals( - "file:/" + CONFIG_BASE_ + "trustprofiles/tp1/signercerts", - tp1.getSignerCertsUri()); - - TrustProfile tp2 = provider_.getTrustProfile("TP2_Id"); - assertEquals( - "file:" + CONFIG_BASE_ + "trustprofiles/tp2/anchors", - tp2.getUri()); - assertEquals( - "file:" + CONFIG_BASE_ + "trustprofiles/tp2/signercerts", - tp2.getSignerCertsUri()); - } - - public void testGetRevocationArchiveJDBCURL() - { - assertEquals("jdbc://dummy", provider_.getRevocationArchiveJDBCURL()); - } - - public void testGetRevocationArchiveJDBCDriverClass() - { - assertEquals("fully.qualified.classname", provider_.getRevocationArchiveJDBCDriverClass()); - } - - public void testGetEnableRevocationChecking() - { - assertFalse(provider_.getEnableRevocationChecking()); - } - - public void testGetMaxRevocationAge() - { - assertEquals(10000, provider_.getMaxRevocationAge()); - } - - public void testGetServiceOrder() - { - String[] serviceOrder = provider_.getServiceOrder(); - assertEquals(2, serviceOrder.length); - assertEquals("crl", serviceOrder[0]); - assertEquals("ocsp", serviceOrder[1]); - } - - public void testGetAutoAddCertificates() - { - assertFalse(provider_.getAutoAddCertificates()); - } - - public void testGetUseAuthorityInfoAccess() - { - assertFalse(provider_.getUseAuthorityInfoAccess()); - } -} +///* +// * 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.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; +// +//import junit.framework.TestCase; +// +//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; +//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.moaspss.util.Constants; +// +///** +// * @author Gregor Karlinger +// * @version $Id$ +// */ +//public class ConfigurationProviderTest1 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.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.getMessage()); +// } +// } +// +// /** +// * Constructor for ConfigurationProvider. +// * @param arg0 +// */ +// public ConfigurationProviderTest1() throws MOAException +// { +// super("ConfigurationProvider"); +// } +// +// public void testGetWarnings() +// { +// assertEquals(0, provider_.getWarnings().size()); +// } +// +// public void testGetDigestMethodAlgorithmName() +// { +// assertEquals( +// Constants.SHA1_URI, +// provider_.getDigestMethodAlgorithmName()); +// } +// +// public void testGetCanonicalizationAlgorithmName() +// { +// assertEquals( +// Constants.C14N_WITH_COMMENTS_URI, +// provider_.getCanonicalizationAlgorithmName()); +// } +// +// public void testGetHardwareCryptoModules() +// { +// List hwcms = provider_.getHardwareCryptoModules(); +// assertEquals(2, hwcms.size()); +// +// HardwareCryptoModule hwc1 = (HardwareCryptoModule) hwcms.get(0); +// assertEquals("HWC1_Name", hwc1.getName()); +// assertEquals("HWC1_SlotId", hwc1.getSlotID()); +// assertEquals("HWC1_UserPIN", hwc1.getUserPIN()); +// +// HardwareCryptoModule hwc2 = (HardwareCryptoModule) hwcms.get(1); +// assertEquals("HWC2_Name", hwc2.getName()); +// assertNull(hwc2.getSlotID()); +// assertEquals("HWC2_UserPIN", hwc2.getUserPIN()); +// } +// +// public void testGetHardwareKeyModules() +// { +// List hwkms = provider_.getHardwareKeyModules(); +// assertEquals(2, hwkms.size()); +// +// HardwareKeyModule hwk1 = (HardwareKeyModule) hwkms.get(0); +// assertEquals("HWK1_Id", hwk1.getId()); +// assertEquals("HWK1_Name", hwk1.getName()); +// assertEquals("HWK1_SlotId", hwk1.getSlotID()); +// assertEquals("HWK1_UserPIN", hwk1.getUserPIN()); +// +// HardwareKeyModule hwk2 = (HardwareKeyModule) hwkms.get(1); +// assertEquals("HWK2_Id", hwk2.getId()); +// assertEquals("HWK2_Name", hwk2.getName()); +// assertNull(hwk2.getSlotID()); +// assertEquals("HWK2_UserPIN", hwk2.getUserPIN()); +// } +// +// public void testGetSoftwareKeyModules() +// { +// List swkms = provider_.getSoftwareKeyModules(); +// assertEquals(2, swkms.size()); +// +// SoftwareKeyModule swk1 = (SoftwareKeyModule) swkms.get(0); +// assertEquals("SWK1_Id", swk1.getId()); +// assertEquals(CONFIG_BASE_ + "swk/SWK1_FileName.txt", swk1.getFileName().replace('\\', '/')); +// assertEquals("SWK1_Password", swk1.getPassWord()); +// +// SoftwareKeyModule swk2 = (SoftwareKeyModule) swkms.get(1); +// assertEquals("SWK2_Id", swk2.getId()); +// assertEquals(CONFIG_BASE_ + "swk/SWK2_FileName.txt", swk2.getFileName().replace('\\', '/')); +// assertNull(swk2.getPassWord()); +// } +// +// public void testGetKeyGroups() +// { +// Map keyGroups = provider_.getKeyGroups(); +// assertEquals(2, keyGroups.size()); +// +// KeyGroup kg1 = (KeyGroup) keyGroups.get("KG1_Id"); +// assertNotNull(kg1); +// assertEquals("KG1_Id", kg1.getId()); +// +// Set kg1Entries = kg1.getKeyGroupEntries(); +// assertEquals(2, kg1Entries.size()); +// +// 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); +// assertEquals("KG2_Id", kg2.getId()); +// +// Set kg2Entries = kg2.getKeyGroupEntries(); +// assertEquals(2, kg2Entries.size()); +// +// 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 +// { +// RFC2253NameParser parser = new RFC2253NameParser("CN=Customer1_Issuer"); +// Name name = parser.parse(); +// Set kgEntries = provider_.getKeyGroupEntries(name, BigInteger.valueOf(4), "KG1_Id"); +// assertEquals(2, kgEntries.size()); +// +// 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 +// { +// 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)); // Default chaining mode +// +// parser = new RFC2253NameParser("CN=TA1_Issuer"); +// name = parser.parse(); +// cert.setIssuerDN(name); +// cert.setSerialNumber(BigInteger.valueOf(5)); +// assertEquals(ChainingModes.CHAIN_MODE, provider_.getChainingMode(cert)); +// } +// +// public void testGetDistributionPoints() throws RFC2253NameParserException +// { +// X509Certificate cert = new X509Certificate(); +// RFC2253NameParser parser = new RFC2253NameParser("CN=DP1_Issuer"); +// Name name = parser.parse(); +// cert.setIssuerDN(name); +// +// Set dps = provider_.getDistributionPoints(cert); +// assertEquals(2, dps.size()); +// +// Iterator dpIt = dps.iterator(); +// while (dpIt.hasNext()) +// { +// CRLDistributionPoint currentDP = (CRLDistributionPoint)dpIt.next(); +// if ("http://crl.myca.org".equals(currentDP.getUri())) +// { +// int reasonCodes = +// iaik.asn1.structures.DistributionPoint.unused | +// iaik.asn1.structures.DistributionPoint.keyCompromise | +// iaik.asn1.structures.DistributionPoint.cACompromise | +// iaik.asn1.structures.DistributionPoint.affiliationChanged | +// iaik.asn1.structures.DistributionPoint.superseded | +// iaik.asn1.structures.DistributionPoint.cessationOfOperation | +// iaik.asn1.structures.DistributionPoint.certificateHold | +// iaik.asn1.structures.DistributionPoint.privilegeWithdrawn | +// iaik.asn1.structures.DistributionPoint.aACompromise; +// assertEquals(reasonCodes, currentDP.getReasonCodes()); +// } +// else if ("http://crl.myotherca.org".equals(currentDP.getUri())) +// { +// int reasonCodes = +// iaik.asn1.structures.DistributionPoint.aACompromise | +// iaik.asn1.structures.DistributionPoint.affiliationChanged; +// assertEquals(reasonCodes, currentDP.getReasonCodes()); +// } +// else fail("Invalid CRL DP URI found: " + currentDP.getUri()); +// } +// +// parser = new RFC2253NameParser("CN=DP2_Issuer"); +// name = parser.parse(); +// cert.setIssuerDN(name); +// +// dps = provider_.getDistributionPoints(cert); +// assertEquals(1, dps.size()); +// +// OCSPDistributionPoint dpo = (OCSPDistributionPoint) dps.toArray()[0]; +// assertEquals("http://crl.yetanotherca.org", dpo.getUri()); +// } +// +// public void testGetCRLArchiveDuration() +// { +// assertEquals(730, provider_.getCRLArchiveDuration()); +// } +// +// public void testGetEnableRevocationArchiving() +// { +// assertFalse(provider_.getEnableRevocationArchiving()); +// } +// +// public void testGetCertStoreLocation() +// { +// assertEquals( +// CONFIG_BASE_ + "certstore_test", +// provider_.getCertStoreLocation().replace('\\', '/')); +// } +// +// public void testGetCreateTransformsInfoProfile() +// { +// Element ctip1 = provider_.getCreateTransformsInfoProfile("CTIP_1"); +// assertEquals("CreateTransformsInfoProfile", ctip1.getLocalName()); +// +// Element ctip2 = provider_.getCreateTransformsInfoProfile("CTIP_2"); +// assertEquals("CreateTransformsInfoProfile", ctip2.getLocalName()); +// } +// +// public void testGetCreateSignatureEnvironmentProfile() +// { +// Element csep = provider_.getCreateSignatureEnvironmentProfile("CSEP_1"); +// assertEquals("CreateSignatureEnvironmentProfile", csep.getLocalName()); +// } +// +// public void testGetVerifyTransformsInfoProfile() +// { +// Element vtip = provider_.getVerifyTransformsInfoProfile("VTIP_1"); +// assertEquals("VerifyTransformsInfoProfile", vtip.getLocalName()); +// } +// +// public void testGetSupplementProfile() +// { +// 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", +// tp1.getUri()); +// assertEquals( +// "file:/" + CONFIG_BASE_ + "trustprofiles/tp1/signercerts", +// tp1.getSignerCertsUri()); +// +// TrustProfile tp2 = provider_.getTrustProfile("TP2_Id"); +// assertEquals( +// "file:" + CONFIG_BASE_ + "trustprofiles/tp2/anchors", +// tp2.getUri()); +// assertEquals( +// "file:" + CONFIG_BASE_ + "trustprofiles/tp2/signercerts", +// tp2.getSignerCertsUri()); +// } +// +// public void testGetRevocationArchiveJDBCURL() +// { +// assertEquals("jdbc://dummy", provider_.getRevocationArchiveJDBCURL()); +// } +// +// public void testGetRevocationArchiveJDBCDriverClass() +// { +// assertEquals("fully.qualified.classname", provider_.getRevocationArchiveJDBCDriverClass()); +// } +// +// public void testGetEnableRevocationChecking() +// { +// assertFalse(provider_.getEnableRevocationChecking()); +// } +// +// public void testGetMaxRevocationAge() +// { +// assertEquals(10000, provider_.getMaxRevocationAge()); +// } +// +// public void testGetServiceOrder() +// { +// String[] serviceOrder = provider_.getServiceOrder(); +// assertEquals(2, serviceOrder.length); +// assertEquals("crl", serviceOrder[0]); +// assertEquals("ocsp", serviceOrder[1]); +// } +// +// public void testGetAutoAddCertificates() +// { +// assertFalse(provider_.getAutoAddCertificates()); +// } +// +// public void testGetUseAuthorityInfoAccess() +// { +// assertFalse(provider_.getUseAuthorityInfoAccess()); +// } +//} diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java index 6bf1c9d..74018c1 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest2.java @@ -1,249 +1,249 @@ -/* - * 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.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.moaspss.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.getMessage()); - } - } - - - /** - * 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()); - } -} +///* +// * 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.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.moaspss.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.getMessage()); +// } +// } +// +// +// /** +// * 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/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java index 33be7f0..c553cec 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/config/ConfigurationProviderTest3.java @@ -1,190 +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.moaspss.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); - } -} +///* +// * 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.moaspss.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); +// } +//} diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java index 2deb180..e4c8020 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/iaik/config/ConfigurationDataImplTest.java @@ -34,6 +34,8 @@ import java.util.Iterator; import java.util.List; import java.util.Set; +import org.junit.Assert; + import test.at.gv.egovernment.moa.spss.SPSSTestCase; import iaik.asn1.structures.DistributionPoint; @@ -114,15 +116,15 @@ public class ConfigurationDataImplTest extends SPSSTestCase { "jdbc:postgresql://10.16.46.108/moa?user=moa&password=moatest"); */ // test cert store configuration - assertEquals(1, certStoreConfig.getParameters().length); - assertEquals( + Assert.assertEquals(1, certStoreConfig.getParameters().length); + Assert.assertEquals( CertStoreTypes.DIRECTORY, certStoreConfig.getParameters()[0].getType()); // test revocation configuration distributionPoints = revocationConfig.getAlternativeDistributionPoints(iaikCert, null, new Date()); - assertEquals(3, distributionPoints.size()); + Assert.assertEquals(3, distributionPoints.size()); found = false; for (iter = distributionPoints.iterator(); iter.hasNext();) { CRLDistributionPoint dp = (CRLDistributionPoint) iter.next(); @@ -133,10 +135,10 @@ public class ConfigurationDataImplTest extends SPSSTestCase { | DistributionPoint.affiliationChanged); } } - assertTrue(found); + Assert.assertTrue(found); // test validation configuration - assertEquals( + Assert.assertEquals( ChainingModes.PKIX_MODE, validationConfig.getChainingMode(iaikCert)); } @@ -159,13 +161,13 @@ public class ConfigurationDataImplTest extends SPSSTestCase { HardwareKeyModuleConfiguration hwKey; SoftwareKeyModuleConfiguration swKey; - assertEquals(7, keyConfigs.size()); + Assert.assertEquals(7, keyConfigs.size()); hwKey = (HardwareKeyModuleConfiguration) keyConfigs.get(0); - assertEquals("cryptoki.dll", hwKey.getModuleName()); - assertEquals("0", hwKey.getSlotID()); - assertEquals("0000", new String(hwKey.getUserPIN())); + Assert.assertEquals("cryptoki.dll", hwKey.getModuleName()); + Assert.assertEquals("0", hwKey.getSlotID()); + Assert.assertEquals("0000", new String(hwKey.getUserPIN())); swKey = (SoftwareKeyModuleConfiguration) keyConfigs.get(1); - assertEquals( + Assert.assertEquals( "buergerkarte", new String(swKey.getKeyStoreAuthenticationData())); } diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java index dc15679..ca519f3 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/AllTests.java @@ -37,11 +37,11 @@ public class AllTests { public static Test suite() { TestSuite suite = new TestSuite(); - suite.addTestSuite(DataObjectFactoryTest.class); - suite.addTestSuite(TransformationFactoryTest.class); - suite.addTestSuite(XMLSignatureCreationInvokerTest.class); - suite.addTestSuite(CMSSignatureVerificationInvokerTest.class); - suite.addTestSuite(XMLSignatureVerificationInvokerTest.class); +// suite.addTestSuite(DataObjectFactoryTest.class); +// suite.addTestSuite(TransformationFactoryTest.class); +// suite.addTestSuite(XMLSignatureCreationInvokerTest.class); +// suite.addTestSuite(CMSSignatureVerificationInvokerTest.class); +// suite.addTestSuite(XMLSignatureVerificationInvokerTest.class); return suite; } diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java index 4bdf62a..fce00c4 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/CMSSignatureVerificationInvokerTest.java @@ -24,6 +24,7 @@ package test.at.gv.egovernment.moa.spss.server.invoke; +import org.junit.Assert; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -78,7 +79,7 @@ public class CMSSignatureVerificationInvokerTest extends SPSSTestCase { System.out.println(DOMUtils.serializeNode(result)); } catch (Exception e) { e.printStackTrace(); - fail(); + Assert.fail(); } } diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java index c5f461c..f0ccd6d 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactoryTest.java @@ -27,6 +27,7 @@ package test.at.gv.egovernment.moa.spss.server.invoke; import java.io.InputStream; import java.security.Security; +import org.junit.Assert; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -52,7 +53,6 @@ import at.gv.egovernment.moaspss.util.Base64Utils; * @version $Id$ */ public class DataObjectFactoryTest extends SPSSTestCase { - private static final String HTTP_BINARY_CONTENT_URL = "http://www.google.com"; private static final String HTTP_XML_CONTENT_URL = "http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"; @@ -105,26 +105,26 @@ public class DataObjectFactoryTest extends SPSSTestCase { DataObject dataObject = factory.createFromURI(HTTP_BINARY_CONTENT_URL, false); - assertNotNull(dataObject); - assertTrue(dataObject instanceof ByteStreamDataObjectImpl); - assertNotNull(((BinaryDataObject) dataObject).getInputStream()); + Assert.assertNotNull(dataObject); + Assert.assertTrue(dataObject instanceof ByteStreamDataObjectImpl); + Assert.assertNotNull(((BinaryDataObject) dataObject).getInputStream()); } public void testCreateFromURIWithXmlHttp() throws Exception { DataObject dataObject = factory.createFromURI(HTTP_XML_CONTENT_URL, false); Element element; - assertNotNull(dataObject); - assertTrue(dataObject instanceof XMLDataObjectImpl); + Assert.assertNotNull(dataObject); + Assert.assertTrue(dataObject instanceof XMLDataObjectImpl); element = ((XMLDataObject) dataObject).getElement(); - assertNotNull(element); - assertEquals("schema", element.getTagName()); + Assert.assertNotNull(element); + Assert.assertEquals("schema", element.getTagName()); } public void testCreateFromURIWithMalformedURI() throws Exception { try { factory.createFromURI(MALFORMED_URL, false); - fail(); + Assert.fail(); } catch (MOAException e) { } } @@ -132,7 +132,7 @@ public class DataObjectFactoryTest extends SPSSTestCase { public void testCreateFromURIWithNonExistingHttpURL() throws Exception { try { factory.createFromURI(HTTP_UNKNOWN_HOST_URL, false); - fail(); + Assert.fail(); } catch (MOAException e) { } } @@ -140,14 +140,14 @@ public class DataObjectFactoryTest extends SPSSTestCase { public void testCreateFromURIWithHttps() throws Exception { DataObject dataObject = factory.createFromURI(HTTPS_BINARY_CONTENT_URL, false); - assertNotNull(dataObject); - assertTrue(dataObject instanceof BinaryDataObject); + Assert.assertNotNull(dataObject); + Assert.assertTrue(dataObject instanceof BinaryDataObject); } public void testCreateFromURIWithUntrustedHttps() throws Exception { try { factory.createFromURI(HTTPS_UNTRUSTED_URL, false); - fail(); + Assert.fail(); } catch (MOAException e) { } @@ -156,7 +156,7 @@ public class DataObjectFactoryTest extends SPSSTestCase { public void testCreateFromURIWithFile() throws Exception { try { factory.createFromURI(FILE_BINARY_CONTENT_URL, false); - fail(); + Assert.fail(); } catch (MOAException e) { } } @@ -178,7 +178,7 @@ public class DataObjectFactoryTest extends SPSSTestCase { true, false); - assertTrue(dataObject instanceof XMLNodeListDataObjectImpl); + Assert.assertTrue(dataObject instanceof XMLNodeListDataObjectImpl); } public void testCreateFromContentOptionalRefTypeWithBase64Content() @@ -195,8 +195,8 @@ public class DataObjectFactoryTest extends SPSSTestCase { true, false); - assertNotNull(dataObject); - assertTrue(dataObject instanceof ByteArrayDataObjectImpl); + Assert.assertNotNull(dataObject); + Assert.assertTrue(dataObject instanceof ByteArrayDataObjectImpl); } } diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java index 64c0c8b..51d323b 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/TransformationFactoryTest.java @@ -27,6 +27,7 @@ package test.at.gv.egovernment.moa.spss.server.invoke; import java.util.List; import java.util.Map; +import org.junit.Assert; import org.w3c.dom.Document; import at.gv.egovernment.moa.spss.MOAApplicationException; @@ -76,8 +77,8 @@ public class TransformationFactoryTest extends SPSSTestCase { transformParser.parseTransform(transform.getDocumentElement()); Transformation t = factory.createTransformation(tr); - assertTrue(t instanceof Canonicalization); - assertEquals( + Assert.assertTrue(t instanceof Canonicalization); + Assert.assertEquals( "http://www.w3.org/TR/2001/REC-xml-c14n-20010315", t.getAlgorithmURI()); } @@ -89,8 +90,8 @@ public class TransformationFactoryTest extends SPSSTestCase { transformParser.parseTransform(transform.getDocumentElement()); Transformation t = factory.createTransformation(tr); - assertTrue(t instanceof Canonicalization); - assertEquals( + Assert.assertTrue(t instanceof Canonicalization); + Assert.assertEquals( "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments", t.getAlgorithmURI()); } @@ -100,7 +101,7 @@ public class TransformationFactoryTest extends SPSSTestCase { Transform tr = transformParser.parseTransform(transform.getDocumentElement()); Transformation t = factory.createTransformation(tr); - assertTrue(t instanceof Base64Transformation); + Assert.assertTrue(t instanceof Base64Transformation); } public void testCreateEnvelopedSignature() throws Exception { @@ -108,7 +109,7 @@ public class TransformationFactoryTest extends SPSSTestCase { Transform tr = transformParser.parseTransform(transform.getDocumentElement()); Transformation t = factory.createTransformation(tr); - assertTrue(t instanceof EnvelopedSignatureTransformation); + Assert.assertTrue(t instanceof EnvelopedSignatureTransformation); } public void testXPathTransformation() throws Exception { @@ -118,10 +119,10 @@ public class TransformationFactoryTest extends SPSSTestCase { Transformation t = factory.createTransformation(tr); Map nsDecls; - assertTrue(t instanceof XPathTransformation); + Assert.assertTrue(t instanceof XPathTransformation); nsDecls = ((XPathTransformation) t).getNamespaceDeclarations(); - assertEquals(1, nsDecls.size()); - assertEquals(Constants.DSIG_NS_URI, nsDecls.get("dsig")); + Assert.assertEquals(1, nsDecls.size()); + Assert.assertEquals(Constants.DSIG_NS_URI, nsDecls.get("dsig")); } public void testCreateXPath2Transformation() throws Exception { @@ -129,7 +130,7 @@ public class TransformationFactoryTest extends SPSSTestCase { Transform tr = transformParser.parseTransform(transform.getDocumentElement()); Transformation t = factory.createTransformation(tr); - assertTrue(t instanceof XPath2Transformation); + Assert.assertTrue(t instanceof XPath2Transformation); } public void testCreateXSLTTransformation() throws Exception { @@ -138,7 +139,7 @@ public class TransformationFactoryTest extends SPSSTestCase { transformParser.parseTransform(transform.getDocumentElement()); XSLTTransformation t = (XSLTTransformation) factory.createTransformation(tr); - assertNotNull(t.getStylesheetElement()); + Assert.assertNotNull(t.getStylesheetElement()); } public void testCreateWithIllegalAlgorithm() throws Exception { @@ -147,7 +148,7 @@ public class TransformationFactoryTest extends SPSSTestCase { Transform tr = transformParser.parseTransform(transform.getDocumentElement()); factory.createTransformation(tr); - fail(); + Assert.fail(); } catch (MOAApplicationException e) { } } @@ -168,13 +169,13 @@ public class TransformationFactoryTest extends SPSSTestCase { Document canonicalization = parseXml(TESTDATA_BASE + "canonicalization.xml"); - assertTrue(trXslt.equals(trXsltEqu)); - assertFalse(trXslt.equals(trXsltDiff)); - assertFalse(trXsltEqu.equals(trXsltDiff)); - assertEquals(trXslt.hashCode(), trXsltEqu.hashCode()); - assertFalse(trXslt.hashCode() == trXsltDiff.hashCode()); - assertFalse(trXsltEqu.hashCode() == trXsltDiff.hashCode()); - assertFalse(trXslt.equals(canonicalization)); + Assert.assertTrue(trXslt.equals(trXsltEqu)); + Assert.assertFalse(trXslt.equals(trXsltDiff)); + Assert.assertFalse(trXsltEqu.equals(trXsltDiff)); + Assert.assertEquals(trXslt.hashCode(), trXsltEqu.hashCode()); + Assert.assertFalse(trXslt.hashCode() == trXsltDiff.hashCode()); + Assert.assertFalse(trXsltEqu.hashCode() == trXsltDiff.hashCode()); + Assert.assertFalse(trXslt.equals(canonicalization)); } public void testEqualsXPath() throws Exception { @@ -187,10 +188,10 @@ public class TransformationFactoryTest extends SPSSTestCase { tr = transformParser.parseTransform(xpathDiff.getDocumentElement()); Transformation trXpathDiff = factory.createTransformation(tr); - assertTrue(trXpath.equals(trXpathEqu)); - assertEquals(trXpath.hashCode(), trXpathEqu.hashCode()); - assertFalse(trXpath.equals(trXpathDiff)); - assertFalse(trXpath.hashCode() == trXpathDiff.hashCode()); + Assert.assertTrue(trXpath.equals(trXpathEqu)); + Assert.assertEquals(trXpath.hashCode(), trXpathEqu.hashCode()); + Assert.assertFalse(trXpath.equals(trXpathDiff)); + Assert.assertFalse(trXpath.hashCode() == trXpathDiff.hashCode()); } public void testEqualsXPath2() throws Exception { @@ -203,10 +204,10 @@ public class TransformationFactoryTest extends SPSSTestCase { tr = transformParser.parseTransform(xpath2Diff.getDocumentElement()); Transformation trXpath2Diff = factory.createTransformation(tr); - assertTrue(trXpath2.equals(trXpath2Equ)); - assertEquals(trXpath2.hashCode(), trXpath2Equ.hashCode()); - assertFalse(trXpath2.equals(trXpath2Diff)); - assertFalse(trXpath2.hashCode() == trXpath2Diff.hashCode()); + Assert.assertTrue(trXpath2.equals(trXpath2Equ)); + Assert.assertEquals(trXpath2.hashCode(), trXpath2Equ.hashCode()); + Assert.assertFalse(trXpath2.equals(trXpath2Diff)); + Assert.assertFalse(trXpath2.hashCode() == trXpath2Diff.hashCode()); } public void testCreateTransformationList() throws Exception { @@ -214,7 +215,7 @@ public class TransformationFactoryTest extends SPSSTestCase { List trs = transformParser.parseTransforms(transforms.getDocumentElement()); List transformationList = factory.createTransformationList(trs); - assertEquals(3, transformationList.size()); + Assert.assertEquals(3, transformationList.size()); } } diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java index e862e2c..6eb746d 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationInvokerTest.java @@ -26,6 +26,7 @@ package test.at.gv.egovernment.moa.spss.server.invoke; import java.util.Collections; +import org.junit.Assert; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -78,7 +79,7 @@ public class XMLSignatureCreationInvokerTest extends SPSSTestCase { System.out.println(DOMUtils.serializeNode(result)); } catch (Exception e) { e.printStackTrace(); - fail(); + Assert.fail(); } } diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java index 565ea27..56c2f14 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureVerificationInvokerTest.java @@ -24,6 +24,7 @@ package test.at.gv.egovernment.moa.spss.server.invoke; +import org.junit.Assert; import org.w3c.dom.Document; import test.at.gv.egovernment.moa.spss.SPSSTestCase; @@ -75,7 +76,7 @@ public class XMLSignatureVerificationInvokerTest extends SPSSTestCase { DOMUtils.serializeNode(responseBuilder.build(response))); } catch (Exception e) { e.printStackTrace(); - fail(); + Assert.fail(); } } diff --git a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java index 9b2fd32..8dde623 100644 --- a/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java +++ b/moaSig/moa-sig-lib/src/test/java/test/at/gv/egovernment/moa/spss/server/tools/CertToolTest.java @@ -27,6 +27,8 @@ package test.at.gv.egovernment.moa.spss.server.tools; import java.io.ByteArrayOutputStream; import java.io.PrintStream; +import org.junit.Assert; + //import at.gv.egovernment.moa.spss.server.tools.CertTool; import test.at.gv.egovernment.moa.MOATestCase; @@ -67,7 +69,7 @@ public class CertToolTest extends MOATestCase { //certTool.printCertInfo(TESTDATA_ROOT + "security/server.cer", ps); result = new String(bos.toByteArray()); System.out.println(result); - assertEquals(EXPECTED_RESULT, result); + Assert.assertEquals(EXPECTED_RESULT, result); } } |