Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJan Bartel2016-02-01 15:57:35 +0000
committerJan Bartel2016-02-01 15:57:35 +0000
commit599696bfc50a5865cdf7da6ae6c14066c037606d (patch)
treeb943ac8c51354b5bf9a903cdf1bdb61ce60236ef /tests
parent4f9abc279b9c35abcba59ec87a7563caa2d96b6f (diff)
parent56c0bc768ca577ea6a110ffd423d3152ebe50201 (diff)
downloadorg.eclipse.jetty.project-599696bfc50a5865cdf7da6ae6c14066c037606d.tar.gz
org.eclipse.jetty.project-599696bfc50a5865cdf7da6ae6c14066c037606d.tar.xz
org.eclipse.jetty.project-599696bfc50a5865cdf7da6ae6c14066c037606d.zip
Merge branch 'master' into session-refactor
Diffstat (limited to 'tests')
-rw-r--r--tests/test-quickstart/pom.xml1
-rw-r--r--tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java204
-rw-r--r--tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartTest.java2
-rw-r--r--tests/test-sessions/test-gcloud-sessions/pom.xml2
4 files changed, 207 insertions, 2 deletions
diff --git a/tests/test-quickstart/pom.xml b/tests/test-quickstart/pom.xml
index 3d65131d19..6b051ee0eb 100644
--- a/tests/test-quickstart/pom.xml
+++ b/tests/test-quickstart/pom.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty.tests</groupId>
diff --git a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java
new file mode 100644
index 0000000000..8121d63e8e
--- /dev/null
+++ b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/AttributeNormalizerTest.java
@@ -0,0 +1,204 @@
+ //
+// ========================================================================
+// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.quickstart;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jetty.util.resource.Resource;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+public class AttributeNormalizerTest
+{
+ @Parameters(name="{0} = {1}")
+ public static List<String[]> data()
+ {
+ String[][] tests = {
+ { "WAR", "/opt/jetty-distro/demo.base/webapps/root" },
+ { "jetty.home", "/opt/jetty-distro" },
+ { "jetty.base", "/opt/jetty-distro/demo.base" },
+ { "user.home", "/home/user" },
+ { "user.dir", "/etc/init.d" },
+ };
+
+ return Arrays.asList(tests);
+ }
+
+ private static String origJettyBase;
+ private static String origJettyHome;
+ private static String origUserHome;
+ private static String origUserDir;
+
+ @BeforeClass
+ public static void initProperties()
+ {
+ origJettyBase = System.getProperty("jetty.base");
+ origJettyHome = System.getProperty("jetty.home");
+ origUserHome = System.getProperty("user.home");
+ origUserDir = System.getProperty("user.dir");
+
+ System.setProperty("jetty.home","/opt/jetty-distro");
+ System.setProperty("jetty.base","/opt/jetty-distro/demo.base");
+ System.setProperty("user.home","/home/user");
+ System.setProperty("user.dir","/etc/init.d");
+ }
+
+ @AfterClass
+ public static void restoreProperties()
+ {
+ if(origJettyBase != null) System.setProperty("jetty.base",origJettyBase);
+ if(origJettyHome != null) System.setProperty("jetty.home",origJettyHome);
+ if(origUserHome != null) System.setProperty("user.home",origUserHome);
+ if(origUserDir != null) System.setProperty("user.dir",origUserDir);
+ }
+
+ @Parameter(0)
+ public String key;
+
+ @Parameter(1)
+ public String path;
+
+ private AttributeNormalizer normalizer;
+
+ public AttributeNormalizerTest() throws MalformedURLException
+ {
+ normalizer = new AttributeNormalizer(Resource.newResource("/opt/jetty-distro/demo.base/webapps/root"));
+ }
+
+ @Test
+ public void testEqual()
+ {
+ assertEquals("file:${" + key + "}",normalizer.normalize("file:" + path));
+ }
+
+ @Test
+ public void testEqualsSlash()
+ {
+ assertEquals("file:${" + key + "}",normalizer.normalize("file:" + path + "/"));
+ }
+
+ @Test
+ public void testEqualsSlashFile()
+ {
+ assertEquals("file:${" + key + "}/file",normalizer.normalize("file:" + path + "/file"));
+ }
+
+ @Test
+ public void testURIEquals() throws URISyntaxException
+ {
+ assertEquals("file:${" + key + "}",normalizer.normalize(new URI("file:" + path)));
+ }
+
+ @Test
+ public void testURIEqualsSlash() throws URISyntaxException
+ {
+ assertEquals("file:${" + key + "}",normalizer.normalize(new URI("file:" + path + "/")));
+ }
+
+ @Test
+ public void testURIEqualsSlashFile() throws URISyntaxException
+ {
+ assertEquals("file:${" + key + "}/file",normalizer.normalize(new URI("file:" + path + "/file")));
+ }
+
+ @Test
+ public void testURLEquals() throws MalformedURLException
+ {
+ assertEquals("file:${" + key + "}",normalizer.normalize(new URL("file:" + path)));
+ }
+
+ @Test
+ public void testURLEqualsSlash() throws MalformedURLException
+ {
+ assertEquals("file:${" + key + "}",normalizer.normalize(new URL("file:" + path + "/")));
+ }
+
+ @Test
+ public void testURLEqualsSlashFile() throws MalformedURLException
+ {
+ assertEquals("file:${" + key + "}/file",normalizer.normalize(new URL("file:" + path + "/file")));
+ }
+
+ @Test
+ public void testJarFileEquals_BangFile()
+ {
+ assertEquals("jar:file:${" + key + "}!/file",normalizer.normalize("jar:file:" + path + "!/file"));
+ }
+
+ @Test
+ public void testJarFileEquals_SlashBangFile()
+ {
+ assertEquals("jar:file:${" + key + "}!/file",normalizer.normalize("jar:file:" + path + "/!/file"));
+ }
+
+ @Test
+ public void testJarFileEquals_FileBangFile()
+ {
+ assertEquals("jar:file:${" + key + "}/file!/file",normalizer.normalize("jar:file:" + path + "/file!/file"));
+ }
+
+ @Test
+ public void testJarFileEquals_URIBangFile() throws URISyntaxException
+ {
+ assertEquals("jar:file:${" + key + "}!/file",normalizer.normalize(new URI("jar:file:" + path + "!/file")));
+ }
+
+ @Test
+ public void testJarFileEquals_URISlashBangFile() throws URISyntaxException
+ {
+ assertEquals("jar:file:${" + key + "}!/file",normalizer.normalize(new URI("jar:file:" + path + "/!/file")));
+ }
+
+ @Test
+ public void testJarFileEquals_URIFileBangFile() throws URISyntaxException
+ {
+ assertEquals("jar:file:${" + key + "}/file!/file",normalizer.normalize(new URI("jar:file:" + path + "/file!/file")));
+ }
+
+ @Test
+ public void testJarFileEquals_URLBangFile() throws MalformedURLException
+ {
+ assertEquals("jar:file:${" + key + "}!/file",normalizer.normalize(new URL("jar:file:" + path + "!/file")));
+ }
+
+ @Test
+ public void testJarFileEquals_URLSlashBangFile() throws MalformedURLException
+ {
+ assertEquals("jar:file:${" + key + "}!/file",normalizer.normalize(new URL("jar:file:" + path + "/!/file")));
+ }
+
+ @Test
+ public void testJarFileEquals_URLFileBangFile() throws MalformedURLException
+ {
+ assertEquals("jar:file:${" + key + "}/file!/file",normalizer.normalize(new URL("jar:file:" + path + "/file!/file")));
+ }
+}
diff --git a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartTest.java b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartTest.java
index 61b853ba35..5ce9c56894 100644
--- a/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartTest.java
+++ b/tests/test-quickstart/src/test/java/org/eclipse/jetty/quickstart/QuickStartTest.java
@@ -160,7 +160,7 @@ public class QuickStartTest
if (contextXml != null)
{
// System.err.println("Applying "+contextXml);
- XmlConfiguration xmlConfiguration = new XmlConfiguration(contextXml.getURL());
+ XmlConfiguration xmlConfiguration = new XmlConfiguration(contextXml.getURI().toURL());
xmlConfiguration.configure(webapp);
}
diff --git a/tests/test-sessions/test-gcloud-sessions/pom.xml b/tests/test-sessions/test-gcloud-sessions/pom.xml
index 6ea0c976c7..d64e0cd077 100644
--- a/tests/test-sessions/test-gcloud-sessions/pom.xml
+++ b/tests/test-sessions/test-gcloud-sessions/pom.xml
@@ -54,7 +54,7 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty.gcloud</groupId>
- <artifactId>gcloud-session-manager</artifactId>
+ <artifactId>jetty-gcloud-session-manager</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>

Back to the top