@Test public void testHandle_unauthorized() throws IOException { when(contentPermissionChecker.isPermitted(eq(REPO_NAME), eq(PyPiFormat.NAME), eq(BreadActions.EDIT), any())) .thenReturn(false); ComponentUpload component = new ComponentUpload(); AssetUpload asset = new AssetUpload(); asset.setPayload(payload); component.getAssetUploads().add(asset); try { underTest.handle(repository, component); fail("Expected validation exception"); } catch (ValidationErrorsException e) { assertThat(e.getValidationErrors().size(), is(1)); assertThat(e.getValidationErrors().get(0).getMessage(), is("Not authorized for requested path 'packages/sample/1.2.0/sample-1.2.0-py2.7.egg'")); } }
@Override public Content handle( final Repository repository, final File content, final String path) throws IOException { if (content.getName().endsWith(".asc")) { return importSignatureFile(content, path, repository); } else { return importPackageFile(content, repository); } }
OrientPyPiUploadHandler extends UploadHandlerSupport { @Override public Content handle( final Repository repository, final File content, final String path) throws IOException { if (content.getName().endsWith(".asc")) { return importSignatureFile(content, path, repository); } else { return importPackageFile(content, repository); } } }
OrientPyPiUploadHandler extends UploadHandlerSupport { @Override public Content handle( final Repository repository, final File content, final String path) throws IOException { if (content.getName().endsWith(".asc")) { return importSignatureFile(content, path, repository); } else { return importPackageFile(content, repository); } } @Inject  OrientPyPiUploadHandler(
      final ContentPermissionChecker contentPermissionChecker,
      @Named("simple") final VariableResolverAdapter variableResolverAdapter,
      final Set<UploadDefinitionExtension> uploadDefinitionExtensions); }
OrientPyPiUploadHandler extends UploadHandlerSupport { @Override public Content handle( final Repository repository, final File content, final String path) throws IOException { if (content.getName().endsWith(".asc")) { return importSignatureFile(content, path, repository); } else { return importPackageFile(content, repository); } } @Inject  OrientPyPiUploadHandler(
      final ContentPermissionChecker contentPermissionChecker,
      @Named("simple") final VariableResolverAdapter variableResolverAdapter,
      final Set<UploadDefinitionExtension> uploadDefinitionExtensions); @Override Content handle(
      final Repository repository, final File content, final String path); @Override UploadResponse handle(final Repository repository, final ComponentUpload upload); @Override UploadDefinition getDefinition(); @Override VariableResolverAdapter getVariableResolverAdapter(); @Override ContentPermissionChecker contentPermissionChecker(); @Override boolean supportsExportImport(); }
OrientPyPiUploadHandler extends UploadHandlerSupport { @Override public Content handle( final Repository repository, final File content, final String path) throws IOException { if (content.getName().endsWith(".asc")) { return importSignatureFile(content, path, repository); } else { return importPackageFile(content, repository); } } @Inject  OrientPyPiUploadHandler(
      final ContentPermissionChecker contentPermissionChecker,
      @Named("simple") final VariableResolverAdapter variableResolverAdapter,
      final Set<UploadDefinitionExtension> uploadDefinitionExtensions); @Override Content handle(
      final Repository repository, final File content, final String path); @Override UploadResponse handle(final Repository repository, final ComponentUpload upload); @Override UploadDefinition getDefinition(); @Override VariableResolverAdapter getVariableResolverAdapter(); @Override ContentPermissionChecker contentPermissionChecker(); @Override boolean supportsExportImport();  }