Package org.sonatype.nexus.capabilities.client

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


  @Test
  public void capabilityOfTypeIsActive() {
    removeAllMessageCapabilities();

    Capability capability = capabilities().create("[capabilityOfTypeActive]")
        .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("Disable capability of type [message]");
    messageCapability.disable();
    capability.refresh();
    MatcherAssert.assertThat(capability.isActive(), is(false));

    logRemote("Enable capability of type [message]");
    messageCapability.enable();
    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


   *
   * @since 2.7
   */
  @Test
  public void uriIsValid() {
    final Capability capability = capabilities().create("[values]")
        .withProperty("uri", "http://localhost")
        .save();
    assertThat(capability.isActive(), is(true));
  }
View Full Code Here

   *
   * @since 2.7
   */
  @Test
  public void urlIsValid() {
    final Capability capability = capabilities().create("[values]")
        .withProperty("url", "http://localhost")
        .save();
    assertThat(capability.isActive(), is(true));
  }
View Full Code Here

  }

  @Override
  public <C extends Capability> C get(final Class<C> type, final String id) {
    checkNotNull(type);
    final Capability capability = get(id);
    if (!type.isAssignableFrom(capability.getClass())) {
      throw new ClassCastException(
          String.format(
              "Expected an '%s' but found that capability is an '%s'",
              type.getName(), capability.getClass().getName()
          )
      );
    }
    return type.cast(capability);
  }
View Full Code Here

  @Override
  public <C extends Capability> C getUnique(final Class<C> type, final Filter filter)
      throws MultipleCapabilitiesFoundException, NexusClientNotFoundException, ClassCastException
  {
    checkNotNull(type);
    final Capability capability = getUnique(filter);
    if (!type.isAssignableFrom(capability.getClass())) {
      throw new ClassCastException(
          String.format(
              "Expected an '%s' but found that capability is an '%s'",
              type.getName(), capability.getClass().getName()
          )
      );
    }
    return type.cast(capability);
  }
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.