Package org.sonatype.nexus.capability

Examples of org.sonatype.nexus.capability.CapabilityReference


    final YumHosted yum = mock(YumHosted.class);
    when(yumRegistry.get(RELEASES)).thenReturn(yum);
    when(yum.getVersion(EXISTING_ALIAS)).thenReturn(TRUNK_VERSION);
    when(yum.getVersion(ALIAS_TO_CREATE)).thenReturn(VERSION_TO_CREATE);

    final CapabilityReference reference = mock(CapabilityReference.class);
    final Collection<CapabilityReference> references = Lists.newArrayList();
    references.add(reference);
    final GenerateMetadataCapability yumRepositoryCapability = mock(GenerateMetadataCapability.class);
    final CapabilityContext capabilityContext = mock(CapabilityContext.class);
    when(reference.context()).thenReturn(capabilityContext);
    when(capabilityContext.id()).thenReturn(CapabilityIdentity.capabilityIdentity("ID"));
    when(capabilityContext.isEnabled()).thenReturn(true);
    when(capabilityContext.notes()).thenReturn("Notes");
    when(reference.capabilityAs(GenerateMetadataCapability.class)).thenReturn(yumRepositoryCapability);
    Map<String, String> aliases = Maps.newHashMap();
    aliases.put("foo", "bar");
    when(yumRepositoryCapability.getConfig()).thenReturn(
        new GenerateMetadataCapabilityConfiguration(RELEASES, aliases, true, 1, "/comps.xml")
    );
View Full Code Here


  @Path("/{id}")
  @Produces({APPLICATION_XML, APPLICATION_JSON})
  @RequiresPermissions(CapabilitiesPlugin.PERMISSION_PREFIX + "read")
  public CapabilityXO get(final @PathParam("id") String id) {
    final CapabilityIdentity capabilityId = capabilityIdentity(id);
    final CapabilityReference reference = capabilityRegistry.get(capabilityId);
    if (reference == null) {
      throw new CapabilityNotFoundException(capabilityId);
    }
    return asCapability(reference);
  }
View Full Code Here

  @Path("/{id}/status")
  @Produces({APPLICATION_XML, APPLICATION_JSON})
  @RequiresPermissions(CapabilitiesPlugin.PERMISSION_PREFIX + "read")
  public CapabilityStatusXO getInfo(final @PathParam("id") String id) {
    final CapabilityIdentity capabilityId = capabilityIdentity(id);
    final CapabilityReference reference = capabilityRegistry.get(capabilityId);
    if (reference == null) {
      throw new CapabilityNotFoundException(capabilityId);
    }
    return asCapabilityStatus(reference);
  }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.capability.CapabilityReference

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.