• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SnapshotArtifactRepositoryMetadata类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata的典型用法代码示例。如果您正苦于以下问题:Java SnapshotArtifactRepositoryMetadata类的具体用法?Java SnapshotArtifactRepositoryMetadata怎么用?Java SnapshotArtifactRepositoryMetadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SnapshotArtifactRepositoryMetadata类属于org.apache.maven.artifact.repository.metadata包,在下文中一共展示了SnapshotArtifactRepositoryMetadata类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: resolveLatestSnapshotBuildNumber

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的package包/类
private int resolveLatestSnapshotBuildNumber( Artifact artifact, ArtifactRepository localRepository,
                                              ArtifactRepository remoteRepository )
    throws RepositoryMetadataResolutionException
{
    RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact );

    getLogger().info( "Retrieving previous build number from " + remoteRepository.getId() );
    repositoryMetadataManager.resolveAlways( metadata, localRepository, remoteRepository );

    int buildNumber = 0;
    Metadata repoMetadata = metadata.getMetadata();
    if ( ( repoMetadata != null )
        && ( repoMetadata.getVersioning() != null && repoMetadata.getVersioning().getSnapshot() != null ) )
    {
        buildNumber = repoMetadata.getVersioning().getSnapshot().getBuildNumber();
    }
    return buildNumber;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:19,代码来源:SnapshotTransformation.java


示例2: testV3PomConvertWithRelocation

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的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


示例3: testV3PomWarningsOnConvert

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的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


示例4: testV3PomConvertWithRelocation

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的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


示例5: testV3PomWarningsOnConvert

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的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


