This commit was manufactured by cvs2svn to create tag 'R1_5_5'.
diff --git a/tests/org.eclipse.wst.internet.cache.tests/.classpath b/tests/org.eclipse.wst.internet.cache.tests/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.cache.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.wst.internet.cache.tests/.cvsignore b/tests/org.eclipse.wst.internet.cache.tests/.cvsignore
new file mode 100644
index 0000000..57763eb
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.cache.tests/.cvsignore
@@ -0,0 +1,4 @@
+bin
+build.xml
+temp.folder
+tests.jar
diff --git a/tests/org.eclipse.wst.internet.cache.tests/.project b/tests/org.eclipse.wst.internet.cache.tests/.project
new file mode 100644
index 0000000..fb4b067
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.cache.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.wst.internet.cache.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/org.eclipse.wst.internet.cache.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.internet.cache.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..ec6c37f
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.cache.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Cache Tests Plug-in
+Bundle-SymbolicName: org.eclipse.wst.internet.cache.tests
+Bundle-Version: 1.0.0
+Bundle-ClassPath: tests.jar
+Bundle-Activator: org.eclipse.wst.internet.cache.tests.internal.CacheTestsPlugin
+Bundle-Vendor: Eclipse
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.junit,
+ org.eclipse.wst.internet.cache,
+ org.eclipse.core.resources,
+ org.eclipse.wst.common.uriresolver
+Eclipse-AutoStart: true
+Export-Package: org.eclipse.wst.internet.cache.internal;x-internal:=true,
+ org.eclipse.wst.internet.cache.tests.internal;x-internal:=true
diff --git a/tests/org.eclipse.wst.internet.cache.tests/about.html b/tests/org.eclipse.wst.internet.cache.tests/about.html
new file mode 100644
index 0000000..4ec5989
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.cache.tests/about.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+
+<BODY lang="EN-US">
+
+<H3>About This Content</H3>
+
+<P>May 2, 2006</P>
+
+<H3>License</H3>
+
+<P>The Eclipse Foundation makes available all content in this plug-in
+("Content"). Unless otherwise indicated below, the Content is provided to you
+under the terms and conditions of the Eclipse Public License Version 1.0
+("EPL"). A copy of the EPL is available at
+<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
+For purposes of the EPL, "Program" will mean the Content.</P>
+
+<P>If you did not receive this Content directly from the Eclipse Foundation, the
+Content is being redistributed by another party ("Redistributor") and different
+terms and conditions may apply to your use of any object code in the Content.
+Check the Redistributors license that was provided with the Content. If no such
+license exists, contact the Redistributor. Unless otherwise indicated below, the
+terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at
+<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
+
+</BODY>
+</HTML>
diff --git a/tests/org.eclipse.wst.internet.cache.tests/build.properties b/tests/org.eclipse.wst.internet.cache.tests/build.properties
new file mode 100644
index 0000000..a2a7b54
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.cache.tests/build.properties
@@ -0,0 +1,7 @@
+source.tests.jar = src/
+output.tests.jar = bin/
+bin.includes = META-INF/,\
+ tests.jar,\
+ test.xml,\
+ about.html
+src.includes = build.properties
diff --git a/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/internal/CacheEntryTest.java b/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/internal/CacheEntryTest.java
new file mode 100644
index 0000000..f98308c
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/internal/CacheEntryTest.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.internet.cache.internal;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Tests for the CacheEntry class.
+ */
+public class CacheEntryTest extends TestCase
+{
+ /**
+ * Create a tests suite from this test class.
+ *
+ * @return A test suite containing this test class.
+ */
+ public static Test suite()
+ {
+ return new TestSuite(CacheEntryTest.class);
+ }
+
+ /**
+ * Test that the entry is not considered expired when -1 is specified.
+ */
+ public void testNotExpiredWhenMinusOne()
+ {
+ CacheEntry cacheEntry = new CacheEntry(null, null, 0, -1);
+ assertFalse("The cache entry is expired when -1 is specified.", cacheEntry.hasExpired());
+ }
+
+ /**
+ * Test that the entry is not considered expired when the set expiration
+ * time is greater than the current system time.
+ */
+ public void testNotExpiredWhenGreaterThanSystemTime()
+ {
+ CacheEntry cacheEntry = new CacheEntry(null, null, 0, System.currentTimeMillis() + 60000);
+ assertFalse("The cache entry is expired when greater than the currnet system time.", cacheEntry.hasExpired());
+ }
+
+ /**
+ * Test that the entry is considered expired when the set expiration
+ * time is less than the current system time.
+ */
+ public void testExpiredWhenLessThanSystemTime()
+ {
+ CacheEntry cacheEntry = new CacheEntry(null, null, 0, System.currentTimeMillis() - 60000);
+ assertTrue("The cache entry is not expired when less than the currnet system time.", cacheEntry.hasExpired());
+ }
+}
diff --git a/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/internal/CacheTest.java b/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/internal/CacheTest.java
new file mode 100644
index 0000000..89f496f
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/internal/CacheTest.java
@@ -0,0 +1,213 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.internet.cache.internal;
+
+import java.io.File;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Tests for the Cache class.
+ */
+public class CacheTest extends TestCase
+{
+ private Cache cache;
+
+ /**
+ * Create a tests suite from this test class.
+ *
+ * @return A test suite containing this test class.
+ */
+ public static Test suite()
+ {
+ return new TestSuite(CacheTest.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ cache = Cache.getInstance();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+
+ /**
+ * Test trying to cache a resource that doesn't exist
+ * on a server that does exist.
+ */
+ public void testGetNonExistantResource()
+ {
+ String resource = "http://www.eclipse.org/webtools/nonexistantfile";
+ String result = cache.getResource(resource);
+ cache.clear();
+ assertNull("The result returned for resource " + resource + " is not null.", result);
+ }
+
+ /**
+ * Test trying to cache a resource that doesn't exist
+ * because the server doesn't exist.
+ */
+// public void testGetNonExistantServer()
+// {
+// String resource = "http://www.eclipse.bad/webtools/nonexistantfile";
+// String result = cache.getResource(resource);
+// cache.clear();
+// assertNull("The result returned for resource " + resource + " is not null.", result);
+// }
+
+ /**
+ * Test trying to get a resource specified by null.
+ */
+ public void testGetNullResource()
+ {
+ String resource = null;
+ String result = cache.getResource(resource);
+ cache.clear();
+ assertNull("The result returned for resource " + resource + " is not null.", result);
+ }
+
+ /**
+ * Test trying to cache a resource that does exist.
+ */
+ public void testGetResourceThatExists()
+ {
+ String resource = "http://www.eclipse.org/webtools";
+ String result = cache.getResource(resource);
+ cache.clear();
+ assertNotNull("The result returned for resource " + resource + " was null.", result);
+ assertTrue("The result and resource are the same.", !resource.equals(result));
+ }
+
+ /**
+ * Test to ensure the result that is returned starts with file:///
+ */
+ public void testResultStartsWithFile()
+ {
+ String resource = "http://www.eclipse.org/webtools";
+ String result = cache.getResource(resource);
+ cache.clear();
+ assertTrue("The result does not start with file:///.", result.startsWith("file:///"));
+ }
+
+ /**
+ * Test to ensure deleting a cache entry deletes it from the cache and
+ * from the file system.
+ */
+ public void testDeleteCacheEntry()
+ {
+ String resource = "http://www.eclipse.org/webtools";
+ String result = cache.getResource(resource);
+ assertNotNull("The local cache file is null.", result);
+ // Remove file:/// from the result.
+ result = result.substring(8);
+ assertTrue("The cache file " + result + " does not exist.", new File(result).exists());
+ cache.deleteEntry(resource);
+ assertFalse("The cache file was not deleted.", new File(result).exists());
+ assertTrue("The cache still contains the deleted entry.", cache.getCachedURIs().length == 0);
+ cache.clear();
+ }
+
+ /**
+ * Test to ensure deleting a null cache entry simply returns.
+ */
+ public void testDeleteNullCacheEntry()
+ {
+ String resource = "http://www.eclipse.org/webtools";
+ cache.getResource(resource);
+ cache.deleteEntry(null);
+ assertFalse("The cache no longer contains the entry after deleting null.", cache.getCachedURIs().length == 0);
+ cache.clear();
+ }
+
+ /**
+ * Test to ensure clearing the cache with a single entry deletes the entry
+ * from the cache and deletes the file from the file system.
+ */
+ public void testClearCacheWithSingleEntry()
+ {
+ String resource1 = "http://www.eclipse.org/webtools";
+ String result1 = cache.getResource(resource1);
+ assertNotNull("The local cache file is null for resource1.", result1);
+ // Remove file:/// from the result.
+ result1 = result1.substring(8);
+ assertTrue("The cache file " + result1 + " does not exist.", new File(result1).exists());
+ cache.clear();
+ assertFalse("The cache file for resource1 was not deleted.", new File(result1).exists());
+ assertTrue("The cache still contains the deleted entries.", cache.getCachedURIs().length == 0);
+ }
+
+ /**
+ * Test to ensure clearing the cache with multiple entries deletes the entries
+ * from the cache and deletes the files from the file system.
+ */
+ public void testClearCacheWithMultipleEntries()
+ {
+ String resource1 = "http://www.eclipse.org/webtools";
+ String resource2 = "http://www.eclipse.org";
+ String result1 = cache.getResource(resource1);
+ String result2 = cache.getResource(resource2);
+ assertNotNull("The local cache file is null for resource1.", result1);
+ assertNotNull("The local cache file is null for resource2.", result2);
+ // Remove file:/// from the result.
+ result1 = result1.substring(8);
+ result2 = result2.substring(8);
+ assertTrue("The cache file " + result1 + " does not exist.", new File(result1).exists());
+ assertTrue("The cache file " + result2 + " does not exist.", new File(result2).exists());
+ cache.clear();
+ assertFalse("The cache file for resource1 was not deleted.", new File(result1).exists());
+ assertFalse("The cache file for resource2 was not deleted.", new File(result2).exists());
+ assertTrue("The cache still contains the deleted entries.", cache.getCachedURIs().length == 0);
+ }
+
+ /**
+ * Test to ensure deleting a null cache entry simply returns.
+ */
+ public void testGetInstance()
+ {
+ assertNotNull("The cache object is null.", cache);
+ }
+
+ /**
+ * Test to ensure getCacheEntries returns all of the cache entries and not entries that
+ * haven't been cached.
+ */
+ public void testGetCacheEntries()
+ {
+ String resource1 = "http://www.eclipse.org/webtools";
+ String resource2 = "http://www.eclipse.org";
+ String resource3 = "http://www.eclipse.org/webtools/nonexistantfile";
+ cache.getResource(resource1);
+ cache.getResource(resource2);
+ cache.getResource(resource3);
+ String[] uris = cache.getCachedURIs();
+ assertTrue("There are not 2 entries in the cache.", uris.length == 2);
+
+ for(int i = 0; i < uris.length -1; i++)
+ {
+ String uri = uris[i];
+ if(!(uri.equals(resource1) || uri.equals(resource2) || uri.equals(resource3)))
+ {
+ fail("The URI " + uri + " is not equal to any of the resources put in the cache.");
+ }
+ }
+ cache.clear();
+
+ }
+
+
+
+
+
+}
diff --git a/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/internal/CacheURIResolverExtensionTest.java b/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/internal/CacheURIResolverExtensionTest.java
new file mode 100644
index 0000000..1f2a6d9
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/internal/CacheURIResolverExtensionTest.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.internet.cache.internal;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Tests for the CacheURIResolverExtension class.
+ */
+public class CacheURIResolverExtensionTest extends TestCase
+{
+ private CacheURIResolverExtension cacheResolver;
+
+ /**
+ * Create a tests suite from this test class.
+ *
+ * @return A test suite containing this test class.
+ */
+ public static Test suite()
+ {
+ return new TestSuite(CacheURIResolverExtensionTest.class);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ cacheResolver = new CacheURIResolverExtension();
+ // The cache is disabled by default. We need to enable it for the tests.
+ CachePlugin.getDefault().setCacheEnabled(true);
+ }
+
+ /**
+ * Test that the result returned when a null systemId is given is null.
+ */
+ public void testResolveNullSystemId()
+ {
+ String result = cacheResolver.resolve(null,"http://www.eclipse.org/webtools", null, null);
+ assertNull("The result is not null.", result);
+ }
+
+ /**
+ * Test that the result returned when a null systemId and a null baselocation
+ * are given is null.
+ */
+ public void testResolveNullSystemIdAndBaselocation()
+ {
+ String result = cacheResolver.resolve(null, null, null, null);
+ assertNull("The result is not null.", result);
+ }
+
+ /**
+ * Test that the result is sucessfully cached when an absolute systemId
+ * is given.
+ */
+ public void testAbsoluteSystemId()
+ {
+ String result = cacheResolver.resolve(null,"http://www.eclipse.org/webtools", null, "http://www.eclipse.org");
+ assertNotNull("The result is null.", result);
+ }
+
+ /**
+ * Test that the result is sucessfully cached when an absolute systemId
+ * is given and a null base location is given
+ */
+ public void testAbsoluteSystemIdNullBaselocation()
+ {
+ String result = cacheResolver.resolve(null, null, null, "http://www.eclipse.org");
+ assertNotNull("The result is null.", result);
+ }
+
+ /**
+ * Test that the result is sucessfully cached when a relative systemId
+ * is given.
+ */
+ public void testRelativeSystemId()
+ {
+ String result = cacheResolver.resolve(null,"http://www.eclipse.org/webtools/community/somefile.xml", null, "community.html");
+ assertNotNull("The result is null.", result);
+ }
+
+ /**
+ * Test that the result is unsucessfully cached when a relative systemId
+ * is given and a null base location is given.
+ */
+ public void testRelativeSystemIdWillNullBaselocation()
+ {
+ String result = cacheResolver.resolve(null, null, null, "community.html");
+ assertNull("The result is not null.", result);
+ }
+
+ /**
+ * Test that null is returned when the cache is disabled.
+ */
+ public void testReturnsNullWhenDisabled()
+ {
+ CachePlugin.getDefault().setCacheEnabled(false);
+ String result = cacheResolver.resolve(null, "http://www.eclipse.org/webtools/", null, "http://www.eclipse.org/webtools/");
+ assertNull("The result is not null.", result);
+ CachePlugin.getDefault().setCacheEnabled(true);
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/internal/LicenseRegistryTest.java b/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/internal/LicenseRegistryTest.java
new file mode 100644
index 0000000..febd010
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/internal/LicenseRegistryTest.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.internet.cache.internal;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class LicenseRegistryTest extends TestCase
+{
+ /**
+ * Create a tests suite from this test class.
+ *
+ * @return A test suite containing this test class.
+ */
+ public static Test suite()
+ {
+ return new TestSuite(LicenseRegistryTest.class);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ /**
+ * Test adding a license to the registry. When added the registry should contain the license
+ * and the license should have the unspecified value.
+ */
+ public void testAddLicenseToRegistry()
+ {
+ String licenseURL = "http://somelicense";
+ LicenseRegistryWrapper registry = new LicenseRegistryWrapper();
+ registry.addLicense(licenseURL);
+ assertEquals("The registry does not have 1 license.", 1, registry.getLicensesHashtable().size());
+ assertTrue("The registry does not conain the license " + licenseURL, registry.getLicensesHashtable().containsKey(licenseURL));
+ assertEquals("The registry does not have the correct value for the license.", LicenseRegistryWrapper.LICENSE_UNSPECIFIED, registry.getLicensesHashtable().get(licenseURL));
+ }
+
+ /**
+ * Test adding a license to the registry twice. The registry should only have a single entry
+ * for the license.
+ */
+ public void testAddLicenseToRegistryTwice()
+ {
+ String licenseURL = "http://somelicense";
+ LicenseRegistryWrapper registry = new LicenseRegistryWrapper();
+ registry.addLicense(licenseURL);
+ registry.addLicense(licenseURL);
+ assertEquals("The registry contains more than one license.", 1, registry.getLicensesHashtable().size());
+ }
+
+ /**
+ * Test agree to license method. The registry should have 'agree' registered for the license.
+ */
+ public void testAgreeToLicense()
+ {
+ String licenseURL = "http://somelicense";
+ LicenseRegistryWrapper registry = new LicenseRegistryWrapper();
+ registry.addLicense(licenseURL);
+ registry.agreeLicense(licenseURL);
+ assertEquals("The registry does not have the correct value for the license.", LicenseRegistryWrapper.LICENSE_AGREE, registry.getLicensesHashtable().get(licenseURL));
+ }
+
+ /**
+ * Test agree to license that is not in the registry. The registry should not create
+ * an entry for the license.
+ */
+ public void testAgreeToLicenseNotInRegistry()
+ {
+ String licenseURL = "http://somelicense";
+ LicenseRegistryWrapper registry = new LicenseRegistryWrapper();
+ registry.agreeLicense(licenseURL);
+ assertEquals("The registry registered the license but it should not have.", 0, registry.getLicensesHashtable().size());
+ }
+
+ /**
+ * Test disagree to license method. The registry should have 'disagree' registered for the license.
+ */
+ public void testDisgreeToLicense()
+ {
+ String licenseURL = "http://somelicense";
+ LicenseRegistryWrapper registry = new LicenseRegistryWrapper();
+ registry.addLicense(licenseURL);
+ registry.disagreeLicense(licenseURL);
+ assertEquals("The registry does not have the correct value for the license.", LicenseRegistryWrapper.LICENSE_DISAGREE, registry.getLicensesHashtable().get(licenseURL));
+ }
+
+ /**
+ * Test disagree to license that is not in the registry. The registry should not create
+ * an entry for the license.
+ */
+ public void testDisagreeToLicenseNotInRegistry()
+ {
+ String licenseURL = "http://somelicense";
+ LicenseRegistryWrapper registry = new LicenseRegistryWrapper();
+ registry.agreeLicense(licenseURL);
+ assertEquals("The registry registered the license but it should not have.", 0, registry.getLicensesHashtable().size());
+ }
+
+ /**
+ * Test prompt for agree for license not in registry.
+ * TODO: This test does not test what it is supposed to.
+ * This test should be corrected if possible.
+ */
+// public void testPromptForLicenseNotInRegistry()
+// {
+// String licenseURL = "http://somelicense";
+// LicenseRegistryWrapper registry = new LicenseRegistryWrapper();
+// assertTrue("The prompt for agreement method does not return true for a license not in the registry.", registry.promptToAcceptLicense(licenseURL, licenseURL));
+// }
+}
diff --git a/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/internal/LicenseRegistryWrapper.java b/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/internal/LicenseRegistryWrapper.java
new file mode 100644
index 0000000..f94b1ea
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/internal/LicenseRegistryWrapper.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.internet.cache.internal;
+
+import java.util.Hashtable;
+
+/**
+ * A wrapper for org.eclipse.wst.internet.cache.internal.LicenseRegistry
+ * that allows for testing of protected methods.
+ */
+public class LicenseRegistryWrapper extends LicenseRegistry
+{
+ protected static Integer LICENSE_UNSPECIFIED = LicenseRegistry.LICENSE_UNSPECIFIED;
+ protected static Integer LICENSE_AGREE = LicenseRegistry.LICENSE_AGREE;
+ protected static Integer LICENSE_DISAGREE = LicenseRegistry.LICENSE_DISAGREE;
+ protected LicenseRegistryWrapper()
+ {
+ super();
+ }
+
+ protected Hashtable getLicensesHashtable()
+ {
+ return licenses;
+ }
+
+ protected void agreeLicense(String url)
+ {
+ super.agreeLicense(url);
+ }
+
+ protected void disagreeLicense(String url)
+ {
+ super.disagreeLicense(url);
+ }
+
+ protected int promptToAcceptLicense(String url, String licenseURL)
+ {
+ return super.promptToAcceptLicense(url, licenseURL);
+ }
+}
diff --git a/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/tests/internal/AllCacheTests.java b/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/tests/internal/AllCacheTests.java
new file mode 100644
index 0000000..f69872f
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/tests/internal/AllCacheTests.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.internet.cache.tests.internal;
+import junit.framework.Test;
+
+import org.eclipse.wst.internet.cache.internal.CacheEntryTest;
+import org.eclipse.wst.internet.cache.internal.CacheTest;
+import org.eclipse.wst.internet.cache.internal.CacheURIResolverExtensionTest;
+import org.eclipse.wst.internet.cache.internal.LicenseRegistryTest;
+/**
+ * The root test suite that contains all other Cache test suites.
+ */
+public class AllCacheTests extends junit.framework.TestSuite
+{
+ /**
+ * Create this test suite.
+ *
+ * @return This test suite.
+ */
+ public static Test suite()
+ {
+ return new AllCacheTests();
+ }
+
+ /**
+ * Constructor
+ */
+ public AllCacheTests()
+ {
+ super("AllCacheTests");
+ addTest(CacheTest.suite());
+ addTest(CacheEntryTest.suite());
+ addTest(CacheURIResolverExtensionTest.suite());
+ addTest(LicenseRegistryTest.suite());
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/tests/internal/CacheTestsPlugin.java b/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/tests/internal/CacheTestsPlugin.java
new file mode 100644
index 0000000..6404a3d
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.cache.tests/src/org/eclipse/wst/internet/cache/tests/internal/CacheTestsPlugin.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.internet.cache.tests.internal;
+
+import org.eclipse.ui.plugin.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.osgi.framework.BundleContext;
+import java.util.*;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class CacheTestsPlugin extends AbstractUIPlugin {
+ //The shared instance.
+ private static CacheTestsPlugin plugin;
+ //Resource bundle.
+ private ResourceBundle resourceBundle;
+
+ /**
+ * The constructor.
+ */
+ public CacheTestsPlugin() {
+ super();
+ plugin = this;
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ plugin = null;
+ resourceBundle = null;
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static CacheTestsPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle,
+ * or 'key' if not found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = CacheTestsPlugin.getDefault().getResourceBundle();
+ try {
+ return (bundle != null) ? bundle.getString(key) : key;
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ try {
+ if (resourceBundle == null)
+ resourceBundle = ResourceBundle.getBundle("org.eclipse.wst.internal.cache.tests.CacheTestsPluginResources");
+ } catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+ return resourceBundle;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.wst.internal.cache.tests", path);
+ }
+}
diff --git a/tests/org.eclipse.wst.internet.cache.tests/test.xml b/tests/org.eclipse.wst.internet.cache.tests/test.xml
new file mode 100644
index 0000000..1b5532f
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.cache.tests/test.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+
+<project name="testsuite" default="run" basedir=".">
+
+ <!-- Configurable Properties -->
+
+ <!-- sets the properties eclipse-home, and library-file -->
+ <property name="plugin-name" value="org.eclipse.wst.internet.cache.tests"/>
+
+ <!-- End Configurable Properties -->
+
+ <!-- The property ${eclipse-home} should be passed into this script -->
+ <!-- Set a meaningful default value for when it is not. -->
+ <property name="eclipse-home" value="${basedir}\..\.."/>
+ <property name="bvtworkspace" value="${basedir}"/>
+ <property name="library-file" value="${eclipse-home}/plugins/org.eclipse.test_3.1.0/library.xml"/>
+ <property name="workspace-folder" value="${bvtworkspace}/${plugin-name}"/>
+
+ <!-- This target holds all initialization code that needs to be done for -->
+ <!-- all tests that are to be run. Initialization for individual tests -->
+ <!-- should be done within the body of the suite target. -->
+ <target name="init">
+ <tstamp/>
+ <delete>
+ <fileset dir="${eclipse-home}" includes="org.eclipse.wst.internet.cache.tests.*.xml"/>
+ </delete>
+ </target>
+
+ <!-- This target defines the tests that need to be run. -->
+ <target name="suite">
+
+ <!-- Start with clean data workspace -->
+ <delete dir="${workspace-folder}" quiet="true"/>
+
+ <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${workspace-folder}"/>
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname" value="org.eclipse.wst.internet.cache.tests.internal.AllCacheTests"/>
+ </ant>
+
+ </target>
+
+ <!-- This target holds code to cleanup the testing environment after -->
+ <!-- after all of the tests have been run. You can use this target to -->
+ <!-- delete temporary files that have been created. -->
+ <target name="cleanup">
+ <delete dir="${workspace-folder}" quiet="true"/>
+ </target>
+
+ <!-- This target runs the test suite. Any actions that need to happen -->
+ <!-- after all the tests have been run should go here. -->
+ <target name="run" depends="init,suite,cleanup">
+ <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="includes" value="org.eclipse.wst.internet.cache.tests*.xml"/>
+ <property name="output-file" value="${plugin-name}.xml"/>
+ </ant>
+ </target>
+
+</project>