Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2006-02-22 04:50:45 +0000
committermkersten2006-02-22 04:50:45 +0000
commit0ae3c74084e015e00913701f5331f30ff02a1c3a (patch)
tree37a8a05054fac329fa3e6b76fb3ba32026675da7 /org.eclipse.mylyn.bugzilla.tests
parent3e0300ea81f3a7f18f96ad4fd65863b8c86be8bc (diff)
downloadorg.eclipse.mylyn.tasks-0ae3c74084e015e00913701f5331f30ff02a1c3a.tar.gz
org.eclipse.mylyn.tasks-0ae3c74084e015e00913701f5331f30ff02a1c3a.tar.xz
org.eclipse.mylyn.tasks-0ae3c74084e015e00913701f5331f30ff02a1c3a.zip
3.1 merge
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests')
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestCDT.java1
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestEquinox.java1
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestGMT.java1
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestPlatform.java1
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestVE.java1
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaParserTest.java1
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaParserTestNoBug.java1
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaProductParserTest.java1
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/FileTool.java266
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/NewBugWizardTest.java1
11 files changed, 11 insertions, 267 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF b/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF
index 6a4d97e51..ad12cfe93 100644
--- a/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF
@@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.ui.workbench.texteditor,
org.eclipse.mylar.bugzilla.core,
org.eclipse.mylar.bugzilla.ui,
- org.eclipse.mylar.tasklist
+ org.eclipse.mylar.tasklist,
+ org.eclipse.mylar.core.tests
Eclipse-AutoStart: true
Bundle-Vendor: Eclipse.org
Bundle-ClassPath: bugzilla-test.jar
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestCDT.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestCDT.java
index a0b04a92c..6703654ec 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestCDT.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestCDT.java
@@ -22,6 +22,7 @@ import junit.framework.TestCase;
import org.eclipse.core.runtime.Path;
import org.eclipse.mylar.bugzilla.core.Attribute;
+import org.eclipse.mylar.core.tests.support.FileTool;
import org.eclipse.mylar.internal.bugzilla.core.NewBugModel;
import org.eclipse.mylar.internal.bugzilla.core.internal.NewBugParser;
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestEquinox.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestEquinox.java
index 5428248b8..b93310611 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestEquinox.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestEquinox.java
@@ -22,6 +22,7 @@ import junit.framework.TestCase;
import org.eclipse.core.runtime.Path;
import org.eclipse.mylar.bugzilla.core.Attribute;
+import org.eclipse.mylar.core.tests.support.FileTool;
import org.eclipse.mylar.internal.bugzilla.core.NewBugModel;
import org.eclipse.mylar.internal.bugzilla.core.internal.NewBugParser;
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestGMT.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestGMT.java
index 32cece51d..d88043c26 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestGMT.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestGMT.java
@@ -22,6 +22,7 @@ import junit.framework.TestCase;
import org.eclipse.core.runtime.Path;
import org.eclipse.mylar.bugzilla.core.Attribute;
+import org.eclipse.mylar.core.tests.support.FileTool;
import org.eclipse.mylar.internal.bugzilla.core.NewBugModel;
import org.eclipse.mylar.internal.bugzilla.core.internal.NewBugParser;
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestPlatform.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestPlatform.java
index d4588c7a5..705528e1e 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestPlatform.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestPlatform.java
@@ -22,6 +22,7 @@ import junit.framework.TestCase;
import org.eclipse.core.runtime.Path;
import org.eclipse.mylar.bugzilla.core.Attribute;
+import org.eclipse.mylar.core.tests.support.FileTool;
import org.eclipse.mylar.internal.bugzilla.core.NewBugModel;
import org.eclipse.mylar.internal.bugzilla.core.internal.NewBugParser;
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestVE.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestVE.java
index 4a1cd0166..75d994ab9 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestVE.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaNewBugParserTestVE.java
@@ -22,6 +22,7 @@ import junit.framework.TestCase;
import org.eclipse.core.runtime.Path;
import org.eclipse.mylar.bugzilla.core.Attribute;
+import org.eclipse.mylar.core.tests.support.FileTool;
import org.eclipse.mylar.internal.bugzilla.core.NewBugModel;
import org.eclipse.mylar.internal.bugzilla.core.internal.NewBugParser;
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaParserTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaParserTest.java
index 0597b1506..231529c60 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaParserTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaParserTest.java
@@ -20,6 +20,7 @@ import junit.framework.TestCase;
import org.eclipse.core.runtime.Path;
import org.eclipse.mylar.bugzilla.core.BugReport;
import org.eclipse.mylar.bugzilla.core.Comment;
+import org.eclipse.mylar.core.tests.support.FileTool;
import org.eclipse.mylar.internal.bugzilla.core.internal.BugParser;
/**
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaParserTestNoBug.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaParserTestNoBug.java
index f6f57e615..9f2a46f96 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaParserTestNoBug.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaParserTestNoBug.java
@@ -18,6 +18,7 @@ import junit.framework.TestCase;
import org.eclipse.core.runtime.Path;
import org.eclipse.mylar.bugzilla.core.BugReport;
+import org.eclipse.mylar.core.tests.support.FileTool;
import org.eclipse.mylar.internal.bugzilla.core.internal.BugParser;
/**
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaProductParserTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaProductParserTest.java
index 0c394ae14..ca3f0ffa2 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaProductParserTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaProductParserTest.java
@@ -25,6 +25,7 @@ import javax.security.auth.login.LoginException;
import junit.framework.TestCase;
import org.eclipse.core.runtime.Path;
+import org.eclipse.mylar.core.tests.support.FileTool;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin;
import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylar.internal.bugzilla.core.internal.ProductParser;
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/FileTool.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/FileTool.java
deleted file mode 100644
index aac1ca69a..000000000
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/FileTool.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.mylar.bugzilla.tests;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.Writer;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Plugin;
-
-public class FileTool {
-
- private final static int MAX_RETRY = 5;
-
- /**
- * A buffer.
- */
- private static byte[] buffer = new byte[8192];
-
- /**
- * Unzips the given zip file to the given destination directory extracting
- * only those entries the pass through the given filter.
- *
- * @param zipFile
- * the zip file to unzip
- * @param dstDir
- * the destination directory
- * @throws IOException
- * in case of problem
- */
- public static void unzip(ZipFile zipFile, File dstDir) throws IOException {
- unzip(zipFile, dstDir, dstDir, 0);
- }
-
- private static void unzip(ZipFile zipFile, File rootDstDir, File dstDir, int depth) throws IOException {
-
- Enumeration<? extends ZipEntry> entries = zipFile.entries();
-
- try {
- while (entries.hasMoreElements()) {
- ZipEntry entry = entries.nextElement();
- if (entry.isDirectory()) {
- continue;
- }
- String entryName = entry.getName();
- File file = new File(dstDir, changeSeparator(entryName, '/', File.separatorChar));
- file.getParentFile().mkdirs();
- InputStream src = null;
- OutputStream dst = null;
- try {
- src = zipFile.getInputStream(entry);
- dst = new FileOutputStream(file);
- transferData(src, dst);
- } finally {
- if (dst != null) {
- try {
- dst.close();
- } catch (IOException e) {
- // don't worry in the finally
- }
- }
- if (src != null) {
- try {
- src.close();
- } catch (IOException e) {
- // don't worry in the finally
- }
- }
- }
- }
- } finally {
- try {
- zipFile.close();
- } catch (IOException e) {
- // don't worry in the finally
- }
- }
- }
-
- /**
- * Returns the given file path with its separator character changed from the
- * given old separator to the given new separator.
- *
- * @param path
- * a file path
- * @param oldSeparator
- * a path separator character
- * @param newSeparator
- * a path separator character
- * @return the file path with its separator character changed from the given
- * old separator to the given new separator
- */
- public static String changeSeparator(String path, char oldSeparator, char newSeparator) {
- return path.replace(oldSeparator, newSeparator);
- }
-
- /**
- * Copies all bytes in the given source file to the given destination file.
- *
- * @param source
- * the given source file
- * @param destination
- * the given destination file
- * @throws IOException
- * in case of error
- */
- public static void transferData(File source, File destination) throws IOException {
- destination.getParentFile().mkdirs();
- InputStream is = null;
- OutputStream os = null;
- try {
- is = new FileInputStream(source);
- os = new FileOutputStream(destination);
- transferData(is, os);
- } finally {
- if (os != null) {
- try {
- os.close();
- } catch (IOException e) {
- // don't worry in the finally
- }
- }
- if (is != null) {
- try {
- is.close();
- } catch (IOException e) {
- // don't worry in the finally
- }
- }
- }
- }
-
- /**
- * Copies all bytes in the given source stream to the given destination
- * stream. Neither streams are closed.
- *
- * @param source
- * the given source stream
- * @param destination
- * the given destination stream
- * @throws IOException
- * in case of error
- */
- public static void transferData(InputStream source, OutputStream destination) throws IOException {
- int bytesRead = 0;
- while (bytesRead != -1) {
- bytesRead = source.read(buffer, 0, buffer.length);
- if (bytesRead != -1) {
- destination.write(buffer, 0, bytesRead);
- }
- }
- }
-
- /**
- * Copies the given source file to the given destination file.
- *
- * @param src
- * the given source file
- * @param dst
- * the given destination file
- * @throws IOException
- * in case of error
- */
- public static void copy(File src, File dst) throws IOException {
- if (src.isDirectory()) {
- String[] srcChildren = src.list();
- for (int i = 0; i < srcChildren.length; ++i) {
- File srcChild = new File(src, srcChildren[i]);
- File dstChild = new File(dst, srcChildren[i]);
- copy(srcChild, dstChild);
- }
- } else
- transferData(src, dst);
- }
-
- public static File getFileInPlugin(Plugin plugin, IPath path) {
- try {
- URL installURL = plugin.getBundle().getEntry(path.toString());
- URL localURL = FileLocator.toFileURL(installURL);
-// URL localURL = Platform.asLocalURL(installURL);
- return new File(localURL.getFile());
- } catch (IOException e) {
- return null;
- }
- }
-
- public static File createTempFileInPlugin(Plugin plugin, IPath path) {
- IPath stateLocation = plugin.getStateLocation();
- stateLocation = stateLocation.append(path);
- return stateLocation.toFile();
- }
-
- public static StringBuffer read(String fileName) throws IOException {
- return read(new FileReader(fileName));
- }
-
- public static StringBuffer read(Reader reader) throws IOException {
- StringBuffer s = new StringBuffer();
- try {
- char[] charBuffer = new char[8196];
- int chars = reader.read(charBuffer);
- while (chars != -1) {
- s.append(charBuffer, 0, chars);
- chars = reader.read(charBuffer);
- }
- } finally {
- try {
- reader.close();
- } catch (IOException e) {
- // don't worry in the finally
- }
- }
- return s;
- }
-
- public static void write(String fileName, StringBuffer content) throws IOException {
- Writer writer = new FileWriter(fileName);
- try {
- writer.write(content.toString());
- } finally {
- try {
- writer.close();
- } catch (IOException e) {
- // don't worry in the finally
- }
- }
- }
-
- public static void delete(File file) {
- if (file.exists()) {
- for (int i = 0; i < MAX_RETRY; i++) {
- if (file.delete())
- i = MAX_RETRY;
- else {
- try {
- Thread.sleep(1000); // sleep a second
- } catch (InterruptedException e) {
- // don't care if the sleep is interrupted
- }
- }
- }
- }
- }
-}
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/NewBugWizardTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/NewBugWizardTest.java
index 30b601957..18f3c4e9e 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/NewBugWizardTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/NewBugWizardTest.java
@@ -20,6 +20,7 @@ import junit.framework.TestCase;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.mylar.bugzilla.core.BugReport;
+import org.eclipse.mylar.core.tests.support.FileTool;
import org.eclipse.mylar.internal.bugzilla.core.NewBugModel;
import org.eclipse.mylar.internal.bugzilla.core.internal.NewBugParser;
import org.eclipse.mylar.internal.bugzilla.ui.wizard.AbstractWizardDataPage;

Back to the top