示例6: transformForInstall

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的package包/类
public void transformForInstall( Artifact artifact, ArtifactRepository localRepository )
{
    if ( artifact.isSnapshot() )
    {
        Snapshot snapshot = new Snapshot();
        snapshot.setLocalCopy( true );
        RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact, snapshot );

        artifact.addMetadata( metadata );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:12,代码来源:SnapshotTransformation.java


示例7: transformForDeployment

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的package包/类
public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository,
                                    ArtifactRepository localRepository )
    throws ArtifactDeploymentException
{
    if ( artifact.isSnapshot() )
    {
        Snapshot snapshot = new Snapshot();

        snapshot.setTimestamp( getDeploymentTimestamp() );

        // we update the build number anyway so that it doesn't get lost. It requires the timestamp to take effect
        try
        {
            int buildNumber = resolveLatestSnapshotBuildNumber( artifact, localRepository, remoteRepository );

            snapshot.setBuildNumber( buildNumber + 1 );
        }
        catch ( RepositoryMetadataResolutionException e )
        {
            throw new ArtifactDeploymentException( "Error retrieving previous build number for artifact '"
                + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
        }

        RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact, snapshot );

        artifact.setResolvedVersion(
            constructVersion( metadata.getMetadata().getVersioning(), artifact.getBaseVersion() ) );

        artifact.addMetadata( metadata );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:32,代码来源:SnapshotTransformation.java


示例8: testV4PomConvert

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testV4PomConvert()
    throws Exception
{
    // test that it is copied as is

    Artifact artifact = createArtifact( "test", "v4artifact", "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();

    File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
    artifactFile.delete();

    artifactConverter.convert( artifact, targetRepository );
    checkSuccess( artifactConverter );

    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 );

    assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );

    File expectedMetadataFile = getTestFile( "src/test/expected-files/v4-artifact-metadata.xml" );

    compareFiles( expectedMetadataFile, artifactMetadataFile );

    assertTrue( "Check snapshot metadata created", versionMetadataFile.exists() );

    expectedMetadataFile = getTestFile( "src/test/expected-files/v4-version-metadata.xml" );

    compareFiles( expectedMetadataFile, versionMetadataFile );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:46,代码来源:LegacyToDefaultConverterTest.java


示例9: testV3PomConvert

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testV3PomConvert()
    throws Exception
{
    // test that the pom is coverted

    Artifact artifact = createArtifact( "test", "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( 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 expectedPomFile = getTestFile( "src/test/expected-files/converted-v3.pom" );
    assertTrue( "Check POM created", pomFile.exists() );

    compareFiles( expectedPomFile, pomFile );

    assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );

    File expectedMetadataFile = getTestFile( "src/test/expected-files/v3-artifact-metadata.xml" );

    compareFiles( expectedMetadataFile, artifactMetadataFile );

    assertTrue( "Check snapshot metadata created", versionMetadataFile.exists() );

    expectedMetadataFile = getTestFile( "src/test/expected-files/v3-version-metadata.xml" );

    compareFiles( expectedMetadataFile, versionMetadataFile );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:44,代码来源:LegacyToDefaultConverterTest.java


示例10: doTestV4SnapshotPomConvert

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的package包/类
private void doTestV4SnapshotPomConvert( String version, String expectedMetadataFileName )
    throws Exception
{
    // test that it is copied as is

    Artifact artifact = createArtifact( "test", "v4artifact", version );
    ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
    File artifactMetadataFile = new File( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
    artifactMetadataFile.delete();

    ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
    File snapshotMetadataFile = new File( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) );
    snapshotMetadataFile.delete();

    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 );

    assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );

    File expectedMetadataFile = getTestFile( "src/test/expected-files/v4-snapshot-artifact-metadata.xml" );

    compareFiles( expectedMetadataFile, artifactMetadataFile );

    assertTrue( "Check snapshot metadata created", snapshotMetadataFile.exists() );

    expectedMetadataFile = getTestFile( expectedMetadataFileName );

    compareFiles( expectedMetadataFile, snapshotMetadataFile );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:43,代码来源:LegacyToDefaultConverterTest.java


示例11: testV3SnapshotPomConvert

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testV3SnapshotPomConvert()
    throws Exception
{
    // test that the pom is coverted

    Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0-SNAPSHOT" );
    ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
    File artifactMetadataFile = new File( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
    artifactMetadataFile.delete();

    ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
    File snapshotMetadataFile = new File( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) );
    snapshotMetadataFile.delete();

    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 expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-snapshot.pom" );
    assertTrue( "Check POM created", pomFile.exists() );

    compareFiles( expectedPomFile, pomFile );

    assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );

    File expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-artifact-metadata.xml" );

    compareFiles( expectedMetadataFile, artifactMetadataFile );

    assertTrue( "Check snapshot metadata created", snapshotMetadataFile.exists() );

    expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-metadata.xml" );

    compareFiles( expectedMetadataFile, snapshotMetadataFile );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:44,代码来源:LegacyToDefaultConverterTest.java


示例12: testV3TimestampedSnapshotPomConvert

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testV3TimestampedSnapshotPomConvert()
    throws Exception
{
    // test that the pom is coverted

    Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0-20060105.130101-3" );
    ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
    File artifactMetadataFile = new File( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
    artifactMetadataFile.delete();

    ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
    File snapshotMetadataFile = new File( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) );
    snapshotMetadataFile.delete();

    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 expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-timestamped-snapshot.pom" );
    assertTrue( "Check POM created", pomFile.exists() );

    compareFiles( expectedPomFile, pomFile );

    assertTrue( "Check artifact snapshotMetadata created", artifactMetadataFile.exists() );

    File expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-artifact-metadata.xml" );

    compareFiles( expectedMetadataFile, artifactMetadataFile );

    assertTrue( "Check snapshot snapshotMetadata created", snapshotMetadataFile.exists() );

    expectedMetadataFile = getTestFile( "src/test/expected-files/v3-timestamped-snapshot-metadata.xml" );

    compareFiles( expectedMetadataFile, snapshotMetadataFile );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:44,代码来源:LegacyToDefaultConverterTest.java


示例13: testRollbackArtifactCreated

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testRollbackArtifactCreated()
    throws Exception
{
    // test rollback can remove a created artifact, including checksums

    Artifact artifact = createArtifact( "test", "rollback-created-artifact", "1.0.0" );
    ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
    File artifactMetadataFile = new File( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
    FileUtils.deleteDirectory( artifactMetadataFile.getParentFile() );

    ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
    File versionMetadataFile = new File( targetRepository.getBasedir(),
                                         targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );

    File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );

    artifactConverter.convert( artifact, targetRepository );
    checkWarnings( artifactConverter, 2 );

    boolean found = false;
    String pattern = "^" + Messages.getString( "invalid.source.pom" ).replaceFirst( "\\{0\\}", ".*" ) + "$";
    for ( List<String> messages : artifactConverter.getWarnings().values() )
    {
        for ( String message : messages )
        {
            if ( message.matches( pattern ) )
            {
                found = true;
                break;
            }
        }

        if ( found )
        {
            break;
        }
    }

    assertTrue( "Check failure message.", found );

    assertFalse( "check artifact rolled back", artifactFile.exists() );
    assertFalse( "check metadata rolled back", artifactMetadataFile.exists() );
    assertFalse( "check metadata rolled back", versionMetadataFile.exists() );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:47,代码来源:LegacyToDefaultConverterTest.java


示例14: testV4PomConvert

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testV4PomConvert()
    throws Exception
{
    // test that it is copied as is

    Artifact artifact = createArtifact( "test", "v4artifact", "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);

    Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
    Files.deleteIfExists(artifactFile);

    artifactConverter.convert( artifact, targetRepository );
    checkSuccess( artifactConverter );

    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 sourcePomFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
    assertTrue( "Check POM created", Files.exists(pomFile) );

    compareFiles( sourcePomFile, pomFile );

    assertTrue( "Check artifact metadata created", Files.exists(artifactMetadataFile) );

    Path expectedMetadataFile = getTestFile( "src/test/expected-files/v4-artifact-metadata.xml" );

    compareFiles( expectedMetadataFile, artifactMetadataFile );

    assertTrue( "Check snapshot metadata created", Files.exists(versionMetadataFile) );

    expectedMetadataFile = getTestFile( "src/test/expected-files/v4-version-metadata.xml" );

    compareFiles( expectedMetadataFile, versionMetadataFile );
}
 
开发者ID:apache,项目名称:archiva,代码行数:46,代码来源:LegacyToDefaultConverterTest.java


示例15: testV3PomConvert

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testV3PomConvert()
    throws Exception
{
    // test that the pom is coverted

    Artifact artifact = createArtifact( "test", "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( artifactConverter );

    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.pom" );
    assertTrue( "Check POM created", Files.exists(pomFile) );

    compareFiles( expectedPomFile, pomFile );

    assertTrue( "Check artifact metadata created", Files.exists(artifactMetadataFile) );

    Path expectedMetadataFile = getTestFile( "src/test/expected-files/v3-artifact-metadata.xml" );

    compareFiles( expectedMetadataFile, artifactMetadataFile );

    assertTrue( "Check snapshot metadata created", Files.exists(versionMetadataFile) );

    expectedMetadataFile = getTestFile( "src/test/expected-files/v3-version-metadata.xml" );

    compareFiles( expectedMetadataFile, versionMetadataFile );
}
 
开发者ID:apache,项目名称:archiva,代码行数:44,代码来源:LegacyToDefaultConverterTest.java


示例16: doTestV4SnapshotPomConvert

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的package包/类
private void doTestV4SnapshotPomConvert( String version, String expectedMetadataFileName )
    throws Exception
{
    // test that it is copied as is

    Artifact artifact = createArtifact( "test", "v4artifact", version );
    ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
    Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
    Files.deleteIfExists(artifactMetadataFile);

    ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
    Path snapshotMetadataFile = Paths.get( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) );
    Files.deleteIfExists(snapshotMetadataFile);

    artifactConverter.convert( artifact, targetRepository );
    checkSuccess( artifactConverter );

    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 sourcePomFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
    assertTrue( "Check POM created", Files.exists(pomFile) );

    compareFiles( sourcePomFile, pomFile );

    assertTrue( "Check artifact metadata created", Files.exists(artifactMetadataFile) );

    Path expectedMetadataFile = getTestFile( "src/test/expected-files/v4-snapshot-artifact-metadata.xml" );

    compareFiles( expectedMetadataFile, artifactMetadataFile );

    assertTrue( "Check snapshot metadata created", Files.exists(snapshotMetadataFile) );

    expectedMetadataFile = getTestFile( expectedMetadataFileName );

    compareFiles( expectedMetadataFile, snapshotMetadataFile );
}
 
开发者ID:apache,项目名称:archiva,代码行数:43,代码来源:LegacyToDefaultConverterTest.java


示例17: testV3SnapshotPomConvert

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testV3SnapshotPomConvert()
    throws Exception
{
    // test that the pom is coverted

    Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0-SNAPSHOT" );
    ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
    Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
    Files.deleteIfExists(artifactMetadataFile);

    ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
    Path snapshotMetadataFile = Paths.get( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) );
    Files.deleteIfExists(snapshotMetadataFile);

    artifactConverter.convert( artifact, targetRepository );
    checkSuccess( artifactConverter );

    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-snapshot.pom" );
    assertTrue( "Check POM created", Files.exists(pomFile) );

    compareFiles( expectedPomFile, pomFile );

    assertTrue( "Check artifact metadata created", Files.exists(artifactMetadataFile) );

    Path expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-artifact-metadata.xml" );

    compareFiles( expectedMetadataFile, artifactMetadataFile );

    assertTrue( "Check snapshot metadata created", Files.exists(snapshotMetadataFile) );

    expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-metadata.xml" );

    compareFiles( expectedMetadataFile, snapshotMetadataFile );
}
 
开发者ID:apache,项目名称:archiva,代码行数:44,代码来源:LegacyToDefaultConverterTest.java


示例18: testV3TimestampedSnapshotPomConvert

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testV3TimestampedSnapshotPomConvert()
    throws Exception
{
    // test that the pom is coverted

    Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0-20060105.130101-3" );
    ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
    Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
    Files.deleteIfExists(artifactMetadataFile);

    ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
    Path snapshotMetadataFile = Paths.get( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) );
    Files.deleteIfExists(snapshotMetadataFile);

    artifactConverter.convert( artifact, targetRepository );
    checkSuccess( artifactConverter );

    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-timestamped-snapshot.pom" );
    assertTrue( "Check POM created", Files.exists(pomFile) );

    compareFiles( expectedPomFile, pomFile );

    assertTrue( "Check artifact snapshotMetadata created", Files.exists(artifactMetadataFile) );

    Path expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-artifact-metadata.xml" );

    compareFiles( expectedMetadataFile, artifactMetadataFile );

    assertTrue( "Check snapshot snapshotMetadata created", Files.exists(snapshotMetadataFile) );

    expectedMetadataFile = getTestFile( "src/test/expected-files/v3-timestamped-snapshot-metadata.xml" );

    compareFiles( expectedMetadataFile, snapshotMetadataFile );
}
 
开发者ID:apache,项目名称:archiva,代码行数:44,代码来源:LegacyToDefaultConverterTest.java


示例19: testRollbackArtifactCreated

import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; //导入依赖的package包/类
@Test
public void testRollbackArtifactCreated()
    throws Exception
{
    // test rollback can remove a created artifact, including checksums

    Artifact artifact = createArtifact( "test", "rollback-created-artifact", "1.0.0" );
    ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
    Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
    org.apache.archiva.common.utils.FileUtils.deleteDirectory( artifactMetadataFile.getParent() );

    ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
    Path versionMetadataFile = Paths.get( targetRepository.getBasedir(),
                                         targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );

    Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact )  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MarkupLanguage类代码示例发布时间:2022-05-22
下一篇:
Java Observation类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap