aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2012-11-21 05:00:47 (EST)
committerThomas Becker2012-11-21 05:00:47 (EST)
commit15b97675c7b820c45481bc4074719dea1299c3af (patch)
tree8b21cc17a19500e4a04f41fabd22b30e4e6c135b
parent5e61bf8935e370386f776a3645371999ce6b28a8 (diff)
downloadorg.eclipse.jetty.project-15b97675c7b820c45481bc4074719dea1299c3af.zip
org.eclipse.jetty.project-15b97675c7b820c45481bc4074719dea1299c3af.tar.gz
org.eclipse.jetty.project-15b97675c7b820c45481bc4074719dea1299c3af.tar.bz2
Deleted jetty-plugins for now. It's not used at the moment and we've no concrete plans on when to use it. It can be restored from history easily.
-rw-r--r--jetty-plugins/pom.xml54
-rw-r--r--jetty-plugins/src/main/java/org/eclipse/jetty/plugins/DefaultPluginManager.java111
-rw-r--r--jetty-plugins/src/main/java/org/eclipse/jetty/plugins/HttpMavenService.java256
-rw-r--r--jetty-plugins/src/main/java/org/eclipse/jetty/plugins/Main.java133
-rw-r--r--jetty-plugins/src/main/java/org/eclipse/jetty/plugins/MavenService.java40
-rw-r--r--jetty-plugins/src/main/java/org/eclipse/jetty/plugins/PluginManager.java28
-rw-r--r--jetty-plugins/src/main/java/org/eclipse/jetty/plugins/model/Plugin.java43
-rw-r--r--jetty-plugins/src/main/java/org/eclipse/jetty/plugins/util/MavenUtils.java172
-rw-r--r--jetty-plugins/src/main/java/org/eclipse/jetty/plugins/util/RepositoryParser.java67
-rw-r--r--jetty-plugins/src/main/java/org/eclipse/jetty/plugins/util/StreamUtils.java39
-rw-r--r--jetty-plugins/src/test/java/org/eclipse/jetty/plugins/HttpMavenServiceIntegrationTest.java83
-rw-r--r--jetty-plugins/src/test/java/org/eclipse/jetty/plugins/HttpMavenServiceTest.java56
-rw-r--r--jetty-plugins/src/test/java/org/eclipse/jetty/plugins/PluginManagerTest.java149
-rw-r--r--jetty-plugins/src/test/java/org/eclipse/jetty/plugins/util/MavenUtilsTest.java46
-rw-r--r--jetty-plugins/src/test/java/org/eclipse/jetty/plugins/util/RepositoryParserTest.java49
-rw-r--r--jetty-plugins/src/test/resources/example-plugin.zipbin484 -> 0 bytes
-rw-r--r--jetty-plugins/src/test/resources/jetty-jmx-version-plugin.zipbin21982 -> 0 bytes
-rw-r--r--jetty-plugins/src/test/resources/jetty_home/.donotdelete0
-rw-r--r--jetty-plugins/src/test/resources/mavenRepoJettyDirectoryListing.html55
-rw-r--r--jetty-plugins/src/test/resources/mavenRepoJettyJMXDirectoryListing.html36
-rw-r--r--jetty-plugins/src/test/resources/mavenRepoJettyJNDIDirectoryListing.html30
-rw-r--r--jetty-plugins/src/test/resources/maven_repo/org/eclipse/jetty/jetty-anotherplugin/version/jetty-anotherplugin-version-plugin.zip0
-rw-r--r--jetty-plugins/src/test/resources/maven_repo/org/eclipse/jetty/jetty-plugin/version/jetty-plugin-version-plugin.zip0
23 files changed, 0 insertions, 1447 deletions
diff --git a/jetty-plugins/pom.xml b/jetty-plugins/pom.xml
deleted file mode 100644
index 12b1190..0000000
--- a/jetty-plugins/pom.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0"?>
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>jetty-project</artifactId>
- <groupId>org.eclipse.jetty</groupId>
- <version>9.0.0-SNAPSHOT</version>
- </parent>
- <artifactId>jetty-plugins</artifactId>
- <name>Jetty :: Plugin Support</name>
- <description>The jetty plugin artifact.</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- <archive>
- <manifest>
- <mainClass>org.eclipse.jetty.plugins.Main</mainClass>
- </manifest>
- </archive>
- </configuration>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.eclipse.jetty.toolchain</groupId>
- <artifactId>jetty-test-helper</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/DefaultPluginManager.java b/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/DefaultPluginManager.java
deleted file mode 100644
index 9203a6f..0000000
--- a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/DefaultPluginManager.java
+++ /dev/null
@@ -1,111 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2012 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.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import org.eclipse.jetty.plugins.model.Plugin;
-
-public class DefaultPluginManager implements PluginManager
-{
- private String _jettyHome;
- private MavenService _mavenService;
-
- private static List<String> excludes = Arrays.asList("META-INF");
-
- public DefaultPluginManager(MavenService mavenService, String jettyHome)
- {
- this._mavenService = mavenService;
- this._jettyHome = jettyHome;
- }
-
- public Set<String> listAvailablePlugins()
- {
- return _mavenService.listAvailablePlugins();
- }
-
-
- public void installPlugin(String pluginName)
- {
- Plugin plugin = _mavenService.getPlugin(pluginName);
- installPlugin(plugin);
- }
-
- private void installPlugin(Plugin plugin)
- {
- try
- {
- ZipFile pluginJar = new ZipFile(plugin.getPluginJar());
- extractJar(pluginJar);
- }
- catch (IOException e)
- {
- throw new IllegalStateException(e);
- }
- }
-
- private void extractJar(ZipFile file)
- {
- Enumeration<? extends ZipEntry> entries = file.entries();
- while (entries.hasMoreElements())
- {
- extractFileFromJar(file, entries.nextElement());
- }
- }
-
- private void extractFileFromJar(ZipFile zipFile, ZipEntry zipEntry)
- {
- for (String exclude : excludes)
- if (zipEntry.getName().startsWith(exclude))
- return;
-
- System.out.println("Extracting: " + zipEntry.getName());
- File f = new File(_jettyHome + File.separator + zipEntry.getName());
- if (zipEntry.isDirectory())
- {
- // if its a directory, create it
- if(!f.mkdir()) // TODO: what if the directory cannot be created?
- System.out.println("Can't create directory: " + f);
- return;
- }
-
-
- try (InputStream is = zipFile.getInputStream(zipEntry);
- FileOutputStream fos = new FileOutputStream(f))
- {
- while (is.available() > 0)
- {
- fos.write(is.read());
- }
- }
- catch (IOException e)
- {
- throw new IllegalStateException("Could not extract plugin zip", e);
- }
- }
-}
diff --git a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/HttpMavenService.java b/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/HttpMavenService.java
deleted file mode 100644
index ad08073..0000000
--- a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/HttpMavenService.java
+++ /dev/null
@@ -1,256 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2012 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.plugins;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jetty.plugins.model.Plugin;
-import org.eclipse.jetty.plugins.util.MavenUtils;
-import org.eclipse.jetty.plugins.util.RepositoryParser;
-import org.eclipse.jetty.plugins.util.StreamUtils;
-
-public class HttpMavenService implements MavenService
-{
- private static final String REPOSITORY_URL = "http://repo2.maven.org/maven2/";
- private static final String[] GROUP_IDS = new String[]{ "org/eclipse/jetty", "org/mortbay/jetty" };
- private static final String VERSION = "9.0.0-SNAPSHOT"; // TODO: should be automatically set
- private boolean _searchRemoteRepository = true;
- private boolean _searchLocalRepository = false;
- private String _localRepository = MavenUtils.getLocalRepositoryLocation();
- private String _repositoryUrl = REPOSITORY_URL;
- private String[] _groupIds = GROUP_IDS;
- private String _version = VERSION;
-
- public Set<String> listAvailablePlugins()
- {
- System.out.println("Using local repo: " + _searchLocalRepository + " remote repo: " + _searchRemoteRepository);
- Set<String> availablePlugins = new HashSet<>();
- if (_searchRemoteRepository)
- availablePlugins.addAll(getListOfRemotePlugins());
-
- if (_searchLocalRepository)
- availablePlugins.addAll(getListOfLocalPlugins());
-
- return availablePlugins;
- }
-
- private Set<String> getListOfLocalPlugins()
- {
- Set<String> availablePlugins = new HashSet<>();
- File localMavenRepository = new File(_localRepository);
- if (!localMavenRepository.exists())
- {
- System.out.println("Can't find local repo: " + localMavenRepository);
- return availablePlugins;
- }
-
- System.out.println("Using local repository: " + localMavenRepository);
-
- for (String groupId : _groupIds)
- {
- File file = new File(_localRepository + groupId);
- if (!file.exists())
- break;
-
- String[] localMavenModuleList = file.list();
-
- System.out.println("Trying the following modules: " + Arrays.toString(localMavenModuleList));
- for (String potentialPlugin : localMavenModuleList)
- {
- File pluginFile = new File(_localRepository + getPluginPath(groupId,potentialPlugin));
- if (pluginFile.exists())
- availablePlugins.add(potentialPlugin);
- }
- }
-
- return availablePlugins;
- }
-
- private Set<String> getListOfRemotePlugins()
- {
- Set<String> availablePlugins = new HashSet<>();
-
- String moduleListing = fetchDirectoryListingOfJettyModules();
- List<String> modules = RepositoryParser
- .parseLinksInDirectoryListing(moduleListing);
-
- for (String module : modules)
- {
- String listing = fetchModuleDirectoryListing(module);
- if (RepositoryParser.isModuleAPlugin(listing))
- {
- availablePlugins.add(module);
- }
- }
- return availablePlugins;
- }
-
- private String fetchDirectoryListingOfJettyModules()
- {
- try
- {
- StringBuilder directoryListing = new StringBuilder();
- for (String groupId : _groupIds)
- {
- URL url = new URL(_repositoryUrl + groupId);
- URLConnection connection = url.openConnection();
- InputStream inputStream = connection.getInputStream();
- directoryListing.append(StreamUtils.inputStreamToString(inputStream));
- }
- return directoryListing.toString();
- }
- catch (IOException e)
- {
- throw new IllegalStateException(e);
- }
- }
-
- private String fetchModuleDirectoryListing(String module)
- {
- for (String groupId : _groupIds)
- {
- try
- {
- URL configJar = new URL(_repositoryUrl + getModulePath(groupId, module));
- URLConnection connection = configJar.openConnection();
- InputStream inputStream = connection.getInputStream();
- return StreamUtils.inputStreamToString(inputStream);
- }
- catch (MalformedURLException e)
- {
- throw new IllegalStateException(e);
- }
- catch (IOException e)
- {
- // Honestly, I'm not a friend of ignoring exceptions as it might
- // hide something important. In this case however it "usually"
- // just means: THIS IS NOT A PLUGIN! However it still might hide
- // things. If that'll be the case, I hope I'm not the one who
- // has to debug my own code. ;)
- System.out.println(e); //TODO:
- }
- }
- return "not a plugin";
- }
-
- public Plugin getPlugin(String pluginName)
- {
- File pluginJar = getPluginFile(pluginName);
- return new Plugin(pluginName, pluginJar);
- }
-
- private String getPluginPath(String groupId, String pluginName)
- {
- return getModulePath(groupId, pluginName) + pluginName + "-" + _version + "-plugin.zip";
- }
-
- private String getModulePath(String groupId, String pluginName)
- {
- return groupId + "/" + pluginName + "/" + _version
- + "/";
- }
-
- /**
- * Tries to find the plugin in the local repo first and then tries the remote repositories in the order they're
- * stored in _repositoryUrls
- *
- * @param pluginName the name of the plugin to get the plugin file for
- * @return the plugin file
- */
- private File getPluginFile(String pluginName)
- {
- for (String groupId : _groupIds)
- {
- File pluginFile = new File(MavenUtils.getLocalRepositoryLocation() + getPluginPath(groupId, pluginName));
- if (pluginFile.exists())
- return pluginFile;
-
- String urlString = _repositoryUrl + getPluginPath(groupId, pluginName);
- String fileName = urlString.substring(urlString.lastIndexOf("/") + 1);
- try
- {
- return getPluginFileFromRemoteLocation(urlString, fileName);
- }
- catch (IOException e)
- {
- System.out.println("Couldn't find plugin: " + pluginName + " at repo: " + _repositoryUrl + ". " +
- "Probably trying other repo. Reason: " + e.getMessage());
- }
- }
- throw new IllegalStateException("Plugin: " + pluginName + " not found at any configured repo.");
- }
-
- private File getPluginFileFromRemoteLocation(String urlString, String fileName) throws IOException
- {
- URL url = new URL(urlString);
- URLConnection connection = url.openConnection();
- InputStream inputStream = connection.getInputStream();
- File tempFile = new File(System.getProperty("java.io.tmpdir"),
- fileName);
- OutputStream out = new FileOutputStream(tempFile);
- byte buf[] = new byte[1024];
- int len;
- while ((len = inputStream.read(buf)) > 0)
- out.write(buf, 0, len);
- out.close();
- inputStream.close();
- return tempFile;
- }
-
- public void setGroupId(String groupId)
- {
- this._groupIds = new String[] { groupId.replace(".", "/") };
- }
-
- public void setLocalRepository(String localRepository)
- {
- this._localRepository = localRepository;
- }
-
- public void setRepositoryUrl(String repositoryUrl)
- {
- this._repositoryUrl = repositoryUrl;
- }
-
- public void setVersion(String version)
- {
- this._version = version;
- }
-
- public void setSearchRemoteRepository(boolean searchRemoteRepository)
- {
- this._searchRemoteRepository = searchRemoteRepository;
- }
-
- public void setSearchLocalRepository(boolean searchLocalRepository)
- {
- this._searchLocalRepository = searchLocalRepository;
- }
-}
diff --git a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/Main.java b/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/Main.java
deleted file mode 100644
index dbe5c35..0000000
--- a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/Main.java
+++ /dev/null
@@ -1,133 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2012 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.plugins;
-
-import java.util.Map;
-import java.util.Set;
-
-public class Main
-{
- private static final String JETTY_HOME = "JETTY_HOME";
-
- private MavenService _mavenService = new HttpMavenService();
- private PluginManager _pluginManager;
- private String _jettyHome;
- private String _installPlugin;
- private boolean _listPlugins;
- private String _repositoryUrl;
- private String _groupId;
- private String _version;
- private boolean _searchRemoteRepository = true;
- private boolean _searchLocalRepository = false;
-
- public static void main(String[] args)
- {
- Main main = new Main();
- main.execute(args);
- }
-
- private void execute(String[] args)
- {
- parseEnvironmentVariables();
- parseCommandline(args);
- configureMavenService();
-
- _pluginManager = new DefaultPluginManager(_mavenService, _jettyHome);
-
- if (_listPlugins)
- listPlugins();
- else if (_installPlugin != null)
- installPlugin();
- }
-
- private void configureMavenService()
- {
- if (_repositoryUrl != null)
- _mavenService.setRepositoryUrl(_repositoryUrl);
- if (_groupId != null)
- _mavenService.setGroupId(_groupId);
- if (_version != null)
- _mavenService.setVersion(_version);
-
- _mavenService.setSearchLocalRepository(_searchLocalRepository);
- _mavenService.setSearchRemoteRepository(_searchRemoteRepository);
- }
-
- private void listPlugins()
- {
- Set<String> availablePlugins = _pluginManager.listAvailablePlugins();
- for (String pluginName : availablePlugins)
- System.out.println(pluginName);
- }
-
- private void installPlugin()
- {
- _pluginManager.installPlugin(_installPlugin);
- System.out.println("Successfully installed plugin: " + _installPlugin
- + " to " + _jettyHome);
- }
-
- private void parseEnvironmentVariables()
- {
- Map<String, String> env = System.getenv();
- if (env.containsKey(JETTY_HOME))
- _jettyHome = env.get(JETTY_HOME);
- }
-
- private void parseCommandline(String[] args)
- {
- int i = 0;
- for (String arg : args)
- {
- i++;
-
- if (arg.startsWith("--jettyHome="))
- _jettyHome = arg.substring(12);
- if (arg.startsWith("--repositoryUrl="))
- _repositoryUrl = arg.substring(16);
- if (arg.startsWith("--groupId="))
- _groupId = arg.substring(10);
- if (arg.startsWith("--version="))
- _version = arg.substring(10);
- if (arg.startsWith("--useLocalRepo="))
- _searchLocalRepository = Boolean.valueOf(arg.substring(15));
- if (arg.startsWith("--useRemoteRepo="))
- _searchRemoteRepository = Boolean.valueOf(arg.substring(15));
- if (arg.startsWith("install"))
- _installPlugin = args[i];
- if ("list".equals(arg))
- _listPlugins = true;
- }
-
- if (_jettyHome == null && _installPlugin != null)
- printUsage("No --jettyHome commandline option specified and no \"JETTY_HOME\" environment variable found!");
- if (_installPlugin == null && !_listPlugins)
- printUsage("Neither install <pluginname> nor list commandline option specified. Nothing to do for me!");
- if (_installPlugin != null && _listPlugins)
- printUsage("Please specify either install <pluginname> or list commandline options, " +
- "but not both at the same time!");
- }
-
- private void printUsage(String errorMessage)
- {
- System.out.println(errorMessage);
- System.exit(1);
- //TODO: print usage
- }
-}
diff --git a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/MavenService.java b/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/MavenService.java
deleted file mode 100644
index 08b55a9..0000000
--- a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/MavenService.java
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2012 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.plugins;
-
-import java.util.Set;
-
-import org.eclipse.jetty.plugins.model.Plugin;
-
-public interface MavenService
-{
- public Set<String> listAvailablePlugins();
-
- public Plugin getPlugin(String pluginName);
-
- public void setGroupId(String groupId);
-
- public void setRepositoryUrl(String repositoryUrl);
-
- public void setVersion(String version);
-
- public void setSearchLocalRepository(boolean searchLocalRepository);
-
- public void setSearchRemoteRepository(boolean searchRemoteRepository);
-}
diff --git a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/PluginManager.java b/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/PluginManager.java
deleted file mode 100644
index 36c721c..0000000
--- a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/PluginManager.java
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2012 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.plugins;
-
-import java.util.Set;
-
-public interface PluginManager
-{
- public Set<String> listAvailablePlugins();
-
- public void installPlugin(String pluginName);
-}
diff --git a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/model/Plugin.java b/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/model/Plugin.java
deleted file mode 100644
index 4225097..0000000
--- a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/model/Plugin.java
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2012 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.plugins.model;
-
-import java.io.File;
-
-public class Plugin
-{
- private final String name;
- private final File pluginJar;
-
- public Plugin(String name, File pluginJar)
- {
- this.name = name;
- this.pluginJar = pluginJar;
- }
-
- public String getName()
- {
- return name;
- }
-
- public File getPluginJar()
- {
- return pluginJar;
- }
-}
diff --git a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/util/MavenUtils.java b/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/util/MavenUtils.java
deleted file mode 100644
index 09cc746..0000000
--- a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/util/MavenUtils.java
+++ /dev/null
@@ -1,172 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2012 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.plugins.util;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-public class MavenUtils
-{
- private final static String DEFAULT_REPOSITORY_LOCATION = System.getProperty("user.home") + "/.m2/repository/";
-
- /**
- * Looks for maven's settings.xml in $M2_HOME/conf/settings.xml
- *
- * @return a file representing the global settings.xml
- */
- static File findGlobalSettingsXml()
- {
- String m2Home = System.getenv("M2_HOME");
- return new File(m2Home + "/conf/settings.xml");
- }
-
- /**
- * Looks for maven's settings.xml in ${user.home}/.m2/settings.xml
- *
- * @return a file representing the user's settings.xml
- */
- static File findUserSettingsXml()
- {
- String userHome = System.getProperty("user.home");
- return new File(userHome + "/.m2/settings.xml");
- }
-
- /**
- * Read the local repository location from settings.xml. A setting in the user's settings.xml will override the
- * global one.
- *
- * @return location of the local maven repo
- */
- public static String getLocalRepositoryLocation()
- {
- String repositoryLocation = DEFAULT_REPOSITORY_LOCATION;
- try
- {
- // find the global setting
- String tempRepositoryLocation = parseSettingsXml(findGlobalSettingsXml());
- if (tempRepositoryLocation != null)
- repositoryLocation = tempRepositoryLocation;
-
- // override with user settings.xml
- tempRepositoryLocation = parseSettingsXml(findUserSettingsXml());
- if (tempRepositoryLocation != null)
- repositoryLocation = tempRepositoryLocation;
- }
- catch (IOException | SAXException e)
- {
- throw new IllegalStateException(e);
- }
- return repositoryLocation;
- }
-
- private static String parseSettingsXml(File settingsXml) throws IOException, SAXException
- {
- if(!settingsXml.exists())
- return null;
-
- // readability is more important than efficiency here, so we just recreate those objects
- XMLReader reader = XMLReaderFactory.createXMLReader();
- SettingsXmlContentHandler settingsXmlContentHandler = new SettingsXmlContentHandler();
- reader.setContentHandler(settingsXmlContentHandler);
-
- InputSource source = new InputSource(new FileReader(settingsXml));
- reader.parse(source);
- return settingsXmlContentHandler.getRepositoryLocation();
- }
-
- private static class SettingsXmlContentHandler implements ContentHandler
- {
- private String repositoryLocation;
- private String currentValue;
-
- @Override
- public void characters(char[] ch, int start, int length) throws SAXException
- {
- currentValue = new String(ch, start, length);
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException
- {
- if (localName.equals("localRepository"))
- {
- repositoryLocation = currentValue;
- }
- }
-
- public String getRepositoryLocation()
- {
- return repositoryLocation;
- }
-
- @Override
- public void setDocumentLocator(Locator locator)
- {
- }
-
- @Override
- public void startDocument() throws SAXException
- {
- }
-
- @Override
- public void endDocument() throws SAXException
- {
- }
-
- @Override
- public void startPrefixMapping(String prefix, String uri) throws SAXException
- {
- }
-
- @Override
- public void endPrefixMapping(String prefix) throws SAXException
- {
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
- {
- }
-
- @Override
- public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
- {
- }
-
- @Override
- public void processingInstruction(String target, String data) throws SAXException
- {
- }
-
- @Override
- public void skippedEntity(String name) throws SAXException
- {
- }
- }
-}
diff --git a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/util/RepositoryParser.java b/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/util/RepositoryParser.java
deleted file mode 100644
index ed16dc8..0000000
--- a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/util/RepositoryParser.java
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2012 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.plugins.util;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class RepositoryParser
-{
- private final static List<String> EXCLUDES = Arrays.asList("..");
-
- public static List<String> parseLinksInDirectoryListing(String listing)
- {
- List<String> modules = new ArrayList<>();
- List<String> lines = Arrays.asList(listing.split("\n"));
- for (String line : lines)
- {
- Pattern p = Pattern.compile(".*?<a href=\"[^>]+>(?=([^</]+)/).*");
- Matcher m = p.matcher(line);
- if (m.matches())
- {
- if (!EXCLUDES.contains(m.group(1)))
- {
- modules.add(m.group(1));
- }
- }
- }
- return modules;
- }
-
- public static boolean isModuleAPlugin(String listing)
- {
- List<String> lines = Arrays.asList(listing.split("\n"));
- for (String line : lines)
- {
- Pattern p = Pattern.compile("-plugin\\.jar");
- Matcher m = p.matcher(line);
- if (m.find())
- {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/util/StreamUtils.java b/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/util/StreamUtils.java
deleted file mode 100644
index cd1a93b..0000000
--- a/jetty-plugins/src/main/java/org/eclipse/jetty/plugins/util/StreamUtils.java
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2012 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.plugins.util;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-public class StreamUtils
-{
- public static String inputStreamToString(InputStream inputStream) throws IOException
- {
- try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)))
- {
- StringBuilder stringBuilder = new StringBuilder();
- String line;
- while ((line = bufferedReader.readLine()) != null)
- stringBuilder.append(line).append("\n");
- return stringBuilder.toString();
- }
- }
-}
diff --git a/jetty-plugins/src/test/java/org/eclipse/jetty/plugins/HttpMavenServiceIntegrationTest.java b/jetty-plugins/src/test/java/org/eclipse/jetty/plugins/HttpMavenServiceIntegrationTest.java
deleted file mode 100644
index 826888c..0000000
--- a/jetty-plugins/src/test/java/org/eclipse/jetty/plugins/HttpMavenServiceIntegrationTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2012 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.plugins;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Set;
-
-import org.eclipse.jetty.plugins.model.Plugin;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.hamcrest.Matchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-/**
- * This is currently more an integration test downloading real stuff from real maven repositories. Actually it's
- * preferred to have a real unit test or at least a local repository server. But since HttpClient.send(exchange) has an
- * api which is really hard to mock, I will leave that exercise for later.
- * <p/>
- * However this tests should be disabled for the general build and ci.
- */
-public class HttpMavenServiceIntegrationTest
-{
- private HttpMavenService _mavenService = new HttpMavenService();
-
- private static final String JETTY_JMX_PLUGIN_NAME = "jetty-jmx";
- private static final String PRIVATE_NEXUS_REPOSITORY_URL = "http://gravity-design.de:8080/nexus/content/repositories/releases/";
- private static final String MAVEN_CENTRAL_URL = "http://repo2.maven.org/maven2/";
-
- @Before
- public void setUp() throws Exception
- {
- _mavenService.setRepositoryUrl(PRIVATE_NEXUS_REPOSITORY_URL);
- }
-
- @Test
- @Ignore("requires online repo")
- public void testListAvailablePlugins()
- {
- Set<String> pluginNames = _mavenService.listAvailablePlugins();
- assertThat(pluginNames.size(), is(2));
- }
-
- @Test
- @Ignore("requires online repo")
- public void testGetPluginJar() throws IOException
- {
- Plugin plugin = _mavenService.getPlugin(JETTY_JMX_PLUGIN_NAME);
- assertThat("jetty-jmx should contain a plugin-jar",
- plugin.getPluginJar(), is(notNullValue()));
- }
-
- @Test
- @Ignore("requires online repo")
- public void testGetConfigJar() throws IOException
- {
- Plugin plugin = _mavenService.getPlugin(JETTY_JMX_PLUGIN_NAME);
- File configJar = plugin.getPluginJar();
- assertThat(configJar, is(not(nullValue())));
- }
-
-}
diff --git a/jetty-plugins/src/test/java/org/eclipse/jetty/plugins/HttpMavenServiceTest.java b/jetty-plugins/src/test/java/org/eclipse/jetty/plugins/HttpMavenServiceTest.java
deleted file mode 100644
index c6a2a88..0000000
--- a/jetty-plugins/src/test/java/org/eclipse/jetty/plugins/HttpMavenServiceTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2012 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.plugins;
-
-import java.util.Set;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-/**
- */
-public class HttpMavenServiceTest
-{
- private HttpMavenService _mavenService = new HttpMavenService();
-
- private static final String MAVEN_CENTRAL_URL = "http://repo2.maven.org/maven2/";
-
- @Before
- public void setUp() throws Exception
- {
- _mavenService.setLocalRepository(this.getClass().getClassLoader().getResource("maven_repo").getFile() + "/");
- _mavenService.setRepositoryUrl(MAVEN_CENTRAL_URL);
- _mavenService.setVersion("version");
- _mavenService.setSearchRemoteRepository(false);
- _mavenService.setSearchLocalRepository(true);
- }
-
- @Test
- public void testListAvailablePlugins()
- {
- Set<String> pluginNames = _mavenService.listAvailablePlugins();
- assertThat(pluginNames.size(), is(2));
- assertThat("plugin jetty-plugin found", pluginNames.contains("jetty-plugin"), is(true));
- assertThat("plugin jetty-anotherplugin found", pluginNames.contains("jetty-anotherplugin"), is(true));
- }
-
-}
diff --git a/jetty-plugins/src/test/java/org/eclipse/jetty/plugins/PluginManagerTest.java b/jetty-plugins/src/test/java/org/eclipse/jetty/plugins/PluginManagerTest.java
deleted file mode 100644
index 24a5151..0000000
--- a/jetty-plugins/src/test/java/org/eclipse/jetty/plugins/PluginManagerTest.java
+++ /dev/null
@@ -1,149 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2012 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.plugins;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.nio.channels.FileChannel;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.jetty.plugins.model.Plugin;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public class PluginManagerTest
-{
- @Mock
- private MavenService _mavenService;
- private DefaultPluginManager _Default_pluginManager;
- private Set<String> availablePlugins = createAvailablePluginsTestData();
- private ClassLoader _classLoader = this.getClass().getClassLoader();
- private String _tmpDir;
- private File _javaTmpDir = new File(System.getProperty("java.io.tmpdir"));
-
- @Before
- public void setUp() throws Exception
- {
- URL resource = this.getClass().getResource("/jetty_home");
- _tmpDir = resource.getFile();
- _Default_pluginManager = new DefaultPluginManager(_mavenService, _tmpDir);
- }
-
- @Test
- public void testListAvailablePlugins()
- {
- when(_mavenService.listAvailablePlugins()).thenReturn(availablePlugins);
- Set<String> availablePlugins = _Default_pluginManager.listAvailablePlugins();
- assertThat("jetty-jmx not found",
- availablePlugins.contains("jetty-jmx"), is(true));
- assertThat("jetty-jta not found",
- availablePlugins.contains("jetty-jta"), is(true));
- }
-
- @Test
- public void testInstallPluginJar()
- {
- String pluginName = "jetty-plugin-with-plugin-zip";
- URL resource = _classLoader.getResource("example-plugin.zip");
- Assert.assertNotNull(resource);
- String pluginZip = resource.getFile();
- File pluginZipFile = new File(pluginZip);
- Plugin plugin = createTestPlugin(pluginName, pluginZipFile);
-
- when(_mavenService.getPlugin(pluginName)).thenReturn(plugin);
-
- _Default_pluginManager.installPlugin(pluginName);
-
- File someJar = new File(_tmpDir + File.separator + "lib" + File.separator + "somejar.jar");
- assertThat("someJar.jar does not exist", someJar.exists(), is(true));
- File someOtherJar = new File(_tmpDir + File.separator + "lib"
- + File.separator + "someotherjar.jar");
- assertThat("someOtherJar.jar does not exist", someOtherJar.exists(),
- is(true));
- }
-
- @Test
- public void testInstallPlugins() throws IOException
- {
- String pluginName = "jetty-jmx";
- URL resource = _classLoader.getResource("jetty-jmx-version-plugin.zip");
- Assert.assertNotNull(resource);
- String jmxPluginZip = resource.getFile();
- File jmxPluginZipFile = new File(jmxPluginZip);
-
- // Need to copy it to a temp file since the implementation will move the
- // file and we need to keep the test files where they are.
- File jmxPluginConfigTempCopy = copyToTempFile(jmxPluginZipFile);
-
- Plugin plugin = new Plugin(pluginName, jmxPluginConfigTempCopy);
-
- when(_mavenService.getPlugin(pluginName)).thenReturn(plugin);
-
- _Default_pluginManager.installPlugin(pluginName);
-
- File metaInf = new File(_tmpDir + File.separator + "META-INF");
- File jettyXmlConfigFile = new File(_tmpDir + File.separator + "start.d"
- + File.separator + "20-jetty-jmx.xml");
- File jettyJmxJarFile = new File(_tmpDir + File.separator + "lib"
- + File.separator + "jetty-jmx-version.jar");
- assertThat("META-INF should be skipped", metaInf.exists(), not(true));
- assertThat("20-jetty-jmx.xml does not exist",
- jettyXmlConfigFile.exists(), is(true));
- assertThat("jetty-jmx-version.jar does not exist",
- jettyJmxJarFile.exists(), is(true));
- }
-
- public File copyToTempFile(File sourceFile) throws IOException
- {
- File destFile = new File(_javaTmpDir + File.separator + sourceFile.getName());
- try (FileChannel destination = new FileOutputStream(destFile).getChannel();
- FileChannel source = new FileInputStream(sourceFile).getChannel())
- {
- destination.transferFrom(source, 0, source.size());
- }
- return destFile;
- }
-
- private Set<String> createAvailablePluginsTestData()
- {
- Set<String> availablePlugins = new HashSet<>();
- availablePlugins.add("jetty-jmx");
- availablePlugins.add("jetty-jta");
- return availablePlugins;
- }
-
- private Plugin createTestPlugin(String name, File jar)
- {
- return new Plugin(name, jar);
- }
-}
diff --git a/jetty-plugins/src/test/java/org/eclipse/jetty/plugins/util/MavenUtilsTest.java b/jetty-plugins/src/test/java/org/eclipse/jetty/plugins/util/MavenUtilsTest.java
deleted file mode 100644
index 569bfed..0000000
--- a/jetty-plugins/src/test/java/org/eclipse/jetty/plugins/util/MavenUtilsTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2012 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.plugins.util;
-
-import java.io.File;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-public class MavenUtilsTest
-{
- @Test
- @Ignore("Very environment specific, so disabled in commit. Enable if working on the code.")
- public void testFindUserSettingsXml()
- {
- File settingsXml = MavenUtils.findUserSettingsXml();
- assertThat("settings.xml is found", settingsXml.exists(), is(true));
- }
-
- @Test
- @Ignore("Very environment specific, so disabled in commit. Enable if working on the code.")
- public void testGetLocalRepositoryLocation()
- {
- String repositoryLocation = MavenUtils.getLocalRepositoryLocation();
- assertThat("maven repository exists", new File(repositoryLocation).exists(), is(true));
- }
-}
diff --git a/jetty-plugins/src/test/java/org/eclipse/jetty/plugins/util/RepositoryParserTest.java b/jetty-plugins/src/test/java/org/eclipse/jetty/plugins/util/RepositoryParserTest.java
deleted file mode 100644
index 45adcdf..0000000
--- a/jetty-plugins/src/test/java/org/eclipse/jetty/plugins/util/RepositoryParserTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2012 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.plugins.util;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.junit.Test;
-
-import static org.hamcrest.Matchers.greaterThan;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-public class RepositoryParserTest
-{
- @Test
- public void testParseLinksInDirectoryListing() throws IOException
- {
- String listing = StreamUtils.inputStreamToString(this.getClass().getClassLoader().getResourceAsStream("mavenRepoJettyDirectoryListing.html"));
- List<String> modules = RepositoryParser.parseLinksInDirectoryListing(listing);
- assertThat("At least ten jetty modules expected", modules.size(), greaterThan(10));
- assertThat("jetty-jmx module expected", modules.contains("jetty-jmx"), is(true));
- }
-
- @Test
- public void testIsPlugin() throws IOException
- {
- String listing = StreamUtils.inputStreamToString(this.getClass().getClassLoader().getResourceAsStream("mavenRepoJettyJMXDirectoryListing.html"));
- assertThat("listing describes a plugin", RepositoryParser.isModuleAPlugin(listing), is(true));
- String nonPluginListing = StreamUtils.inputStreamToString(this.getClass().getClassLoader().getResourceAsStream("mavenRepoJettyJNDIDirectoryListing.html"));
- assertThat("listing doesn't describe a plugin", RepositoryParser.isModuleAPlugin(nonPluginListing), is(false));
- }
-}
diff --git a/jetty-plugins/src/test/resources/example-plugin.zip b/jetty-plugins/src/test/resources/example-plugin.zip
deleted file mode 100644
index c152b1f..0000000
--- a/jetty-plugins/src/test/resources/example-plugin.zip
+++ /dev/null
Binary files differ
diff --git a/jetty-plugins/src/test/resources/jetty-jmx-version-plugin.zip b/jetty-plugins/src/test/resources/jetty-jmx-version-plugin.zip
deleted file mode 100644
index f680dd0..0000000
--- a/jetty-plugins/src/test/resources/jetty-jmx-version-plugin.zip
+++ /dev/null
Binary files differ
diff --git a/jetty-plugins/src/test/resources/jetty_home/.donotdelete b/jetty-plugins/src/test/resources/jetty_home/.donotdelete
deleted file mode 100644
index e69de29..0000000
--- a/jetty-plugins/src/test/resources/jetty_home/.donotdelete
+++ /dev/null
diff --git a/jetty-plugins/src/test/resources/mavenRepoJettyDirectoryListing.html b/jetty-plugins/src/test/resources/mavenRepoJettyDirectoryListing.html
deleted file mode 100644
index cd6549c..0000000
--- a/jetty-plugins/src/test/resources/mavenRepoJettyDirectoryListing.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<html>
-<head><title>Index of /maven2/org/eclipse/jetty/</title></head>
-<body bgcolor="white">
-<h1>Index of /maven2/org/eclipse/jetty/</h1><hr><pre><a href="../">../</a>
-<a href="aggregate/">aggregate/</a> 22-Dec-2011 21:20 -
-<a href="example-async-rest/">example-async-rest/</a> 09-Mar-2012 16:06 -
-<a href="example-jetty-embedded/">example-jetty-embedded/</a> 09-Mar-2012 16:06 -
-<a href="jetty-ajp/">jetty-ajp/</a> 09-Mar-2012 16:06 -
-<a href="jetty-annotations/">jetty-annotations/</a> 09-Mar-2012 16:06 -
-<a href="jetty-client/">jetty-client/</a> 09-Mar-2012 16:06 -
-<a href="jetty-continuation/">jetty-continuation/</a> 09-Mar-2012 16:06 -
-<a href="jetty-deploy/">jetty-deploy/</a> 09-Mar-2012 16:06 -
-<a href="jetty-distribution/">jetty-distribution/</a> 09-Mar-2012 16:06 -
-<a href="jetty-embedded-examples/">jetty-embedded-examples/</a> 21-Sep-2009 15:50 -
-<a href="jetty-http/">jetty-http/</a> 09-Mar-2012 16:06 -
-<a href="jetty-http-spi/">jetty-http-spi/</a> 09-Mar-2012 16:06 -
-<a href="jetty-io/">jetty-io/</a> 09-Mar-2012 16:06 -
-<a href="jetty-jaspi/">jetty-jaspi/</a> 09-Mar-2012 16:06 -
-<a href="jetty-jmx/">jetty-jmx/</a> 09-Mar-2012 16:06 -
-<a href="jetty-jndi/">jetty-jndi/</a> 09-Mar-2012 16:06 -
-<a href="jetty-jsp/">jetty-jsp/</a> 09-Mar-2012 16:06 -
-<a href="jetty-jsp-2.1/">jetty-jsp-2.1/</a> 25-Oct-2011 01:05 -
-<a href="jetty-monitor/">jetty-monitor/</a> 09-Mar-2012 16:06 -
-<a href="jetty-nested/">jetty-nested/</a> 09-Mar-2012 16:06 -
-<a href="jetty-nosql/">jetty-nosql/</a> 09-Mar-2012 16:06 -
-<a href="jetty-overlay-deployer/">jetty-overlay-deployer/</a> 09-Mar-2012 16:06 -
-<a href="jetty-parent/">jetty-parent/</a> 20-Sep-2011 16:54 -
-<a href="jetty-plus/">jetty-plus/</a> 09-Mar-2012 16:06 -
-<a href="jetty-policy/">jetty-policy/</a> 09-Mar-2012 16:06 -
-<a href="jetty-project/">jetty-project/</a> 09-Mar-2012 16:06 -
-<a href="jetty-rewrite/">jetty-rewrite/</a> 09-Mar-2012 16:06 -
-<a href="jetty-security/">jetty-security/</a> 09-Mar-2012 16:06 -
-<a href="jetty-server/">jetty-server/</a> 09-Mar-2012 16:06 -
-<a href="jetty-servlet/">jetty-servlet/</a> 09-Mar-2012 16:06 -
-<a href="jetty-servlet-tester/">jetty-servlet-tester/</a> 21-Sep-2009 15:52 -
-<a href="jetty-servlets/">jetty-servlets/</a> 09-Mar-2012 16:06 -
-<a href="jetty-start/">jetty-start/</a> 09-Mar-2012 16:06 -
-<a href="jetty-test-webapp/">jetty-test-webapp/</a> 21-Sep-2009 15:50 -
-<a href="jetty-util/">jetty-util/</a> 09-Mar-2012 16:06 -
-<a href="jetty-webapp/">jetty-webapp/</a> 09-Mar-2012 16:06 -
-<a href="jetty-websocket/">jetty-websocket/</a> 09-Mar-2012 16:06 -
-<a href="jetty-xml/">jetty-xml/</a> 09-Mar-2012 16:06 -
-<a href="npn/">npn/</a> 09-Mar-2012 16:05 -
-<a href="orbit/">orbit/</a> 24-Jan-2012 23:22 -
-<a href="osgi/">osgi/</a> 27-May-2011 08:34 -
-<a href="spdy/">spdy/</a> 09-Mar-2012 16:05 -
-<a href="test-continuation/">test-continuation/</a> 01-Apr-2010 13:30 -
-<a href="test-continuation-jetty6/">test-continuation-jetty6/</a> 01-Apr-2010 13:30 -
-<a href="test-jetty-nested/">test-jetty-nested/</a> 09-Mar-2012 16:06 -
-<a href="test-jetty-servlet/">test-jetty-servlet/</a> 09-Mar-2012 16:06 -
-<a href="test-jetty-webapp/">test-jetty-webapp/</a> 09-Mar-2012 16:06 -
-<a href="tests/">tests/</a> 30-Nov-2011 02:16 -
-<a href="toolchain/">toolchain/</a> 06-Dec-2011 23:32 -
-</pre><hr></body>
-</html> \ No newline at end of file
diff --git a/jetty-plugins/src/test/resources/mavenRepoJettyJMXDirectoryListing.html b/jetty-plugins/src/test/resources/mavenRepoJettyJMXDirectoryListing.html
deleted file mode 100644
index ac33b1a..0000000
--- a/jetty-plugins/src/test/resources/mavenRepoJettyJMXDirectoryListing.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<html>
-<head><title>Index of /maven2/org/eclipse/jetty/jetty-jmx/7.6.0.v20120127/</title></head>
-<body bgcolor="white">
-<h1>Index of /maven2/org/eclipse/jetty/jetty-jmx/7.6.0.v20120127/</h1><hr><pre><a href="../">../</a>
-<a href="jetty-jmx-7.6.0.v20120127-plugin.jar">jetty-jmx-7.6.0.v20120127-plugin.jar</a> 27-Jan-2012 14:24 1873
-<a href="jetty-jmx-7.6.0.v20120127-plugin.jar.asc">jetty-jmx-7.6.0.v20120127-plugin.jar.asc</a> 27-Jan-2012 14:24 198
-<a href="jetty-jmx-7.6.0.v20120127-plugin.jar.asc.md5">jetty-jmx-7.6.0.v20120127-plugin.jar.asc.md5</a> 27-Jan-2012 14:24 32
-<a href="jetty-jmx-7.6.0.v20120127-plugin.jar.asc.sha1">jetty-jmx-7.6.0.v20120127-plugin.jar.asc.sha1</a> 27-Jan-2012 14:24 40
-<a href="jetty-jmx-7.6.0.v20120127-plugin.jar.md5">jetty-jmx-7.6.0.v20120127-plugin.jar.md5</a> 27-Jan-2012 14:24 32
-<a href="jetty-jmx-7.6.0.v20120127-plugin.jar.sha1">jetty-jmx-7.6.0.v20120127-plugin.jar.sha1</a> 27-Jan-2012 14:24 40
-<a href="jetty-jmx-7.6.0.v20120127-javadoc.jar">jetty-jmx-7.6.0.v20120127-javadoc.jar</a> 27-Jan-2012 14:24 52590
-<a href="jetty-jmx-7.6.0.v20120127-javadoc.jar.asc">jetty-jmx-7.6.0.v20120127-javadoc.jar.asc</a> 27-Jan-2012 14:24 198
-<a href="jetty-jmx-7.6.0.v20120127-javadoc.jar.asc.md5">jetty-jmx-7.6.0.v20120127-javadoc.jar.asc.md5</a> 27-Jan-2012 14:24 32
-<a href="jetty-jmx-7.6.0.v20120127-javadoc.jar.asc.sha1">jetty-jmx-7.6.0.v20120127-javadoc.jar.asc.sha1</a> 27-Jan-2012 14:24 40
-<a href="jetty-jmx-7.6.0.v20120127-javadoc.jar.md5">jetty-jmx-7.6.0.v20120127-javadoc.jar.md5</a> 27-Jan-2012 14:24 32
-<a href="jetty-jmx-7.6.0.v20120127-javadoc.jar.sha1">jetty-jmx-7.6.0.v20120127-javadoc.jar.sha1</a> 27-Jan-2012 14:24 40
-<a href="jetty-jmx-7.6.0.v20120127-sources.jar">jetty-jmx-7.6.0.v20120127-sources.jar</a> 27-Jan-2012 14:24 16675
-<a href="jetty-jmx-7.6.0.v20120127-sources.jar.asc">jetty-jmx-7.6.0.v20120127-sources.jar.asc</a> 27-Jan-2012 14:24 198
-<a href="jetty-jmx-7.6.0.v20120127-sources.jar.asc.md5">jetty-jmx-7.6.0.v20120127-sources.jar.asc.md5</a> 27-Jan-2012 14:24 32
-<a href="jetty-jmx-7.6.0.v20120127-sources.jar.asc.sha1">jetty-jmx-7.6.0.v20120127-sources.jar.asc.sha1</a> 27-Jan-2012 14:24 40
-<a href="jetty-jmx-7.6.0.v20120127-sources.jar.md5">jetty-jmx-7.6.0.v20120127-sources.jar.md5</a> 27-Jan-2012 14:24 32
-<a href="jetty-jmx-7.6.0.v20120127-sources.jar.sha1">jetty-jmx-7.6.0.v20120127-sources.jar.sha1</a> 27-Jan-2012 14:24 40
-<a href="jetty-jmx-7.6.0.v20120127.jar">jetty-jmx-7.6.0.v20120127.jar</a> 27-Jan-2012 14:24 23187
-<a href="jetty-jmx-7.6.0.v20120127.jar.asc">jetty-jmx-7.6.0.v20120127.jar.asc</a> 27-Jan-2012 14:24 198
-<a href="jetty-jmx-7.6.0.v20120127.jar.asc.md5">jetty-jmx-7.6.0.v20120127.jar.asc.md5</a> 27-Jan-2012 14:24 32
-<a href="jetty-jmx-7.6.0.v20120127.jar.asc.sha1">jetty-jmx-7.6.0.v20120127.jar.asc.sha1</a> 27-Jan-2012 14:24 40
-<a href="jetty-jmx-7.6.0.v20120127.jar.md5">jetty-jmx-7.6.0.v20120127.jar.md5</a> 27-Jan-2012 14:24 32
-<a href="jetty-jmx-7.6.0.v20120127.jar.sha1">jetty-jmx-7.6.0.v20120127.jar.sha1</a> 27-Jan-2012 14:24 40
-<a href="jetty-jmx-7.6.0.v20120127.pom">jetty-jmx-7.6.0.v20120127.pom</a> 27-Jan-2012 14:24 2655
-<a href="jetty-jmx-7.6.0.v20120127.pom.asc">jetty-jmx-7.6.0.v20120127.pom.asc</a> 27-Jan-2012 14:24 198
-<a href="jetty-jmx-7.6.0.v20120127.pom.asc.md5">jetty-jmx-7.6.0.v20120127.pom.asc.md5</a> 27-Jan-2012 14:24 32
-<a href="jetty-jmx-7.6.0.v20120127.pom.asc.sha1">jetty-jmx-7.6.0.v20120127.pom.asc.sha1</a> 27-Jan-2012 14:24 40
-<a href="jetty-jmx-7.6.0.v20120127.pom.md5">jetty-jmx-7.6.0.v20120127.pom.md5</a> 27-Jan-2012 14:24 32
-<a href="jetty-jmx-7.6.0.v20120127.pom.sha1">jetty-jmx-7.6.0.v20120127.pom.sha1</a> 27-Jan-2012 14:24 40
-</pre><hr></body>
-</html> \ No newline at end of file
diff --git a/jetty-plugins/src/test/resources/mavenRepoJettyJNDIDirectoryListing.html b/jetty-plugins/src/test/resources/mavenRepoJettyJNDIDirectoryListing.html
deleted file mode 100644
index e1e6bf8..0000000
--- a/jetty-plugins/src/test/resources/mavenRepoJettyJNDIDirectoryListing.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<html>
-<head><title>Index of /maven2/org/eclipse/jetty/jetty-jndi/7.6.0.v20120127/</title></head>
-<body bgcolor="white">
-<h1>Index of /maven2/org/eclipse/jetty/jetty-jndi/7.6.0.v20120127/</h1><hr><pre><a href="../">../</a>
-<a href="jetty-jndi-7.6.0.v20120127-javadoc.jar">jetty-jndi-7.6.0.v20120127-javadoc.jar</a> 27-Jan-2012 14:37 127695
-<a href="jetty-jndi-7.6.0.v20120127-javadoc.jar.asc">jetty-jndi-7.6.0.v20120127-javadoc.jar.asc</a> 27-Jan-2012 14:37 198
-<a href="jetty-jndi-7.6.0.v20120127-javadoc.jar.asc.md5">jetty-jndi-7.6.0.v20120127-javadoc.jar.asc.md5</a> 27-Jan-2012 14:37 32
-<a href="jetty-jndi-7.6.0.v20120127-javadoc.jar.asc.sha1">jetty-jndi-7.6.0.v20120127-javadoc.jar.asc.sha1</a> 27-Jan-2012 14:37 40
-<a href="jetty-jndi-7.6.0.v20120127-javadoc.jar.md5">jetty-jndi-7.6.0.v20120127-javadoc.jar.md5</a> 27-Jan-2012 14:37 32
-<a href="jetty-jndi-7.6.0.v20120127-javadoc.jar.sha1">jetty-jndi-7.6.0.v20120127-javadoc.jar.sha1</a> 27-Jan-2012 14:37 40
-<a href="jetty-jndi-7.6.0.v20120127-sources.jar">jetty-jndi-7.6.0.v20120127-sources.jar</a> 27-Jan-2012 14:37 26645
-<a href="jetty-jndi-7.6.0.v20120127-sources.jar.asc">jetty-jndi-7.6.0.v20120127-sources.jar.asc</a> 27-Jan-2012 14:37 198
-<a href="jetty-jndi-7.6.0.v20120127-sources.jar.asc.md5">jetty-jndi-7.6.0.v20120127-sources.jar.asc.md5</a> 27-Jan-2012 14:37 32
-<a href="jetty-jndi-7.6.0.v20120127-sources.jar.asc.sha1">jetty-jndi-7.6.0.v20120127-sources.jar.asc.sha1</a> 27-Jan-2012 14:37 40
-<a href="jetty-jndi-7.6.0.v20120127-sources.jar.md5">jetty-jndi-7.6.0.v20120127-sources.jar.md5</a> 27-Jan-2012 14:37 32
-<a href="jetty-jndi-7.6.0.v20120127-sources.jar.sha1">jetty-jndi-7.6.0.v20120127-sources.jar.sha1</a> 27-Jan-2012 14:37 40
-<a href="jetty-jndi-7.6.0.v20120127.jar">jetty-jndi-7.6.0.v20120127.jar</a> 27-Jan-2012 14:36 38073
-<a href="jetty-jndi-7.6.0.v20120127.jar.asc">jetty-jndi-7.6.0.v20120127.jar.asc</a> 27-Jan-2012 14:37 198
-<a href="jetty-jndi-7.6.0.v20120127.jar.asc.md5">jetty-jndi-7.6.0.v20120127.jar.asc.md5</a> 27-Jan-2012 14:37 32
-<a href="jetty-jndi-7.6.0.v20120127.jar.asc.sha1">jetty-jndi-7.6.0.v20120127.jar.asc.sha1</a> 27-Jan-2012 14:37 40
-<a href="jetty-jndi-7.6.0.v20120127.jar.md5">jetty-jndi-7.6.0.v20120127.jar.md5</a> 27-Jan-2012 14:36 32
-<a href="jetty-jndi-7.6.0.v20120127.jar.sha1">jetty-jndi-7.6.0.v20120127.jar.sha1</a> 27-Jan-2012 14:36 40
-<a href="jetty-jndi-7.6.0.v20120127.pom">jetty-jndi-7.6.0.v20120127.pom</a> 27-Jan-2012 14:36 2810
-<a href="jetty-jndi-7.6.0.v20120127.pom.asc">jetty-jndi-7.6.0.v20120127.pom.asc</a> 27-Jan-2012 14:37 198
-<a href="jetty-jndi-7.6.0.v20120127.pom.asc.md5">jetty-jndi-7.6.0.v20120127.pom.asc.md5</a> 27-Jan-2012 14:37 32
-<a href="jetty-jndi-7.6.0.v20120127.pom.asc.sha1">jetty-jndi-7.6.0.v20120127.pom.asc.sha1</a> 27-Jan-2012 14:37 40
-<a href="jetty-jndi-7.6.0.v20120127.pom.md5">jetty-jndi-7.6.0.v20120127.pom.md5</a> 27-Jan-2012 14:37 32
-<a href="jetty-jndi-7.6.0.v20120127.pom.sha1">jetty-jndi-7.6.0.v20120127.pom.sha1</a> 27-Jan-2012 14:37 40
-</pre><hr></body>
-</html> \ No newline at end of file
diff --git a/jetty-plugins/src/test/resources/maven_repo/org/eclipse/jetty/jetty-anotherplugin/version/jetty-anotherplugin-version-plugin.zip b/jetty-plugins/src/test/resources/maven_repo/org/eclipse/jetty/jetty-anotherplugin/version/jetty-anotherplugin-version-plugin.zip
deleted file mode 100644
index e69de29..0000000
--- a/jetty-plugins/src/test/resources/maven_repo/org/eclipse/jetty/jetty-anotherplugin/version/jetty-anotherplugin-version-plugin.zip
+++ /dev/null
diff --git a/jetty-plugins/src/test/resources/maven_repo/org/eclipse/jetty/jetty-plugin/version/jetty-plugin-version-plugin.zip b/jetty-plugins/src/test/resources/maven_repo/org/eclipse/jetty/jetty-plugin/version/jetty-plugin-version-plugin.zip
deleted file mode 100644
index e69de29..0000000
--- a/jetty-plugins/src/test/resources/maven_repo/org/eclipse/jetty/jetty-plugin/version/jetty-plugin-version-plugin.zip
+++ /dev/null