本文整理汇总了Java中org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata类的典型用法代码示例。如果您正苦于以下问题:Java ArtifactRepositoryMetadata类的具体用法?Java ArtifactRepositoryMetadata怎么用?Java ArtifactRepositoryMetadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArtifactRepositoryMetadata类属于org.apache.maven.artifact.repository.metadata包,在下文中一共展示了ArtifactRepositoryMetadata类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testIncorrectSourceChecksumMd5
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testIncorrectSourceChecksumMd5()
throws Exception
{
// test that it fails when the source md5 is wrong
Artifact artifact = createArtifact( "test", "incorrectMd5Artifact", "1.0.0" );
File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
file.delete();
artifactConverter.convert( artifact, targetRepository );
checkWarnings( artifactConverter, 2 );
assertHasWarningReason( artifactConverter, Messages.getString( "failure.incorrect.md5" ) );
assertFalse( "Check artifact not created", file.exists() );
ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
File metadataFile =
new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
assertFalse( "Check metadata not created", metadataFile.exists() );
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:23,代码来源:LegacyToDefaultConverterTest.java
示例2: testIncorrectSourceChecksumSha1
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testIncorrectSourceChecksumSha1()
throws Exception
{
// test that it fails when the source sha1 is wrong
Artifact artifact = createArtifact( "test", "incorrectSha1Artifact", "1.0.0" );
File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
file.delete();
artifactConverter.convert( artifact, targetRepository );
checkWarnings( artifactConverter, 2 );
assertHasWarningReason( artifactConverter, Messages.getString( "failure.incorrect.sha1" ) );
assertFalse( "Check artifact not created", file.exists() );
ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
File metadataFile =
new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
assertFalse( "Check metadata not created", metadataFile.exists() );
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:23,代码来源:LegacyToDefaultConverterTest.java
示例3: testInvalidSourceArtifactMetadata
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testInvalidSourceArtifactMetadata()
throws Exception
{
// test artifact is not converted when source metadata is invalid, and returns failure
createModernSourceRepository();
Artifact artifact = createArtifact( "test", "incorrectArtifactMetadata", "1.0.0" );
File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
file.delete();
artifactConverter.convert( artifact, targetRepository );
checkWarnings( artifactConverter, 2 );
assertHasWarningReason( artifactConverter,
Messages.getString( "failure.incorrect.artifactMetadata.versions" ) );
assertFalse( "Check artifact not created", file.exists() );
ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
File metadataFile =
new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
assertFalse( "Check metadata not created", metadataFile.exists() );
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:26,代码来源:LegacyToDefaultConverterTest.java
示例4: testInvalidSourceSnapshotMetadata
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testInvalidSourceSnapshotMetadata()
throws Exception
{
// test artifact is not converted when source snapshot metadata is invalid and returns failure
createModernSourceRepository();
Artifact artifact = createArtifact( "test", "incorrectSnapshotMetadata", "1.0.0-20060102.030405-6" );
File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
file.delete();
artifactConverter.convert( artifact, targetRepository );
checkWarnings( artifactConverter, 2 );
assertHasWarningReason( artifactConverter,
Messages.getString( "failure.incorrect.snapshotMetadata.snapshot" ) );
assertFalse( "Check artifact not created", file.exists() );
ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
File metadataFile =
new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
assertFalse( "Check metadata not created", metadataFile.exists() );
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:26,代码来源:LegacyToDefaultConverterTest.java
示例5: retrieveLatestReleasedVersion
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
private String retrieveLatestReleasedVersion(final Artifact artifact) {
final RepositoryMetadata metadata = new ArtifactRepositoryMetadata(artifact);
try {
repositoryMetadataManager.resolve(metadata, currentProject.getRemoteArtifactRepositories(), localRepository);
} catch (final RepositoryMetadataResolutionException e1) {
e1.printStackTrace();
}
final Metadata repoMetadata = metadata.getMetadata();
if (repoMetadata.getVersioning() != null) {
final String releasedVersion = repoMetadata.getVersioning().getRelease();
if (releasedVersion != null) {
return releasedVersion;
}
final String latestVersion = repoMetadata.getVersioning().getLatest();
if (latestVersion != null) {
return latestVersion;
}
}
return repoMetadata.getVersion();
}
开发者ID:portofrotterdam,项目名称:versiondebt-plugin,代码行数:22,代码来源:VersiondebtMojo.java
示例6: testIncorrectSourceChecksumMd5
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testIncorrectSourceChecksumMd5()
throws Exception
{
// test that it fails when the source md5 is wrong
Artifact artifact = createArtifact( "test", "incorrectMd5Artifact", "1.0.0" );
Path file = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
Files.deleteIfExists(file);
artifactConverter.convert( artifact, targetRepository );
checkWarnings( artifactConverter, 2 );
assertHasWarningReason( artifactConverter, Messages.getString( "failure.incorrect.md5" ) );
assertFalse( "Check artifact not created", Files.exists(file) );
ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
Path metadataFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
assertFalse( "Check metadata not created", Files.exists(metadataFile) );
}
开发者ID:apache,项目名称:archiva,代码行数:22,代码来源:LegacyToDefaultConverterTest.java
示例7: testIncorrectSourceChecksumSha1
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testIncorrectSourceChecksumSha1()
throws Exception
{
// test that it fails when the source sha1 is wrong
Artifact artifact = createArtifact( "test", "incorrectSha1Artifact", "1.0.0" );
Path file = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
Files.deleteIfExists(file);
artifactConverter.convert( artifact, targetRepository );
checkWarnings( artifactConverter, 2 );
assertHasWarningReason( artifactConverter, Messages.getString( "failure.incorrect.sha1" ) );
assertFalse( "Check artifact not created", Files.exists(file) );
ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
Path metadataFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
assertFalse( "Check metadata not created", Files.exists(metadataFile) );
}
开发者ID:apache,项目名称:archiva,代码行数:22,代码来源:LegacyToDefaultConverterTest.java
示例8: testInvalidSourceArtifactMetadata
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testInvalidSourceArtifactMetadata()
throws Exception
{
// test artifact is not converted when source metadata is invalid, and returns failure
createModernSourceRepository();
Artifact artifact = createArtifact( "test", "incorrectArtifactMetadata", "1.0.0" );
Path file = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
Files.deleteIfExists(file);
artifactConverter.convert( artifact, targetRepository );
checkWarnings( artifactConverter, 2 );
assertHasWarningReason( artifactConverter,
Messages.getString( "failure.incorrect.artifactMetadata.versions" ) );
assertFalse( "Check artifact not created", Files.exists(file) );
ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
Path metadataFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
assertFalse( "Check metadata not created", Files.exists(metadataFile) );
}
开发者ID:apache,项目名称:archiva,代码行数:25,代码来源:LegacyToDefaultConverterTest.java
示例9: testInvalidSourceSnapshotMetadata
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testInvalidSourceSnapshotMetadata()
throws Exception
{
// test artifact is not converted when source snapshot metadata is invalid and returns failure
createModernSourceRepository();
Artifact artifact = createArtifact( "test", "incorrectSnapshotMetadata", "1.0.0-20060102.030405-6" );
Path file = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
Files.deleteIfExists(file);
artifactConverter.convert( artifact, targetRepository );
checkWarnings( artifactConverter, 2 );
assertHasWarningReason( artifactConverter,
Messages.getString( "failure.incorrect.snapshotMetadata.snapshot" ) );
assertFalse( "Check artifact not created", Files.exists(file) );
ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
Path metadataFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
assertFalse( "Check metadata not created", Files.exists(metadataFile) );
}
开发者ID:apache,项目名称:archiva,代码行数:25,代码来源:LegacyToDefaultConverterTest.java
示例10: testMetadata
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
public void testMetadata() throws Exception
{
ArtifactRepository remoteRepository = remoteRepository();
ArtifactRepository localRepository = localRepository();
Artifact a = createRemoteArtifact( "a", "0.0.1-SNAPSHOT" );
RepositoryMetadata metadata = new ArtifactRepositoryMetadata( a );
File file = new File( localRepository.getBasedir(),
localRepository.pathOfLocalRepositoryMetadata( metadata, localRepository ) );
file.delete();
File touchFile = updateCheckManager.getTouchfile( metadata, file );
touchFile.delete();
assertTrue( updateCheckManager.isUpdateRequired( metadata, remoteRepository, file ) );
file.getParentFile().mkdirs();
file.createNewFile();
updateCheckManager.touch( metadata, remoteRepository, file );
assertFalse( updateCheckManager.isUpdateRequired( metadata, remoteRepository, file ) );
assertNotNull( updateCheckManager.readLastUpdated( touchFile, updateCheckManager.getMetadataKey( remoteRepository, file ) ) );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:27,代码来源:DefaultUpdateCheckManagerTest.java
示例11: retrieveAvailableVersions
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
public List<ArtifactVersion> retrieveAvailableVersions( MetadataResolutionRequest request )
throws ArtifactMetadataRetrievalException
{
RepositoryMetadata metadata = new ArtifactRepositoryMetadata( request.getArtifact() );
try
{
repositoryMetadataManager.resolve( metadata, request );
}
catch ( RepositoryMetadataResolutionException e )
{
throw new ArtifactMetadataRetrievalException( e.getMessage(), e, request.getArtifact() );
}
List<String> availableVersions = request.getLocalRepository().findVersions( request.getArtifact() );
return retrieveAvailableVersionsFromMetadata( metadata.getMetadata(), availableVersions );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:19,代码来源:MavenMetadataSource.java
示例12: retrieveAvailableVersionsFromDeploymentRepository
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
public List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact,
ArtifactRepository localRepository,
ArtifactRepository deploymentRepository )
throws ArtifactMetadataRetrievalException
{
RepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
try
{
repositoryMetadataManager.resolveAlways( metadata, localRepository, deploymentRepository );
}
catch ( RepositoryMetadataResolutionException e )
{
throw new ArtifactMetadataRetrievalException( e.getMessage(), e, artifact );
}
List<String> availableVersions = localRepository.findVersions( artifact );
return retrieveAvailableVersionsFromMetadata( metadata.getMetadata(), availableVersions );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:21,代码来源:MavenMetadataSource.java
示例13: testV3PomConvertWithRelocation
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testV3PomConvertWithRelocation()
throws Exception
{
Artifact artifact = createArtifact( "test", "relocated-v3artifact", "1.0.0" );
ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
File artifactMetadataFile = new File( targetRepository.getBasedir(),
targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
artifactMetadataFile.delete();
ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
File versionMetadataFile = new File( targetRepository.getBasedir(),
targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
versionMetadataFile.delete();
artifactConverter.convert( artifact, targetRepository );
//checkSuccess(); --> commented until MNG-2100 is fixed
File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
assertTrue( "Check if relocated artifact created", artifactFile.exists() );
assertTrue( "Check if relocated artifact matches",
FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
Artifact pomArtifact = createArtifact( "relocated-test", "relocated-v3artifact", "1.0.0", "1.0.0", "pom" );
File pomFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( pomArtifact ) );
File testFile = getTestFile( "target/test-target-repository/" + targetRepository.pathOf( pomArtifact ) );
compareFiles( pomFile, testFile );
Artifact orig = createArtifact( "test", "relocated-v3artifact", "1.0.0", "1.0.0", "pom" );
artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( orig ) );
assertTrue( "Check if relocation artifact pom is created", artifactFile.exists() );
testFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( orig ) );
compareFiles( artifactFile, testFile );
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:34,代码来源:LegacyToDefaultConverterTest.java
示例14: testV3PomWarningsOnConvert
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testV3PomWarningsOnConvert()
throws Exception
{
// test that the pom is converted but that warnings are reported
Artifact artifact = createArtifact( "test", "v3-warnings-artifact", "1.0.0" );
ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
File artifactMetadataFile = new File( targetRepository.getBasedir(),
targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
artifactMetadataFile.delete();
ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
File versionMetadataFile = new File( targetRepository.getBasedir(),
targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
versionMetadataFile.delete();
artifactConverter.convert( artifact, targetRepository );
checkWarnings( artifactConverter, 2 );
File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
assertTrue( "Check artifact created", artifactFile.exists() );
assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
artifact = createPomArtifact( artifact );
File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-warnings.pom" );
assertTrue( "Check POM created", pomFile.exists() );
compareFiles( expectedPomFile, pomFile );
// TODO: check 2 warnings (extend and versions) matched on i18n key
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:34,代码来源:LegacyToDefaultConverterTest.java
示例15: testModifedArtifactFails
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testModifedArtifactFails()
throws Exception
{
// test that it fails when the source artifact has changed and is different to the existing artifact in the
// target repository
Artifact artifact = createArtifact( "test", "modified-artifact", "1.0.0" );
Artifact pomArtifact = createPomArtifact( artifact );
File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
assertTrue( "Check target file exists", targetFile.exists() );
assertTrue( "Check target POM exists", targetPomFile.exists() );
sourceFile.setLastModified( System.currentTimeMillis() );
sourcePomFile.setLastModified( System.currentTimeMillis() );
long origTime = targetFile.lastModified();
long origPomTime = targetPomFile.lastModified();
// Need to guarantee last modified is not equal
Thread.sleep( SLEEP_MILLIS );
artifactConverter.convert( artifact, targetRepository );
checkWarnings( artifactConverter, 2 );
assertHasWarningReason( artifactConverter, Messages.getString( "failure.target.already.exists" ) );
assertEquals( "Check unmodified", origTime, targetFile.lastModified() );
assertEquals( "Check unmodified", origPomTime, targetPomFile.lastModified() );
ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
File metadataFile =
new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
assertFalse( "Check metadata not created", metadataFile.exists() );
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:41,代码来源:LegacyToDefaultConverterTest.java
示例16: testForcedUnmodifiedArtifact
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testForcedUnmodifiedArtifact()
throws Exception
{
// test unmodified artifact is still converted when set to force
artifactConverter =
applicationContext.getBean( "artifactConverter#force-repository-converter", ArtifactConverter.class );
Artifact artifact = createArtifact( "test", "unmodified-artifact", "1.0.0" );
Artifact pomArtifact = createPomArtifact( artifact );
File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd", Locale.getDefault() );
long origTime = dateFormat.parse( "2006-03-03" ).getTime();
targetFile.setLastModified( origTime );
targetPomFile.setLastModified( origTime );
sourceFile.setLastModified( dateFormat.parse( "2006-01-01" ).getTime() );
sourcePomFile.setLastModified( dateFormat.parse( "2006-02-02" ).getTime() );
artifactConverter.convert( artifact, targetRepository );
checkSuccess( artifactConverter );
compareFiles( sourceFile, targetFile );
compareFiles( sourcePomFile, targetPomFile );
assertFalse( "Check modified", origTime == targetFile.lastModified() );
assertFalse( "Check modified", origTime == targetPomFile.lastModified() );
ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
File metadataFile =
new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
assertTrue( "Check metadata created", metadataFile.exists() );
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:40,代码来源:LegacyToDefaultConverterTest.java
示例17: testDryRunSuccess
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testDryRunSuccess()
throws Exception
{
// test dry run does nothing on a run that will be successful, and returns success
artifactConverter =
applicationContext.getBean( "artifactConverter#dryrun-repository-converter", ArtifactConverter.class );
Artifact artifact = createArtifact( "test", "dryrun-artifact", "1.0.0" );
Artifact pomArtifact = createPomArtifact( artifact );
File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
// clear warning before test related to MRM-1638
artifactConverter.clearWarnings();
artifactConverter.convert( artifact, targetRepository );
checkSuccess( artifactConverter );
assertTrue( "Check source file exists", sourceFile.exists() );
assertTrue( "Check source POM exists", sourcePomFile.exists() );
assertFalse( "Check target file doesn't exist", targetFile.exists() );
assertFalse( "Check target POM doesn't exist", targetPomFile.exists() );
ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
File metadataFile =
new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
assertFalse( "Check metadata not created", metadataFile.exists() );
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:34,代码来源:LegacyToDefaultConverterTest.java
示例18: testMergeArtifactMetadata
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testMergeArtifactMetadata()
throws Exception
{
// test artifact level metadata is merged when it already exists on successful conversion
Artifact artifact = createArtifact( "test", "newversion-artifact", "1.0.1" );
artifactConverter.convert( artifact, targetRepository );
checkSuccess( artifactConverter );
File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
assertTrue( "Check artifact created", artifactFile.exists() );
assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
artifact = createPomArtifact( artifact );
File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
assertTrue( "Check POM created", pomFile.exists() );
compareFiles( sourcePomFile, pomFile );
ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
File artifactMetadataFile = new File( targetRepository.getBasedir(),
targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );
File expectedMetadataFile = getTestFile( "src/test/expected-files/newversion-artifact-metadata.xml" );
compareFiles( expectedMetadataFile, artifactMetadataFile );
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:31,代码来源:LegacyToDefaultConverterTest.java
示例19: testV3PomConvertWithRelocation
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testV3PomConvertWithRelocation()
throws Exception
{
Artifact artifact = createArtifact( "test", "relocated-v3artifact", "1.0.0" );
ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
Files.deleteIfExists(artifactMetadataFile);
ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
Path versionMetadataFile = Paths.get( targetRepository.getBasedir(),
targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
Files.deleteIfExists(versionMetadataFile);
artifactConverter.convert( artifact, targetRepository );
//checkSuccess(); --> commented until MNG-2100 is fixed
Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
assertTrue( "Check if relocated artifact created", Files.exists(artifactFile) );
assertTrue( "Check if relocated artifact matches",
FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );
Artifact pomArtifact = createArtifact( "relocated-test", "relocated-v3artifact", "1.0.0", "1.0.0", "pom" );
Path pomFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( pomArtifact ) );
Path testFile = getTestFile( "target/test-target-repository/" + targetRepository.pathOf( pomArtifact ) );
compareFiles( pomFile, testFile );
Artifact orig = createArtifact( "test", "relocated-v3artifact", "1.0.0", "1.0.0", "pom" );
artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( orig ) );
assertTrue( "Check if relocation artifact pom is created", Files.exists(artifactFile) );
testFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( orig ) );
compareFiles( artifactFile, testFile );
}
开发者ID:apache,项目名称:archiva,代码行数:34,代码来源:LegacyToDefaultConverterTest.java
示例20: testV3PomWarningsOnConvert
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testV3PomWarningsOnConvert()
throws Exception
{
// test that the pom is converted but that warnings are reported
Artifact artifact = createArtifact( "test", "v3-warnings-artifact", "1.0.0" );
ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
Files.deleteIfExists(artifactMetadataFile);
ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
Path versionMetadataFile = Paths.get( targetRepository.getBasedir(),
targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
Files.deleteIfExists(versionMetadataFile);
artifactConverter.convert( artifact, targetRepository );
checkWarnings( artifactConverter, 2 );
Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
assertTrue( "Check artifact created", Files.exists(artifactFile) );
assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );
artifact = createPomArtifact( artifact );
Path pomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
Path expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-warnings.pom" );
assertTrue( "Check POM created", Files.exists(pomFile) );
compareFiles( expectedPomFile, pomFile );
// TODO: check 2 warnings (extend and versions) matched on i18n key
}
开发者ID:apache,项目名称:archiva,代码行数:34,代码来源:LegacyToDefaultConverterTest.java
注:本文中的org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论