Home | History | Annotate | Download | only in testtype
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
      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 
     17 package com.android.cts.tradefed.testtype;
     18 
     19 import com.android.ddmlib.testrunner.TestIdentifier;
     20 import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
     21 
     22 import java.io.IOException;
     23 import java.io.InputStream;
     24 import java.io.OutputStream;
     25 import java.util.Collection;
     26 
     27 /**
     28  * Interface for accessing test plan data.
     29  */
     30 public interface ITestPlan {
     31 
     32     /**
     33      * Populates the test plan data from given XML stream.
     34      *
     35      * @param xmlStream the {@link InputStream} that contains the test plan xml.
     36      */
     37     public void parse(InputStream xmlStream) throws ParseException;
     38 
     39     /**
     40      * Gets the list of test uris contained in this plan.
     41      */
     42     public Collection<String> getTestUris();
     43 
     44     /**
     45      * Gets the {@link TestFilter} that should be used to exclude tests from given package.
     46      */
     47     public TestFilter getExcludedTestFilter(String uri);
     48 
     49     /**
     50      * Add a package to this test plan
     51      * @param uri
     52      */
     53     public void addPackage(String uri);
     54 
     55     /**
     56      * Add a excluded test to this test plan
     57      *
     58      * @param uri the package uri
     59      * @param testToExclude the test to exclude for given package
     60      */
     61     public void addExcludedTest(String uri, TestIdentifier testToExclude);
     62 
     63     /**
     64      * Adds the list of excluded tests for given package
     65      *
     66      * @param pkgUri
     67      * @param excludedTests
     68      */
     69     public void addExcludedTests(String uri, Collection<TestIdentifier> excludedTests);
     70 
     71     /**
     72      * Serialize the contents of this test plan.
     73      *
     74      * @param xmlOutStream the {@link OutputStream} to serialize test plan contents to
     75      * @throws IOException
     76      */
     77     public void serialize(OutputStream xmlOutStream) throws IOException;
     78 
     79     /**
     80      * @return the test plan name
     81      */
     82     public String getName();
     83 
     84 }
     85