auto import from //branches/cupcake/...@137197

This commit is contained in:
The Android Open Source Project
2009-03-09 11:52:11 -07:00
parent 9b690286ca
commit 692ab02175
44 changed files with 1260 additions and 1248 deletions

View File

@@ -13,7 +13,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.jdt.launching,
org.eclipse.ui.views,
com.android.ide.eclipse.ddms
Eclipse-LazyStart: true
Bundle-ActivationPolicy: lazy
Bundle-Vendor: The Android Open Source Project
Bundle-ClassPath: kxml2-2.3.0.jar,
.

View File

@@ -0,0 +1,110 @@
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Eclipse Public License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.eclipse.org/org/documents/epl-v10.php
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.ide.eclipse.adt.launch;
import java.io.IOException;
import java.util.Arrays;
import junit.framework.TestCase;
public class JUnitLaunchConfigDelegateTest extends TestCase {
public void testAbleToFetchJunitJar() throws IOException {
assertTrue(JUnitLaunchConfigDelegate.getJunitJarLocation().endsWith("junit.jar"));
}
public void testFixBootpathExtWithAndroidJar() {
String[][] testArray = {
null,
{ "android.jar"},
null,
{ "some_other_jar.jar" },
};
String[][] expectedArray = {
null,
null,
null,
{ "some_other_jar.jar" },
};
assertEqualsArrays(expectedArray, JUnitLaunchConfigDelegate.fixBootpathExt(testArray));
}
public void testFixBootpathExtWithNoAndroidJar() {
String[][] testArray = {
null,
{ "somejar.jar"},
null,
};
String[][] expectedArray = {
null,
{ "somejar.jar"},
null,
};
assertEqualsArrays(expectedArray, JUnitLaunchConfigDelegate.fixBootpathExt(testArray));
}
public void testFixClasspathWithJunitJar() throws IOException {
String[] testArray = {
JUnitLaunchConfigDelegate.getJunitJarLocation(),
};
String[] expectedArray = {
JUnitLaunchConfigDelegate.getJunitJarLocation(),
};
assertEqualsArrays(expectedArray,
JUnitLaunchConfigDelegate.fixClasspath(testArray, "test"));
}
public void testFixClasspathWithoutJunitJar() throws IOException {
String[] testArray = {
"random.jar",
};
String[] expectedArray = {
"random.jar",
JUnitLaunchConfigDelegate.getJunitJarLocation(),
};
assertEqualsArrays(expectedArray,
JUnitLaunchConfigDelegate.fixClasspath(testArray, "test"));
}
public void testFixClasspathWithNoJars() throws IOException {
String[] testArray = {
};
String[] expectedArray = {
JUnitLaunchConfigDelegate.getJunitJarLocation(),
};
assertEqualsArrays(expectedArray,
JUnitLaunchConfigDelegate.fixClasspath(testArray, "test"));
}
private void assertEqualsArrays(String[][] a1, String[][] a2) {
assertTrue(Arrays.deepEquals(a1, a2));
}
private void assertEqualsArrays(String[] a1, String[] a2) {
assertTrue(Arrays.deepEquals(a1, a2));
}
}

View File

