Search in sources :

Example 16 with FakeLocalPackage

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

the class PatchInstallerFactoryTest method cantHandleNoPatchOnWindowsWithNoPatcher.

@Test
public void cantHandleNoPatchOnWindowsWithNoPatcher() {
    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));
    myRepositoryPackages.setRemotePkgInfos(ImmutableList.of(remote));
    assertFalse(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 17 with FakeLocalPackage

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

the class PatchInstallerUtilTest method getDependantPatcher.

@Test
public void getDependantPatcher() throws Exception {
    LocalPackage target = new FakeLocalPackage("patcher;v2");
    List<LocalPackage> local = ImmutableList.of(new FakeLocalPackage("patcher;v1"), target, new FakeLocalPackage("patcher;v3"));
    FakeRemotePackage update = new FakeRemotePackage("p");
    List<RemotePackage> remote = ImmutableList.of(update, new FakeRemotePackage("patcher;v4"));
    update.setDependencies(ImmutableList.of(new FakeDependency(target.getPath())));
    RepositoryPackages packages = new RepositoryPackages(local, remote);
    FakeRepoManager mgr = new FakeRepoManager(new File("/sdk"), packages);
    LocalPackage patcher = PatchInstallerUtil.getDependantPatcher(update, mgr);
    assertEquals(target, patcher);
}
Also used : FakeRemotePackage(com.android.repository.testframework.FakePackage.FakeRemotePackage) FakeLocalPackage(com.android.repository.testframework.FakePackage.FakeLocalPackage) LocalPackage(com.android.repository.api.LocalPackage) FakeLocalPackage(com.android.repository.testframework.FakePackage.FakeLocalPackage) RepositoryPackages(com.android.repository.impl.meta.RepositoryPackages) FakeDependency(com.android.repository.testframework.FakeDependency) FakeRepoManager(com.android.repository.testframework.FakeRepoManager) RemotePackage(com.android.repository.api.RemotePackage) FakeRemotePackage(com.android.repository.testframework.FakePackage.FakeRemotePackage) File(java.io.File) Test(org.junit.Test)

Example 18 with FakeLocalPackage

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

the class PatchInstallerUtilTest method dependantPatcherNotInstalled.

@Test
public void dependantPatcherNotInstalled() throws Exception {
    FakeLocalPackage target = new FakeLocalPackage("patcher;v2");
    List<LocalPackage> local = ImmutableList.of(new FakeLocalPackage("patcher;v1"), new FakeLocalPackage("patcher;v3"));
    FakeRemotePackage update = new FakeRemotePackage("p");
    List<RemotePackage> remote = ImmutableList.of(update, new FakeRemotePackage("patcher;v4"));
    update.setDependencies(ImmutableList.of(new FakeDependency(target.getPath())));
    RepositoryPackages packages = new RepositoryPackages(local, remote);
    FakeRepoManager mgr = new FakeRepoManager(new File("/sdk"), packages);
    LocalPackage patcher = PatchInstallerUtil.getDependantPatcher(update, mgr);
    assertNull(patcher);
}
Also used : FakeRemotePackage(com.android.repository.testframework.FakePackage.FakeRemotePackage) FakeLocalPackage(com.android.repository.testframework.FakePackage.FakeLocalPackage) LocalPackage(com.android.repository.api.LocalPackage) FakeLocalPackage(com.android.repository.testframework.FakePackage.FakeLocalPackage) RepositoryPackages(com.android.repository.impl.meta.RepositoryPackages) FakeDependency(com.android.repository.testframework.FakeDependency) FakeRepoManager(com.android.repository.testframework.FakeRepoManager) RemotePackage(com.android.repository.api.RemotePackage) FakeRemotePackage(com.android.repository.testframework.FakePackage.FakeRemotePackage) File(java.io.File) Test(org.junit.Test)

Example 19 with FakeLocalPackage

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

the class PatchInstallerUtilTest method noLatestPatcher.

@Test
public void noLatestPatcher() throws Exception {
    List<LocalPackage> local = ImmutableList.of(new FakeLocalPackage("foo"));
    RepositoryPackages packages = new RepositoryPackages(local, ImmutableList.of());
    FakeRepoManager mgr = new FakeRepoManager(new File("/sdk"), packages);
    LocalPackage patcher = PatchInstallerUtil.getLatestPatcher(mgr);
    assertNull(patcher);
}
Also used : FakeLocalPackage(com.android.repository.testframework.FakePackage.FakeLocalPackage) LocalPackage(com.android.repository.api.LocalPackage) FakeLocalPackage(com.android.repository.testframework.FakePackage.FakeLocalPackage) RepositoryPackages(com.android.repository.impl.meta.RepositoryPackages) FakeRepoManager(com.android.repository.testframework.FakeRepoManager) File(java.io.File) 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