Search in sources :

Example 6 with FakeLocalPackage

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

the class PatchInstallerFactoryTest method createInstallerWithPatch.

@Test
public void createInstallerWithPatch() {
    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));
    Installer installer = myInstallerFactory.createInstaller(remote, myRepoManager, new FakeDownloader(myFileOp), myFileOp);
    assertTrue(installer instanceof PatchInstaller);
}
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)

Example 7 with FakeLocalPackage

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

the class PatchInstallerFactoryTest method cantHandleWindowsUninstallWithoutPatcher.

@Test
public void cantHandleWindowsUninstallWithoutPatcher() {
    myFileOp.setIsWindows(true);
    LocalPackage p = new FakeLocalPackage("foo");
    myRepositoryPackages.setLocalPkgInfos(ImmutableList.of(p));
    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 8 with FakeLocalPackage

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

the class PatchInstallerFactoryTest method canHandleWindowsUninstallWithPatcher.

@Test
public void canHandleWindowsUninstallWithPatcher() {
    myFileOp.setIsWindows(true);
    LocalPackage p = new FakeLocalPackage("foo");
    myRepositoryPackages.setLocalPkgInfos(ImmutableList.of(p, PATCHER_4));
    assertTrue(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 9 with FakeLocalPackage

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

the class PatchInstallerFactoryTest method createPatchUninstaller.

@Test
public void createPatchUninstaller() {
    myFileOp.setIsWindows(true);
    FakeLocalPackage p = new FakeLocalPackage("foo");
    myRepositoryPackages.setLocalPkgInfos(ImmutableList.of(p, PATCHER_4));
    assertTrue(myInstallerFactory.createUninstaller(p, myRepoManager, myFileOp) instanceof PatchUninstaller);
}
Also used : FakeLocalPackage(com.android.repository.testframework.FakePackage.FakeLocalPackage) Test(org.junit.Test)

Example 10 with FakeLocalPackage

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

the class PatchInstallerFactoryTest method createFallbackUninstaller.

@Test
public void createFallbackUninstaller() {
    FakeLocalPackage p = new FakeLocalPackage("foo");
    assertFalse(myInstallerFactory.createUninstaller(p, myRepoManager, myFileOp) instanceof PatchUninstaller);
}
Also used : FakeLocalPackage(com.android.repository.testframework.FakePackage.FakeLocalPackage) 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