@@ -33,7 +33,7 @@ import java.util.List; | |||
public class ElementTextListClosure | |||
implements Closure | |||
{ | |||
private List<String> list = new ArrayList<String>(); | |||
private List<String> list = new ArrayList<>(); | |||
public void execute( Object input ) | |||
{ |
@@ -298,7 +298,7 @@ public class XMLReader | |||
} | |||
else if ( evaluated instanceof Node ) | |||
{ | |||
List<Element> ret = new ArrayList<Element>(); | |||
List<Element> ret = new ArrayList<>(); | |||
ret.add( (Element) evaluated ); | |||
return ret; | |||
} | |||
@@ -319,7 +319,7 @@ public class XMLReader | |||
return null; | |||
} | |||
List<String> ret = new ArrayList<String>(); | |||
List<String> ret = new ArrayList<>(); | |||
for ( Iterator<Element> iter = elemList.iterator(); iter.hasNext(); ) | |||
{ | |||
Element listelem = iter.next(); |
@@ -38,7 +38,7 @@ public class XMLReaderTest | |||
{ | |||
assertEquals( "Element List Size", expectedTexts.length, elementList.size() ); | |||
List<String> texts = new ArrayList<String>(); | |||
List<String> texts = new ArrayList<>(); | |||
for ( Element element : elementList ) | |||
{ | |||
texts.add( element.getTextTrim() ); |
@@ -361,7 +361,7 @@ public class ArchivaDavResource | |||
public DavResourceIterator getMembers() | |||
{ | |||
List<DavResource> list = new ArrayList<DavResource>(); | |||
List<DavResource> list = new ArrayList<>(); | |||
if ( exists() && isCollection() ) | |||
{ | |||
for ( String item : localResource.list() ) |
@@ -128,7 +128,7 @@ public class ArchivaDavResourceFactory | |||
private Logger log = LoggerFactory.getLogger( ArchivaDavResourceFactory.class ); | |||
@Inject | |||
private List<AuditListener> auditListeners = new ArrayList<AuditListener>(); | |||
private List<AuditListener> auditListeners = new ArrayList<>(); | |||
@Inject | |||
private RepositoryContentFactory repositoryFactory; | |||
@@ -220,7 +220,7 @@ public class ArchivaDavResourceFactory | |||
String activePrincipal = getActivePrincipal( request ); | |||
List<String> resourcesInAbsolutePath = new ArrayList<String>(); | |||
List<String> resourcesInAbsolutePath = new ArrayList<>(); | |||
boolean readMethod = WebdavMethodUtil.isReadMethod( request.getMethod() ); | |||
DavResource resource; | |||
@@ -258,7 +258,7 @@ public class ArchivaDavResourceFactory | |||
// make a copy to avoid potential concurrent modifications (eg. by configuration) | |||
// TODO: ultimately, locking might be more efficient than copying in this fashion since updates are | |||
// infrequent | |||
List<String> repositories = new ArrayList<String>( repoGroupConfig.getRepositories() ); | |||
List<String> repositories = new ArrayList<>( repoGroupConfig.getRepositories() ); | |||
resource = processRepositoryGroup( request, archivaLocator, repositories, activePrincipal, | |||
resourcesInAbsolutePath, repoGroupConfig ); | |||
} | |||
@@ -441,7 +441,7 @@ public class ArchivaDavResourceFactory | |||
throws DavException | |||
{ | |||
DavResource resource = null; | |||
List<DavException> storedExceptions = new ArrayList<DavException>(); | |||
List<DavException> storedExceptions = new ArrayList<>(); | |||
String pathInfo = StringUtils.removeEnd( request.getPathInfo(), "/" ); | |||
@@ -998,7 +998,7 @@ public class ArchivaDavResourceFactory | |||
request.getDavSession(), locator, this, mimeTypes, auditListeners, scheduler, | |||
fileLockManager ); | |||
} | |||
List<File> mergedRepositoryContents = new ArrayList<File>(); | |||
List<File> mergedRepositoryContents = new ArrayList<>(); | |||
// multiple repo types so we guess they are all the same type | |||
// so use the first one | |||
// FIXME add a method with group in the repository storage |
@@ -90,7 +90,7 @@ public class ArchivaVirtualDavResource | |||
if ( outputContext.hasStream() ) | |||
{ | |||
Collections.sort( localResources ); | |||
List<File> localResourceFiles = new ArrayList<File>(); | |||
List<File> localResourceFiles = new ArrayList<>(); | |||
for ( File resourceFile : localResources ) | |||
{ |
@@ -47,7 +47,7 @@ public class IndexWriter | |||
public IndexWriter( DavResource resource, File localResource, String logicalResource ) | |||
{ | |||
this.localResources = new ArrayList<File>(); | |||
this.localResources = new ArrayList<>(); | |||
this.localResources.add( localResource ); | |||
this.logicalResource = logicalResource; | |||
this.isVirtual = false; | |||
@@ -139,7 +139,7 @@ public class IndexWriter | |||
{ | |||
for ( File localResource : localResources ) | |||
{ | |||
List<File> files = new ArrayList<File>( Arrays.asList( localResource.listFiles() ) ); | |||
List<File> files = new ArrayList<>( Arrays.asList( localResource.listFiles() ) ); | |||
Collections.sort( files ); | |||
for ( File file : files ) | |||
@@ -152,13 +152,13 @@ public class IndexWriter | |||
{ | |||
// virtual repository - filter unique directories | |||
Map<String, List<String>> uniqueChildFiles = new HashMap<String, List<String>>(); | |||
List<String> sortedList = new ArrayList<String>(); | |||
List<String> sortedList = new ArrayList<>(); | |||
for ( File resource : localResources ) | |||
{ | |||
List<File> files = new ArrayList<File>( Arrays.asList( resource.listFiles() ) ); | |||
List<File> files = new ArrayList<>( Arrays.asList( resource.listFiles() ) ); | |||
for ( File file : files ) | |||
{ | |||
List<String> mergedChildFiles = new ArrayList<String>(); | |||
List<String> mergedChildFiles = new ArrayList<>(); | |||
if ( uniqueChildFiles.get( file.getName() ) == null ) | |||
{ | |||
mergedChildFiles.add( file.getAbsolutePath() ); | |||
@@ -177,7 +177,7 @@ public class IndexWriter | |||
} | |||
Collections.sort( sortedList ); | |||
List<String> written = new ArrayList<String>(); | |||
List<String> written = new ArrayList<>(); | |||
for ( String fileName : sortedList ) | |||
{ | |||
List<String> childFilesFromMap = uniqueChildFiles.get( fileName ); |
@@ -37,7 +37,7 @@ public class WebdavMethodUtil | |||
static | |||
{ | |||
READ_METHODS = new ArrayList<String>(); | |||
READ_METHODS = new ArrayList<>( 5 ); | |||
READ_METHODS.add( "HEAD" ); | |||
READ_METHODS.add( "GET" ); | |||
READ_METHODS.add( "PROPFIND" ); |
@@ -33,7 +33,7 @@ public class TestAuditListener | |||
return events; | |||
} | |||
private List<AuditEvent> events = new ArrayList<AuditEvent>(); | |||
private List<AuditEvent> events = new ArrayList<>(); | |||
public void auditEvent( AuditEvent event ) | |||
{ |
@@ -288,7 +288,7 @@ public class ArchivaDavResourceFactoryTest | |||
+ "/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar", LOCAL_REPO_GROUP, | |||
new ArchivaDavLocatorFactory() ); | |||
List<RepositoryGroupConfiguration> repoGroups = new ArrayList<RepositoryGroupConfiguration>(); | |||
List<RepositoryGroupConfiguration> repoGroups = new ArrayList<>(); | |||
RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration(); | |||
repoGroup.setId( LOCAL_REPO_GROUP ); | |||
repoGroup.addRepository( INTERNAL_REPO ); | |||
@@ -371,7 +371,7 @@ public class ArchivaDavResourceFactoryTest | |||
createManagedRepository( LOCAL_MIRROR_REPO, new File( "target/test-classes/local-mirror" ).getPath(), | |||
"default" ), false, null ); | |||
List<RepositoryGroupConfiguration> repoGroups = new ArrayList<RepositoryGroupConfiguration>(); | |||
List<RepositoryGroupConfiguration> repoGroups = new ArrayList<>(); | |||
RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration(); | |||
repoGroup.setId( LOCAL_REPO_GROUP ); | |||
repoGroup.addRepository( INTERNAL_REPO ); |
@@ -95,7 +95,7 @@ public class RepositoryServletRepositoryGroupTest | |||
configuration.addManagedRepository( | |||
createManagedRepository( MANAGED_REPO_LAST, "Last Test Repo", repoRootLast, true ) ); | |||
List<String> managedRepoIds = new ArrayList<String>(); | |||
List<String> managedRepoIds = new ArrayList<>(); | |||
managedRepoIds.add( MANAGED_REPO_FIRST ); | |||
managedRepoIds.add( MANAGED_REPO_LAST ); | |||
@@ -112,7 +112,7 @@ public class RepositoryServletRepositoryGroupTest | |||
configuration.addManagedRepository( | |||
createManagedRepository( MANAGED_REPO_LAST, "Last Test Repo", repoRootLast, true ) ); | |||
List<String> invalidManagedRepoIds = new ArrayList<String>(); | |||
List<String> invalidManagedRepoIds = new ArrayList<>(); | |||
invalidManagedRepoIds.add( MANAGED_REPO_FIRST ); | |||
invalidManagedRepoIds.add( MANAGED_REPO_INVALID ); | |||
invalidManagedRepoIds.add( MANAGED_REPO_LAST ); |
@@ -46,11 +46,11 @@ public class ProjectVersionMetadata | |||
private CiManagement ciManagement; | |||
private List<License> licenses = new ArrayList<License>(); | |||
private List<License> licenses = new ArrayList<>(); | |||
private List<MailingList> mailingLists = new ArrayList<MailingList>(); | |||
private List<MailingList> mailingLists = new ArrayList<>(); | |||
private List<Dependency> dependencies = new ArrayList<Dependency>(); | |||
private List<Dependency> dependencies = new ArrayList<>(); | |||
private boolean incomplete; | |||
@@ -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() ); |
@@ -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() ); | |||
@@ -53,7 +53,7 @@ public class DefaultAuditManager | |||
throws MetadataRepositoryException | |||
{ | |||
// TODO: consider a more efficient implementation that directly gets the last ten from the content repository | |||
List<AuditRecord> records = new ArrayList<AuditRecord>(); | |||
List<AuditRecord> records = new ArrayList<>(); | |||
for ( String repositoryId : repositoryIds ) | |||
{ | |||
List<String> names = metadataRepository.getMetadataFacets( repositoryId, AuditEvent.FACET_ID ); | |||
@@ -65,7 +65,7 @@ public class DefaultAuditManager | |||
Collections.sort( records ); | |||
records = records.subList( 0, records.size() < NUM_RECENT_EVENTS ? records.size() : NUM_RECENT_EVENTS ); | |||
List<AuditEvent> events = new ArrayList<AuditEvent>( records.size() ); | |||
List<AuditEvent> events = new ArrayList<>( records.size() ); | |||
for ( AuditRecord record : records ) | |||
{ | |||
AuditEvent auditEvent = (AuditEvent) metadataRepository.getMetadataFacet( record.repositoryId, | |||
@@ -104,7 +104,7 @@ public class DefaultAuditManager | |||
Date endTime ) | |||
throws MetadataRepositoryException | |||
{ | |||
List<AuditEvent> results = new ArrayList<AuditEvent>(); | |||
List<AuditEvent> results = new ArrayList<>(); | |||
for ( String repositoryId : repositoryIds ) | |||
{ | |||
List<String> list = metadataRepository.getMetadataFacets( repositoryId, AuditEvent.FACET_ID ); |
@@ -96,7 +96,7 @@ public class AuditManagerTest | |||
throws Exception | |||
{ | |||
int numEvents = 11; | |||
List<AuditEvent> expectedEvents = new ArrayList<AuditEvent>( numEvents ); | |||
List<AuditEvent> expectedEvents = new ArrayList<>( numEvents ); | |||
for ( int i = 0; i < numEvents; i++ ) | |||
{ | |||
AuditEvent event = createEvent( AUDIT_EVENT_BASE + MILLIS_FORMAT.format( i ) ); | |||
@@ -134,7 +134,7 @@ public class AuditManagerTest | |||
throws Exception | |||
{ | |||
int numEvents = 5; | |||
List<AuditEvent> expectedEvents = new ArrayList<AuditEvent>( numEvents ); | |||
List<AuditEvent> expectedEvents = new ArrayList<>( numEvents ); | |||
for ( int i = 0; i < numEvents; i++ ) | |||
{ | |||
expectedEvents.add( createEvent( AUDIT_EVENT_BASE + MILLIS_FORMAT.format( i ) ) ); | |||
@@ -171,7 +171,7 @@ public class AuditManagerTest | |||
{ | |||
int numEvents = 11; | |||
Map<String, List<String>> eventNames = new LinkedHashMap<String, List<String>>(); | |||
List<AuditEvent> events = new ArrayList<AuditEvent>(); | |||
List<AuditEvent> events = new ArrayList<>(); | |||
eventNames.put( TEST_REPO_ID, new ArrayList<String>() ); | |||
eventNames.put( TEST_REPO_ID_2, new ArrayList<String>() ); | |||
for ( int i = 0; i < numEvents; i++ ) | |||
@@ -604,7 +604,7 @@ public class AuditManagerTest | |||
private List<String> getEventNames( List<AuditEvent> events ) | |||
{ | |||
List<String> names = new ArrayList<String>( events.size() ); | |||
List<String> names = new ArrayList<>( events.size() ); | |||
for ( AuditEvent event : events ) | |||
{ | |||
names.add( event.getName() ); |
@@ -146,7 +146,7 @@ public class Maven3DependencyTreeBuilder | |||
return; | |||
} | |||
List<RemoteRepository> remoteRepositories = new ArrayList<RemoteRepository>(); | |||
List<RemoteRepository> remoteRepositories = new ArrayList<>(); | |||
Map<String, NetworkProxy> networkProxies = new HashMap<String, NetworkProxy>(); | |||
try | |||
@@ -197,7 +197,7 @@ public class Maven3DependencyTreeBuilder | |||
throws DependencyTreeBuilderException | |||
{ | |||
List<TreeEntry> treeEntries = new ArrayList<TreeEntry>(); | |||
List<TreeEntry> treeEntries = new ArrayList<>(); | |||
TreeDependencyNodeVisitor treeDependencyNodeVisitor = new TreeDependencyNodeVisitor( treeEntries ); | |||
buildDependencyTree( repositoryIds, groupId, artifactId, version, treeDependencyNodeVisitor ); |
@@ -232,7 +232,7 @@ public class Maven2RepositoryStorage | |||
// TODO: this is a workaround until we can properly resolve using proxies as well - this doesn't cache | |||
// anything locally! | |||
List<RemoteRepository> remoteRepositories = new ArrayList<RemoteRepository>(); | |||
List<RemoteRepository> remoteRepositories = new ArrayList<>(); | |||
Map<String, NetworkProxy> networkProxies = new HashMap<String, NetworkProxy>(); | |||
Map<String, List<ProxyConnector>> proxyConnectorsMap = proxyConnectorAdmin.getProxyConnectorAsMap(); | |||
@@ -399,7 +399,7 @@ public class Maven2RepositoryStorage | |||
private List<org.apache.archiva.metadata.model.Dependency> convertDependencies( List<Dependency> dependencies ) | |||
{ | |||
List<org.apache.archiva.metadata.model.Dependency> l = | |||
new ArrayList<org.apache.archiva.metadata.model.Dependency>(); | |||
new ArrayList<>(); | |||
for ( Dependency dependency : dependencies ) | |||
{ | |||
org.apache.archiva.metadata.model.Dependency newDependency = | |||
@@ -444,7 +444,7 @@ public class Maven2RepositoryStorage | |||
private List<org.apache.archiva.metadata.model.License> convertLicenses( List<License> licenses ) | |||
{ | |||
List<org.apache.archiva.metadata.model.License> l = new ArrayList<org.apache.archiva.metadata.model.License>(); | |||
List<org.apache.archiva.metadata.model.License> l = new ArrayList<>(); | |||
for ( License license : licenses ) | |||
{ | |||
org.apache.archiva.metadata.model.License newLicense = new org.apache.archiva.metadata.model.License(); | |||
@@ -458,7 +458,7 @@ public class Maven2RepositoryStorage | |||
private List<org.apache.archiva.metadata.model.MailingList> convertMailingLists( List<MailingList> mailingLists ) | |||
{ | |||
List<org.apache.archiva.metadata.model.MailingList> l = | |||
new ArrayList<org.apache.archiva.metadata.model.MailingList>(); | |||
new ArrayList<>(); | |||
for ( MailingList mailingList : mailingLists ) | |||
{ | |||
org.apache.archiva.metadata.model.MailingList newMailingList = | |||
@@ -512,7 +512,7 @@ public class Maven2RepositoryStorage | |||
String[] files = dir.list( new DirectoryFilter( filter ) ); | |||
if ( files != null ) | |||
{ | |||
fileNames = new ArrayList<String>( Arrays.asList( files ) ); | |||
fileNames = new ArrayList<>( Arrays.asList( files ) ); | |||
Collections.sort( fileNames ); | |||
} | |||
else | |||
@@ -543,7 +543,7 @@ public class Maven2RepositoryStorage | |||
File dir = pathTranslator.toFile( getRepositoryBasedir( repoId ), namespace ); | |||
// scan all the directories which are potential namespaces. Any directories known to be projects are excluded | |||
List<String> namespaces = new ArrayList<String>(); | |||
List<String> namespaces = new ArrayList<>(); | |||
File[] files = dir.listFiles( new DirectoryFilter( filter ) ); | |||
if ( files != null ) | |||
{ | |||
@@ -565,7 +565,7 @@ public class Maven2RepositoryStorage | |||
File dir = pathTranslator.toFile( getRepositoryBasedir( repoId ), namespace ); | |||
// scan all directories in the namespace, and only include those that are known to be projects | |||
List<String> projects = new ArrayList<String>(); | |||
List<String> projects = new ArrayList<>(); | |||
File[] files = dir.listFiles( new DirectoryFilter( filter ) ); | |||
if ( files != null ) | |||
{ | |||
@@ -601,7 +601,7 @@ public class Maven2RepositoryStorage | |||
// all files that are not metadata and not a checksum / signature are considered artifacts | |||
File[] files = dir.listFiles( new ArtifactDirectoryFilter( readMetadataRequest.getFilter() ) ); | |||
List<ArtifactMetadata> artifacts = new ArrayList<ArtifactMetadata>(); | |||
List<ArtifactMetadata> artifacts = new ArrayList<>(); | |||
if ( files != null ) | |||
{ | |||
for ( File file : files ) |
@@ -59,7 +59,7 @@ public class MockRepoAdmin | |||
throws RepositoryAdminException | |||
{ | |||
List<RemoteRepository> remoteRepositories = | |||
new ArrayList<RemoteRepository>( archivaConfiguration.getConfiguration().getRemoteRepositories().size() ); | |||
new ArrayList<>( archivaConfiguration.getConfiguration().getRemoteRepositories().size() ); | |||
for ( RemoteRepositoryConfiguration repositoryConfiguration : archivaConfiguration.getConfiguration().getRemoteRepositories() ) | |||
{ | |||
RemoteRepository remoteRepository = | |||
@@ -186,7 +186,7 @@ public class MockRepoAdmin | |||
{ | |||
List<ProxyConnectorConfiguration> proxyConnectorConfigurations = | |||
archivaConfiguration.getConfiguration().getProxyConnectors(); | |||
List<ProxyConnector> proxyConnectors = new ArrayList<ProxyConnector>( proxyConnectorConfigurations.size() ); | |||
List<ProxyConnector> proxyConnectors = new ArrayList<>( proxyConnectorConfigurations.size() ); | |||
for ( ProxyConnectorConfiguration configuration : proxyConnectorConfigurations ) | |||
{ | |||
proxyConnectors.add( getProxyConnector( configuration ) ); | |||
@@ -233,7 +233,7 @@ public class MockRepoAdmin | |||
List<ProxyConnector> connectors = proxyConnectorMap.get( key ); | |||
if ( connectors == null ) | |||
{ | |||
connectors = new ArrayList<ProxyConnector>( 1 ); | |||
connectors = new ArrayList<>( 1 ); | |||
proxyConnectorMap.put( key, connectors ); | |||
} | |||
@@ -63,7 +63,7 @@ public class TestMetadataRepository | |||
public List<String> getMetadataFacets( String repoId, String facetId ) | |||
{ | |||
return new ArrayList<String>( facets.keySet() ); | |||
return new ArrayList<>( facets.keySet() ); | |||
} | |||
public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name ) |
@@ -187,7 +187,7 @@ public class ManagedDefaultRepositoryContentTest | |||
Set<String> testedVersionSet = repoContent.getVersions( reference ); | |||
// Sort the list (for asserts) | |||
List<String> testedVersions = new ArrayList<String>(); | |||
List<String> testedVersions = new ArrayList<>(); | |||
testedVersions.addAll( testedVersionSet ); | |||
Collections.sort( testedVersions, new VersionComparator() ); | |||
@@ -212,7 +212,7 @@ public class ManagedDefaultRepositoryContentTest | |||
Set<String> testedVersionSet = repoContent.getVersions( reference ); | |||
// Sort the list (for asserts later) | |||
List<String> testedVersions = new ArrayList<String>(); | |||
List<String> testedVersions = new ArrayList<>(); | |||
testedVersions.addAll( testedVersionSet ); | |||
Collections.sort( testedVersions, new VersionComparator() ); | |||
@@ -98,7 +98,7 @@ public class ManagedLegacyRepositoryContentTest | |||
Set<String> testedVersionSet = repoContent.getVersions( reference ); | |||
// Sort the list (for asserts later) | |||
List<String> testedVersions = new ArrayList<String>(); | |||
List<String> testedVersions = new ArrayList<>(); | |||
testedVersions.addAll( testedVersionSet ); | |||
Collections.sort( testedVersions, new VersionComparator() ); | |||
@@ -124,7 +124,7 @@ public class ManagedLegacyRepositoryContentTest | |||
Set<String> testedVersionSet = repoContent.getVersions( reference ); | |||
// Sort the list (for asserts later) | |||
List<String> testedVersions = new ArrayList<String>(); | |||
List<String> testedVersions = new ArrayList<>(); | |||
testedVersions.addAll( testedVersionSet ); | |||
Collections.sort( testedVersions, new VersionComparator() ); | |||
@@ -147,7 +147,7 @@ public class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest | |||
proxyConnectors.setDisabled( false ); | |||
c.addProxyConnector( proxyConnectors ); | |||
List<String> repos = new ArrayList<String>(); | |||
List<String> repos = new ArrayList<>(); | |||
repos.add( TEST_REPO_ID ); | |||
repos.add( TEST_SNAP_REPO_ID ); | |||
@@ -210,7 +210,7 @@ public class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest | |||
assertDependency( dependencies.get( 0 ), "commons-io", "commons-io", "1.4" ); | |||
assertDependency( dependencies.get( 1 ), "junit", "junit", "3.8.1", "test" ); | |||
List<String> paths = new ArrayList<String>(); | |||
List<String> paths = new ArrayList<>(); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-module-a" ); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-parent" ); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-root" ); | |||
@@ -244,7 +244,7 @@ public class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest | |||
assertEquals( "test-artifact-module-a", facet.getArtifactId() ); | |||
assertEquals( "jar", facet.getPackaging() ); | |||
List<String> paths = new ArrayList<String>(); | |||
List<String> paths = new ArrayList<>(); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-module-a" ); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-parent" ); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-root" ); | |||
@@ -273,7 +273,7 @@ public class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest | |||
assertEquals( "missing-parent", facet.getArtifactId() ); | |||
assertEquals( "jar", facet.getPackaging() ); | |||
List<String> paths = new ArrayList<String>(); | |||
List<String> paths = new ArrayList<>(); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-module-a" ); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-parent" ); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-root" ); | |||
@@ -320,7 +320,7 @@ public class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest | |||
assertDependency( dependencies.get( 0 ), "commons-io", "commons-io", "1.4" ); | |||
assertDependency( dependencies.get( 1 ), "junit", "junit", "3.8.1", "test" ); | |||
List<String> paths = new ArrayList<String>(); | |||
List<String> paths = new ArrayList<>(); | |||
paths.add( "target/test-repositorys/com/example/test/test-snapshot-artifact-module-a" ); | |||
paths.add( "target/test-repositorys/com/example/test/test-snapshot-artifact-root" ); | |||
deleteTestArtifactWithParent( paths ); | |||
@@ -362,7 +362,7 @@ public class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest | |||
assertDependency( dependencies.get( 0 ), "commons-io", "commons-io", "1.4" ); | |||
assertDependency( dependencies.get( 1 ), "junit", "junit", "3.8.1", "test" ); | |||
List<String> paths = new ArrayList<String>(); | |||
List<String> paths = new ArrayList<>(); | |||
paths.add( "target/test-repositorys/com/example/test/test-snapshot-artifact-module-a" ); | |||
paths.add( "target/test-repositorys/com/example/test/test-snapshot-artifact-root" ); | |||
@@ -406,7 +406,7 @@ public class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest | |||
assertDependency( dependencies.get( 0 ), "commons-io", "commons-io", "1.4" ); | |||
assertDependency( dependencies.get( 1 ), "junit", "junit", "3.8.1", "test" ); | |||
List<String> paths = new ArrayList<String>(); | |||
List<String> paths = new ArrayList<>(); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-module-b" ); | |||
paths.add( "target/test-repository/com/example/test/test-snapshot-artifact-root" ); | |||
@@ -464,7 +464,7 @@ public class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest | |||
private void assertMailingList( String prefix, MailingList mailingList, String name, boolean allowPost, | |||
String nabbleUrl ) | |||
{ | |||
List<String> otherArchives = new ArrayList<String>(); | |||
List<String> otherArchives = new ArrayList<>(); | |||
otherArchives.add( "http://www.mail-archive.com/" + prefix + "@archiva.apache.org" ); | |||
if ( nabbleUrl != null ) | |||
{ |
@@ -177,7 +177,7 @@ public class Maven2RepositoryMetadataResolverMRM1411Test | |||
assertDependency( dependencies.get( 0 ), "commons-io", "commons-io", "1.4" ); | |||
assertDependency( dependencies.get( 1 ), "junit", "junit", "3.8.1", "test" ); | |||
List<String> paths = new ArrayList<String>(); | |||
List<String> paths = new ArrayList<>(); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-module-a" ); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-parent" ); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-root" ); | |||
@@ -209,7 +209,7 @@ public class Maven2RepositoryMetadataResolverMRM1411Test | |||
assertEquals( "test-artifact-module-a", facet.getArtifactId() ); | |||
assertEquals( "jar", facet.getPackaging() ); | |||
List<String> paths = new ArrayList<String>(); | |||
List<String> paths = new ArrayList<>(); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-module-a" ); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-parent" ); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-root" ); | |||
@@ -235,7 +235,7 @@ public class Maven2RepositoryMetadataResolverMRM1411Test | |||
assertEquals( "missing-parent", facet.getArtifactId() ); | |||
assertEquals( "jar", facet.getPackaging() ); | |||
List<String> paths = new ArrayList<String>(); | |||
List<String> paths = new ArrayList<>(); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-module-a" ); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-parent" ); | |||
paths.add( "target/test-repository/com/example/test/test-artifact-root" ); | |||
@@ -282,7 +282,7 @@ public class Maven2RepositoryMetadataResolverMRM1411Test | |||
assertDependency( dependencies.get( 0 ), "commons-io", "commons-io", "1.4" ); | |||
assertDependency( dependencies.get( 1 ), "junit", "junit", "3.8.1", "test" ); | |||
List<String> paths = new ArrayList<String>(); | |||
List<String> paths = new ArrayList<>(); | |||
paths.add( "target/test-repository/com/example/test/test-snapshot-artifact-module-a" ); | |||
paths.add( "target/test-repository/com/example/test/test-snapshot-artifact-root" ); | |||
@@ -310,7 +310,7 @@ public class Maven2RepositoryMetadataResolverMRM1411Test | |||
{ | |||
} | |||
List<String> paths = new ArrayList<String>(); | |||
List<String> paths = new ArrayList<>(); | |||
paths.add( "target/test-repository/com/example/test/test-snapshot-artifact-module-a" ); | |||
paths.add( "target/test-repository/com/example/test/test-snapshot-artifact-root" ); | |||
@@ -368,7 +368,7 @@ public class Maven2RepositoryMetadataResolverMRM1411Test | |||
private void assertMailingList( String prefix, MailingList mailingList, String name, boolean allowPost, | |||
String nabbleUrl ) | |||
{ | |||
List<String> otherArchives = new ArrayList<String>(); | |||
List<String> otherArchives = new ArrayList<>(); | |||
otherArchives.add( "http://www.mail-archive.com/" + prefix + "@archiva.apache.org" ); | |||
if ( nabbleUrl != null ) | |||
{ |
@@ -217,7 +217,7 @@ public class Maven2RepositoryMetadataResolverTest | |||
{ | |||
Collection<ArtifactMetadata> springArtifacts = storage.readArtifactsMetadata( | |||
new ReadMetadataRequest( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.2", ALL ) ); | |||
List<ArtifactMetadata> artifacts = new ArrayList<ArtifactMetadata>( springArtifacts ); | |||
List<ArtifactMetadata> artifacts = new ArrayList<>( springArtifacts ); | |||
Collections.sort( artifacts, new Comparator<ArtifactMetadata>() | |||
{ | |||
public int compare( ArtifactMetadata o1, ArtifactMetadata o2 ) | |||
@@ -259,7 +259,7 @@ public class Maven2RepositoryMetadataResolverTest | |||
{ | |||
Collection<ArtifactMetadata> testArtifacts = storage.readArtifactsMetadata( | |||
new ReadMetadataRequest( TEST_REPO_ID, "com.example.test", "test-artifact", "1.0-SNAPSHOT", ALL ) ); | |||
List<ArtifactMetadata> artifacts = new ArrayList<ArtifactMetadata>( testArtifacts ); | |||
List<ArtifactMetadata> artifacts = new ArrayList<>( testArtifacts ); | |||
Collections.sort( artifacts, new Comparator<ArtifactMetadata>() | |||
{ | |||
public int compare( ArtifactMetadata o1, ArtifactMetadata o2 ) | |||
@@ -559,7 +559,7 @@ public class Maven2RepositoryMetadataResolverTest | |||
public void testGetArtifacts() | |||
throws Exception | |||
{ | |||
List<ArtifactMetadata> artifacts = new ArrayList<ArtifactMetadata>( storage.readArtifactsMetadata( | |||
List<ArtifactMetadata> artifacts = new ArrayList<>( storage.readArtifactsMetadata( | |||
new ReadMetadataRequest( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.2", ALL ) ) ); | |||
assertEquals( 3, artifacts.size() ); | |||
Collections.sort( artifacts, new Comparator<ArtifactMetadata>() | |||
@@ -582,7 +582,7 @@ public class Maven2RepositoryMetadataResolverTest | |||
{ | |||
ExcludesFilter<String> filter = | |||
new ExcludesFilter<String>( Collections.singletonList( "plexus-spring-1.2.pom" ) ); | |||
List<ArtifactMetadata> artifacts = new ArrayList<ArtifactMetadata>( storage.readArtifactsMetadata( | |||
List<ArtifactMetadata> artifacts = new ArrayList<>( storage.readArtifactsMetadata( | |||
new ReadMetadataRequest( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.2", filter ) ) ); | |||
assertEquals( 2, artifacts.size() ); | |||
Collections.sort( artifacts, new Comparator<ArtifactMetadata>() | |||
@@ -646,7 +646,7 @@ public class Maven2RepositoryMetadataResolverTest | |||
private void assertMailingList( String prefix, MailingList mailingList, String name, boolean allowPost, | |||
String nabbleUrl ) | |||
{ | |||
List<String> otherArchives = new ArrayList<String>(); | |||
List<String> otherArchives = new ArrayList<>(); | |||
otherArchives.add( "http://www.mail-archive.com/" + prefix + "@archiva.apache.org" ); | |||
if ( nabbleUrl != null ) | |||
{ |
@@ -369,7 +369,7 @@ public class MetadataToolsTest | |||
Set<String> testedVersionSet = tools.gatherSnapshotVersions( repoContent, reference ); | |||
// Sort the list (for asserts) | |||
List<String> testedVersions = new ArrayList<String>(); | |||
List<String> testedVersions = new ArrayList<>(); | |||
testedVersions.addAll( testedVersionSet ); | |||
Collections.sort( testedVersions, new VersionComparator() ); | |||
@@ -374,7 +374,7 @@ public class CassandraMetadataRepository | |||
{ | |||
// TODO use cql queries to delete all | |||
List<String> namespacesKey = new ArrayList<String>(); | |||
List<String> namespacesKey = new ArrayList<>(); | |||
QueryResult<OrderedRows<String, String, String>> result = HFactory // | |||
.createRangeSlicesQuery( keyspace, ss, ss, ss ) // | |||
@@ -465,7 +465,7 @@ public class CassandraMetadataRepository | |||
.setRange( null, null, false, Integer.MAX_VALUE ) // | |||
.execute(); | |||
List<String> repoIds = new ArrayList<String>( cResult.get().getCount() ); | |||
List<String> repoIds = new ArrayList<>( cResult.get().getCount() ); | |||
for ( Row<String, String, String> row : cResult.get() ) | |||
{ | |||
@@ -517,7 +517,7 @@ public class CassandraMetadataRepository | |||
.addEqualsExpression( "repositoryName", repoId ) // | |||
.execute(); | |||
List<String> namespaces = new ArrayList<String>( result.get().getCount() ); | |||
List<String> namespaces = new ArrayList<>( result.get().getCount() ); | |||
for ( Row<String, String, String> row : result.get() ) | |||
{ | |||
@@ -553,7 +553,7 @@ public class CassandraMetadataRepository | |||
.addEqualsExpression( "repositoryName", repoId ) // | |||
.execute(); | |||
List<String> namespaces = new ArrayList<String>( result.get().getCount() ); | |||
List<String> namespaces = new ArrayList<>( result.get().getCount() ); | |||
for ( Row<String, String, String> row : result.get() ) | |||
{ | |||
@@ -1125,7 +1125,7 @@ public class CassandraMetadataRepository | |||
protected List<MailingList> getMailingLists( String projectVersionMetadataKey ) | |||
{ | |||
List<MailingList> mailingLists = new ArrayList<MailingList>(); | |||
List<MailingList> mailingLists = new ArrayList<>(); | |||
QueryResult<OrderedRows<String, String, String>> result = | |||
HFactory.createRangeSlicesQuery( cassandraArchivaManager.getKeyspace(), ss, ss, ss ) // | |||
@@ -1146,7 +1146,7 @@ public class CassandraMetadataRepository | |||
mailingList.setSubscribeAddress( columnFamilyResult.getString( "subscribeAddress" ) ); | |||
mailingList.setUnsubscribeAddress( columnFamilyResult.getString( "unsubscribeAddress" ) ); | |||
List<String> otherArchives = new ArrayList<String>(); | |||
List<String> otherArchives = new ArrayList<>(); | |||
for ( String columnName : columnFamilyResult.getColumnNames() ) | |||
{ | |||
@@ -1207,7 +1207,7 @@ public class CassandraMetadataRepository | |||
protected List<License> getLicenses( String projectVersionMetadataKey ) | |||
{ | |||
List<License> licenses = new ArrayList<License>(); | |||
List<License> licenses = new ArrayList<>(); | |||
QueryResult<OrderedRows<String, String, String>> result = | |||
HFactory.createRangeSlicesQuery( cassandraArchivaManager.getKeyspace(), ss, ss, ss ) // | |||
@@ -1289,7 +1289,7 @@ public class CassandraMetadataRepository | |||
protected List<Dependency> getDependencies( String projectVersionMetadataKey ) | |||
{ | |||
List<Dependency> dependencies = new ArrayList<Dependency>(); | |||
List<Dependency> dependencies = new ArrayList<>(); | |||
QueryResult<OrderedRows<String, String, String>> result = | |||
HFactory.createRangeSlicesQuery( cassandraArchivaManager.getKeyspace(), ss, ss, ss ) // | |||
@@ -1536,7 +1536,7 @@ public class CassandraMetadataRepository | |||
.addEqualsExpression( "facetId", facetId ) // | |||
.execute(); | |||
final List<String> facets = new ArrayList<String>(); | |||
final List<String> facets = new ArrayList<>(); | |||
for ( Row<String, String, String> row : result.get() ) | |||
{ | |||
@@ -1715,7 +1715,7 @@ public class CassandraMetadataRepository | |||
} | |||
QueryResult<OrderedRows<String, String, Long>> result = query.execute(); | |||
List<ArtifactMetadata> artifactMetadatas = new ArrayList<ArtifactMetadata>( result.get().getCount() ); | |||
List<ArtifactMetadata> artifactMetadatas = new ArrayList<>( result.get().getCount() ); | |||
for ( Row<String, String, Long> row : result.get() ) | |||
{ | |||
@@ -1902,7 +1902,7 @@ public class CassandraMetadataRepository | |||
QueryResult<OrderedRows<String, String, String>> result = query.execute(); | |||
List<ArtifactMetadata> artifactMetadatas = new ArrayList<ArtifactMetadata>( result.get().getCount() ); | |||
List<ArtifactMetadata> artifactMetadatas = new ArrayList<>( result.get().getCount() ); | |||
for ( Row<String, String, String> row : result.get() ) | |||
{ | |||
@@ -1931,14 +1931,14 @@ public class CassandraMetadataRepository | |||
.addEqualsExpression( "version", projectVersion ) // | |||
.execute(); | |||
List<String> dependenciesIds = new ArrayList<String>( result.get().getCount() ); | |||
List<String> dependenciesIds = new ArrayList<>( result.get().getCount() ); | |||
for ( Row<String, String, String> row : result.get().getList() ) | |||
{ | |||
dependenciesIds.add( getStringValue( row.getColumnSlice(), "projectVersionMetadataModel.key" ) ); | |||
} | |||
List<ProjectVersionReference> references = new ArrayList<ProjectVersionReference>( result.get().getCount() ); | |||
List<ProjectVersionReference> references = new ArrayList<>( result.get().getCount() ); | |||
for ( String key : dependenciesIds ) | |||
{ | |||
@@ -2019,7 +2019,7 @@ public class CassandraMetadataRepository | |||
return Collections.emptyList(); | |||
} | |||
List<ArtifactMetadata> artifactMetadatas = new ArrayList<ArtifactMetadata>( result.get().getCount() ); | |||
List<ArtifactMetadata> artifactMetadatas = new ArrayList<>( result.get().getCount() ); | |||
for ( Row<String, String, String> row : result.get() ) | |||
{ | |||
@@ -2059,7 +2059,7 @@ public class CassandraMetadataRepository | |||
} | |||
final List<MetadataFacetModel> metadataFacetModels = | |||
new ArrayList<MetadataFacetModel>( result.get().getCount() ); | |||
new ArrayList<>( result.get().getCount() ); | |||
for ( Row<String, String, String> row : result.get() ) | |||
{ | |||
@@ -2093,14 +2093,14 @@ public class CassandraMetadataRepository | |||
} ); | |||
Iterator<MetadataFacetModel> iterator = metadataFacetModelIterable.iterator(); | |||
Map<String, List<MetadataFacetModel>> metadataFacetValuesPerFacetId = | |||
new HashMap<String, List<MetadataFacetModel>>(); | |||
new HashMap<>(); | |||
while ( iterator.hasNext() ) | |||
{ | |||
MetadataFacetModel metadataFacetModel = iterator.next(); | |||
List<MetadataFacetModel> values = metadataFacetValuesPerFacetId.get( metadataFacetModel.getName() ); | |||
if ( values == null ) | |||
{ | |||
values = new ArrayList<MetadataFacetModel>(); | |||
values = new ArrayList<>(); | |||
metadataFacetValuesPerFacetId.put( metadataFacetModel.getFacetId(), values ); | |||
} | |||
values.add( metadataFacetModel ); |
@@ -137,7 +137,7 @@ public class DefaultCassandraArchivaManager | |||
consistencyLevelPolicy.setDefaultWriteConsistencyLevel( HConsistencyLevel.valueOf( writeConsistencyLevel ) ); | |||
keyspace = HFactory.createKeyspace( keyspaceName, cluster, consistencyLevelPolicy ); | |||
List<ColumnFamilyDefinition> cfds = new ArrayList<ColumnFamilyDefinition>(); | |||
List<ColumnFamilyDefinition> cfds = new ArrayList<>(); | |||
// namespace table | |||
{ |
@@ -57,11 +57,11 @@ public class ProjectVersionMetadataModel | |||
private CiManagement ciManagement; | |||
private List<License> licenses = new ArrayList<License>(); | |||
private List<License> licenses = new ArrayList<>(); | |||
private List<MailingList> mailingLists = new ArrayList<MailingList>(); | |||
private List<MailingList> mailingLists = new ArrayList<>(); | |||
private List<Dependency> dependencies = new ArrayList<Dependency>(); | |||
private List<Dependency> dependencies = new ArrayList<>(); | |||
private boolean incomplete; | |||
@@ -132,7 +132,7 @@ public class FileMetadataRepository | |||
Properties properties = readOrCreateProperties( directory, PROJECT_VERSION_METADATA_KEY ); | |||
// remove properties that are not references or artifacts | |||
for ( Object key : new ArrayList<Object>( properties.keySet() ) ) | |||
for ( Object key : properties.keySet() ) | |||
{ | |||
String name = (String) key; | |||
if ( !name.contains( ":" ) && !name.equals( "facetIds" ) ) | |||
@@ -240,7 +240,7 @@ public class FileMetadataRepository | |||
private static void clearMetadataFacetProperties( Collection<MetadataFacet> facetList, Properties properties, | |||
String prefix ) | |||
{ | |||
List<Object> propsToRemove = new ArrayList<Object>(); | |||
List<Object> propsToRemove = new ArrayList<>(); | |||
for ( MetadataFacet facet : facetList ) | |||
{ | |||
for ( Object key : properties.keySet() ) | |||
@@ -303,7 +303,7 @@ public class FileMetadataRepository | |||
public List<String> getMetadataFacets( String repoId, String facetId ) | |||
{ | |||
File directory = getMetadataDirectory( repoId, facetId ); | |||
List<String> facets = new ArrayList<String>(); | |||
List<String> facets = new ArrayList<>(); | |||
recurse( facets, "", directory ); | |||
return facets; | |||
} | |||
@@ -409,7 +409,7 @@ public class FileMetadataRepository | |||
// TODO: this is quite slow - if we are to persist with this repository implementation we should build an index | |||
// of this information (eg. in Lucene, as before) | |||
List<ArtifactMetadata> artifacts = new ArrayList<ArtifactMetadata>(); | |||
List<ArtifactMetadata> artifacts = new ArrayList<>(); | |||
for ( String ns : getRootNamespaces( repoId ) ) | |||
{ | |||
getArtifactsByDateRange( artifacts, repoId, ns, startTime, endTime ); | |||
@@ -580,7 +580,7 @@ public class FileMetadataRepository | |||
public Collection<String> getRepositories() | |||
{ | |||
List<String> repositories = new ArrayList<String>(); | |||
List<String> repositories = new ArrayList<>(); | |||
for ( ManagedRepositoryConfiguration managedRepositoryConfiguration : configuration.getConfiguration().getManagedRepositories() ) | |||
{ | |||
repositories.add( managedRepositoryConfiguration.getId() ); | |||
@@ -595,7 +595,7 @@ public class FileMetadataRepository | |||
// alternatively, we could build a referential tree in the content repository, however it would need some levels | |||
// of depth to avoid being too broad to be useful (eg. /repository/checksums/a/ab/abcdef1234567) | |||
List<ArtifactMetadata> artifacts = new ArrayList<ArtifactMetadata>(); | |||
List<ArtifactMetadata> artifacts = new ArrayList<>(); | |||
for ( String ns : getRootNamespaces( repositoryId ) ) | |||
{ | |||
getArtifactsByChecksum( artifacts, repositoryId, ns, checksum ); | |||
@@ -642,7 +642,7 @@ public class FileMetadataRepository | |||
properties.remove( "artifact:facetIds:" + id ); | |||
String prefix = "artifact:facet:" + id + ":"; | |||
for ( Object key : new ArrayList<Object>( properties.keySet() ) ) | |||
for ( Object key : properties.keySet() ) | |||
{ | |||
String property = (String) key; | |||
if ( property.startsWith( prefix ) ) | |||
@@ -679,7 +679,7 @@ public class FileMetadataRepository | |||
properties.remove( "artifact:facetIds:" + id ); | |||
String prefix = "artifact:facet:" + id + ":"; | |||
for ( Object key : new ArrayList<Object>( properties.keySet() ) ) | |||
for ( Object key : properties.keySet() ) | |||
{ | |||
String property = (String) key; | |||
if ( property.startsWith( prefix ) ) | |||
@@ -1077,7 +1077,7 @@ public class FileMetadataRepository | |||
Properties properties = readOrCreateProperties( directory, PROJECT_VERSION_METADATA_KEY ); | |||
int numberOfRefs = Integer.parseInt( properties.getProperty( "ref:lastReferenceNum", "-1" ) ) + 1; | |||
List<ProjectVersionReference> references = new ArrayList<ProjectVersionReference>(); | |||
List<ProjectVersionReference> references = new ArrayList<>(); | |||
for ( int i = 0; i < numberOfRefs; i++ ) | |||
{ | |||
ProjectVersionReference reference = new ProjectVersionReference(); | |||
@@ -1098,7 +1098,7 @@ public class FileMetadataRepository | |||
public Collection<String> getNamespaces( String repoId, String baseNamespace ) | |||
{ | |||
List<String> allNamespaces = new ArrayList<String>(); | |||
List<String> allNamespaces = new ArrayList<>(); | |||
File directory = getDirectory( repoId ); | |||
File[] files = directory.listFiles(); | |||
if ( files != null ) | |||
@@ -1112,7 +1112,7 @@ public class FileMetadataRepository | |||
} | |||
} | |||
Set<String> namespaces = new LinkedHashSet<String>(); | |||
Set<String> namespaces = new LinkedHashSet<>(); | |||
int fromIndex = baseNamespace != null ? baseNamespace.length() + 1 : 0; | |||
for ( String namespace : allNamespaces ) | |||
{ | |||
@@ -1129,12 +1129,12 @@ public class FileMetadataRepository | |||
} | |||
} | |||
} | |||
return new ArrayList<String>( namespaces ); | |||
return new ArrayList<>( namespaces ); | |||
} | |||
public Collection<String> getProjects( String repoId, String namespace ) | |||
{ | |||
List<String> projects = new ArrayList<String>(); | |||
List<String> projects = new ArrayList<>(); | |||
File directory = new File( getDirectory( repoId ), namespace ); | |||
File[] files = directory.listFiles(); | |||
if ( files != null ) | |||
@@ -1152,7 +1152,7 @@ public class FileMetadataRepository | |||
public Collection<String> getProjectVersions( String repoId, String namespace, String projectId ) | |||
{ | |||
List<String> projectVersions = new ArrayList<String>(); | |||
List<String> projectVersions = new ArrayList<>(); | |||
File directory = new File( getDirectory( repoId ), namespace + "/" + projectId ); | |||
File[] files = directory.listFiles(); | |||
if ( files != null ) | |||
@@ -1240,7 +1240,7 @@ public class FileMetadataRepository | |||
public List<ArtifactMetadata> getArtifacts( String repoId ) | |||
{ | |||
List<ArtifactMetadata> artifacts = new ArrayList<ArtifactMetadata>(); | |||
List<ArtifactMetadata> artifacts = new ArrayList<>(); | |||
for ( String ns : getRootNamespaces( repoId ) ) | |||
{ | |||
getArtifacts( artifacts, repoId, ns ); |
@@ -423,7 +423,7 @@ public class JcrMetadataRepository | |||
public List<String> getMetadataFacets( String repositoryId, String facetId ) | |||
throws MetadataRepositoryException | |||
{ | |||
List<String> facets = new ArrayList<String>(); | |||
List<String> facets = new ArrayList<>(); | |||
try | |||
{ | |||
@@ -625,7 +625,7 @@ public class JcrMetadataRepository | |||
} | |||
QueryResult result = query.execute(); | |||
artifacts = new ArrayList<ArtifactMetadata>(); | |||
artifacts = new ArrayList<>(); | |||
for ( Node n : JcrUtils.getNodes( result ) ) | |||
{ | |||
artifacts.add( getArtifactFromNode( repoId, n ) ); | |||
@@ -650,7 +650,7 @@ public class JcrMetadataRepository | |||
{ | |||
Node node = root.getNode( "repositories" ); | |||
repositories = new ArrayList<String>(); | |||
repositories = new ArrayList<>(); | |||
NodeIterator i = node.getNodes(); | |||
while ( i.hasNext() ) | |||
{ | |||
@@ -684,7 +684,7 @@ public class JcrMetadataRepository | |||
query.bindValue( "checksum", valueFactory.createValue( checksum ) ); | |||
QueryResult result = query.execute(); | |||
artifacts = new ArrayList<ArtifactMetadata>(); | |||
artifacts = new ArrayList<>(); | |||
for ( Node n : JcrUtils.getNodes( result ) ) | |||
{ | |||
artifacts.add( getArtifactFromNode( repositoryId, n ) ); | |||
@@ -728,7 +728,7 @@ public class JcrMetadataRepository | |||
Query query = getJcrSession().getWorkspace().getQueryManager().createQuery( q, Query.JCR_SQL2 ); | |||
QueryResult result = query.execute(); | |||
artifacts = new ArrayList<ArtifactMetadata>(); | |||
artifacts = new ArrayList<>(); | |||
for ( Node n : JcrUtils.getNodes( result ) ) | |||
{ | |||
if ( n.isNodeType( ARTIFACT_NODE_TYPE ) ) | |||
@@ -988,7 +988,7 @@ public class JcrMetadataRepository | |||
throws MetadataResolutionException | |||
{ | |||
List<ProjectVersionReference> references = new ArrayList<ProjectVersionReference>(); | |||
List<ProjectVersionReference> references = new ArrayList<>(); | |||
// TODO: bind variables instead | |||
String q = "SELECT * FROM [archiva:dependency] WHERE ISDESCENDANTNODE([/repositories/" + repositoryId + | |||
@@ -1200,7 +1200,7 @@ public class JcrMetadataRepository | |||
String projectVersion ) | |||
throws MetadataResolutionException | |||
{ | |||
List<ArtifactMetadata> artifacts = new ArrayList<ArtifactMetadata>(); | |||
List<ArtifactMetadata> artifacts = new ArrayList<>(); | |||
try | |||
{ | |||
@@ -1377,7 +1377,7 @@ public class JcrMetadataRepository | |||
private Collection<String> getNodeNames( String path, String nodeType ) | |||
throws MetadataResolutionException | |||
{ | |||
List<String> names = new ArrayList<String>(); | |||
List<String> names = new ArrayList<>(); | |||
try | |||
{ |
@@ -83,7 +83,7 @@ public class DuplicateArtifactsConsumer | |||
@Inject | |||
private RepositorySessionFactory repositorySessionFactory; | |||
private List<String> includes = new ArrayList<String>(); | |||
private List<String> includes = new ArrayList<>(); | |||
private File repositoryDir; | |||
@@ -272,7 +272,7 @@ public class DefaultRepositoryStatisticsManager | |||
Date startTime, Date endTime ) | |||
throws MetadataRepositoryException | |||
{ | |||
List<RepositoryStatistics> results = new ArrayList<RepositoryStatistics>(); | |||
List<RepositoryStatistics> results = new ArrayList<>(); | |||
List<String> list = metadataRepository.getMetadataFacets( repositoryId, RepositoryStatistics.FACET_ID ); | |||
Collections.sort( list, Collections.reverseOrder() ); | |||
for ( String name : list ) |
@@ -255,7 +255,7 @@ public class RepositoryStatisticsManagerTest | |||
addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) ); | |||
addStats( new Date( current.getTime() - 1000 ), current ); | |||
ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() ); | |||
ArrayList<String> keys = new ArrayList<>( statsCreated.keySet() ); | |||
expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn( keys ); | |||
@@ -299,7 +299,7 @@ public class RepositoryStatisticsManagerTest | |||
addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) ); | |||
addStats( new Date( current.getTime() - 1000 ), current ); | |||
List<String> keys = new ArrayList<String>( statsCreated.keySet() ); | |||
List<String> keys = new ArrayList<>( statsCreated.keySet() ); | |||
expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn( keys ); | |||
@@ -347,7 +347,7 @@ public class RepositoryStatisticsManagerTest | |||
addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) ); | |||
addStats( new Date( current.getTime() - 1000 ), current ); | |||
List<String> keys = new ArrayList<String>( statsCreated.keySet() ); | |||
List<String> keys = new ArrayList<>( statsCreated.keySet() ); | |||
expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn( keys ); | |||
@@ -395,7 +395,7 @@ public class RepositoryStatisticsManagerTest | |||
addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) ); | |||
addStats( new Date( current.getTime() - 1000 ), current ); | |||
ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() ); | |||
ArrayList<String> keys = new ArrayList<>( statsCreated.keySet() ); | |||
expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn( keys ); | |||
@@ -447,7 +447,7 @@ public class RepositoryStatisticsManagerTest | |||
addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) ); | |||
addStats( new Date( current.getTime() - 1000 ), current ); | |||
ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() ); | |||
ArrayList<String> keys = new ArrayList<>( statsCreated.keySet() ); | |||
expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn( keys ); | |||
@@ -285,7 +285,7 @@ public class Maven2RepositoryMerger | |||
Date lastUpdatedTimestamp, String timestamp ) | |||
throws RepositoryMetadataException | |||
{ | |||
ArrayList<String> availableVersions = new ArrayList<String>(); | |||
ArrayList<String> availableVersions = new ArrayList<>(); | |||
String latestVersion = artifactMetadata.getProjectVersion(); | |||
ArchivaRepositoryMetadata projectMetadata = getMetadata( projectMetaDataFileIntargetRepo ); | |||
@@ -376,7 +376,7 @@ public class Maven2RepositoryMerger | |||
{ | |||
List<ArtifactMetadata> targetArtifacts = metadataRepository.getArtifacts( targetRepo ); | |||
List<ArtifactMetadata> sourceArtifacts = metadataRepository.getArtifacts( sourceRepo ); | |||
List<ArtifactMetadata> conflictsArtifacts = new ArrayList<ArtifactMetadata>(); | |||
List<ArtifactMetadata> conflictsArtifacts = new ArrayList<>(); | |||
for ( ArtifactMetadata targetArtifact : targetArtifacts ) | |||
{ |
@@ -68,7 +68,7 @@ public class Maven2RepositoryMergerTest | |||
private List<ArtifactMetadata> getArtifacts() | |||
{ | |||
List<ArtifactMetadata> metadata = new ArrayList<ArtifactMetadata>(); | |||
List<ArtifactMetadata> metadata = new ArrayList<>(); | |||
ArtifactMetadata artifact1 = new ArtifactMetadata(); | |||
artifact1.setNamespace( "com.example.test" ); | |||
artifact1.setProject( "test-artifact" ); | |||
@@ -102,7 +102,7 @@ public class Maven2RepositoryMergerTest | |||
testRepo.setLocation( "target" + File.separatorChar + "test-repository" ); | |||
RepositoryScanningConfiguration repoScanConfig = new RepositoryScanningConfiguration(); | |||
List<String> knownContentConsumers = new ArrayList<String>(); | |||
List<String> knownContentConsumers = new ArrayList<>(); | |||
knownContentConsumers.add( "metadata-updater12" ); | |||
repoScanConfig.setKnownContentConsumers( knownContentConsumers ); | |||
c.setRepositoryScanning( repoScanConfig ); | |||
@@ -151,7 +151,7 @@ public class Maven2RepositoryMergerTest | |||
testRepoWithConflicts.setLocation( sourceRepo ); | |||
RepositoryScanningConfiguration repoScanConfig = new RepositoryScanningConfiguration(); | |||
List<String> knownContentConsumers = new ArrayList<String>(); | |||
List<String> knownContentConsumers = new ArrayList<>(); | |||
knownContentConsumers.add( "metadata-updater" ); | |||
repoScanConfig.setKnownContentConsumers( knownContentConsumers ); | |||
c.setRepositoryScanning( repoScanConfig ); |