use of com.intellij.openapi.updateSettings.impl.ExternalUpdate 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.intellij.openapi.updateSettings.impl.ExternalUpdate 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.intellij.openapi.updateSettings.impl.ExternalUpdate 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