@@ -15,15 +15,14 @@
*/
package com.android.ide.eclipse.tests;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.runtime.Plugin;
import java.lang.reflect.Modifier;
import java.net.URL;
import java.util.Enumeration;
import java.util.logging.Logger;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Class for collecting all test cases in an eclipse plugin
@@ -31,8 +30,6 @@ import java.util.logging.Logger;
*/
public class EclipseTestCollector {
private static final Logger sLogger = Logger.getLogger(EclipseTestCollector.class.getName());
/**
* Constructor
*/
@@ -49,13 +46,13 @@ public class EclipseTestCollector {
*/
public void addTestCases(TestSuite suite, Plugin plugin, String expectedPackage) {
if (plugin != null) {
Enumeration entries = plugin.getBundle().findEntries("/", "*.class", true);
Enumeration<?> entries = plugin.getBundle().findEntries("/", "*.class", true);
while (entries.hasMoreElements()) {
URL entry = (URL)entries.nextElement();
String filePath = entry.getPath().replace(".class", "");
try {
Class testClass = getClass(filePath, expectedPackage);
Class<?> testClass = getClass(filePath, expectedPackage);
if (isTestClass(testClass)) {
suite.addTestSuite(testClass);
}
@@ -69,11 +66,11 @@ public class EclipseTestCollector {
}
/**
* Returns true if given class shouk\ld be added to suite
* Returns true if given class should be added to suite
* @param testClass
* @return
*/
protected boolean isTestClass(Class testClass) {
protected boolean isTestClass(Class<?> testClass) {
return TestCase.class.isAssignableFrom(testClass) &&
Modifier.isPublic(testClass.getModifiers()) &&
hasPublicConstructor(testClass);
@@ -84,7 +81,7 @@ public class EclipseTestCollector {
* @param testClass
* @return
*/
protected boolean hasPublicConstructor(Class testClass) {
protected boolean hasPublicConstructor(Class<?> testClass) {
try {
TestSuite.getTestConstructor(testClass);
} catch(NoSuchMethodException e) {
@@ -100,7 +97,7 @@ public class EclipseTestCollector {
* @return
* @throws ClassNotFoundException
*/
protected Class getClass(String filePath, String expectedPackage) throws ClassNotFoundException {
protected Class<?> getClass(String filePath, String expectedPackage) throws ClassNotFoundException {
String dotPath = filePath.replace('/', '.');
// remove the output folders, by finding where package name starts
int index = dotPath.indexOf(expectedPackage);

View File

@@ -49,7 +49,7 @@ public class UnitTests {
* Override parent class to exclude functional tests
*/
@Override
protected boolean isTestClass(Class testClass) {
protected boolean isTestClass(Class<?> testClass) {
return super.isTestClass(testClass) &&
!testClass.getPackage().getName().startsWith(FuncTests.FUNC_TEST_PACKAGE);
}

View File

@@ -31,7 +31,6 @@ import com.android.ide.eclipse.mock.FolderMock;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import junit.framework.TestCase;
@@ -47,7 +46,6 @@ public class ConfigMatchTest extends TestCase {
private FolderConfiguration config2;
private FolderConfiguration config1;
@SuppressWarnings("unchecked")
@Override
protected void setUp() throws Exception {
super.setUp();

View File

@@ -20,7 +20,6 @@ import com.android.ide.eclipse.editors.resources.configurations.FolderConfigurat
import com.android.ide.eclipse.editors.resources.configurations.ResourceQualifier;
import java.lang.reflect.Field;
import java.util.ArrayList;
import junit.framework.TestCase;
@@ -41,7 +40,6 @@ public class QualifierListTest extends TestCase {
mManager = null;
}
@SuppressWarnings("unchecked")
public void testQualifierList() {
try {
// get the list of qualifier in the resource manager

View File

@@ -424,11 +424,13 @@ public class FileMock implements IFile {
throw new NotImplementedException();
}
public Map getPersistentProperties() throws CoreException {
@SuppressWarnings("unchecked")
public Map getPersistentProperties() throws CoreException {
throw new NotImplementedException();
}
public Map getSessionProperties() throws CoreException {
@SuppressWarnings("unchecked")
public Map getSessionProperties() throws CoreException {
throw new NotImplementedException();
}

View File

@@ -428,11 +428,11 @@ public final class FolderMock implements IFolder {
throw new NotImplementedException();
}
public Map getPersistentProperties() throws CoreException {
public Map<?,?> getPersistentProperties() throws CoreException {
throw new NotImplementedException();
}
public Map getSessionProperties() throws CoreException {
public Map<?,?> getSessionProperties() throws CoreException {
throw new NotImplementedException();
}

View File

@@ -42,6 +42,7 @@ import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import java.net.URI;
import java.util.Map;
@SuppressWarnings("deprecation")
public class ProjectMock implements IProject {
public void build(int kind, IProgressMonitor monitor) throws CoreException {
@@ -95,7 +96,6 @@ public class ProjectMock implements IProject {
throw new NotImplementedException();
}
@SuppressWarnings("deprecation")
public IPath getPluginWorkingLocation(IPluginDescriptor plugin) {
throw new NotImplementedException();
}
@@ -459,6 +459,8 @@ public class ProjectMock implements IProject {
throw new NotImplementedException();
}
@SuppressWarnings("unchecked")
public Object getAdapter(Class adapter) {
throw new NotImplementedException();
}
@@ -476,11 +478,11 @@ public class ProjectMock implements IProject {
throw new NotImplementedException();
}
public Map getPersistentProperties() throws CoreException {
public Map<?,?> getPersistentProperties() throws CoreException {
throw new NotImplementedException();
}
public Map getSessionProperties() throws CoreException {
public Map<?,?> getSessionProperties() throws CoreException {
throw new NotImplementedException();
}