mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Code streamlining.
This commit is contained in:
parent
97b21f3397
commit
a5c4ac9c10
13 changed files with 86 additions and 170 deletions
|
@ -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 + '!';
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<TestSourceFile> files) {
|
||||
public RefactoringBaseTest(String name, Collection<TestSourceFile> 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');
|
||||
}
|
||||
|
|
|
@ -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<TestSourceFile> files) {
|
||||
public RefactoringHistoryTest(String name, Collection<TestSourceFile> files) {
|
||||
super(name, files);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<TestSourceFile> files) {
|
||||
public RefactoringTest(String name, Collection<TestSourceFile> 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<TestSourceFile> files) {
|
||||
private void initializeConfiguration(Collection<TestSourceFile> 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) {
|
||||
|
|
|
@ -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<RefactoringBaseTest> createTests(BufferedReader inputReader) throws Exception {
|
||||
|
||||
String line;
|
||||
Vector<TestSourceFile> files = new Vector<TestSourceFile>();
|
||||
Collection<TestSourceFile> files = new ArrayList<TestSourceFile>();
|
||||
TestSourceFile actFile = null;
|
||||
MatcherState matcherState = MatcherState.skip;
|
||||
ArrayList<RefactoringBaseTest> testCases = new ArrayList<RefactoringBaseTest>();
|
||||
|
@ -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<TestSourceFile>();
|
||||
files = new ArrayList<TestSourceFile>();
|
||||
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<TestSourceFile> files) throws Exception {
|
||||
|
||||
|
||||
private static RefactoringBaseTest createTestClass(String className, String testName, Collection<TestSourceFile> 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) {
|
||||
|
|
|
@ -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<TestSourceFile> files) {
|
||||
public ExtractConstantRefactoringTest(String name, Collection<TestSourceFile> 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$
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<TestSourceFile> files) {
|
||||
public ExtractFunctionRefactoringTest(String name, Collection<TestSourceFile> files) {
|
||||
super(name, files);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<TestSourceFile> files) {
|
||||
public ExtractLocalVariableRefactoringTest(String name, Collection<TestSourceFile> 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;
|
||||
}
|
||||
|
|
|
@ -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<TestSourceFile> files) {
|
||||
public GenerateGettersAndSettersTest(String name, Collection<TestSourceFile> files) {
|
||||
super(name, files);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<TestSourceFile> files) {
|
||||
public HideMethodRefactoringTest(String name, Collection<TestSourceFile> files) {
|
||||
super(name, files);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<TestSourceFile> files) {
|
||||
public ImplementMethodRefactoringTest(String name, Collection<TestSourceFile> 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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -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<TestSourceFile> files) {
|
||||
public TranslationUnitHelperTest(String name, Collection<TestSourceFile> files) {
|
||||
super(name, files);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue