Search in sources :

Example 11 with FakeLocalPackage

use of com.android.repository.testframework.FakePackage.FakeLocalPackage 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);
}
Also used : FakeLocalPackage(com.android.repository.testframework.FakePackage.FakeLocalPackage) RepositoryPackages(com.android.repository.impl.meta.RepositoryPackages) FakeRepoManager(com.android.repository.testframework.FakeRepoManager) RepoManager(com.android.repository.api.RepoManager) FakeRepoManager(com.android.repository.testframework.FakeRepoManager) AndroidSdkHandler(com.android.sdklib.repository.AndroidSdkHandler) MockFileOp(com.android.repository.testframework.MockFileOp) NotNull(org.jetbrains.annotations.NotNull)

Example 12 with FakeLocalPackage

use of com.android.repository.testframework.FakePackage.FakeLocalPackage in project android by JetBrains.

the class PatchInstallerFactoryTest method canHandleNoPatchOnWindowsWithNewPatcher.

@Test
public void canHandleNoPatchOnWindowsWithNewPatcher() {
    myFileOp.setIsWindows(true);
    FakeRemotePackage remote = new FakeRemotePackage("foo");
    remote.setRevision(new Revision(2));
    FakeLocalPackage local = new FakeLocalPackage("foo");
    local.setRevision(new Revision(1));
    myRepositoryPackages.setLocalPkgInfos(ImmutableList.of(local, PATCHER_4));
    myRepositoryPackages.setRemotePkgInfos(ImmutableList.of(remote));
    assertTrue(myInstallerFactory.canHandlePackage(remote, myRepoManager, myFileOp));
}
Also used : FakeRemotePackage(com.android.repository.testframework.FakePackage.FakeRemotePackage) FakeLocalPackage(com.android.repository.testframework.FakePackage.FakeLocalPackage) Revision(com.android.repository.Revision) Test(org.junit.Test)

Example 13 with FakeLocalPackage

use of com.android.repository.testframework.FakePackage.FakeLocalPackage in project android by JetBrains.

the class PatchInstallerFactoryTest method canHandleOnWindows.

@Test
public void canHandleOnWindows() {
    myFileOp.setIsWindows(true);
    FakeRemotePackage remote = new FakeRemotePackage("foo");
    remote.setRevision(new Revision(2));
    remote.setPatchInfo("foo", new Revision(1));
    FakeLocalPackage local = new FakeLocalPackage("foo");
    local.setRevision(new Revision(1));
    myRepositoryPackages.setLocalPkgInfos(ImmutableList.of(local, PATCHER_4));
    myRepositoryPackages.setRemotePkgInfos(ImmutableList.of(remote));
    assertTrue(myInstallerFactory.canHandlePackage(remote, myRepoManager, myFileOp));
}
Also used : FakeRemotePackage(com.android.repository.testframework.FakePackage.FakeRemotePackage) FakeLocalPackage(com.android.repository.testframework.FakePackage.FakeLocalPackage) Revision(com.android.repository.Revision) Test(org.junit.Test)

Example 14 with FakeLocalPackage

use of com.android.repository.testframework.FakePackage.FakeLocalPackage in project android by JetBrains.

the class PatchInstallerFactoryTest method cantHandleLinuxUninstallWithPatcher.

@Test
public void cantHandleLinuxUninstallWithPatcher() {
    LocalPackage p = new FakeLocalPackage("foo");
    myRepositoryPackages.setLocalPkgInfos(ImmutableList.of(p, PATCHER_4));
    assertFalse(myInstallerFactory.canHandlePackage(p, myRepoManager, myFileOp));
}
Also used : FakeLocalPackage(com.android.repository.testframework.FakePackage.FakeLocalPackage) LocalPackage(com.android.repository.api.LocalPackage) FakeLocalPackage(com.android.repository.testframework.FakePackage.FakeLocalPackage) Test(org.junit.Test)

Example 15 with FakeLocalPackage

use of com.android.repository.testframework.FakePackage.FakeLocalPackage in project android by JetBrains.

the class PatchInstallerFactoryTest method createFallbackInstaller.

@Test
public void createFallbackInstaller() {
    FakeRemotePackage remote = new FakeRemotePackage("foo");
    remote.setRevision(new Revision(2));
    FakeLocalPackage local = new FakeLocalPackage("foo");
    local.setRevision(new Revision(1));
    myRepositoryPackages.setLocalPkgInfos(ImmutableList.of(local, PATCHER_4));
    myRepositoryPackages.setRemotePkgInfos(ImmutableList.of(remote));
    Installer installer = myInstallerFactory.createInstaller(remote, myRepoManager, new FakeDownloader(myFileOp), myFileOp);
    assertNotNull(installer);
    assertFalse(installer instanceof PatchOperation);
}
Also used : FakeRemotePackage(com.android.repository.testframework.FakePackage.FakeRemotePackage) FakeLocalPackage(com.android.repository.testframework.FakePackage.FakeLocalPackage) Revision(com.android.repository.Revision) Installer(com.android.repository.api.Installer) FakeDownloader(com.android.repository.testframework.FakeDownloader) Test(org.junit.Test)

Aggregations

FakeLocalPackage (com.android.repository.testframework.FakePackage.FakeLocalPackage)19 Test (org.junit.Test)18 FakeRemotePackage (com.android.repository.testframework.FakePackage.FakeRemotePackage)11 Revision (com.android.repository.Revision)9 LocalPackage (com.android.repository.api.LocalPackage)7 RepositoryPackages (com.android.repository.impl.meta.RepositoryPackages)5 FakeRepoManager (com.android.repository.testframework.FakeRepoManager)5 File (java.io.File)4 Installer (com.android.repository.api.Installer)3 FakeDownloader (com.android.repository.testframework.FakeDownloader)3 RemotePackage (com.android.repository.api.RemotePackage)2 FakeDependency (com.android.repository.testframework.FakeDependency)2 RepoManager (com.android.repository.api.RepoManager)1 MockFileOp (com.android.repository.testframework.MockFileOp)1 AndroidSdkHandler (com.android.sdklib.repository.AndroidSdkHandler)1 NotNull (org.jetbrains.annotations.NotNull)1