Package org.apache.maven.archiva.model

Examples of org.apache.maven.archiva.model.ArchivaArtifact


        throws Exception
    {
        List<ArchivaArtifact> newArtifacts = new ArrayList<ArchivaArtifact>();
        Date whenGathered = Calendar.getInstance().getTime();

        ArchivaArtifact artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-one", "1.0", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        newArtifacts.add( artifact );

        artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-one", "1.1", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        newArtifacts.add( artifact );

        artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-one", "2.0", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        newArtifacts.add( artifact );

        artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-two", "1.0.1", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        newArtifacts.add( artifact );

        artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-two", "1.0.2", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        newArtifacts.add( artifact );

        artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-two", "1.0.3-SNAPSHOT", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        newArtifacts.add( artifact );

        artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-three", "2.0-SNAPSHOT", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        newArtifacts.add( artifact );

        artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-four", "1.1-beta-2", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        newArtifacts.add( artifact );

        artifactDAOStub.setArtifacts( newArtifacts );

        Map<String, String> reqParams = new HashMap<String, String>();
View Full Code Here


        }
    }

    private ArchivaArtifact createArtifact( String repoId, String groupId, String artifactId, String version )
    {
        ArchivaArtifact artifact = artifactDao.createArtifact( groupId, artifactId, version, "", "jar" );
        artifact.getModel().setLastModified( new Date() ); // mandatory field.
        artifact.getModel().setRepositoryId( repoId );
        return artifact;
    }
View Full Code Here

    }

    private void setupArtifacts()
        throws Exception
    {
        ArchivaArtifact artifact;

        // Setup artifacts in fresh DB.
        artifact = createArtifact( "central", "commons-lang", "commons-lang", "2.0" );
        artifactDao.saveArtifact( artifact );
View Full Code Here

        artifactDao = dao.getArtifactDAO();
    }

    public ArchivaArtifact createArtifact( String artifactId, String version, int daysOld )
    {
        ArchivaArtifact artifact = artifactDao.createArtifact( "org.apache.maven.archiva.test", artifactId, version,
                                                               "", "jar" );
        Calendar cal = Calendar.getInstance();
        cal.add( Calendar.DAY_OF_MONTH, ( -1 ) * daysOld );
        artifact.getModel().setLastModified( cal.getTime() );
        artifact.getModel().setRepositoryId( "testable_repo" );
        return artifact;
    }
View Full Code Here

    }

    public void testConstraint()
        throws Exception
    {
        ArchivaArtifact artifact;

        // Setup artifacts in fresh DB.
        artifact = createArtifact( "test-one", "1.0", 200 );
        artifactDao.saveArtifact( artifact );
View Full Code Here

        List<ArchivaArtifact> artifacts = new ArrayList<ArchivaArtifact>();

        Date whenGathered = Calendar.getInstance().getTime();
        whenGathered.setTime( 123456789 );

        ArchivaArtifact artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-one", "1.0", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifacts.add( artifact );

        artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-one", "1.1", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifacts.add( artifact );

        artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-one", "2.0", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifacts.add( artifact );

        artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-two", "1.0.1", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifacts.add( artifact );

        artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-two", "1.0.2", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifacts.add( artifact );

        artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-two", "1.0.3-SNAPSHOT", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifacts.add( artifact );

        artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-three", "2.0-SNAPSHOT", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifacts.add( artifact );

        artifact = new ArchivaArtifact( "org.apache.archiva", "artifact-four", "1.1-beta-2", "", "jar" );
        artifact.getModel().setRepositoryId( "test-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifacts.add( artifact );

        return artifacts;
    }
View Full Code Here

    extends AbstractArchivaDatabaseTestCase
{
    public ArchivaArtifact createArtifact( String groupId, String artifactId, String version, String whenProcessed )
        throws Exception
    {
        ArchivaArtifact artifact = dao.getArtifactDAO().createArtifact( groupId, artifactId, version, "", "jar" );
        assertNotNull( "Artifact should not be null.", artifact );
        Date dateWhenProcessed = null;

        if ( whenProcessed != null )
        {
            dateWhenProcessed = toDate( whenProcessed );
        }

        artifact.getModel().setWhenProcessed( dateWhenProcessed );

        // Satisfy table / column requirements.
        artifact.getModel().setLastModified( new Date() );

        return artifact;
    }
View Full Code Here

            int found = 0;
            Iterator it = results.iterator();
            while ( it.hasNext() )
            {
                ArchivaArtifact artifact = (ArchivaArtifact) it.next();
                if ( artifactId.equals( artifact.getArtifactId() ) )
                {
                    found++;
                }
            }
View Full Code Here

    private DatabaseUpdater dbupdater;

    public ArchivaArtifact createArtifact( String groupId, String artifactId, String version, String whenProcessed )
        throws Exception
    {
        ArchivaArtifact artifact = dao.getArtifactDAO().createArtifact( groupId, artifactId, version, "", "jar" );
        assertNotNull( "Artifact should not be null.", artifact );
        Date dateWhenProcessed = null;

        if ( whenProcessed != null )
        {
            dateWhenProcessed = toDate( whenProcessed );
        }

        artifact.getModel().setWhenProcessed( dateWhenProcessed );

        // Satisfy table / column requirements.
        artifact.getModel().setLastModified( new Date() );

        return artifact;
    }
View Full Code Here

       
        TestDatabaseUnprocessedConsumer consumer = lookupTestUnprocessedConsumer();
        consumer.resetCount();

        // Check the state of the artifact in the DB.
        ArchivaArtifact savedArtifact = dao.getArtifactDAO().getArtifact( groupId, artifactId, version, classifier,
                                                                          type );
        assertFalse( "Artifact should not be considered processed (yet).", savedArtifact.getModel().isProcessed() );

        // Update the artifact
        dbupdater.updateUnprocessed( savedArtifact );

        // Check the update.
        ArchivaArtifact processed = dao.getArtifactDAO().getArtifact( groupId, artifactId, version, classifier, type );
        assertTrue( "Artifact should be flagged as processed.", processed.getModel().isProcessed() );

        // Did the unprocessed consumer do it's thing?
        assertEquals( "Processed Count.", 1, consumer.getCountProcessed() );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.archiva.model.ArchivaArtifact

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.