1 /* 2 * Copyright (C) 2009 The Android Open Source Project 3 * 4 * Licensed under the Eclipse Public License, Version 1.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.eclipse.org/org/documents/epl-v10.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.ide.eclipse.adt.internal.launch.junit.runtime; 17 18 import com.android.ddmlib.IDevice; 19 import com.android.ddmlib.testrunner.IRemoteAndroidTestRunner.TestSize; 20 21 import org.eclipse.core.resources.IProject; 22 import org.eclipse.debug.core.ILaunch; 23 24 import java.util.Collection; 25 import java.util.Collections; 26 27 /** 28 * Contains info about Android JUnit launch 29 */ 30 public class AndroidJUnitLaunchInfo { 31 private final IProject mProject; 32 private final String mAppPackage; 33 private final String mRunner; 34 35 private boolean mDebugMode = false; 36 private Collection<IDevice> mDevices = Collections.EMPTY_LIST; 37 private String mTestPackage = null; 38 private String mTestClass = null; 39 private String mTestMethod = null; 40 private ILaunch mLaunch = null; 41 private TestSize mTestSize = null; 42 AndroidJUnitLaunchInfo(IProject project, String appPackage, String runner)43 public AndroidJUnitLaunchInfo(IProject project, String appPackage, String runner) { 44 mProject = project; 45 mAppPackage = appPackage; 46 mRunner = runner; 47 } 48 getProject()49 public IProject getProject() { 50 return mProject; 51 } 52 getAppPackage()53 public String getAppPackage() { 54 return mAppPackage; 55 } 56 getRunner()57 public String getRunner() { 58 return mRunner; 59 } 60 isDebugMode()61 public boolean isDebugMode() { 62 return mDebugMode; 63 } 64 setDebugMode(boolean debugMode)65 public void setDebugMode(boolean debugMode) { 66 mDebugMode = debugMode; 67 } 68 getTestSize()69 public TestSize getTestSize() { 70 return mTestSize; 71 } 72 setTestSize(TestSize size)73 public void setTestSize(TestSize size) { 74 mTestSize = size; 75 } 76 getDevices()77 public Collection<IDevice> getDevices() { 78 return mDevices; 79 } 80 setDevices(Collection<IDevice> devices)81 public void setDevices(Collection<IDevice> devices) { 82 mDevices = devices; 83 } 84 85 /** 86 * Specify to run all tests within given package. 87 * 88 * @param testPackage fully qualified java package 89 */ setTestPackage(String testPackage)90 public void setTestPackage(String testPackage) { 91 mTestPackage = testPackage; 92 } 93 94 /** 95 * Return the package of tests to run. 96 * 97 * @return fully qualified java package. <code>null</code> if not specified. 98 */ getTestPackage()99 public String getTestPackage() { 100 return mTestPackage; 101 } 102 103 /** 104 * Sets the test class to run. 105 * 106 * @param testClass fully qualfied test class to run 107 * Expected format: x.y.x.testclass 108 */ setTestClass(String testClass)109 public void setTestClass(String testClass) { 110 mTestClass = testClass; 111 } 112 113 /** 114 * Returns the test class to run. 115 * 116 * @return fully qualfied test class to run. 117 * <code>null</code> if not specified. 118 */ getTestClass()119 public String getTestClass() { 120 return mTestClass; 121 } 122 123 /** 124 * Sets the test method to run. testClass must also be set. 125 * 126 * @param testMethod test method to run 127 */ setTestMethod(String testMethod)128 public void setTestMethod(String testMethod) { 129 mTestMethod = testMethod; 130 } 131 132 /** 133 * Returns the test method to run. 134 * 135 * @return test method to run. <code>null</code> if not specified. 136 */ getTestMethod()137 public String getTestMethod() { 138 return mTestMethod; 139 } 140 getLaunch()141 public ILaunch getLaunch() { 142 return mLaunch; 143 } 144 setLaunch(ILaunch launch)145 public void setLaunch(ILaunch launch) { 146 mLaunch = launch; 147 } 148 } 149