aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/metadata/metadata-repository-api
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-04-10 16:36:21 +1000
committerOlivier Lamy <olamy@apache.org>2014-04-10 16:36:21 +1000
commit5fa4ceb731b5440b7d7439c2d924f299dc109384 (patch)
tree06952be8c970f4f3ecf6a1769907c0d4dc678eae /archiva-modules/metadata/metadata-repository-api
parent03601570ef70ec4c1ae9f2b992333b8200c016d5 (diff)
downloadarchiva-5fa4ceb731b5440b7d7439c2d924f299dc109384.tar.gz
archiva-5fa4ceb731b5440b7d7439c2d924f299dc109384.zip
more diamond
Diffstat (limited to 'archiva-modules/metadata/metadata-repository-api')
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java16
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java38
2 files changed, 27 insertions, 27 deletions
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java
index 5c921d68b..06b4bb532 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java
@@ -213,7 +213,7 @@ public class DefaultMetadataResolver
}
session.markDirty();
- namespaces = new ArrayList<String>( namespaces );
+ namespaces = new ArrayList<>( namespaces );
namespaces.addAll( storageNamespaces );
}
@@ -240,7 +240,7 @@ public class DefaultMetadataResolver
namespaces = metadataRepository.getNamespaces( repoId, namespace );
namespacesCache.put( cacheKey, namespaces );
}
- Collection<String> exclusions = new ArrayList<String>( namespaces );
+ Collection<String> exclusions = new ArrayList<>( namespaces );
exclusions.addAll( metadataRepository.getProjects( repoId, namespace ) );
Collection<String> storageNamespaces =
repositoryStorage.listNamespaces( repoId, namespace, new ExcludesFilter<String>( exclusions ) );
@@ -265,7 +265,7 @@ public class DefaultMetadataResolver
}
session.markDirty();
- namespaces = new ArrayList<String>( namespaces );
+ namespaces = new ArrayList<>( namespaces );
namespaces.addAll( storageNamespaces );
}
return namespaces;
@@ -283,7 +283,7 @@ public class DefaultMetadataResolver
{
MetadataRepository metadataRepository = session.getRepository();
Collection<String> projects = metadataRepository.getProjects( repoId, namespace );
- Collection<String> exclusions = new ArrayList<String>( projects );
+ Collection<String> exclusions = new ArrayList<>( projects );
String cacheKey = repoId + "-" + namespace;
Collection<String> namespaces = namespacesCache.get( cacheKey );
@@ -319,7 +319,7 @@ public class DefaultMetadataResolver
}
session.markDirty();
- projects = new ArrayList<String>( projects );
+ projects = new ArrayList<>( projects );
projects.addAll( storageProjects );
}
return projects;
@@ -387,7 +387,7 @@ public class DefaultMetadataResolver
}
session.markDirty();
- projectVersions = new ArrayList<String>( projectVersions );
+ projectVersions = new ArrayList<>( projectVersions );
projectVersions.addAll( storageProjectVersions );
}
return projectVersions;
@@ -433,7 +433,7 @@ public class DefaultMetadataResolver
}
session.markDirty();
- artifacts = new ArrayList<ArtifactMetadata>( artifacts );
+ artifacts = new ArrayList<>( artifacts );
artifacts.addAll( storageArtifacts );
}
return artifacts;
@@ -450,7 +450,7 @@ public class DefaultMetadataResolver
private Collection<String> createArtifactIdList( Collection<ArtifactMetadata> artifacts )
{
- Collection<String> artifactIds = new ArrayList<String>();
+ Collection<String> artifactIds = new ArrayList<>();
for ( ArtifactMetadata artifact : artifacts )
{
artifactIds.add( artifact.getId() );
diff --git a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
index 27eef207b..5f7f8c0a2 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
@@ -204,7 +204,7 @@ public abstract class AbstractMetadataRepositoryTest
public void testGetArtifactOnly()
throws Exception
{
- assertThat( new ArrayList<ArtifactMetadata>(
+ assertThat( new ArrayList<>(
repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT,
TEST_PROJECT_VERSION ) ) ).isNotNull().isEmpty();
assertThat(
@@ -508,19 +508,19 @@ public abstract class AbstractMetadataRepositoryTest
Collection<ArtifactMetadata> artifacts =
repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
- assertEquals( Collections.singletonList( artifactMetadata ), new ArrayList<ArtifactMetadata>( artifacts ) );
+ assertEquals( Collections.singletonList( artifactMetadata ), new ArrayList<>( artifacts ) );
artifacts = repository.getArtifacts( TEST_REPO_ID );
- assertEquals( Collections.singletonList( artifactMetadata ), new ArrayList<ArtifactMetadata>( artifacts ) );
+ assertEquals( Collections.singletonList( artifactMetadata ), new ArrayList<>( artifacts ) );
artifacts = repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 );
- assertEquals( Collections.singletonList( artifactMetadata ), new ArrayList<ArtifactMetadata>( artifacts ) );
+ assertEquals( Collections.singletonList( artifactMetadata ), new ArrayList<>( artifacts ) );
artifacts = repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 );
- assertEquals( Collections.singletonList( artifactMetadata ), new ArrayList<ArtifactMetadata>( artifacts ) );
+ assertEquals( Collections.singletonList( artifactMetadata ), new ArrayList<>( artifacts ) );
artifacts = repository.getArtifactsByDateRange( TEST_REPO_ID, null, null );
- assertEquals( Collections.singletonList( artifactMetadata ), new ArrayList<ArtifactMetadata>( artifacts ) );
+ assertEquals( Collections.singletonList( artifactMetadata ), new ArrayList<>( artifacts ) );
}
@Test
@@ -812,7 +812,7 @@ public abstract class AbstractMetadataRepositoryTest
Collection<ArtifactMetadata> artifacts =
repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
- ArrayList<ArtifactMetadata> actual = new ArrayList<ArtifactMetadata>( artifacts );
+ ArrayList<ArtifactMetadata> actual = new ArrayList<>( artifacts );
Collections.sort( actual, new Comparator<ArtifactMetadata>()
{
public int compare( ArtifactMetadata o1, ArtifactMetadata o2 )
@@ -1028,13 +1028,13 @@ public abstract class AbstractMetadataRepositoryTest
// test it restricts to the appropriate repository
assertEquals( Collections.singletonList( artifact ),
- new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ) );
- assertEquals( Collections.singletonList( secondArtifact ), new ArrayList<ArtifactMetadata>(
+ new ArrayList<>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ) );
+ assertEquals( Collections.singletonList( secondArtifact ), new ArrayList<>(
repository.getArtifactsByChecksum( OTHER_REPO_ID, TEST_SHA1 ) ) );
assertEquals( Collections.singletonList( artifact ),
- new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ) );
+ new ArrayList<>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ) );
assertEquals( Collections.singletonList( secondArtifact ),
- new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( OTHER_REPO_ID, TEST_MD5 ) ) );
+ new ArrayList<>( repository.getArtifactsByChecksum( OTHER_REPO_ID, TEST_MD5 ) ) );
}
@Test
@@ -1121,7 +1121,7 @@ public abstract class AbstractMetadataRepositoryTest
repository.save();
assertEquals( Collections.singletonList( artifact ),
- new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ) );
+ new ArrayList<>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ) );
}
@Test
@@ -1133,7 +1133,7 @@ public abstract class AbstractMetadataRepositoryTest
repository.save();
assertEquals( Collections.singletonList( artifact ),
- new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ) );
+ new ArrayList<>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ) );
}
@Test
@@ -1147,9 +1147,9 @@ public abstract class AbstractMetadataRepositoryTest
repository.save();
assertEquals( Collections.singletonList( artifact ),
- new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ) );
+ new ArrayList<>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ) );
assertEquals( Collections.singletonList( artifact ),
- new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ) );
+ new ArrayList<>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ) );
}
@Test
@@ -1166,11 +1166,11 @@ public abstract class AbstractMetadataRepositoryTest
repository.save();
List<ArtifactMetadata> artifacts =
- new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) );
+ new ArrayList<>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) );
Collections.sort( artifacts, new ArtifactMetadataComparator() );
assertEquals( Arrays.asList( artifact2, artifact1 ), artifacts );
- artifacts = new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) );
+ artifacts = new ArrayList<>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) );
Collections.sort( artifacts, new ArtifactMetadataComparator() );
assertEquals( Arrays.asList( artifact2, artifact1 ), artifacts );
}
@@ -1215,7 +1215,7 @@ public abstract class AbstractMetadataRepositoryTest
Collections.sort( expected, new ArtifactMetadataComparator() );
List<ArtifactMetadata> actual =
- new ArrayList<ArtifactMetadata>( repository.getArtifactsByDateRange( TEST_REPO_ID, null, null ) );
+ new ArrayList<>( repository.getArtifactsByDateRange( TEST_REPO_ID, null, null ) );
Collections.sort( actual, new ArtifactMetadataComparator() );
assertEquals( expected, actual );
@@ -1276,7 +1276,7 @@ public abstract class AbstractMetadataRepositoryTest
Collection<ArtifactMetadata> artifacts =
repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION );
- assertEquals( Collections.singletonList( artifact ), new ArrayList<ArtifactMetadata>( artifacts ) );
+ assertEquals( Collections.singletonList( artifact ), new ArrayList<>( artifacts ) );
repository.removeArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact.getId() );