diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/Messages.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/Messages.java deleted file mode 100644 index 85863e7c112..00000000000 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/Messages.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik - * Rapperswil, University of applied sciences 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: - * Institute for Software - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.ui.tests.refactoring; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.cdt.ui.tests.refactoring.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringBaseTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringBaseTest.java index 4ba392967e9..d1b648a775b 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringBaseTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringBaseTest.java @@ -7,15 +7,15 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Institute for Software - initial API and implementation + * Institute for Software - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.ui.tests.refactoring; import java.io.BufferedReader; import java.io.InputStreamReader; +import java.util.Collection; import java.util.Map; import java.util.TreeMap; -import java.util.Vector; import org.eclipse.cdt.core.tests.BaseTestFramework; import org.eclipse.core.resources.IFile; @@ -27,7 +27,6 @@ import org.eclipse.jface.text.TextSelection; /** * @author Guido Zgraggen IFS - * */ public abstract class RefactoringBaseTest extends BaseTestFramework implements ILogListener{ protected static final NullProgressMonitor NULL_PROGRESS_MONITOR = new NullProgressMonitor(); @@ -40,7 +39,7 @@ public abstract class RefactoringBaseTest extends BaseTestFramework implements I super(name); } - public RefactoringBaseTest(String name, Vector files) { + public RefactoringBaseTest(String name, Collection files) { super(name); for (TestSourceFile file : files) { fileMap.put(file.getName(), file); @@ -79,7 +78,7 @@ public abstract class RefactoringBaseTest extends BaseTestFramework implements I BufferedReader br = new BufferedReader(new InputStreamReader(file.getContents())); StringBuilder code = new StringBuilder(); String line; - while((line = br.readLine()) != null) { + while ((line = br.readLine()) != null) { code.append(line); code.append('\n'); } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringHistoryTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringHistoryTest.java index 826f5edb4a7..dde6d2bef55 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringHistoryTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringHistoryTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Institute for Software, HSR Hochschule fuer Technik + * Copyright (c) 2009, 2011 Institute for Software, HSR Hochschule fuer Technik * Rapperswil, University of applied sciences and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -7,14 +7,14 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Institute for Software (IFS)- initial API and implementation + * Institute for Software (IFS)- initial API and implementation ******************************************************************************/ package org.eclipse.cdt.ui.tests.refactoring; import java.io.ByteArrayInputStream; import java.net.URI; +import java.util.Collection; import java.util.Properties; -import java.util.Vector; import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.runtime.NullProgressMonitor; @@ -29,15 +29,11 @@ import org.eclipse.cdt.internal.ui.refactoring.CRefactoring; /** * @author Emanuel Graf IFS - * */ -public class RefactoringHistoryTest extends - ExtractFunctionRefactoringTest { - +public class RefactoringHistoryTest extends ExtractFunctionRefactoringTest { private TestSourceFile scriptFile; - public RefactoringHistoryTest(String name, - Vector files) { + public RefactoringHistoryTest(String name, Collection files) { super(name, files); } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTest.java index b4d1ec08979..16298bf41d7 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTest.java @@ -14,8 +14,8 @@ package org.eclipse.cdt.ui.tests.refactoring; import java.io.ByteArrayInputStream; import java.io.IOException; +import java.util.Collection; import java.util.Properties; -import java.util.Vector; import org.eclipse.ltk.core.refactoring.RefactoringStatus; import org.eclipse.ltk.core.refactoring.RefactoringStatusEntry; @@ -36,12 +36,9 @@ public abstract class RefactoringTest extends RefactoringBaseTest { protected String fileName; protected RefactoringASTCache astCache; - public RefactoringTest(String name, Vector files) { + public RefactoringTest(String name, Collection files) { super(name, files); initializeConfiguration(files); - for (TestSourceFile file : files) { - fileMap.put(file.getName(), file); - } } protected abstract void configureRefactoring(Properties refactoringProperties); @@ -63,7 +60,7 @@ public abstract class RefactoringTest extends RefactoringBaseTest { super.tearDown(); } - private void initializeConfiguration(Vector files) { + private void initializeConfiguration(Collection files) { TestSourceFile configFile = null; for (TestSourceFile currentFile : files) { @@ -75,7 +72,7 @@ public abstract class RefactoringTest extends RefactoringBaseTest { Properties refactoringProperties = new Properties(); try { - if(configFile != null) { + if (configFile != null) { refactoringProperties.load(new ByteArrayInputStream(configFile.getSource().getBytes())); } } catch (IOException e) { diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTester.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTester.java index 203a704bc00..61f6a5d10b0 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTester.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTester.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik + * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik * Rapperswil, University of applied sciences and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Institute for Software - initial API and implementation + * Institute for Software - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.ui.tests.refactoring; @@ -15,10 +15,9 @@ import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; +import java.util.Collection; import java.util.Iterator; -import java.util.Vector; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -34,10 +33,8 @@ import org.eclipse.cdt.ui.testplugin.CTestPlugin; /** * @author Emanuel Graf - * */ public class RefactoringTester extends TestSuite{ - enum MatcherState{skip, inTest, inSource, inExpectedResult} private static final String classRegexp = "//#(.*)\\s*(\\w*)*$"; //$NON-NLS-1$ @@ -61,9 +58,8 @@ public class RefactoringTester extends TestSuite{ } private static ArrayList createTests(BufferedReader inputReader) throws Exception { - String line; - Vector files = new Vector(); + Collection files = new ArrayList(); TestSourceFile actFile = null; MatcherState matcherState = MatcherState.skip; ArrayList testCases = new ArrayList(); @@ -71,13 +67,12 @@ public class RefactoringTester extends TestSuite{ String className = null; boolean bevorFirstTest = true; - while ((line = inputReader.readLine()) != null){ - - if(lineMatchesBeginOfTest(line)) { - if(!bevorFirstTest) { + while ((line = inputReader.readLine()) != null) { + if (lineMatchesBeginOfTest(line)) { + if (!bevorFirstTest) { RefactoringBaseTest test = createTestClass(className, testName, files); testCases.add(test); - files = new Vector(); + files = new ArrayList(); className = null; testName = null; } @@ -85,27 +80,27 @@ public class RefactoringTester extends TestSuite{ testName = getNameOfTest(line); bevorFirstTest = false; continue; - } else if (lineMatchesBeginOfResult(line)) { + } else if (lineMatchesBeginOfResult(line)) { matcherState = MatcherState.inExpectedResult; continue; - }else if (lineMatchesFileName(line)) { + } else if (lineMatchesFileName(line)) { matcherState = MatcherState.inSource; actFile = new TestSourceFile(getFileName(line)); files.add(actFile); continue; - }else if(lineMatchesClassName(line)) { + } else if (lineMatchesClassName(line)) { className = getNameOfClass(line); continue; } - switch(matcherState) { + switch (matcherState) { case inSource: - if(actFile != null) { + if (actFile != null) { actFile.addLineToSource(line); } break; case inExpectedResult: - if(actFile != null) { + if (actFile != null) { actFile.addLineToExpectedSource(line); } break; @@ -118,50 +113,44 @@ public class RefactoringTester extends TestSuite{ return testCases; } - - - private static RefactoringBaseTest createTestClass(String className, String testName, Vector files) throws Exception { - - + private static RefactoringBaseTest createTestClass(String className, String testName, Collection files) throws Exception { try { Class refClass = Class.forName(className); - Class paratypes[] = new Class[2]; - paratypes[0] = testName.getClass(); - paratypes[1] = files.getClass(); - Constructor ct = refClass.getConstructor(paratypes); - Object arglist[] = new Object[2]; - arglist[0] = testName; - arglist[1] = files; - RefactoringBaseTest test = (RefactoringBaseTest) ct.newInstance(arglist); - for (TestSourceFile file : files) { - TextSelection sel = file.getSelection(); - if(sel != null) { - test.setFileWithSelection(file.getName()); - test.setSelection(sel); - break; + if (testName == null) { + testName = refClass.getSimpleName(); + } + Constructor[] constructors = refClass.getConstructors(); + for (Constructor ctor : constructors) { + Object arglist[] = new Object[] { testName, files }; + if (ctor.getParameterTypes().length == arglist.length) { + RefactoringBaseTest test = null; + try { + test = (RefactoringBaseTest) ctor.newInstance(arglist); + } catch (IllegalArgumentException e) { + continue; + } + for (TestSourceFile file : files) { + TextSelection sel = file.getSelection(); + if (sel != null) { + test.setFileWithSelection(file.getName()); + test.setSelection(sel); + break; + } + } + return test; } } - return test; + throw new Exception(className + " class does not provide required constructor"); //$NON-NLS-1$ } catch (ClassNotFoundException e) { - throw new Exception(Messages.getString("RefactoringTester.UnknownTestClass")); //$NON-NLS-1$ - } catch (SecurityException e) { - throw new Exception(Messages.getString("RefactoringTester.SecurityException"), e); //$NON-NLS-1$ - } catch (NoSuchMethodException e) { - throw new Exception(Messages.getString("RefactoringTester.ConstructorError")); //$NON-NLS-1$ - } catch (IllegalArgumentException e) { - throw new Exception(Messages.getString("RefactoringTester.IllegalArgument"), e); //$NON-NLS-1$ - } catch (InstantiationException e) { - throw new Exception(Messages.getString("RefactoringTester.InstantiationException"), e); //$NON-NLS-1$ - } catch (IllegalAccessException e) { - throw new Exception(Messages.getString("RefactoringTester.IllegalAccessException"), e); //$NON-NLS-1$ - } catch (InvocationTargetException e) { - throw new Exception(Messages.getString("RefactoringTester.InvocationTargetException"), e); //$NON-NLS-1$ + throw new Exception("Unknown test class " + className); //$NON-NLS-1$ + } catch (Exception e) { + throw new Exception(e.getClass().getSimpleName() + " diring creation of test " + className, e); //$NON-NLS-1$ } } private static String getFileName(String line) { Matcher matcherBeginOfTest = createMatcherFromString(fileRegexp, line); - if(matcherBeginOfTest.find()) + if (matcherBeginOfTest.find()) return matcherBeginOfTest.group(1); else return null; @@ -169,7 +158,7 @@ public class RefactoringTester extends TestSuite{ private static String getNameOfClass(String line) { Matcher matcherBeginOfTest = createMatcherFromString(classRegexp, line); - if(matcherBeginOfTest.find()) + if (matcherBeginOfTest.find()) return matcherBeginOfTest.group(1); else return null; @@ -193,10 +182,9 @@ public class RefactoringTester extends TestSuite{ private static String getNameOfTest(String line) { Matcher matcherBeginOfTest = createMatcherFromString(testRegexp, line); - if(matcherBeginOfTest.find()) + if (matcherBeginOfTest.find()) return matcherBeginOfTest.group(1); - else - return Messages.getString("RefactoringTester.NotNamed"); //$NON-NLS-1$ + return null; } private static boolean lineMatchesBeginOfResult(String line) { diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractconstant/ExtractConstantRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractconstant/ExtractConstantRefactoringTest.java index f5dfeb8b74a..b45d7c44a31 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractconstant/ExtractConstantRefactoringTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractconstant/ExtractConstantRefactoringTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik + * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik * Rapperswil, University of applied sciences and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -7,12 +7,12 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Institute for Software - initial API and implementation + * Institute for Software - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.ui.tests.refactoring.extractconstant; +import java.util.Collection; import java.util.Properties; -import java.util.Vector; import org.eclipse.core.resources.IFile; import org.eclipse.ltk.core.refactoring.Change; @@ -30,11 +30,9 @@ import org.eclipse.cdt.internal.ui.refactoring.utils.VisibilityEnum; * @author Emanuel Graf */ public class ExtractConstantRefactoringTest extends RefactoringTest { - - protected VisibilityEnum visibility; - public ExtractConstantRefactoringTest(String name, Vector files) { + public ExtractConstantRefactoringTest(String name, Collection files) { super(name, files); } @@ -57,7 +55,5 @@ public class ExtractConstantRefactoringTest extends RefactoringTest { @Override protected void configureRefactoring(Properties refactoringProperties) { visibility = VisibilityEnum.getEnumForStringRepresentation(refactoringProperties.getProperty("visibility", VisibilityEnum.v_public.toString())); //$NON-NLS-1$ - } - } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionRefactoringTest.java index f88ac9a5159..53ec3d742ed 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionRefactoringTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionRefactoringTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik + * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik * Rapperswil, University of applied sciences and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -7,12 +7,12 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Institute for Software - initial API and implementation + * Institute for Software - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.ui.tests.refactoring.extractfunction; +import java.util.Collection; import java.util.Properties; -import java.util.Vector; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; @@ -30,10 +30,8 @@ import org.eclipse.cdt.internal.ui.refactoring.utils.VisibilityEnum; /** * @author Emanuel Graf - * */ public class ExtractFunctionRefactoringTest extends RefactoringTest { - protected String methodName; protected boolean replaceDuplicates; protected boolean returnValue; @@ -47,7 +45,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTest { * @param name * @param files */ - public ExtractFunctionRefactoringTest(String name, Vector files) { + public ExtractFunctionRefactoringTest(String name, Collection files) { super(name, files); } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringTest.java index 40555be621b..4cfec842af2 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik + * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik * Rapperswil, University of applied sciences and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -7,12 +7,12 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Institute for Software - initial API and implementation + * Institute for Software - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable; +import java.util.Collection; import java.util.Properties; -import java.util.Vector; import org.eclipse.core.resources.IFile; import org.eclipse.ltk.core.refactoring.Change; @@ -34,7 +34,7 @@ public class ExtractLocalVariableRefactoringTest extends RefactoringTest { protected String variableName; protected boolean fatalError; - public ExtractLocalVariableRefactoringTest(String name, Vector files) { + public ExtractLocalVariableRefactoringTest(String name, Collection files) { super(name, files); } @@ -46,7 +46,7 @@ public class ExtractLocalVariableRefactoringTest extends RefactoringTest { CRefactoring refactoring = new ExtractLocalVariableRefactoring( refFile, selection, info, cproject); RefactoringStatus checkInitialConditions = refactoring.checkInitialConditions(NULL_PROGRESS_MONITOR); - if(fatalError){ + if (fatalError){ assertConditionsFatalError(checkInitialConditions); return; } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/gettersandsetters/GenerateGettersAndSettersTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/gettersandsetters/GenerateGettersAndSettersTest.java index 84371d6885e..ace833623a3 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/gettersandsetters/GenerateGettersAndSettersTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/gettersandsetters/GenerateGettersAndSettersTest.java @@ -14,9 +14,9 @@ package org.eclipse.cdt.ui.tests.refactoring.gettersandsetters; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.Properties; -import java.util.Vector; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; @@ -48,7 +48,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTest { * @param name * @param files */ - public GenerateGettersAndSettersTest(String name, Vector files) { + public GenerateGettersAndSettersTest(String name, Collection files) { super(name, files); } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/hidemethod/HideMethodRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/hidemethod/HideMethodRefactoringTest.java index 4908b9d75aa..125110811ca 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/hidemethod/HideMethodRefactoringTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/hidemethod/HideMethodRefactoringTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik + * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik * Rapperswil, University of applied sciences and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -7,12 +7,12 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Institute for Software - initial API and implementation + * Institute for Software - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.ui.tests.refactoring.hidemethod; +import java.util.Collection; import java.util.Properties; -import java.util.Vector; import org.eclipse.core.resources.IFile; import org.eclipse.ltk.core.refactoring.Change; @@ -32,7 +32,7 @@ public class HideMethodRefactoringTest extends RefactoringTest { private int errors; private int fatalerrors; - public HideMethodRefactoringTest(String name, Vector files) { + public HideMethodRefactoringTest(String name, Collection files) { super(name, files); } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java index f1f1a82b932..49fc46dab96 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik + * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik * Rapperswil, University of applied sciences and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -7,12 +7,12 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Institute for Software - initial API and implementation + * Institute for Software - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.ui.tests.refactoring.implementmethod; +import java.util.Collection; import java.util.Properties; -import java.util.Vector; import org.eclipse.core.resources.IFile; import org.eclipse.ltk.core.refactoring.Change; @@ -26,22 +26,18 @@ import org.eclipse.cdt.internal.ui.refactoring.implementmethod.ImplementMethodRe /** * @author Mirko Stocker - * */ public class ImplementMethodRefactoringTest extends RefactoringTest { - protected int finalWarnings; private int initialWarnings; - public ImplementMethodRefactoringTest(String name,Vector files) { + public ImplementMethodRefactoringTest(String name, Collection files) { super(name, files); } @Override protected void runTest() throws Throwable { - IFile refFile = project.getFile(fileName); - CRefactoring refactoring = new ImplementMethodRefactoring(refFile, selection, null, cproject); try { @@ -65,8 +61,7 @@ public class ImplementMethodRefactoringTest extends RefactoringTest { assertConditionsWarning(finalConditions, finalWarnings); } compareFiles(fileMap); - } - finally { + } finally { refactoring.unlockIndex(); } } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/messages.properties b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/messages.properties deleted file mode 100644 index f007b5afc59..00000000000 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/messages.properties +++ /dev/null @@ -1,18 +0,0 @@ -############################################################################### -# Copyright (c) 2008 Wind River Systems 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: -# Wind River Systems - initial API and implementation -############################################################################### -RefactoringTester.UnknownTestClass=Unknown TestClass. Make sure the test's sourcefile specifies a valid test class. -RefactoringTester.SecurityException=Security Exception during Test creation -RefactoringTester.ConstructorError=Test class does not provied required constructor. -RefactoringTester.IllegalArgument=IllegalArgumentException during Test creation -RefactoringTester.InstantiationException=InstantiationException during Test creation -RefactoringTester.IllegalAccessException=IllegalAccessException during Test creation -RefactoringTester.InvocationTargetException=InvocationTargetException during Test creation -RefactoringTester.NotNamed=Not Named diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/utils/TranslationUnitHelperTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/utils/TranslationUnitHelperTest.java index 38437bb5feb..8f2bae06511 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/utils/TranslationUnitHelperTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/utils/TranslationUnitHelperTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Institute for Software, HSR Hochschule fuer Technik + * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik * Rapperswil, University of applied sciences and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -7,12 +7,12 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Institute for Software - initial API and implementation + * Institute for Software - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.ui.tests.refactoring.utils; +import java.util.Collection; import java.util.Properties; -import java.util.Vector; import org.eclipse.core.resources.IFile; @@ -25,13 +25,11 @@ import org.eclipse.cdt.internal.ui.refactoring.utils.TranslationUnitHelper; /** * @author Mirko Stocker - * */ public class TranslationUnitHelperTest extends RefactoringTest { - private int offset; - public TranslationUnitHelperTest(String name,Vector files) { + public TranslationUnitHelperTest(String name, Collection files) { super(name, files); }