Package org.sonatype.nexus.proxy.events

Examples of org.sonatype.nexus.proxy.events.RepositoryRegistryEventRemove


  private void deleteRepository(final RepositoryTypeDescriptor rtd, final Repository repository,
                                final boolean silently)
  {
    if (!silently) {
      eventBus.post(new RepositoryRegistryEventRemove(this, repository));
    }

    // dump the event listeners, as once deleted doesn't care about config changes any longer
    if (repository instanceof AbstractConfigurable) {
      ((AbstractConfigurable) repository).unregisterFromEventBus();
View Full Code Here


   */
  @Test
  public void satisfiedWhenRepositoryAdded() {
    assertThat(underTest.isSatisfied(), is(true));

    underTest.handle(new RepositoryRegistryEventRemove(repositoryRegistry, repository));
    underTest.handle(new RepositoryRegistryEventAdd(repositoryRegistry, repository));
    assertThat(underTest.isSatisfied(), is(true));

    verifyEventBusEvents(satisfied(underTest), unsatisfied(underTest), satisfied(underTest));
  }
View Full Code Here

   */
  @Test
  public void repositoryIsRemoved() {
    assertThat(underTest.isSatisfied(), is(true));

    underTest.handle(new RepositoryRegistryEventRemove(repositoryRegistry, repository));
    assertThat(underTest.isSatisfied(), is(false));

    verifyEventBusEvents(satisfied(underTest), unsatisfied(underTest));
  }
View Full Code Here

  @Test
  public void noReactionWhenAnotherRepositoryIsRemoved() {
    assertThat(underTest.isSatisfied(), is(true));
    final Repository anotherRepository = mock(Repository.class);
    when(anotherRepository.getId()).thenReturn("another");
    underTest.handle(new RepositoryRegistryEventRemove(repositoryRegistry, anotherRepository));
    assertThat(underTest.isSatisfied(), is(true));
  }
View Full Code Here

    inspect(e);
  }

  protected void inspect(Event<?> evt) {
    if (evt instanceof RepositoryRegistryEventRemove) {
      RepositoryRegistryEventRemove rEvt = (RepositoryRegistryEventRemove) evt;

      String repositoryId = rEvt.getRepository().getId();

      try {
        // Delete target privs that match repo/groupId
        cleanupPrivileges(TargetPrivilegeRepositoryPropertyDescriptor.ID, repositoryId);
        cleanupPrivileges(TargetPrivilegeGroupPropertyDescriptor.ID, repositoryId);
      }
      catch (NoSuchPrivilegeException e) {
        log.error("Unable to clean privileges attached to repository", e);
      }
      catch (NoSuchAuthorizationManagerException e) {
        log.error("Unable to clean privileges attached to repository", e);
      }
    }
    if (evt instanceof TargetRegistryEventRemove) {
      TargetRegistryEventRemove rEvt = (TargetRegistryEventRemove) evt;

      String targetId = rEvt.getTarget().getId();

      try {
        cleanupPrivileges(TargetPrivilegeRepositoryTargetPropertyDescriptor.ID, targetId);
      }
      catch (NoSuchPrivilegeException e) {
View Full Code Here

   */
  @Test
  public void unsatisfiedWhenRepositoryIsRemoved() {
    assertThat(underTest.isSatisfied(), is(true));

    underTest.handle(new RepositoryRegistryEventRemove(repositoryRegistry, repository));
    assertThat(underTest.isSatisfied(), is(false));

    verifyEventBusEvents(satisfied(underTest), unsatisfied(underTest));
  }
View Full Code Here

   */
  @Test
  public void unsatisfiedWhenRepositoryIsRemoved() {
    assertThat(underTest.isSatisfied(), is(true));

    underTest.handle(new RepositoryRegistryEventRemove(repositoryRegistry, repository));
    assertThat(underTest.isSatisfied(), is(false));

    verifyEventBusEvents(satisfied(underTest), unsatisfied(underTest));
  }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.proxy.events.RepositoryRegistryEventRemove

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.