@SuppressWarnings("java:S2699") @Test public void uploadComponent() throws Exception { HttpServletRequest request = mock(HttpServletRequest.class); UploadResponse uploadResponse = new UploadResponse(emptyList()); when(uploadManager.handle(testRepo, request)).thenReturn(uploadResponse); underTest.uploadComponent(testRepoName, request); }
@Override @POST @Consumes(MediaType.MULTIPART_FORM_DATA) public void uploadComponent(@QueryParam("repository") final String repositoryId, @Context final HttpServletRequest request) throws IOException { if (!uploadConfiguration.isEnabled()) { throw new WebApplicationException(NOT_FOUND); } Repository repository = repositoryManagerRESTAdapter.getRepository(repositoryId); try { uploadManager.handle(repository, request); } catch (IllegalOperationException e) { throw new WebApplicationMessageException(Status.BAD_REQUEST, e.getMessage()); } }
ComponentsResource extends ComponentsResourceSupport implements Resource, ComponentsResourceDoc { @Override @POST @Consumes(MediaType.MULTIPART_FORM_DATA) public void uploadComponent(@QueryParam("repository") final String repositoryId, @Context final HttpServletRequest request) throws IOException { if (!uploadConfiguration.isEnabled()) { throw new WebApplicationException(NOT_FOUND); } Repository repository = repositoryManagerRESTAdapter.getRepository(repositoryId); try { uploadManager.handle(repository, request); } catch (IllegalOperationException e) { throw new WebApplicationMessageException(Status.BAD_REQUEST, e.getMessage()); } } }
ComponentsResource extends ComponentsResourceSupport implements Resource, ComponentsResourceDoc { @Override @POST @Consumes(MediaType.MULTIPART_FORM_DATA) public void uploadComponent(@QueryParam("repository") final String repositoryId, @Context final HttpServletRequest request) throws IOException { if (!uploadConfiguration.isEnabled()) { throw new WebApplicationException(NOT_FOUND); } Repository repository = repositoryManagerRESTAdapter.getRepository(repositoryId); try { uploadManager.handle(repository, request); } catch (IllegalOperationException e) { throw new WebApplicationMessageException(Status.BAD_REQUEST, e.getMessage()); } } @Inject  ComponentsResource(
      final RepositoryManagerRESTAdapter repositoryManagerRESTAdapter,
      final MaintenanceService maintenanceService,
      final UploadManager uploadManager,
      final UploadConfiguration uploadConfiguration,
      final ComponentXOFactory componentXOFactory,
      final ContentAuthHelper contentAuthHelper); }
ComponentsResource extends ComponentsResourceSupport implements Resource, ComponentsResourceDoc { @Override @POST @Consumes(MediaType.MULTIPART_FORM_DATA) public void uploadComponent(@QueryParam("repository") final String repositoryId, @Context final HttpServletRequest request) throws IOException { if (!uploadConfiguration.isEnabled()) { throw new WebApplicationException(NOT_FOUND); } Repository repository = repositoryManagerRESTAdapter.getRepository(repositoryId); try { uploadManager.handle(repository, request); } catch (IllegalOperationException e) { throw new WebApplicationMessageException(Status.BAD_REQUEST, e.getMessage()); } } @Inject  ComponentsResource(
      final RepositoryManagerRESTAdapter repositoryManagerRESTAdapter,
      final MaintenanceService maintenanceService,
      final UploadManager uploadManager,
      final UploadConfiguration uploadConfiguration,
      final ComponentXOFactory componentXOFactory,
      final ContentAuthHelper contentAuthHelper); @Override @GET Page<ComponentXO> getComponents(@QueryParam("continuationToken") final String continuationToken,
                                         @QueryParam("repository") final String repositoryId); @Override @GET @Path("/{id}") ComponentXO getComponentById(@PathParam("id") final String id); @Override @DELETE @Path("/{id}") void deleteComponent(@PathParam("id") final String id); @Override @POST @Consumes(MediaType.MULTIPART_FORM_DATA) void uploadComponent(@QueryParam("repository") final String repositoryId,
                              @Context final HttpServletRequest request); }
ComponentsResource extends ComponentsResourceSupport implements Resource, ComponentsResourceDoc { @Override @POST @Consumes(MediaType.MULTIPART_FORM_DATA) public void uploadComponent(@QueryParam("repository") final String repositoryId, @Context final HttpServletRequest request) throws IOException { if (!uploadConfiguration.isEnabled()) { throw new WebApplicationException(NOT_FOUND); } Repository repository = repositoryManagerRESTAdapter.getRepository(repositoryId); try { uploadManager.handle(repository, request); } catch (IllegalOperationException e) { throw new WebApplicationMessageException(Status.BAD_REQUEST, e.getMessage()); } } @Inject  ComponentsResource(
      final RepositoryManagerRESTAdapter repositoryManagerRESTAdapter,
      final MaintenanceService maintenanceService,
      final UploadManager uploadManager,
      final UploadConfiguration uploadConfiguration,
      final ComponentXOFactory componentXOFactory,
      final ContentAuthHelper contentAuthHelper); @Override @GET Page<ComponentXO> getComponents(@QueryParam("continuationToken") final String continuationToken,
                                         @QueryParam("repository") final String repositoryId); @Override @GET @Path("/{id}") ComponentXO getComponentById(@PathParam("id") final String id); @Override @DELETE @Path("/{id}") void deleteComponent(@PathParam("id") final String id); @Override @POST @Consumes(MediaType.MULTIPART_FORM_DATA) void uploadComponent(@QueryParam("repository") final String repositoryId,
                              @Context final HttpServletRequest request); static final String RESOURCE_URI; }