use of com.android.repository.testframework.FakePackage.FakeLocalPackage in project android by JetBrains.
the class PatchInstallerUtilTest method getLatestPatcher.
@Test
public void getLatestPatcher() throws Exception {
LocalPackage target = new FakeLocalPackage("patcher;v3");
List<LocalPackage> local = ImmutableList.of(new FakeLocalPackage("patcher;v1"), target, new FakeLocalPackage("patcher;v2"));
RepositoryPackages packages = new RepositoryPackages(local, ImmutableList.of());
FakeRepoManager mgr = new FakeRepoManager(new File("/sdk"), packages);
LocalPackage patcher = PatchInstallerUtil.getLatestPatcher(mgr);
assertEquals(target, patcher);
}
use of com.android.repository.testframework.FakePackage.FakeLocalPackage in project android by JetBrains.
the class PatchInstallerFactoryTest method createInstallerWithoutPatch.
@Test
public void createInstallerWithoutPatch() {
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));
Installer installer = myInstallerFactory.createInstaller(remote, myRepoManager, new FakeDownloader(myFileOp), myFileOp);
assertTrue(installer instanceof FullInstaller);
}
use of com.android.repository.testframework.FakePackage.FakeLocalPackage in project android by JetBrains.
the class PatchInstallerFactoryTest method canHandleOnLinux.
@Test
public void canHandleOnLinux() {
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));
}
use of com.android.repository.testframework.FakePackage.FakeLocalPackage in project android by JetBrains.
the class PatchInstallerFactoryTest method cantHandleWrongPatch.
@Test
public void cantHandleWrongPatch() {
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, 1));
myRepositoryPackages.setLocalPkgInfos(ImmutableList.of(local, PATCHER_4));
myRepositoryPackages.setRemotePkgInfos(ImmutableList.of(remote));
assertFalse(myInstallerFactory.canHandlePackage(remote, myRepoManager, myFileOp));
}
use of com.android.repository.testframework.FakePackage.FakeLocalPackage in project android by JetBrains.
the class PatchInstallerFactoryTest method cantHandleNoPatchOnWindowsWithOldPatcher.
@Test
public void cantHandleNoPatchOnWindowsWithOldPatcher() {
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_2));
myRepositoryPackages.setRemotePkgInfos(ImmutableList.of(remote));
assertFalse(myInstallerFactory.canHandlePackage(remote, myRepoManager, myFileOp));
}
Aggregations