diff options
Diffstat (limited to 'pdf-as-lib/src/test/java/at')
4 files changed, 554 insertions, 0 deletions
diff --git a/pdf-as-lib/src/test/java/at/gv/egiz/pdfas/utils/CsvUtilsTest.java b/pdf-as-lib/src/test/java/at/gv/egiz/pdfas/utils/CsvUtilsTest.java new file mode 100644 index 0000000..813dab3 --- /dev/null +++ b/pdf-as-lib/src/test/java/at/gv/egiz/pdfas/utils/CsvUtilsTest.java @@ -0,0 +1,59 @@ +/**
+ * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright>
+ * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a
+ * joint initiative of the Federal Chancellery Austria 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 at.gv.egiz.pdfas.utils;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+/**
+ * Some tests for CSV utils. Note that the German version of CSV is used, with semicolons instead of commas.
+ *
+ * @author Datentechnik Innovation GmbH
+ */
+public class CsvUtilsTest {
+
+ @Test
+ public void testEscapeCsvValue() {
+ assertEquals("", CsvUtils.escapeCsvValue(null));
+ assertEquals("", CsvUtils.escapeCsvValue(""));
+ assertEquals("Hello World", CsvUtils.escapeCsvValue("Hello World"));
+ assertEquals("1,2", CsvUtils.escapeCsvValue("1,2"));
+ assertEquals("3.4", CsvUtils.escapeCsvValue("3.4"));
+ assertEquals("1", CsvUtils.escapeCsvValue(1));
+ }
+
+ @Test
+ public void testEscapeCsvValueQuotes() {
+ // RFC 4180 (6): Fields containing line breaks (CRLF), double quotes, and commas
+ // should be enclosed in double-quotes.
+ assertEquals("\"Hello\nWorld\"", CsvUtils.escapeCsvValue("Hello\nWorld"));
+ assertEquals("\"Hello;World\"", CsvUtils.escapeCsvValue("Hello;World"));
+ // RFC 4180 (7): If double-quotes are used to enclose fields, then a double-quote
+ // appearing inside a field must be escaped by preceding it with
+ // another double quote.
+ assertEquals("\"Hello \"\"World\"\"\"", CsvUtils.escapeCsvValue("Hello \"World\""));
+ }
+
+}
diff --git a/pdf-as-lib/src/test/java/at/knowcenter/wag/egov/egiz/cfg/NestedPropertiesTest.java b/pdf-as-lib/src/test/java/at/knowcenter/wag/egov/egiz/cfg/NestedPropertiesTest.java new file mode 100644 index 0000000..d2d9c50 --- /dev/null +++ b/pdf-as-lib/src/test/java/at/knowcenter/wag/egov/egiz/cfg/NestedPropertiesTest.java @@ -0,0 +1,263 @@ +/**
+ * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright>
+ * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a
+ * joint initiative of the Federal Chancellery Austria 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 at.knowcenter.wag.egov.egiz.cfg;
+
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
+import org.junit.Test;
+
+/**
+ * Tests dealing with include-capable properties.
+ *
+ * @author Datentechnik Innovation GmbH
+ */
+public class NestedPropertiesTest {
+
+ @Test
+ public void testNoIncludes() throws IOException {
+ File configFile = new File(NestedPropertiesTest.class.getResource("config_noincludes.properties").getFile());
+
+ Properties expectedProperties = new Properties();
+ InputStream in = null;
+ try {
+ expectedProperties.load(in = new FileInputStream(configFile));
+ } finally {
+ IOUtils.closeQuietly(in);
+ }
+
+ NestedProperties nestedProperties = new NestedProperties();
+ nestedProperties.load(configFile);
+
+ assertEquals(expectedProperties, nestedProperties);
+ }
+
+ @Test
+ public void testSingleIncludes() throws IOException {
+ File configFile = new File(NestedPropertiesTest.class.getResource("config_single_includes.properties")
+ .getFile());
+
+ Properties expectedProperties = new Properties();
+ InputStream in = null;
+ try {
+ expectedProperties.load(in = getClass().getResourceAsStream("config_noincludes.properties"));
+ } finally {
+ IOUtils.closeQuietly(in);
+ }
+
+ NestedProperties nestedProperties = new NestedProperties();
+ nestedProperties.load(configFile);
+
+ assertEquals(expectedProperties, nestedProperties);
+ }
+
+ @Test
+ public void testSingleIncludesWithDefaultConfig() throws IOException {
+ // add some properties to a default configuration object
+ Properties defaultConfiguration = new Properties();
+ defaultConfiguration.put("key1", "defaultValue1");
+ defaultConfiguration.put("key2", "defaultValue2");
+ // set a property which will be locally overridden by config_single_includes.properties
+ defaultConfiguration.put("correct_document_on_verify_if_necessary", "false");
+ defaultConfiguration.put("sig_obj.types.INVISIBLE", "off");
+
+ File configFile = new File(NestedPropertiesTest.class.getResource("config_single_includes.properties")
+ .getFile());
+
+ Properties expectedProperties = new Properties();
+ InputStream in = null;
+ try {
+ expectedProperties.load(in = getClass().getResourceAsStream("config_noincludes.properties"));
+ expectedProperties.put("key1", "defaultValue1");
+ expectedProperties.put("key2", "defaultValue2");
+ } finally {
+ IOUtils.closeQuietly(in);
+ }
+
+ // load include aware properties considering default configuration
+ NestedProperties nestedProperties = new NestedProperties(defaultConfiguration);
+ nestedProperties.load(configFile);
+
+ assertEquals(expectedProperties, nestedProperties);
+ }
+
+ @Test
+ public void testWildcardIncludes() throws IOException {
+ File configFile = new File(NestedPropertiesTest.class.getResource("config_wildcard_includes.properties")
+ .getFile());
+
+ Properties expectedProperties = new Properties();
+ InputStream in = null;
+ try {
+ expectedProperties.load(in = getClass().getResourceAsStream("config_noincludes.properties"));
+ } finally {
+ IOUtils.closeQuietly(in);
+ }
+
+ NestedProperties nestedProperties = new NestedProperties();
+ nestedProperties.load(configFile);
+
+ assertEquals(expectedProperties, nestedProperties);
+ }
+
+ @Test
+ public void testNestedIncludes() throws IOException {
+ File configFile = new File(NestedPropertiesTest.class.getResource("config_nested_includes.properties")
+ .getFile());
+
+ Properties expectedProperties = new Properties();
+ InputStream in = null;
+ try {
+ expectedProperties.load(in = getClass().getResourceAsStream("config_noincludes.properties"));
+ } finally {
+ IOUtils.closeQuietly(in);
+ }
+
+ NestedProperties nestedProperties = new NestedProperties();
+ nestedProperties.load(configFile);
+
+ assertEquals(expectedProperties, nestedProperties);
+ }
+
+ @Test
+ public void testSubdirIncludes() throws IOException {
+ File configFile = new File(NestedPropertiesTest.class.getResource("config_subdir_includes.properties")
+ .getFile());
+
+ Properties expectedProperties = new Properties();
+ InputStream in = null;
+ try {
+ expectedProperties.load(in = getClass().getResourceAsStream("config_noincludes.properties"));
+ } finally {
+ IOUtils.closeQuietly(in);
+ }
+
+ NestedProperties nestedProperties = new NestedProperties();
+ nestedProperties.load(configFile);
+
+ assertEquals(expectedProperties, nestedProperties);
+ }
+
+ @Test(timeout = 2500, expected = CircularIncludeException.class)
+ public void testCircularIncludes() throws IOException {
+ File configFile = new File(NestedPropertiesTest.class.getResource("circular/profile.1.properties").getFile());
+ NestedProperties nestedProperties = new NestedProperties();
+ nestedProperties.load(configFile);
+ fail("Circular references should have been detected.");
+ }
+
+ @Test
+ /**
+ * Tests include priority: Included properties should override locally set properties.
+ */
+ public void testLocalVsIncludedProperties() throws IOException {
+ File configFile = new File(NestedPropertiesTest.class.getResource("local_vs_included_properties.properties")
+ .getFile());
+ NestedProperties nestedProperties = new NestedProperties();
+ nestedProperties.load(configFile);
+
+ Properties expectedProperties = new Properties();
+ expectedProperties.put("key1", "included value 1");
+ expectedProperties.put("key2", "local value 2");
+ expectedProperties.put("key3", "local value 3");
+ expectedProperties.put("key4", "local value 4");
+
+ assertEquals(expectedProperties, nestedProperties);
+ }
+
+ @Test
+ public void testIncludeOrder() throws CircularIncludeException, IOException {
+ File configFile = new File(NestedPropertiesTest.class.getResource("include_order.properties").getFile());
+ NestedProperties nestedProperties = new NestedProperties();
+ nestedProperties.load(configFile);
+
+ Properties expectedProperties = new Properties();
+ expectedProperties.put("key1", "include_xyz");
+ expectedProperties.put("key2", "include_abc");
+ expectedProperties.put("key3", "include_3");
+ expectedProperties.put("key4", "include_2");
+ expectedProperties.put("key5", "include_1");
+ expectedProperties.put("key6", "include");
+
+ assertEquals(expectedProperties, nestedProperties);
+ }
+
+ /**
+ * Java default {@link Properties} does not provide equals and hashcode methods therefore default properties are not
+ * taken into consideration when comparing two Properties (using {@link Hashtable#equals(Object)}. This method
+ * compares two Properties considering defaults. Note that this method considers two Properties equal if the
+ * respective union of keys and default keys equals.
+ *
+ * @param expected
+ * The expected set of Properties.
+ * @param actual
+ * Properties to be compared with.
+ */
+ private static void assertEquals(Properties expected, Properties actual) {
+ if (expected == actual) {
+ // same object
+ return;
+ }
+ if (expected == null || actual == null) {
+ fail("expected: <" + expected + "> but was <" + actual + ">");
+ }
+ // fetch all keys (including defaults) from actual properties
+ @SuppressWarnings("unchecked")
+ Enumeration<String> actualPropertyNames = (Enumeration<String>) actual.propertyNames();
+ Set<String> actualKeys = new HashSet<String>();
+ while (actualPropertyNames.hasMoreElements()) {
+ actualKeys.add(actualPropertyNames.nextElement());
+ }
+
+ @SuppressWarnings("unchecked")
+ Enumeration<String> expectedPropertyNames = (Enumeration<String>) expected.propertyNames();
+ while (expectedPropertyNames.hasMoreElements()) {
+ String key = expectedPropertyNames.nextElement();
+ String expectedValue = expected.getProperty(key);
+ if (!actualKeys.contains(key)) {
+ fail("missing entry for key '" + key + "'");
+ }
+ String actualValue = actual.getProperty(key);
+ if (!StringUtils.equals(expectedValue, actualValue)) {
+ fail("key '" + key + "' value expected: <" + expectedValue + "> but was <" + actualValue + ">");
+ }
+ actualKeys.remove(key);
+ }
+ if (!actualKeys.isEmpty()) {
+ fail("more entries found than expected: " + StringUtils.join(actualKeys, ", "));
+ }
+ }
+
+}
diff --git a/pdf-as-lib/src/test/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypesStateTest.java b/pdf-as-lib/src/test/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypesStateTest.java new file mode 100644 index 0000000..02931eb --- /dev/null +++ b/pdf-as-lib/src/test/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypesStateTest.java @@ -0,0 +1,101 @@ +/**
+ * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright>
+ * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a
+ * joint initiative of the Federal Chancellery Austria 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 at.knowcenter.wag.egov.egiz.sig;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import at.knowcenter.wag.egov.egiz.sig.SignatureTypes.State;
+
+/**
+ * Tests regarding new signature profile states "verify_only" and "sign_only".
+ *
+ * @author Datentechnik Innovation GmbH
+ */
+public class SignatureTypesStateTest {
+
+ @Test
+ public void testFromString() {
+ assertEquals(State.ON, State.fromString("on"));
+ assertEquals(State.ON, State.fromString("ON"));
+ assertEquals(State.ON, State.fromString("On"));
+ assertEquals(State.ON, State.fromString("enabled"));
+ assertEquals(State.ON, State.fromString("yes"));
+ assertEquals(State.ON, State.fromString("true"));
+
+ assertEquals(State.SIGN_ONLY, State.fromString("sign_only"));
+ assertEquals(State.SIGN_ONLY, State.fromString("signonly"));
+ assertEquals(State.SIGN_ONLY, State.fromString("sign-only"));
+ assertEquals(State.SIGN_ONLY, State.fromString("SignOnly"));
+ assertEquals(State.SIGN_ONLY, State.fromString("SIGN_ONLY"));
+ assertEquals(State.SIGN_ONLY, State.fromString("sign only"));
+ assertEquals(State.SIGN_ONLY, State.fromString("sign"));
+
+ assertEquals(State.VERIFY_ONLY, State.fromString("verify_only"));
+ assertEquals(State.VERIFY_ONLY, State.fromString("verifyonly"));
+ assertEquals(State.VERIFY_ONLY, State.fromString("verify-only"));
+ assertEquals(State.VERIFY_ONLY, State.fromString("Verifyonly"));
+ assertEquals(State.VERIFY_ONLY, State.fromString("VERIFY_ONLY"));
+ assertEquals(State.VERIFY_ONLY, State.fromString("verify only"));
+ assertEquals(State.VERIFY_ONLY, State.fromString("verify"));
+ }
+
+ @Test
+ public void testDefaultState() {
+ assertEquals(State.OFF, State.fromString(""));
+ assertEquals(State.OFF, State.fromString(null));
+ assertEquals(State.OFF, State.fromString("off"));
+ assertEquals(State.OFF, State.fromString("OFF"));
+ assertEquals(State.OFF, State.fromString("foo"));
+ }
+
+ @Test
+ public void testIn() {
+ assertTrue(State.ON.in(State.values()));
+ assertTrue(State.ON.in(State.ON));
+ assertFalse(State.ON.in());
+ assertFalse(State.ON.in((State) null));
+ assertFalse(State.ON.in(State.OFF, State.VERIFY_ONLY, State.SIGN_ONLY));
+ }
+
+ @Test
+ public void testCanSign() {
+ assertTrue(State.ON.canSign());
+ assertFalse(State.OFF.canSign());
+ assertTrue(State.SIGN_ONLY.canSign());
+ assertFalse(State.VERIFY_ONLY.canSign());
+ }
+
+ @Test
+ public void testCanVerify() {
+ assertTrue(State.ON.canVerify());
+ assertFalse(State.OFF.canVerify());
+ assertFalse(State.SIGN_ONLY.canVerify());
+ assertTrue(State.VERIFY_ONLY.canVerify());
+ }
+
+}
diff --git a/pdf-as-lib/src/test/java/at/knowcenter/wag/egov/egiz/sig/signaturelayout/SignatureLayoutHandlerFactoryTests.java b/pdf-as-lib/src/test/java/at/knowcenter/wag/egov/egiz/sig/signaturelayout/SignatureLayoutHandlerFactoryTests.java new file mode 100644 index 0000000..45572bd --- /dev/null +++ b/pdf-as-lib/src/test/java/at/knowcenter/wag/egov/egiz/sig/signaturelayout/SignatureLayoutHandlerFactoryTests.java @@ -0,0 +1,131 @@ +package at.knowcenter.wag.egov.egiz.sig.signaturelayout;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import at.gv.egiz.pdfas.PdfAsFactory;
+import at.gv.egiz.pdfas.api.exceptions.PdfAsException;
+import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException;
+import at.knowcenter.wag.egov.egiz.exceptions.SettingsException;
+import at.knowcenter.wag.egov.egiz.sig.signaturelayout.atrust.ATrustSignatureLayoutHandler;
+import at.knowcenter.wag.egov.egiz.sig.signaturelayout.mocca.MOCCASignatureLayout10Handler;
+import at.knowcenter.wag.egov.egiz.sig.signaturelayout.mocca.MoccaXades14SignatureLayoutHandler;
+import at.knowcenter.wag.egov.egiz.sig.signaturelayout.mocca.OldMOCCASignatureLayoutHandler;
+
+/**
+ * Tests for {@link SignatureLayoutHandlerFactory} providing signature layout handlers for various types of citizen card
+ * software.
+ *
+ * @author Datentechnik Innovation GmbH
+ */
+public class SignatureLayoutHandlerFactoryTests {
+
+ /**
+ * Instantiates the PDF-AS api which will be used for tests.
+ *
+ * @throws PdfAsException
+ * In case the PDF-AS api could not be instantiated (e.g. due to configuration issues).
+ */
+ @BeforeClass
+ public static void init() throws PdfAsException {
+
+ // determine config dir
+ File configFile = new File(SignatureLayoutHandlerFactoryTests.class.getResource(
+ "/at/knowcenter/wag/egov/egiz/signaturelayout/cfg/config.properties").getFile());
+ assertTrue(configFile.exists() && configFile.canRead());
+
+ // determine work dir
+ File workPath = configFile.getParentFile().getParentFile();
+
+ // Note: calculating signature positions without applying signatures is not covered by the api interface.
+ // Therefore we instantiate the api only in order to get the configuration be loaded.
+ PdfAsFactory.createPdfAs(workPath);
+ }
+
+ @Test
+ public void testSupportForMoccaWithXAdES14() throws ConnectorException, SettingsException {
+ String bkuIdentifier = "citizen-card-environment/1.2 MOCCA/1.3.9-SNAPSHOT-r1159-X14 SignatureLayout/1.0";
+ SignatureLayoutHandler signatureLayoutHandler = SignatureLayoutHandlerFactory.getSignatureLayoutHandlerInstance(bkuIdentifier);
+ assertTrue(signatureLayoutHandler instanceof MoccaXades14SignatureLayoutHandler);
+
+ bkuIdentifier = "citizen-card-environment/1.2 MOCCA/1.3.9-r1234-X14 SignatureLayout/1.0";
+ signatureLayoutHandler = SignatureLayoutHandlerFactory.getSignatureLayoutHandlerInstance(bkuIdentifier);
+ assertTrue(signatureLayoutHandler instanceof MoccaXades14SignatureLayoutHandler);
+
+ bkuIdentifier = "citizen-card-environment/1.2 MOCCA/1.3.9-SNAPSHOT-r1159-X14 SignatureLayout/1.1";
+ signatureLayoutHandler = SignatureLayoutHandlerFactory.getSignatureLayoutHandlerInstance(bkuIdentifier);
+ assertTrue(signatureLayoutHandler instanceof MoccaXades14SignatureLayoutHandler);
+
+ bkuIdentifier = "citizen-card-environment/1.2 MOCCA/1.3.9-r1234-X14 SignatureLayout/1.1";
+ signatureLayoutHandler = SignatureLayoutHandlerFactory.getSignatureLayoutHandlerInstance(bkuIdentifier);
+ assertTrue(signatureLayoutHandler instanceof MoccaXades14SignatureLayoutHandler);
+ }
+
+ @Test
+ public void testSupportForMoccaWithSignatureLayout10() throws ConnectorException, SettingsException {
+ String bkuIdentifier = "citizen-card-environment/1.2 MOCCA/1.3.8-r1111 SignatureLayout/1.0";
+ SignatureLayoutHandler signatureLayoutHandler = SignatureLayoutHandlerFactory.getSignatureLayoutHandlerInstance(bkuIdentifier);
+ assertTrue(signatureLayoutHandler instanceof MOCCASignatureLayout10Handler);
+
+ bkuIdentifier = "citizen-card-environment/1.2 MOCCA/1.3.8-r1111 SignatureLayout/1.1";
+ try {
+ SignatureLayoutHandlerFactory.getSignatureLayoutHandlerInstance(bkuIdentifier);
+ fail("ConnectorException expected; SignatureLayout 1.1 not supported.");
+ } catch (ConnectorException e) {
+ assertEquals(373, e.getErrorCode());
+ }
+ }
+
+ @Test
+ public void testSupportForMoccaWithLegacySignatureLayout() throws ConnectorException, SettingsException {
+ String bkuIdentifier = "citizen-card-environment/1.2 MOCCA/1.0.0-r123";
+ SignatureLayoutHandler signatureLayoutHandler = SignatureLayoutHandlerFactory.getSignatureLayoutHandlerInstance(bkuIdentifier);
+ assertTrue(signatureLayoutHandler instanceof OldMOCCASignatureLayoutHandler);
+ }
+
+ @Test
+ public void testSupportForATrustLocal133() throws ConnectorException, SettingsException {
+ String bkuIdentifier = "citizen-card-environment/1.2 asignSecurityLayer/1.3.3";
+ SignatureLayoutHandler signatureLayoutHandler = SignatureLayoutHandlerFactory.getSignatureLayoutHandlerInstance(bkuIdentifier);
+ assertTrue(signatureLayoutHandler instanceof ATrustSignatureLayoutHandler);
+ }
+
+ @Test
+ public void testNonSupportForATrustLocal140() throws ConnectorException, SettingsException {
+ String bkuIdentifier = "citizen-card-environment/1.2 asignSecurityLayer/1.4.0";
+ try {
+ SignatureLayoutHandlerFactory.getSignatureLayoutHandlerInstance(bkuIdentifier);
+ fail("ConnectorException expected; A.Trust BKU 1.4.0 not supported.");
+ } catch (ConnectorException e) {
+ assertEquals(373, e.getErrorCode());
+ }
+ }
+
+ @Test
+ public void testSupportForATrustLocal141() throws ConnectorException, SettingsException {
+ String bkuIdentifier = "citizen-card-environment/1.2 asignSecurityLayer/1.4.1";
+ SignatureLayoutHandler signatureLayoutHandler = SignatureLayoutHandlerFactory.getSignatureLayoutHandlerInstance(bkuIdentifier);
+ assertTrue(signatureLayoutHandler instanceof ATrustSignatureLayoutHandler);
+ }
+
+ @Test
+ public void testSupportForATrustLocal142() throws ConnectorException, SettingsException {
+ String bkuIdentifier = "citizen-card-environment/1.2 asignSecurityLayer/1.4.2";
+ SignatureLayoutHandler signatureLayoutHandler = SignatureLayoutHandlerFactory.getSignatureLayoutHandlerInstance(bkuIdentifier);
+ assertTrue(signatureLayoutHandler instanceof ATrustSignatureLayoutHandler);
+ }
+
+ @Test
+ public void testSupportForATrustMobile110() throws ConnectorException, SettingsException {
+ String bkuIdentifier = "citizen-card-environment/1.2 asignMobileBku/1.1.0";
+ SignatureLayoutHandler signatureLayoutHandler = SignatureLayoutHandlerFactory.getSignatureLayoutHandlerInstance(bkuIdentifier);
+ assertTrue(signatureLayoutHandler instanceof ATrustSignatureLayoutHandler);
+ }
+
+}
|