@Test public void testNewChannelAndNewBuildAppear() { // assume user has version 9 eap subscription (default or selected) // and new channels appears - eap of version 10 is there // and new build withing old channel appears also // we need to show only one dialog TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP); UpdateStrategyCustomization customization = new UpdateStrategyCustomization(); UpdateStrategy strategy = new UpdateStrategy( 9, BuildNumber.fromString("IU-95.429"), InfoReader.read("idea-newChannel.xml"), settings, customization); CheckForUpdateResult result = strategy.checkForUpdates(); assertEquals(UpdateStrategy.State.LOADED, result.getState()); BuildInfo update = result.getNewBuildInSelectedChannel(); assertNotNull(update); assertEquals("95.627", update.getNumber().toString()); UpdateChannel newChannel = result.getChannelToPropose(); assertNotNull(newChannel); assertEquals("IDEA10EAP", newChannel.getId()); assertEquals("IntelliJ IDEA X EAP", newChannel.getName()); }
@Test public void testStableChannelProposedByDefault() { BuildNumber currentBuild = BuildNumber.fromString("IU-143.381"); TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.RELEASE); UpdateStrategyCustomization customization = new UpdateStrategyCustomization(); UpdateStrategy strategy = new UpdateStrategy( 15, currentBuild, InfoReader.read("idea-123280.xml"), settings, customization); CheckForUpdateResult result = strategy.checkForUpdates(); assertEquals(UpdateStrategy.State.LOADED, result.getState()); UpdateChannel channelToPropose = result.getChannelToPropose(); assertNotNull(channelToPropose); assertEquals("IDEA_Release", channelToPropose.getId()); settings.setKnownChannelIds(Collections.singletonList(channelToPropose.getId())); result = strategy.checkForUpdates(); assertEquals(UpdateStrategy.State.LOADED, result.getState()); assertNull(result.getChannelToPropose()); }
@Test public void testNewChannelWithOlderBuild() { TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP); UpdateStrategyCustomization customization = new UpdateStrategyCustomization(); UpdateStrategy strategy = new UpdateStrategy( 10, BuildNumber.fromString("IU-107.80"), InfoReader.read("idea-newChannel.xml"), settings, customization); CheckForUpdateResult result = strategy.checkForUpdates(); assertEquals(UpdateStrategy.State.LOADED, result.getState()); BuildInfo update = result.getNewBuildInSelectedChannel(); assertNull(update); UpdateChannel newChannel = result.getChannelToPropose(); assertNull(newChannel); }
@Test public void testNewChannelAppears() { // assume user has version 9 eap subscription (default or selected) // and new channel appears - eap of version 10 is there TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.RELEASE); UpdateStrategyCustomization customization = new UpdateStrategyCustomization(); UpdateStrategy strategy = new UpdateStrategy( 9, BuildNumber.fromString("IU-95.627"), InfoReader.read("idea-newChannel-release.xml"), settings, customization); CheckForUpdateResult result = strategy.checkForUpdates(); assertEquals(UpdateStrategy.State.LOADED, result.getState()); BuildInfo update = result.getNewBuildInSelectedChannel(); assertNull(update); UpdateChannel newChannel = result.getChannelToPropose(); assertNotNull(newChannel); assertEquals("IDEA10EAP", newChannel.getId()); assertEquals("IntelliJ IDEA X EAP", newChannel.getName()); }