コード例 #1
0
  @Test
  public void testChannelWithCurrentStatusPreferred() {
    BuildNumber currentBuild = BuildNumber.fromString("IU-139.658");
    TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP);
    UpdateStrategyCustomization customization = new UpdateStrategyCustomization();
    UpdateStrategy strategy =
        new UpdateStrategy(
            14, currentBuild, InfoReader.read("idea-patchAvailable.xml"), settings, customization);

    CheckForUpdateResult result = strategy.checkForUpdates();
    assertEquals(UpdateStrategy.State.LOADED, result.getState());

    UpdateChannel channel = result.getUpdatedChannel();
    assertNotNull(channel);
    assertEquals(ChannelStatus.EAP, channel.getStatus());

    BuildInfo selectedChannel = result.getNewBuildInSelectedChannel();
    assertNotNull(selectedChannel);
    assertNotNull(selectedChannel.findPatchForBuild(currentBuild));
  }
コード例 #2
0
  @Test
  public void testStableUpdatePreferredByDefault() {
    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 channel = result.getUpdatedChannel();
    assertNotNull(channel);
    assertEquals(ChannelStatus.RELEASE, channel.getStatus());

    BuildInfo build = result.getNewBuildInSelectedChannel();
    assertNotNull(build);
    assertEquals("143.382", build.getNumber().toString());
    assertNotNull(build.findPatchForBuild(currentBuild));
  }