MailingList mailingList = new MailingList();
mailingList.setName( "Foo List" );
mailingList.setOtherArchives( Arrays.asList( "other archive" ) );
- metadata.setMailingLists( Arrays.asList( mailingList ) );
+ metadata.setMailingLists( Arrays.asList( mailingList ) );
Scm scm = new Scm();
scm.setConnection( "connection" );
mailingList = metadata.getMailingLists().get( 0 );
assertEquals( "Foo List", mailingList.getName() );
//assertEquals( Collections.singletonList( "other archive" ), mailingList.getOtherArchives() );
- Assertions.assertThat( mailingList.getOtherArchives() ).isNotNull().isNotEmpty().hasSize( 1 ).contains( "other archive" );
+ Assertions.assertThat( mailingList.getOtherArchives() ).isNotNull().isNotEmpty().hasSize( 1 ).contains(
+ "other archive" );
assertEquals( "connection", metadata.getScm().getConnection() );
assertEquals( "dev conn", metadata.getScm().getDeveloperConnection() );
// test it restricts to the appropriate repository
assertEquals( Collections.singletonList( artifact ),
- repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) );
- assertEquals( Collections.singletonList( secondArtifact ),
- repository.getArtifactsByChecksum( OTHER_REPO_ID, TEST_SHA1 ) );
+ new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ) );
+ assertEquals( Collections.singletonList( secondArtifact ), new ArrayList<ArtifactMetadata>(
+ repository.getArtifactsByChecksum( OTHER_REPO_ID, TEST_SHA1 ) ) );
assertEquals( Collections.singletonList( artifact ),
- repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) );
+ new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ) );
assertEquals( Collections.singletonList( secondArtifact ),
- repository.getArtifactsByChecksum( OTHER_REPO_ID, TEST_MD5 ) );
+ new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( OTHER_REPO_ID, TEST_MD5 ) ) );
}
@Test
repository.save();
assertEquals( Collections.singletonList( artifact ),
- repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) );
+ new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ) );
}
@Test
repository.save();
assertEquals( Collections.singletonList( artifact ),
- repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) );
+ new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ) );
}
@Test
repository.save();
assertEquals( Collections.singletonList( artifact ),
- repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) );
+ new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ) );
assertEquals( Collections.singletonList( artifact ),
- repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) );
+ new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ) );
}
@Test
ArtifactMetadata artifact = createArtifact();
repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact );
- Collection<ArtifactMetadata> artifactsByChecksum = repository.getArtifactsByChecksum( TEST_REPO_ID, "not checksum" );
- assertEquals( Collections.<ArtifactMetadata>emptyList(), artifactsByChecksum );
+ Collection<ArtifactMetadata> artifactsByChecksum =
+ repository.getArtifactsByChecksum( TEST_REPO_ID, "not checksum" );
+ Assertions.assertThat( artifactsByChecksum ).isNotNull().isEmpty();
}
}
- protected ArtifactMetadata mapArtifactMetadataLongColumnSlice( ColumnSlice columnSlice )
+ protected ArtifactMetadata mapArtifactMetadataLongColumnSlice( ColumnSlice<String,Long> columnSlice )
{
ArtifactMetadata artifactMetadata = new ArtifactMetadata();
artifactMetadata.setNamespace( getAsStringValue( columnSlice, "namespaceId" ) );
artifactMetadata.setMd5( getAsStringValue( columnSlice, "md5" ) );
artifactMetadata.setProject( getAsStringValue( columnSlice, "project" ) );
artifactMetadata.setProjectVersion( getAsStringValue( columnSlice, "projectVersion" ) );
- artifactMetadata.setRepositoryId( getStringValue( columnSlice, "repositoryName" ) );
+ artifactMetadata.setRepositoryId( getAsStringValue( columnSlice, "repositoryName" ) );
artifactMetadata.setSha1( getAsStringValue( columnSlice, "sha1" ) );
artifactMetadata.setVersion( getAsStringValue( columnSlice, "version" ) );
Long whenGathered = getLongValue( columnSlice, "whenGathered" );
return artifactMetadata;
}
+ protected ArtifactMetadata mapArtifactMetadataStringColumnSlice( ColumnSlice<String,String> columnSlice )
+ {
+ ArtifactMetadata artifactMetadata = new ArtifactMetadata();
+ artifactMetadata.setNamespace( getStringValue( columnSlice, "namespaceId" ) );
+ artifactMetadata.setSize( getAsLongValue( columnSlice, "size" ) );
+ artifactMetadata.setId( getStringValue( columnSlice, "id" ) );
+ artifactMetadata.setFileLastModified( getAsLongValue( columnSlice, "fileLastModified" ) );
+ artifactMetadata.setMd5( getStringValue( columnSlice, "md5" ) );
+ artifactMetadata.setProject( getStringValue( columnSlice, "project" ) );
+ artifactMetadata.setProjectVersion( getStringValue( columnSlice, "projectVersion" ) );
+ artifactMetadata.setRepositoryId( getStringValue( columnSlice, "repositoryName" ) );
+ artifactMetadata.setSha1( getStringValue( columnSlice, "sha1" ) );
+ artifactMetadata.setVersion( getStringValue( columnSlice, "version" ) );
+ Long whenGathered = getAsLongValue( columnSlice, "whenGathered" );
+ if ( whenGathered != null )
+ {
+ artifactMetadata.setWhenGathered( new Date( whenGathered ) );
+ }
+ return artifactMetadata;
+ }
+
protected void populateFacets( final ArtifactMetadata artifactMetadata )
{
/* final List<MetadataFacetModel> metadataFacetModels = new ArrayList<MetadataFacetModel>();
if ( StringUtils.equals( repositoryName, repositoryId ) )
{
- artifactMetadataMap.put( row.getKey(), mapArtifactMetadataLongColumnSlice( columnSlice ) );
+ artifactMetadataMap.put( row.getKey(), mapArtifactMetadataStringColumnSlice( columnSlice ) );
}
}
if ( StringUtils.equals( repositoryName, repositoryId ) )
{
- artifactMetadataMap.put( row.getKey(), mapArtifactMetadataLongColumnSlice( columnSlice ) );
+ artifactMetadataMap.put( row.getKey(), mapArtifactMetadataStringColumnSlice( columnSlice ) );
}
}