public void deleteArtifactWithClassifier()
throws Exception
{
initSourceTargetRepo();
BrowseService browseService = getBrowseService( authorizationHeader, false );
List<Artifact> artifacts =
browseService.getArtifactDownloadInfos( "commons-logging", "commons-logging", "1.0.1", SOURCE_REPO_ID );
Assertions.assertThat( artifacts ).isNotNull().isNotEmpty().hasSize( 3 );
VersionsList versionsList =
browseService.getVersionsList( "commons-logging", "commons-logging", SOURCE_REPO_ID );
Assertions.assertThat( versionsList.getVersions() ).isNotNull().isNotEmpty().hasSize( 6 );
log.info( "artifacts.size: {}", artifacts.size() );
try
{
File artifactFile = new File(
"target/test-origin-repo/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar" );
File artifactFilemd5 = new File(
"target/test-origin-repo/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar.md5" );
File artifactFilesha1 = new File(
"target/test-origin-repo/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar.sha1" );
assertTrue( "artifact not exists:" + artifactFile.getPath(), artifactFile.exists() );
assertTrue( "md5 not exists:" + artifactFilemd5.getPath(), artifactFilemd5.exists() );
assertTrue( "sha1 not exists:" + artifactFilesha1.getPath(), artifactFilesha1.exists() );
Artifact artifact = new Artifact();
artifact.setGroupId( "commons-logging" );
artifact.setArtifactId( "commons-logging" );
artifact.setVersion( "1.0.1" );
artifact.setClassifier( "javadoc" );
artifact.setPackaging( "jar" );
artifact.setContext( SOURCE_REPO_ID );
RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
repositoriesService.deleteArtifact( artifact );
assertFalse( "artifact not deleted exists:" + artifactFile.getPath(), artifactFile.exists() );
assertFalse( "md5 still exists:" + artifactFilemd5.getPath(), artifactFilemd5.exists() );
assertFalse( "sha1 still exists:" + artifactFilesha1.getPath(), artifactFilesha1.exists() );
artifacts =
browseService.getArtifactDownloadInfos( "commons-logging", "commons-logging", "1.0.1", SOURCE_REPO_ID );
log.info( "artifact: {}", artifacts );
Assertions.assertThat( artifacts ).isNotNull().isNotEmpty().hasSize( 2 );
versionsList = browseService.getVersionsList( "commons-logging", "commons-logging", SOURCE_REPO_ID );
log.info( "versionsList: {}", versionsList );
Assertions.assertThat( versionsList.getVersions() ).isNotNull().isNotEmpty().hasSize( 6 );