use of com.android.repository.Revision in project android by JetBrains.
the class PatchInstallerFactoryTest method cantHandleNoSrcOnWindows.
@Test
public void cantHandleNoSrcOnWindows() {
myFileOp.setIsWindows(true);
FakeRemotePackage remote = new FakeRemotePackage("foo");
remote.setRevision(new Revision(2));
myRepositoryPackages.setLocalPkgInfos(ImmutableList.of(PATCHER_4));
myRepositoryPackages.setRemotePkgInfos(ImmutableList.of(remote));
assertFalse(myInstallerFactory.canHandlePackage(remote, myRepoManager, myFileOp));
}
use of com.android.repository.Revision in project android by JetBrains.
the class SdkComponentSource method getStatuses.
@NotNull
@Override
public Collection<? extends Pair<String, String>> getStatuses() {
Revision toolsRevision = null;
LocalPackage toolsPackage = getRepoManager().getPackages().getLocalPackages().get(SdkConstants.FD_TOOLS);
if (toolsPackage != null) {
toolsRevision = toolsPackage.getVersion();
}
Revision platformRevision = null;
AndroidVersion platformVersion = null;
for (LocalPackage info : getRepoManager().getPackages().getLocalPackagesForPrefix(SdkConstants.FD_PLATFORMS)) {
if (info.getTypeDetails() instanceof DetailsTypes.PlatformDetailsType) {
DetailsTypes.PlatformDetailsType details = (DetailsTypes.PlatformDetailsType) info.getTypeDetails();
AndroidVersion testVersion = new AndroidVersion(details.getApiLevel(), details.getCodename());
if (platformVersion == null || platformVersion.compareTo(testVersion) < 0) {
platformRevision = info.getVersion();
platformVersion = testVersion;
}
}
}
List<Pair<String, String>> result = Lists.newArrayList();
if (toolsRevision != null) {
result.add(Pair.create("Android SDK Tools:", toolsRevision.toString()));
}
if (platformVersion != null) {
result.add(Pair.create("Android Platform Version:", String.format("%1$s revision %2$s", platformVersion.getCodename() != null ? platformVersion.getCodename() : SdkVersionInfo.getAndroidName(platformVersion.getApiLevel()), platformRevision)));
}
return result;
}
use of com.android.repository.Revision in project android by JetBrains.
the class SdkComponentSourceTest method testIgnored.
public void testIgnored() throws Exception {
final AtomicReference<String> id = new AtomicReference<String>();
ProgressIndicator progress = new StudioProgressIndicatorAdapter(new FakeProgressIndicator(), null);
for (UpdatableExternalComponent c : myTestComponentSource.getAvailableVersions(progress, null)) {
if ("package newerRemote".equals(c.getName())) {
id.set(SdkComponentSource.getPackageRevisionId((RepoPackage) c.getKey()));
}
}
assertNotNull(id.get());
ExternalComponentManager.getInstance().registerComponentSource(myTestComponentSource);
UpdateSettings settings = new UpdateSettings() {
@Override
public List<String> getEnabledExternalUpdateSources() {
return ImmutableList.of(myTestComponentSource.getName());
}
@Override
public List<String> getIgnoredBuildNumbers() {
return ImmutableList.of(id.get());
}
};
Collection<ExternalUpdate> updates = UpdateChecker.updateExternal(true, settings, progress);
assertEquals(1, updates.size());
ExternalUpdate update = updates.iterator().next();
Iterator<UpdatableExternalComponent> iter = update.getComponents().iterator();
UpdatableExternalComponent component = iter.next();
assertEquals("package newerPreview", component.getName());
assertEquals(new Revision(1, 0, 0, 2), ((RepoPackage) component.getKey()).getVersion());
assertFalse(iter.hasNext());
}
use of com.android.repository.Revision in project android by JetBrains.
the class SdkComponentSourceTest method testBetaUpdates.
public void testBetaUpdates() throws Exception {
myChannelId = 1;
ExternalComponentManager.getInstance().registerComponentSource(myTestComponentSource);
ProgressIndicator progress = new StudioProgressIndicatorAdapter(new FakeProgressIndicator(), null);
UpdateSettings settings = new UpdateSettings() {
@Override
public List<String> getEnabledExternalUpdateSources() {
return ImmutableList.of(myTestComponentSource.getName());
}
};
Collection<ExternalUpdate> updates = UpdateChecker.updateExternal(true, settings, progress);
assertEquals(1, updates.size());
ExternalUpdate update = updates.iterator().next();
Iterator<UpdatableExternalComponent> iter = update.getComponents().iterator();
UpdatableExternalComponent component = iter.next();
assertEquals("package newerPreview", component.getName());
assertEquals(new Revision(1, 0, 0, 2), ((RepoPackage) component.getKey()).getVersion());
component = iter.next();
assertEquals("package newerRemote", component.getName());
assertEquals(new Revision(1, 1, 0), ((RepoPackage) component.getKey()).getVersion());
component = iter.next();
assertEquals("package zNewerInBeta", component.getName());
assertEquals(new Revision(2, 0, 0), ((RepoPackage) component.getKey()).getVersion());
assertFalse(iter.hasNext());
}
use of com.android.repository.Revision in project android by JetBrains.
the class SdkComponentSourceTest method testUpdates.
public void testUpdates() throws Exception {
ExternalComponentManager.getInstance().registerComponentSource(myTestComponentSource);
ProgressIndicator progress = new StudioProgressIndicatorAdapter(new FakeProgressIndicator(), null);
UpdateSettings settings = new UpdateSettings() {
@Override
public List<String> getEnabledExternalUpdateSources() {
return ImmutableList.of(myTestComponentSource.getName());
}
};
Collection<ExternalUpdate> updates = UpdateChecker.updateExternal(true, settings, progress);
assertEquals(1, updates.size());
ExternalUpdate update = updates.iterator().next();
Iterator<UpdatableExternalComponent> iter = update.getComponents().iterator();
UpdatableExternalComponent component = iter.next();
assertEquals("package newerPreview", component.getName());
assertEquals(new Revision(1, 0, 0, 2), ((RepoPackage) component.getKey()).getVersion());
component = iter.next();
assertEquals("package newerRemote", component.getName());
assertEquals(new Revision(1, 1, 0), ((RepoPackage) component.getKey()).getVersion());
assertFalse(iter.hasNext());
}
Aggregations