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