@Test public void getContentSelectorFindsSelectorByName() { SelectorConfiguration matchingSelector = new OrientSelectorConfiguration(); matchingSelector.setName("test"); matchingSelector.setAttributes(emptyMap()); when(selectorManager.findByName(matchingSelector.getName())).thenReturn(Optional.of(matchingSelector)); ContentSelectorApiResponse response = underTest.getContentSelector(matchingSelector.getName()); assertThat(response.getName(), is(matchingSelector.getName())); }
@GET @Path("{name}") @RequiresAuthentication @RequiresPermissions("nexus:selectors:read") public ContentSelectorApiResponse getContentSelector(@PathParam("name") final String name) { SelectorConfiguration configuration = findConfigurationByNameOrThrowNotFound(name); return ContentSelectorsApiResource.fromSelectorConfiguration(configuration); }
ContentSelectorsApiResource implements Resource, ContentSelectorsResourceDoc { @GET @Path("{name}") @RequiresAuthentication @RequiresPermissions("nexus:selectors:read") public ContentSelectorApiResponse getContentSelector(@PathParam("name") final String name) { SelectorConfiguration configuration = findConfigurationByNameOrThrowNotFound(name); return ContentSelectorsApiResource.fromSelectorConfiguration(configuration); } }
ContentSelectorsApiResource implements Resource, ContentSelectorsResourceDoc { @GET @Path("{name}") @RequiresAuthentication @RequiresPermissions("nexus:selectors:read") public ContentSelectorApiResponse getContentSelector(@PathParam("name") final String name) { SelectorConfiguration configuration = findConfigurationByNameOrThrowNotFound(name); return ContentSelectorsApiResource.fromSelectorConfiguration(configuration); } @Inject  ContentSelectorsApiResource(final SelectorFactory selectorFactory, final SelectorManager selectorManager); }
ContentSelectorsApiResource implements Resource, ContentSelectorsResourceDoc { @GET @Path("{name}") @RequiresAuthentication @RequiresPermissions("nexus:selectors:read") public ContentSelectorApiResponse getContentSelector(@PathParam("name") final String name) { SelectorConfiguration configuration = findConfigurationByNameOrThrowNotFound(name); return ContentSelectorsApiResource.fromSelectorConfiguration(configuration); } @Inject  ContentSelectorsApiResource(final SelectorFactory selectorFactory, final SelectorManager selectorManager); @GET @RequiresAuthentication @RequiresPermissions("nexus:selectors:read") List<ContentSelectorApiResponse> getContentSelectors(); @POST @Validate @RequiresAuthentication @RequiresPermissions("nexus:selectors:create") void createContentSelector(@Valid final ContentSelectorApiCreateRequest request); @GET @Path("{name}") @RequiresAuthentication @RequiresPermissions("nexus:selectors:read") ContentSelectorApiResponse getContentSelector(@PathParam("name") final String name); @PUT @Path("{name}") @Validate @RequiresAuthentication @RequiresPermissions("nexus:selectors:update") void updateContentSelector(@PathParam("name") final String name,
                                    @Valid final ContentSelectorApiUpdateRequest request); @DELETE @Path("{name}") @RequiresAuthentication @RequiresPermissions("nexus:selectors:delete") void deleteContentSelector(@PathParam("name") final String name); }
ContentSelectorsApiResource implements Resource, ContentSelectorsResourceDoc { @GET @Path("{name}") @RequiresAuthentication @RequiresPermissions("nexus:selectors:read") public ContentSelectorApiResponse getContentSelector(@PathParam("name") final String name) { SelectorConfiguration configuration = findConfigurationByNameOrThrowNotFound(name); return ContentSelectorsApiResource.fromSelectorConfiguration(configuration); } @Inject  ContentSelectorsApiResource(final SelectorFactory selectorFactory, final SelectorManager selectorManager); @GET @RequiresAuthentication @RequiresPermissions("nexus:selectors:read") List<ContentSelectorApiResponse> getContentSelectors(); @POST @Validate @RequiresAuthentication @RequiresPermissions("nexus:selectors:create") void createContentSelector(@Valid final ContentSelectorApiCreateRequest request); @GET @Path("{name}") @RequiresAuthentication @RequiresPermissions("nexus:selectors:read") ContentSelectorApiResponse getContentSelector(@PathParam("name") final String name); @PUT @Path("{name}") @Validate @RequiresAuthentication @RequiresPermissions("nexus:selectors:update") void updateContentSelector(@PathParam("name") final String name,
                                    @Valid final ContentSelectorApiUpdateRequest request); @DELETE @Path("{name}") @RequiresAuthentication @RequiresPermissions("nexus:selectors:delete") void deleteContentSelector(@PathParam("name") final String name);  }