OrientNpmUploadHandler extends UploadHandlerSupport implements NpmUploadHandler { @Override public UploadDefinition getDefinition() { if (definition == null) { definition = getDefinition(NpmFormat.NAME, false); } return definition; } @Inject  OrientNpmUploadHandler(final ContentPermissionChecker contentPermissionChecker,
                                @Named("simple") final VariableResolverAdapter variableResolverAdapter,
                                final NpmPackageParser npmPackageParser,
                                final Set<UploadDefinitionExtension> uploadDefinitionExtensions); @Override UploadResponse handle(final Repository repository, final ComponentUpload upload); @Override Content handle(
      final Repository repository,
      final File content,
      final String path); @Override UploadDefinition getDefinition(); @Override VariableResolverAdapter getVariableResolverAdapter(); @Override ContentPermissionChecker contentPermissionChecker(); @Override boolean supportsExportImport();  }
@Test public void testGetDefinition() { UploadDefinition def = underTest.getDefinition(); assertThat(def.isMultipleUpload(), is(false)); assertThat(def.getComponentFields(), empty()); assertThat(def.getAssetFields(), empty()); }
@Test public void testGetDefinitionWithExtensionContributions() { underTest = new OrientNpmUploadHandler(contentPermissionChecker, new SimpleVariableResolverAdapter(), new NpmPackageParser(), getDefinitionExtensions()); UploadDefinition def = underTest.getDefinition(); assertThat(def.getComponentFields(), contains(new UploadFieldDefinition("foo", "Foo", null, true, STRING, "bar"))); assertThat(def.getAssetFields(), empty()); }