Package de.idos.updates.store

Examples of de.idos.updates.store.Installation


        this.slowThreadStartSignal = slowThreadStartSignal;
    }

    @Override
    public Installation beginInstallation(Version version) {
        Installation installation = versionStore.beginInstallation(version);
        return new SlowInstallation(installation,slowThreadStartSignal);
    }
View Full Code Here


    return new VersionLookup(createLookup(), report).lookUpLatestVersion();
  }

  @Override
  public OngoingInstallation transferVersionTo(Version version, VersionReceptacle store) {
    Installation installation = store.beginInstallation(version);
    InstallationStrategy<T> strategy = createInstallationStrategy(installation);
    ThreadedInstaller.PrepareInstallation(strategy, report).install(version);
    return installation;
  }
View Full Code Here

    Repository repository = new FilesystemRepository(repositoryFolder);
    versionStore = new FilesystemVersionStore(versionStoreFolder,
            new ZipInstallationStarter(new FilesystemInstallationStarter()));
    updateSystemBuilder.useStore(versionStore);
    updateSystemBuilder.useRepository(repository);
    Installation installation = versionStore.beginInstallation(currentVersion);
    File file = folder.newFile();
    installation.addContent(new FileDataInVersion(file));
    installation.finish();
  }
View Full Code Here

    assertThat(elementsToInstall.size(), is(2));
  }

  @Test
  public void extendsBaseUrlWhenDownloadingElements() throws Exception {
    Installation installation = FilesystemInstallation.create(folder.getRoot(), new NullReport());
    HttpInstaller installer = createInstaller(installation);
    installer.installElement("fileToUpdate", new NumericVersion(5, 0, 4));
    assertThat(new File(folder.getRoot(), "fileToUpdate").exists(), is(true));
  }
View Full Code Here

  @Test(timeout = 5000)
  public void deletesVersionIfErrorsOccurDuringTransfer() throws Exception {
    final CountDownLatch countDownLatch = new CountDownLatch(1);
    NumericVersion version = new NumericVersion(5, 0, 4);
    Installation installation = mock(Installation.class);
    doThrow(new RuntimeException()).when(installation).addContent(isA(DataInVersion.class));
    doAnswer(new Answer() {
      @Override
      public Object answer(InvocationOnMock invocation) throws Throwable {
        countDownLatch.countDown();
View Full Code Here

    new HttpRepository("xx");
  }

  @Test
  public void createsHttpInstaller() throws Exception {
    Installation installation = mock(Installation.class);
    InstallationStrategy<String> strategy = repository.createInstallationStrategy(installation);
    Version mock = mock(Version.class);
    strategy.installElement("X", mock);
    verify(installation).addContent(isA(UrlDataInVersion.class));
  }
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

  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);
    repository.reportAllProgressTo(report);
    repository.transferVersionTo(version, store);
View Full Code Here

  }

  @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

        store = new FixedVersionStore(folder.getRoot(), wrapped);
    }

    @Test
    public void forwardsAdditionToWrappedStore() throws Exception {
        Installation installation = mock(Installation.class);
        when(wrapped.beginInstallation(version)).thenReturn(installation);
        Installation actualInstallation = store.beginInstallation(version);
        assertThat(actualInstallation, is(installation));
    }
View Full Code Here

TOP

Related Classes of de.idos.updates.store.Installation

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.