Home | History | Annotate | Download | only in packages
      1 /*
      2  * Copyright (C) 2011 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.sdklib.internal.repository.packages;
     18 
     19 import com.android.sdklib.internal.repository.packages.SystemImagePackage;
     20 import com.android.sdklib.internal.repository.sources.SdkSource;
     21 
     22 
     23 /**
     24  * A mock {@link SystemImagePackage} for testing.
     25  *
     26  * By design, this package contains one and only one archive.
     27  */
     28 public class MockSystemImagePackage extends SystemImagePackage {
     29     /**
     30      * Creates a {@link MockSystemImagePackage} using the given base platform version
     31      * and package revision.
     32      *
     33      * By design, this package contains one and only one archive.
     34      */
     35     public MockSystemImagePackage(MockPlatformPackage basePlatform, int revision, String abi) {
     36         super(basePlatform.getVersion(),
     37                 revision,
     38                 abi,
     39                 null /*props*/,
     40                 String.format("/sdk/system-images/android-%s/%s",
     41                         basePlatform.getVersion().getApiString(), abi));
     42     }
     43 
     44     /**
     45      * Creates a {@link MockSystemImagePackage} using the given base platform version,
     46      * sdk source and package revision.
     47      *
     48      * By design, this package contains one and only one archive.
     49      */
     50     public MockSystemImagePackage(
     51             SdkSource source,
     52             MockPlatformPackage basePlatform,
     53             int revision,
     54             String abi) {
     55         super(source,
     56                 basePlatform.getVersion(),
     57                 revision,
     58                 abi,
     59                 null /*props*/,
     60                 String.format("/sdk/system-images/android-%s/%s",
     61                         basePlatform.getVersion().getApiString(), abi));
     62     }
     63 }
     64