Package org.sonatype.nexus.configuration

Examples of org.sonatype.nexus.configuration.ConfigurationCommitEvent


  public void testSimplePull()
      throws Exception
  {
    // flush all potential changes
    eventBus().post(new ConfigurationPrepareForSaveEvent(getApplicationConfiguration()));
    eventBus().post(new ConfigurationCommitEvent(getApplicationConfiguration()));

    // get hold on all registered reposes
    Repository repo1 = getRepositoryRegistry().getRepository("repo1");
    Repository repo2 = getRepositoryRegistry().getRepository("repo2");
    Repository repo3 = getRepositoryRegistry().getRepository("repo3");
    Repository inhouse = getRepositoryRegistry().getRepository("inhouse");
    Repository inhouseSnapshot = getRepositoryRegistry().getRepository("inhouse-snapshot");
    MavenGroupRepository test = getRepositoryRegistry().getRepositoryWithFacet("test", MavenGroupRepository.class);

    // now change some of them
    repo1.setLocalStatus(LocalStatus.OUT_OF_SERVICE);
    repo3.setName("kuku");
    test.setMergeMetadata(false);

    // changes are not applied yet!
    assertEquals("Should not be applied!", LocalStatus.IN_SERVICE, repo1.getLocalStatus());
    assertEquals("Should not be applied!", "repo3", repo3.getName());
    assertEquals("Should not be applied!", true, test.isMergeMetadata());

    // fire prepareForSave event
    ConfigurationPrepareForSaveEvent pevt = new ConfigurationPrepareForSaveEvent(getApplicationConfiguration());
    eventBus().post(pevt);
    assertFalse(pevt.isVetoed());

    eventBus().post(new ConfigurationCommitEvent(getApplicationConfiguration()));

    // changes are now applied!
    assertEquals("Should be applied!", LocalStatus.OUT_OF_SERVICE, repo1.getLocalStatus());
    assertEquals("Should be applied!", "kuku", repo3.getName());
    assertEquals("Should be applied!", false, test.isMergeMetadata());
View Full Code Here


    eventBus.post(prepare);

    if (!prepare.isVetoed()) {
      logApplyConfiguration(prepare.getChanges());

      eventBus.post(new ConfigurationCommitEvent(this));

      eventBus.post(new ConfigurationChangeEvent(this, prepare.getChanges(), getCurrentUserId()));

      return true;
    }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.configuration.ConfigurationCommitEvent

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.