Package de.idos.updates

Examples of de.idos.updates.UpdateSystem


  public static void main(String[] arguments) throws Exception {
    if (mainClassAlreadyOnClasspath()) {
      ApplicationLauncher.loadFromSystemClasspath().launch(MAIN_CLASS, MAIN_METHOD);
    }
    else{
      UpdateSystem updateSystem = ConfiguredUpdateSystem.loadProperties().create();
      updateSystem.reportAllProgressTo(new ConsoleReport());
      updateSystem.checkForUpdates().updateToLatestVersion();
      File versionFolder = updateSystem.getFolderForVersionToRun();
      ApplicationLauncher.loadFromFolder(versionFolder).launch(MAIN_CLASS, MAIN_METHOD);
    }
  }
View Full Code Here


    configurator.saveConfiguration();
  }

  @Test
  public void usesConfiguredFileRepository() throws Exception {
    UpdateSystem updateSystem = ConfiguredUpdateSystem.loadProperties().create();
    Version latestVersion = getUpdaterThatHasRun(updateSystem).getLatestVersion();
    assertThat(latestVersion, is(sameVersionAs(new NumericVersion(4, 2, 1))));
  }
View Full Code Here

  @Test
  public void canChangeDiscovery() throws Exception {
    VersionDiscovery discovery = mock(VersionDiscovery.class);
    NumericVersion overriddenVersion = new NumericVersion(4, 2, 2);
    when(discovery.getLatestVersion()).thenReturn(overriddenVersion);
    UpdateSystem updateSystem = ConfiguredUpdateSystem.loadProperties().butDiscoverAvailableVersionThrough(discovery).create();
    Updater updater = getUpdaterThatHasRun(updateSystem);
    Version latestVersion = updater.getLatestVersion();
    assertThat(latestVersion, is(sameVersionAs(overriddenVersion)));
  }
View Full Code Here

  }

  @Test
  public void canOverrideUnknownInstalledVersion() throws Exception {
    NumericVersion overriddenVersion = new NumericVersion(4, 2, 2);
    UpdateSystem updateSystem = ConfiguredUpdateSystem.loadProperties().andIfTheInstalledVersionIsUnknownUse(overriddenVersion).create();
    Updater updater = getUpdaterThatHasRun(updateSystem);
    Version installedVersion = updater.getInstalledVersion();
    assertThat(installedVersion, is(sameVersionAs(overriddenVersion)));
  }
View Full Code Here

    configurator.saveConfiguration();
  }

  @Test
  public void statesConfiguredFolderAsVersionFolder() throws Exception {
    UpdateSystem updateSystem = ConfiguredUpdateSystem.loadProperties().create();
    File folder = updateSystem.getFolderForVersionToRun();
    assertThat(folder, is(fixedVersionFolder));
  }
View Full Code Here

    assertThat(folder, is(fixedVersionFolder));
  }

  @Test(timeout = 1500)
  public void canInstallUpdatesEvenWhenTheActualVersionIsFixed() throws Exception {
    UpdateSystem updateSystem = ConfiguredUpdateSystem.loadProperties().create();
    Updater updater = getUpdaterThatHasRun(updateSystem);
    OngoingInstallation installation = updater.updateToLatestVersion();
    while(installation.isRunning()){
      //wait
    }
View Full Code Here

  }

  @Test
  public void canOverrideUnknownFixedVersionNumber() throws Exception {
    NumericVersion overriddenVersion = new NumericVersion(3, 3, 1);
    UpdateSystem updateSystem = ConfiguredUpdateSystem.loadProperties().andIfTheInstalledVersionIsUnknownUse(overriddenVersion).create();
    Version installedVersion = getUpdaterThatHasRun(updateSystem).getInstalledVersion();
    assertThat(installedVersion, is(sameVersionAs(overriddenVersion)));
  }
View Full Code Here

  @Test
  public void returnsFixedVersionNumberEvenIfALaterVersionIsInstalled() throws Exception {
    File versionsFolder = new File(getVersionParent(), "versions");
    new File(versionsFolder, "4.0.0").mkdirs();
    NumericVersion overriddenVersion = new NumericVersion(3, 3, 1);
    UpdateSystem updateSystem = ConfiguredUpdateSystem.loadProperties().andIfTheInstalledVersionIsUnknownUse(overriddenVersion).create();
    Version installedVersion = getUpdaterThatHasRun(updateSystem).getInstalledVersion();
    assertThat(installedVersion, is(sameVersionAs(overriddenVersion)));
  }
View Full Code Here

    properties.store(new FileOutputStream(configuration), "");
  }

  @Test
  public void usesConfiguredHttpRepository() throws Exception {
    UpdateSystem updateSystem = ConfiguredUpdateSystem.loadProperties().create();
    Updater updater = getUpdaterThatHasRun(updateSystem);
    Version latestVersion = updater.getLatestVersion();
    assertThat(latestVersion, is(sameVersionAs(new NumericVersion(5, 0, 4))));
  }
View Full Code Here

    assertThat(latestVersion, is(sameVersionAs(new NumericVersion(5, 0, 4))));
  }

  @Test
  public void storesInAppNameFolder() throws Exception {
    UpdateSystem updateSystem = ConfiguredUpdateSystem.loadProperties().create();
    getUpdaterThatHasRun(updateSystem).updateToLatestVersion();
    String userHome = System.getProperty("user.home");
    assertThat(new File(userHome, ".updateunittest/versions").exists(), is(true));
  }
View Full Code Here

TOP

Related Classes of de.idos.updates.UpdateSystem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.