Package org.sonatype.nexus.capabilities.client

Examples of org.sonatype.nexus.capabilities.client.Capability


    serverConfiguration().security().settings().addRealm(RUTAUTH_REALM);
    serverConfiguration().security().save();
  }

  void configureRemoteHeader(final String headerName) {
    Capability rutauthCapability;
    try {
      rutauthCapability = capabilities().getUnique(Filter.capabilitiesThat().haveType("rutauth"));
    }
    catch (NexusClientNotFoundException e) {
      rutauthCapability = capabilities().create("rutauth");
    }
    rutauthCapability.withProperty("httpHeader", headerName).save();
  }
View Full Code Here


   *
   * @since 2.4
   */
  @Test
  public void checkErrorOnActivation() {
    final Capability capability = capabilities().create("[withActivationError]").save();
    MatcherAssert.assertThat(capability.hasErrors(), is(true));
    MatcherAssert.assertThat(capability.isActive(), is(false));
    MatcherAssert.assertThat(capability.stateDescription(),
        containsString("This capability always fails on activate"));
  }
View Full Code Here

    final MavenHostedRepository repository = repositories().create(MavenHostedRepository.class, rId)
        .excludeFromSearchResults()
        .save();

    Capability capability = capabilities().create("[repositoryIsInService]")
        .withProperty("repository", rId)
        .save();
    MatcherAssert.assertThat(capability.isActive(), is(true));

    logRemote("Put repository '{}' out of service", rId);
    repository.putOutOfService();
    capability.refresh();
    MatcherAssert.assertThat(capability.isActive(), is(false));

    logRemote("Put repository '{}' back in service", rId);
    repository.putInService();
    capability.refresh();
    MatcherAssert.assertThat(capability.isActive(), is(true));
  }
View Full Code Here

    final MavenHostedRepository repository = repositories().create(MavenHostedRepository.class, rId)
        .excludeFromSearchResults()
        .save()
        .putOutOfService();

    Capability capability = capabilities().create("[repositoryIsInService]")
        .withProperty("repository", rId)
        .save();
    MatcherAssert.assertThat(capability.isActive(), is(false));

    logRemote("Put repository '{}' back in service", rId);
    repository.putInService();
    capability.refresh();
    MatcherAssert.assertThat(capability.isActive(), is(true));
  }
View Full Code Here

        .save();
    repositories().create(MavenHostedRepository.class, rIdInactive)
        .excludeFromSearchResults()
        .save().putOutOfService();

    Capability capability = capabilities().create("[repositoryIsInService]")
        .withProperty("repository", rIdActive)
        .save();
    MatcherAssert.assertThat(capability.isActive(), is(true));

    logRemote("Change capability to use repository '{}'", rIdInactive);
    capability.withProperty("repository", rIdInactive).save();
    MatcherAssert.assertThat(capability.isActive(), is(false));
  }
View Full Code Here

    final MavenProxyRepository repository = repositories().create(MavenProxyRepository.class, rId)
        .asProxyOf(repositories().get("releases").contentUri())
        .save();

    Capability capability = capabilities().create("[repositoryIsNotBlocked]")
        .withProperty("repository", rId)
        .save();
    MatcherAssert.assertThat(capability.isActive(), is(true));

    logRemote("Block repository '{}'", rId);
    repository.block();
    capability.refresh();
    MatcherAssert.assertThat(capability.isActive(), is(false));

    logRemote("Unblock repository '{}'", rId);
    repository.unblock();
    capability.refresh();
    MatcherAssert.assertThat(capability.isActive(), is(true));
  }
View Full Code Here

    final MavenProxyRepository repository = repositories().create(MavenProxyRepository.class, rId)
        .asProxyOf(repositories().get("releases").contentUri())
        .save()
        .block();

    Capability capability = capabilities().create("[repositoryIsNotBlocked]")
        .withProperty("repository", rId)
        .save();
    MatcherAssert.assertThat(capability.isActive(), is(false));

    logRemote("Unblock repository '{}'", rId);
    repository.unblock();
    capability.refresh();
    MatcherAssert.assertThat(capability.isActive(), is(true));
  }
View Full Code Here

    repositories().create(MavenProxyRepository.class, rIdBlocked)
        .asProxyOf(repositories().get("releases").contentUri())
        .save()
        .block();

    Capability capability = capabilities().create("[repositoryIsNotBlocked]")
        .withProperty("repository", rIdNotBlocked)
        .save();
    MatcherAssert.assertThat(capability.isActive(), is(true));

    logRemote("Change capability to use repository '{}'", rIdBlocked);
    capability.withProperty("repository", rIdBlocked).save();
    MatcherAssert.assertThat(capability.isActive(), is(false));
  }
View Full Code Here

    final MavenHostedRepository repository = repositories().create(MavenHostedRepository.class, rId)
        .excludeFromSearchResults()
        .save()
        .putOutOfService();

    Capability capability = capabilities().create("[repositoryIsInService]")
        .withProperty("repository", rId)
        .save();
    MatcherAssert.assertThat(capability.isActive(), is(false));

    logRemote("Remove repository '{}'", rId);
    repository.remove();

    thrown.expect(UniformInterfaceException.class);
    thrown.expectMessage(String.format("Capability with id '%s' was not found", capability.id()));
    capability.refresh();
  }
View Full Code Here

   */
  @Test
  public void capabilityOfTypeExists() {
    removeAllMessageCapabilities();

    Capability capability = capabilities().create("[capabilityOfTypeExists]")
        .save();
    MatcherAssert.assertThat(capability.isActive(), is(false));

    logRemote("Create a capability of type [message]");
    final Capability messageCapability = capabilities().create("[message]")
        .withProperty("repository", "releases")
        .save();
    capability.refresh();
    MatcherAssert.assertThat(capability.isActive(), is(true));

    logRemote("Remove capability of type [message]");
    messageCapability.remove();
    capability.refresh();
    MatcherAssert.assertThat(capability.isActive(), is(false));
  }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.capabilities.client.Capability

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.