diff options
author | Tomasz Zarna | 2010-08-09 12:59:18 +0000 |
---|---|---|
committer | Tomasz Zarna | 2010-08-09 12:59:18 +0000 |
commit | ea4d4b72900434ab11e1a05a5cb5d6f2983a858e (patch) | |
tree | ce88168b0c4fd1c661d156413590523e3b485fca /tests/org.eclipse.team.tests.cvs.core | |
parent | 4f2606b17fed062e0ec60c94f2a21094c8643fd0 (diff) | |
download | eclipse.platform.team-ea4d4b72900434ab11e1a05a5cb5d6f2983a858e.tar.gz eclipse.platform.team-ea4d4b72900434ab11e1a05a5cb5d6f2983a858e.tar.xz eclipse.platform.team-ea4d4b72900434ab11e1a05a5cb5d6f2983a858e.zip |
bug 322131: [Tests] org.eclipse.team.tests.ccvs.ui.benchmark.Util#importZip method is duplicated
Diffstat (limited to 'tests/org.eclipse.team.tests.cvs.core')
3 files changed, 33 insertions, 56 deletions
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTest.java index a6abbe570..7e98e0258 100644 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTest.java +++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -17,7 +17,9 @@ import java.util.HashMap; import java.util.Iterator; import java.util.zip.ZipException; -import org.eclipse.core.commands.*; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.NotEnabledException; +import org.eclipse.core.commands.NotHandledException; import org.eclipse.core.commands.common.NotDefinedException; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; @@ -26,7 +28,9 @@ import org.eclipse.team.core.TeamException; import org.eclipse.team.core.subscribers.Subscriber; import org.eclipse.team.tests.ccvs.core.EclipseTest; import org.eclipse.team.tests.ccvs.core.subscriber.SyncInfoSource; -import org.eclipse.test.performance.*; +import org.eclipse.test.performance.Dimension; +import org.eclipse.test.performance.Performance; +import org.eclipse.test.performance.PerformanceMeter; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.WorkbenchException; import org.eclipse.ui.handlers.IHandlerService; @@ -53,7 +57,7 @@ public abstract class BenchmarkTest extends EclipseTest { protected IProject createAndImportProject(String prefix, File zipFile) throws TeamException, CoreException, ZipException, IOException, InterruptedException, InvocationTargetException { // create a project with no contents IProject project = getUniqueTestProject(prefix); - Util.importZip(project, zipFile); + BenchmarkUtils.importZip(project, zipFile); return project; } diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkUtils.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkUtils.java index a929d97a2..c7e79d084 100644 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkUtils.java +++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -11,17 +11,36 @@ package org.eclipse.team.tests.ccvs.ui.benchmark; -import java.io.*; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.lang.reflect.InvocationTargetException; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; import java.util.zip.ZipException; import java.util.zip.ZipFile; import junit.framework.Assert; -import org.eclipse.compare.structuremergeviewer.*; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; +import org.eclipse.compare.structuremergeviewer.DiffNode; +import org.eclipse.compare.structuremergeviewer.IDiffContainer; +import org.eclipse.compare.structuremergeviewer.IDiffElement; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; import org.eclipse.team.internal.ccvs.core.CVSStatus; import org.eclipse.ui.wizards.datatransfer.ImportOperation; import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/Util.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/Util.java deleted file mode 100644 index a00302ad7..000000000 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/Util.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 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.team.tests.ccvs.ui.benchmark; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.util.zip.ZipException; -import java.util.zip.ZipFile; - -import junit.framework.Assert; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.ui.wizards.datatransfer.ImportOperation; -import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; - -/** - * CVS Test related utility methods - */ -public class Util { - - /** - * Imports a .zip file into a container's root folder. - * @param container the container - * @param file the path of the .zip file - */ - public static void importZip(IContainer container, File file) - throws IOException, ZipException, InterruptedException, InvocationTargetException { - ZipFile zipFile = new ZipFile(file); - ZipFileStructureProvider provider = new ZipFileStructureProvider(zipFile); - ImportOperation importOperation = new ImportOperation(container.getFullPath(), - provider.getRoot(), provider, null); - importOperation.setOverwriteResources(true); // don't ask - importOperation.run(new NullProgressMonitor()); - Assert.assertTrue(importOperation.getStatus().isOK()); - } -} |