@Test public void testHandle_snapshot_not_supported() throws Exception { when(mavenFacet.getVersionPolicy()).thenReturn(VersionPolicy.SNAPSHOT); when(versionPolicyValidator.validArtifactPath(any(), any())).thenReturn(false); ComponentUpload componentUpload = new ComponentUpload(); componentUpload.getFields().put("groupId", "org.apache.maven"); componentUpload.getFields().put("artifactId", "tomcat"); componentUpload.getFields().put("version", "5.0.28-SNAPSHOT"); AssetUpload assetUpload = new AssetUpload(); assetUpload.getFields().put("extension", "jar"); assetUpload.setPayload(jarPayload); componentUpload.getAssetUploads().add(assetUpload); try { underTest.handle(repository, componentUpload); fail("Expected version policy mismatch exception"); } catch (ValidationErrorsException e) { assertThat(e.getValidationErrors().size(), is(1)); assertThat(e.getValidationErrors().get(0).getMessage(), is("Upload to snapshot repositories not supported, use the maven client.")); } }
@Override protected VersionPolicy getVersionPolicy(final Repository repository) { return repository.facet(MavenFacet.class).getVersionPolicy(); }
MavenUploadHandler extends MavenUploadHandlerSupport { @Override protected VersionPolicy getVersionPolicy(final Repository repository) { return repository.facet(MavenFacet.class).getVersionPolicy(); } }
MavenUploadHandler extends MavenUploadHandlerSupport { @Override protected VersionPolicy getVersionPolicy(final Repository repository) { return repository.facet(MavenFacet.class).getVersionPolicy(); } @Inject  MavenUploadHandler(
      final Maven2MavenPathParser parser,
      @Named(Maven2Format.NAME) final VariableResolverAdapter variableResolverAdapter,
      final ContentPermissionChecker contentPermissionChecker,
      final VersionPolicyValidator versionPolicyValidator,
      final MavenPomGenerator mavenPomGenerator,
      final Set<UploadDefinitionExtension> uploadDefinitionExtensions); }
MavenUploadHandler extends MavenUploadHandlerSupport { @Override protected VersionPolicy getVersionPolicy(final Repository repository) { return repository.facet(MavenFacet.class).getVersionPolicy(); } @Inject  MavenUploadHandler(
      final Maven2MavenPathParser parser,
      @Named(Maven2Format.NAME) final VariableResolverAdapter variableResolverAdapter,
      final ContentPermissionChecker contentPermissionChecker,
      final VersionPolicyValidator versionPolicyValidator,
      final MavenPomGenerator mavenPomGenerator,
      final Set<UploadDefinitionExtension> uploadDefinitionExtensions);  }
MavenUploadHandler extends MavenUploadHandlerSupport { @Override protected VersionPolicy getVersionPolicy(final Repository repository) { return repository.facet(MavenFacet.class).getVersionPolicy(); } @Inject  MavenUploadHandler(
      final Maven2MavenPathParser parser,
      @Named(Maven2Format.NAME) final VariableResolverAdapter variableResolverAdapter,
      final ContentPermissionChecker contentPermissionChecker,
      final VersionPolicyValidator versionPolicyValidator,
      final MavenPomGenerator mavenPomGenerator,
      final Set<UploadDefinitionExtension> uploadDefinitionExtensions);   }