summaryrefslogtreecommitdiff
path: root/BKUWebStart/src/test
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-08-14 10:55:59 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-08-14 10:55:59 +0000
commita8e021a5b4450e117b76d9f6cc69bd24cd1dd5d3 (patch)
treec3913b3a4c59b027dc0fe2f7712ad2a6c0533eac /BKUWebStart/src/test
parenta59e78782149933c37e21486c292f2c1a7fc9c2c (diff)
downloadmocca-a8e021a5b4450e117b76d9f6cc69bd24cd1dd5d3.tar.gz
mocca-a8e021a5b4450e117b76d9f6cc69bd24cd1dd5d3.tar.bz2
mocca-a8e021a5b4450e117b76d9f6cc69bd24cd1dd5d3.zip
fixed updateRequired function
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@434 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUWebStart/src/test')
-rw-r--r--BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java175
-rw-r--r--BKUWebStart/src/test/resources/commons-logging.properties1
-rw-r--r--BKUWebStart/src/test/resources/log4j.properties35
3 files changed, 211 insertions, 0 deletions
diff --git a/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java b/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java
new file mode 100644
index 00000000..0c08a276
--- /dev/null
+++ b/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java
@@ -0,0 +1,175 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package at.gv.egiz.bku.webstart;
+
+import java.io.File;
+import java.net.URI;
+import java.util.zip.ZipOutputStream;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author clemens
+ */
+public class ConfiguratorTest {
+
+
+ public ConfiguratorTest() {
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * Test of ensureConfiguration method, of class Configurator.
+ */
+ @Ignore
+ @Test
+ public void testEnsureConfiguration() throws Exception {
+ System.out.println("ensureConfiguration");
+ Configurator instance = new Configurator();
+ instance.ensureConfiguration();
+ // TODO review the generated test code and remove the default call to fail.
+ fail("The test case is a prototype.");
+ }
+
+ /**
+ * Test of ensureCertificates method, of class Configurator.
+ */
+ @Ignore
+ @Test
+ public void testEnsureCertificates() throws Exception {
+ System.out.println("ensureCertificates");
+ Configurator instance = new Configurator();
+ instance.ensureCertificates();
+ // TODO review the generated test code and remove the default call to fail.
+ fail("The test case is a prototype.");
+ }
+
+ /**
+ * Test of isCertRenewed method, of class Configurator.
+ */
+ @Ignore
+ @Test
+ public void testIsCertRenewed() {
+ System.out.println("isCertRenewed");
+ Configurator instance = new Configurator();
+ boolean expResult = false;
+ boolean result = instance.isCertRenewed();
+ assertEquals(expResult, result);
+ // TODO review the generated test code and remove the default call to fail.
+ fail("The test case is a prototype.");
+ }
+
+ /**
+ * Test of readVersion method, of class Configurator.
+ */
+ @Ignore
+ @Test
+ public void testReadVersion() {
+ System.out.println("readVersion");
+ File versionFile = null;
+ String expResult = "";
+ String result = Configurator.readVersion(versionFile);
+ assertEquals(expResult, result);
+ // TODO review the generated test code and remove the default call to fail.
+ fail("The test case is a prototype.");
+ }
+
+ /**
+ * Test of updateRequired method, of class Configurator.
+ */
+ @Test
+ public void testUpdateRequired() {
+ System.out.println("updateRequired");
+ String oldVersion = "1.0.9-SNAPSHOT-r123";
+ String minVersion = "1.0.9-SNAPSHOT";
+ boolean expResult = false;
+ boolean result = Configurator.updateRequired(oldVersion, minVersion);
+ assertEquals(expResult, result);
+
+ oldVersion = "1.0.9-SNAPSHOT-r123";
+ minVersion = "1.0.9";
+ expResult = true;
+ result = Configurator.updateRequired(oldVersion, minVersion);
+ assertEquals(expResult, result);
+
+ oldVersion = "1.0.9-SNAPSHOT-r123";
+ minVersion = "1.0.10-SNAPSHOT";
+ expResult = true;
+ result = Configurator.updateRequired(oldVersion, minVersion);
+ assertEquals(expResult, result);
+
+ oldVersion = "1.0.9";
+ minVersion = "1.0.9.1-SNAPSHOT";
+ expResult = true;
+ result = Configurator.updateRequired(oldVersion, minVersion);
+ assertEquals(expResult, result);
+
+ oldVersion = "1.0.9";
+ minVersion = "1.0.8.99-SNAPSHOT";
+ expResult = false;
+ result = Configurator.updateRequired(oldVersion, minVersion);
+ assertEquals(expResult, result);
+
+ oldVersion = "1";
+ minVersion = "2";
+ expResult = true;
+ result = Configurator.updateRequired(oldVersion, minVersion);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of backupAndDelete method, of class Configurator.
+ */
+ @Ignore
+ @Test
+ public void testBackupAndDelete() throws Exception {
+ System.out.println("backupAndDelete");
+ File dir = null;
+ URI relativeTo = null;
+ ZipOutputStream zip = null;
+ Configurator.backupAndDelete(dir, relativeTo, zip);
+ // TODO review the generated test code and remove the default call to fail.
+ fail("The test case is a prototype.");
+ }
+
+ /**
+ * Test of initConfig method, of class Configurator.
+ */
+ @Ignore
+ @Test
+ public void testInitConfig() throws Exception {
+ System.out.println("initConfig");
+ File configDir = null;
+ Configurator instance = new Configurator();
+ instance.initConfig(configDir);
+ // TODO review the generated test code and remove the default call to fail.
+ fail("The test case is a prototype.");
+ }
+
+} \ No newline at end of file
diff --git a/BKUWebStart/src/test/resources/commons-logging.properties b/BKUWebStart/src/test/resources/commons-logging.properties
new file mode 100644
index 00000000..29292562
--- /dev/null
+++ b/BKUWebStart/src/test/resources/commons-logging.properties
@@ -0,0 +1 @@
+org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
diff --git a/BKUWebStart/src/test/resources/log4j.properties b/BKUWebStart/src/test/resources/log4j.properties
new file mode 100644
index 00000000..ea08c51d
--- /dev/null
+++ b/BKUWebStart/src/test/resources/log4j.properties
@@ -0,0 +1,35 @@
+# 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.
+
+# loglever DEBUG, appender STDOUT
+log4j.rootLogger=TRACE, STDOUT
+log4j.logger.org.mortbay.log=INFO
+log4j.logger.pki=INFO
+
+#log4j.additivity.pki=false
+
+# STDOUT appender
+log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
+log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
+#log4j.appender.STDOUT.layout.ConversionPattern=%5p | %d{dd HH:mm:ss,SSS} | %20c | %10t | %m%n
+#log4j.appender.STDOUT.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+log4j.appender.STDOUT.layout.ConversionPattern=%-5p |%d | %t | %c %x- %m%n
+
+### FILE appender
+log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.file.datePattern='.'yyyy-MM-dd
+log4j.appender.file.File=${user.home}/.mocca/logs/webstart.log
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %-5p %c{1}:%L - %m%n \ No newline at end of file