summaryrefslogtreecommitdiff
path: root/mocca-1.2.11/bkucommon/src/test/java/at/gv/egiz/bku/conf
diff options
context:
space:
mode:
Diffstat (limited to 'mocca-1.2.11/bkucommon/src/test/java/at/gv/egiz/bku/conf')
-rw-r--r--mocca-1.2.11/bkucommon/src/test/java/at/gv/egiz/bku/conf/CertValidatorTest.java35
-rw-r--r--mocca-1.2.11/bkucommon/src/test/java/at/gv/egiz/bku/conf/DummyConfiguration.java32
2 files changed, 67 insertions, 0 deletions
diff --git a/mocca-1.2.11/bkucommon/src/test/java/at/gv/egiz/bku/conf/CertValidatorTest.java b/mocca-1.2.11/bkucommon/src/test/java/at/gv/egiz/bku/conf/CertValidatorTest.java
new file mode 100644
index 00000000..d97d741d
--- /dev/null
+++ b/mocca-1.2.11/bkucommon/src/test/java/at/gv/egiz/bku/conf/CertValidatorTest.java
@@ -0,0 +1,35 @@
+package at.gv.egiz.bku.conf;
+
+import iaik.x509.X509Certificate;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.security.cert.CertificateException;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class CertValidatorTest {
+
+ private CertValidator cv;
+
+ @Before
+ public void setUp() throws URISyntaxException {
+ cv = new CertValidatorImpl();
+ URL caDir = getClass().getClassLoader().getResource("at/gv/egiz/bku/conf/certs/CACerts");
+ URL certDir = getClass().getClassLoader().getResource("at/gv/egiz/bku/conf/certs/certStore");
+ cv.init(new File(caDir.toURI()), new File(certDir.toURI()));
+ }
+
+ @Test
+ public void testValid() throws CertificateException, IOException {
+ X509Certificate cert = new X509Certificate(getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/conf/certs/testCerts/www.a-trust.at.der"));
+ assertTrue(cv.isCertificateValid("TID", new X509Certificate[]{cert}));
+ }
+
+}
diff --git a/mocca-1.2.11/bkucommon/src/test/java/at/gv/egiz/bku/conf/DummyConfiguration.java b/mocca-1.2.11/bkucommon/src/test/java/at/gv/egiz/bku/conf/DummyConfiguration.java
new file mode 100644
index 00000000..1e0e5aa9
--- /dev/null
+++ b/mocca-1.2.11/bkucommon/src/test/java/at/gv/egiz/bku/conf/DummyConfiguration.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package at.gv.egiz.bku.conf;
+
+/**
+ *
+ * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
+ */
+public class DummyConfiguration extends Configuration {
+
+ public DummyConfiguration() {
+ this.setMaxDataUrlHops(MAX_DATAURL_HOPS_DEFAULT);
+ //this.set...
+ }
+
+
+}