• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /**
25  * Contains info about Android JUnit launch
26  */
27 public class AndroidJUnitLaunchInfo {
28     private final IProject mProject;
29     private final String mAppPackage;
30     private final String mRunner;
31 
32     private boolean mDebugMode = false;
33     private IDevice mDevice = null;
34     private String mTestPackage = null;
35     private String mTestClass = null;
36     private String mTestMethod = null;
37     private ILaunch mLaunch = null;
38     private TestSize mTestSize = null;
39 
AndroidJUnitLaunchInfo(IProject project, String appPackage, String runner)40     public AndroidJUnitLaunchInfo(IProject project, String appPackage, String runner) {
41         mProject = project;
42         mAppPackage = appPackage;
43         mRunner = runner;
44     }
45 
getProject()46     public IProject getProject() {
47         return mProject;
48     }
49 
getAppPackage()50     public String getAppPackage() {
51         return mAppPackage;
52     }
53 
getRunner()54     public String getRunner() {
55         return mRunner;
56     }
57 
isDebugMode()58     public boolean isDebugMode() {
59         return mDebugMode;
60     }
61 
setDebugMode(boolean debugMode)62     public void setDebugMode(boolean debugMode) {
63         mDebugMode = debugMode;
64     }
65 
getTestSize()66     public TestSize getTestSize() {
67         return mTestSize;
68     }
69 
setTestSize(TestSize size)70     public void setTestSize(TestSize size) {
71         mTestSize = size;
72     }
73 
getDevice()74     public IDevice getDevice() {
75         return mDevice;
76     }
77 
setDevice(IDevice device)78     public void setDevice(IDevice device) {
79         mDevice = device;
80     }
81 
82     /**
83      * Specify to run all tests within given package.
84      *
85      * @param testPackage fully qualified java package
86      */
setTestPackage(String testPackage)87     public void setTestPackage(String testPackage) {
88         mTestPackage = testPackage;
89     }
90 
91     /**
92      * Return the package of tests to run.
93      *
94      * @return fully qualified java package. <code>null</code> if not specified.
95      */
getTestPackage()96     public String getTestPackage() {
97         return mTestPackage;
98     }
99 
100     /**
101      * Sets the test class to run.
102      *
103      * @param testClass fully qualfied test class to run
104      *    Expected format: x.y.x.testclass
105      */
setTestClass(String testClass)106     public void setTestClass(String testClass) {
107         mTestClass = testClass;
108     }
109 
110     /**
111      * Returns the test class to run.
112      *
113      * @return fully qualfied test class to run.
114      *   <code>null</code> if not specified.
115      */
getTestClass()116     public String getTestClass() {
117         return mTestClass;
118     }
119 
120     /**
121      * Sets the test method to run. testClass must also be set.
122      *
123      * @param testMethod test method to run
124      */
setTestMethod(String testMethod)125     public void setTestMethod(String testMethod) {
126         mTestMethod = testMethod;
127     }
128 
129     /**
130      * Returns the test method to run.
131      *
132      * @return test method to run. <code>null</code> if not specified.
133      */
getTestMethod()134     public String getTestMethod() {
135         return mTestMethod;
136     }
137 
getLaunch()138     public ILaunch getLaunch() {
139         return mLaunch;
140     }
141 
setLaunch(ILaunch launch)142     public void setLaunch(ILaunch launch) {
143         mLaunch = launch;
144     }
145 }
146