Package de.idos.updates

Examples of de.idos.updates.NumericVersion


    verify(installation).addContent(isA(UrlDataInVersion.class));
  }

  @Test
  public void worksIfNoReporterIsRegistered() throws Exception {
    repository.transferVersionTo(new NumericVersion(5, 0, 4), new FilesystemVersionStore(folder.getRoot(), new FilesystemInstallationStarter()));
    assertThat(new File(folder.getRoot(), "5.0.4").exists(), is(true));
  }
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

    assertThat(latestVersion, is(sameVersionAs(overriddenVersion)));
  }

  @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

  @Test
  public void reportsLatestVersionFromFile() throws Exception {
    addVersion("4.2.1");
    Version version = getLatestVersionFromRepository();
    assertThat(version, is(sameVersionAs(new NumericVersion(4, 2, 1))));
  }
View Full Code Here

  @Test
  public void reportsLatestVersionFromAllRegistered() throws Exception {
    addVersion("4.2.1");
    addVersion("4.2.2");
    Version version = getLatestVersionFromRepository();
    assertThat(version, is(sameVersionAs(new NumericVersion(4, 2, 2))));
  }
View Full Code Here

  @Test
  public void transfersVersionToStore() throws Exception {
    addVersion("4.2.1");
    File content = addContentToVersion("4.2.1", "content");
    NumericVersion version = new NumericVersion(4, 2, 1);
    Installation installation = mock(Installation.class);
    when(store.beginInstallation(version)).thenReturn(installation);
    new FilesystemRepository(folder.getRoot()).transferVersionTo(version, store);
    Thread.sleep(10);
    verify(installation).addContent(new FileDataInVersion(content));
View Full Code Here

  @Test
  public void runsInstallationInASeparateThread() throws Exception {
    addVersion("4.2.1");
    addContentToVersion("4.2.1", "content");
    NumericVersion version = new NumericVersion(4, 2, 1);
    CountDownLatch latch = new CountDownLatch(1);
    Installation installation = new SlowInstallation(new NullInstallation(), latch);
    when(store.beginInstallation(version)).thenReturn(installation);
    FilesystemRepository repository = new FilesystemRepository(folder.getRoot());
    ProgressReport report = mock(ProgressReport.class);
View Full Code Here

    verify(report, never()).finishedInstallation();
  }

  @Test
  public void handsOutInstallationControllerFromStore() throws Exception {
    NumericVersion version = new NumericVersion(4, 2, 1);
    Installation installation = mock(Installation.class);
    when(store.beginInstallation(version)).thenReturn(installation);
    FilesystemRepository repository = new FilesystemRepository(folder.getRoot());
    OngoingInstallation actualInstallation = repository.transferVersionTo(version, store);
    assertThat(actualInstallation, is((OngoingInstallation) installation));
View Full Code Here

  Version fallback = new NumericVersion(1, 0, 0);
  FallbackVersionDiscovery discovery = new FallbackVersionDiscovery(wrapped, fallback);

  @Test
  public void returnsOriginalVersionIfItIsNotTheNullVersion() throws Exception {
    Version original = new NumericVersion(0, 8, 9);
    when(wrapped.getLatestVersion()).thenReturn(original);
    assertThat(discovery.getLatestVersion(), is(original));
  }
View Full Code Here

    assertThat(getUpdaterThatHasRun(updateSystem).hasUpdate(), is(UpdateAvailability.NotAvailable));
  }

  @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

TOP

Related Classes of de.idos.updates.NumericVersion

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.