@Test public void testBuildTarGz() throws IOException { assertThat( builder.getExtensionFromFile( getFile( "/tmp/foo-1.0.tar.gz" ) ) ).isEqualTo( "tar.gz" ); }
String getExtensionFromFile( StorageAsset file ) { String[] parts = file.getName().split( "-" ); if ( parts.length > 0 ) { Pattern p = Pattern.compile( "\\.([a-z]+[a-z0-9\\.]*)" ); Matcher m = p.matcher( parts[parts.length - 1] ); if ( m.find() ) { return m.group( 1 ); } } return StorageUtil.getExtension( file ); }
ArtifactBuilder { String getExtensionFromFile( StorageAsset file ) { String[] parts = file.getName().split( "-" ); if ( parts.length > 0 ) { Pattern p = Pattern.compile( "\\.([a-z]+[a-z0-9\\.]*)" ); Matcher m = p.matcher( parts[parts.length - 1] ); if ( m.find() ) { return m.group( 1 ); } } return StorageUtil.getExtension( file ); } }
ArtifactBuilder { String getExtensionFromFile( StorageAsset file ) { String[] parts = file.getName().split( "-" ); if ( parts.length > 0 ) { Pattern p = Pattern.compile( "\\.([a-z]+[a-z0-9\\.]*)" ); Matcher m = p.matcher( parts[parts.length - 1] ); if ( m.find() ) { return m.group( 1 ); } } return StorageUtil.getExtension( file ); } ArtifactBuilder(); }
ArtifactBuilder { String getExtensionFromFile( StorageAsset file ) { String[] parts = file.getName().split( "-" ); if ( parts.length > 0 ) { Pattern p = Pattern.compile( "\\.([a-z]+[a-z0-9\\.]*)" ); Matcher m = p.matcher( parts[parts.length - 1] ); if ( m.find() ) { return m.group( 1 ); } } return StorageUtil.getExtension( file ); } ArtifactBuilder(); ArtifactBuilder withManagedRepositoryContent( ManagedRepositoryContent managedRepositoryContent ); ArtifactBuilder forArtifactMetadata( ArtifactMetadata artifactMetadata ); Artifact build(); }
ArtifactBuilder { String getExtensionFromFile( StorageAsset file ) { String[] parts = file.getName().split( "-" ); if ( parts.length > 0 ) { Pattern p = Pattern.compile( "\\.([a-z]+[a-z0-9\\.]*)" ); Matcher m = p.matcher( parts[parts.length - 1] ); if ( m.find() ) { return m.group( 1 ); } } return StorageUtil.getExtension( file ); } ArtifactBuilder(); ArtifactBuilder withManagedRepositoryContent( ManagedRepositoryContent managedRepositoryContent ); ArtifactBuilder forArtifactMetadata( ArtifactMetadata artifactMetadata ); Artifact build();  }