use of com.android.repository.testframework.MockFileOp in project android by JetBrains.
the class PatchInstallerTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
ourFileOp = new MockFileOp();
}
use of com.android.repository.testframework.MockFileOp in project android by JetBrains.
the class AndroidVirtualDeviceTest method testCreateDevice.
public void testCreateDevice() throws Exception {
MockFileOp fop = new MockFileOp();
recordPlatform23(fop);
recordGoogleApisAddon23(fop);
recordGoogleApisSysImg23(fop);
fop.recordExistingFile(new File(DeviceArtDescriptor.getBundledDescriptorsFolder(), "nexus_5x"));
AndroidSdkHandler sdkHandler = new AndroidSdkHandler(new File("/sdk"), new File("/android-home"), fop);
final AvdManagerConnection connection = new AvdManagerConnection(sdkHandler);
FakePackage.FakeRemotePackage remotePlatform = new FakePackage.FakeRemotePackage("platforms;android-23");
RepoFactory factory = AndroidSdkHandler.getRepositoryModule().createLatestFactory();
DetailsTypes.PlatformDetailsType platformDetailsType = factory.createPlatformDetailsType();
platformDetailsType.setApiLevel(23);
remotePlatform.setTypeDetails((TypeDetails) platformDetailsType);
Map<String, RemotePackage> remotes = Maps.newHashMap();
remotes.put("platforms;android-23", remotePlatform);
AndroidVirtualDevice avd = new AndroidVirtualDevice(new ScopedStateStore(ScopedStateStore.Scope.STEP, null, null), remotes, true, fop);
final AvdInfo avdInfo = avd.createAvd(connection, sdkHandler);
assertNotNull(avdInfo);
disposeOnTearDown(() -> connection.deleteAvd(avdInfo));
assertNotNull(avdInfo);
Map<String, String> properties = avdInfo.getProperties();
Map<String, String> referenceMap = getReferenceMap();
for (Map.Entry<String, String> entry : referenceMap.entrySet()) {
assertEquals(entry.getKey(), entry.getValue(), FileUtil.toSystemIndependentName(properties.get(entry.getKey())));
}
// AVD manager will set some extra properties that we don't care about and that may be system dependant.
// We do not care about those so we only ensure we have the ones we need.
File skin = new File(properties.get(AvdManager.AVD_INI_SKIN_PATH));
assertEquals("nexus_5x", skin.getName());
}
use of com.android.repository.testframework.MockFileOp in project android by JetBrains.
the class RepositoryUrlManagerTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
myFileOp = new MockFileOp();
myRepositoryUrlManager = new RepositoryUrlManager(true);
mySdkHandler = new AndroidSdkHandler(SDK_DIR, ANDROID_HOME, myFileOp);
mySdk = Mockito.mock(AndroidSdkData.class);
Mockito.when(mySdk.getLocation()).thenReturn(SDK_DIR);
String[] paths = new String[] { // Android repository
"extras/android/m2repository/com/android/support/appcompat-v7/18.0.0/appcompat-v7-18.0.0.aar", "extras/android/m2repository/com/android/support/appcompat-v7/19.0.0/appcompat-v7-19.0.0.aar", "extras/android/m2repository/com/android/support/appcompat-v7/19.0.1/appcompat-v7-19.0.1.aar", "extras/android/m2repository/com/android/support/appcompat-v7/19.1.0/appcompat-v7-19.1.0.aar", "extras/android/m2repository/com/android/support/appcompat-v7/20.0.0/appcompat-v7-20.0.0.aar", "extras/android/m2repository/com/android/support/appcompat-v7/21.0.0/appcompat-v7-21.0.0.aar", "extras/android/m2repository/com/android/support/appcompat-v7/21.0.2/appcompat-v7-21.0.2.aar", "extras/android/m2repository/com/android/support/cardview-v7/21.0.0/cardview-v7-21.0.0.aar", "extras/android/m2repository/com/android/support/cardview-v7/21.0.2/cardview-v7-21.0.2.aar", "extras/android/m2repository/com/android/support/support-v13/20.0.0/support-v13-20.0.0.aar", "extras/android/m2repository/com/android/support/support-v13/21.0.0/support-v13-21.0.0.aar", "extras/android/m2repository/com/android/support/support-v13/21.0.2/support-v13-21.0.2.aar", // JARs were used before 19.0.0
"extras/android/m2repository/com/android/support/support-v4/13.0.0/support-v4-13.0.0.jar", "extras/android/m2repository/com/android/support/support-v4/19.0.1/support-v4-19.0.1.aar", "extras/android/m2repository/com/android/support/support-v4/20.0.0/support-v4-20.0.0.aar", "extras/android/m2repository/com/android/support/support-v4/20.0.0/support-v4-20.0.0-rc1.aar", "extras/android/m2repository/com/android/support/support-v4/21.0.0/support-v4-21.0.0.aar", "extras/android/m2repository/com/android/support/support-v4/21.0.2/support-v4-21.0.2.aar", "extras/android/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha7/constraint-layout-1.0.0-alpha7.aar", // Google repository
"extras/google/m2repository/com/google/android/gms/play-services/3.1.36/play-services-3.1.36.aar", "extras/google/m2repository/com/google/android/gms/play-services/3.1.59/play-services-3.1.59.aar", "extras/google/m2repository/com/google/android/gms/play-services/3.2.25/play-services-3.2.25.aar", "extras/google/m2repository/com/google/android/gms/play-services/3.2.65/play-services-3.2.65.aar", "extras/google/m2repository/com/google/android/gms/play-services/4.0.30/play-services-4.0.30.aar", "extras/google/m2repository/com/google/android/gms/play-services/4.1.32/play-services-4.1.32.aar", "extras/google/m2repository/com/google/android/gms/play-services/4.2.42/play-services-4.2.42.aar", "extras/google/m2repository/com/google/android/gms/play-services/4.3.23/play-services-4.3.23.aar", "extras/google/m2repository/com/google/android/gms/play-services/4.4.52/play-services-4.4.52.aar", "extras/google/m2repository/com/google/android/gms/play-services/5.0.89/play-services-5.0.89.aar", "extras/google/m2repository/com/google/android/gms/play-services/5.2.08/play-services-5.2.08.aar", "extras/google/m2repository/com/google/android/gms/play-services-wearable/5.0.77/play-services-wearable-5.0.77.aar", "extras/google/m2repository/com/google/android/gms/play-services-wearable/6.1.11/play-services-wearable-6.1.11.aar", "extras/google/m2repository/com/google/android/gms/play-services-wearable/6.1.71/play-services-wearable-6.1.71.aar", "extras/google/m2repository/com/google/android/support/wearable/1.0.0/wearable-1.0.0.aar", "extras/google/m2repository/com/google/android.wearable/wearable/2.0.0-alpha2/wearable-2.0.0-alpha2.aar" };
for (String path : paths) {
myFileOp.createNewFile(new File(SDK_DIR, path));
}
}
use of com.android.repository.testframework.MockFileOp in project android by JetBrains.
the class AvdWizardUtilsTest method createMockSdk.
@NotNull
private static AndroidSdkHandler createMockSdk(String versionString, String path) {
FakeLocalPackage p = new FakeLocalPackage(path);
p.setRevision(Revision.parseRevision(versionString));
RepositoryPackages packages = new RepositoryPackages();
packages.setLocalPkgInfos(ImmutableList.of(p));
RepoManager mgr = new FakeRepoManager(null, packages);
return new AndroidSdkHandler(null, null, new MockFileOp(), mgr);
}
use of com.android.repository.testframework.MockFileOp in project android by JetBrains.
the class PatchInstallerFactoryTest method setUp.
@Before
public void setUp() {
myFileOp = new MockFileOp();
myInstallerFactory = new PatchInstallerFactory();
myInstallerFactory.setFallbackFactory(new BasicInstallerFactory());
myRepositoryPackages = new RepositoryPackages();
File root = new File("/sdk");
myRepoManager = new FakeRepoManager(root, myRepositoryPackages);
}
Aggregations