Package org.apache.maven.archiva.database

Examples of org.apache.maven.archiva.database.ObjectNotFoundException


        searchControl.expectAndDefaultReturn( search.search( "", observableRepoIds, "archiva", limits, null ), results );

        archivaDAOControl.expectAndReturn( archivaDAO.query( new UniqueVersionConstraint( observableRepoIds, resultHit.getGroupId(),
                                                                                          resultHit.getArtifactId() ) ), null );

        ObjectNotFoundException exception = new ObjectNotFoundException( "org.apache.archiva.archiva-test:1.0" );

        repoBrowsingControl.expectAndThrow( repoBrowsing.selectVersion( "", observableRepoIds, "org.apache.archiva", "archiva-test", "1.0" ), exception );

        logger.debug( "Unable to find pom artifact : " + exception.getMessage() );
        loggerControl.setDefaultVoidCallable();

        userReposControl.replay();
        searchControl.replay();
        repoBrowsingControl.replay();
View Full Code Here


        observableRepoIds.add( "repo1.mirror" );
        observableRepoIds.add( "public.releases" );
       
        userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
        repoBrowsingControl.expectAndThrow(
               repoBrowsing.selectVersion( "", observableRepoIds, ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), new ObjectNotFoundException( "Artifact does not exist." ) );
       
        userReposControl.replay();
        repoBrowsingControl.replay();
       
        try
View Full Code Here

        }

        // throw exception if pom artifact is still null!
        if ( pomArtifact == null )
        {
            throw new ObjectNotFoundException( "Unable to find artifact " + Keys.toKey( groupId, artifactId, version ) +
                " in observable repository [" + StringUtils.join( observableRepositoryIds.iterator(), ", " ) +
                "] for user " + principal );
        }

        return pomArtifact;
View Full Code Here

        }

        // Allowed to see this?
        if ( !observableRepos.contains( artifact.getModel().getRepositoryId() ) )
        {
            throw new ObjectNotFoundException( "Unable to find artifact " + Keys.toKey( groupId, artifactId, version ) +
                " in observable repository [" + StringUtils.join( observableRepos.iterator(), ", " ) + "] for user " +
                principal );
        }

        return artifact.getModel().getRepositoryId();
View Full Code Here

    public Object getObjectById( Class<?> clazz, Object id, String fetchGroup )
        throws ObjectNotFoundException, ArchivaDatabaseException
    {
        if ( id == null )
        {
            throw new ObjectNotFoundException( "Unable to get object '" + clazz.getName() + "' from jdo using null id." );
        }

        PersistenceManager pm = getPersistenceManager();
        Transaction tx = pm.currentTransaction();

        try
        {
            tx.begin();

            if ( fetchGroup != null )
            {
                pm.getFetchPlan().addGroup( fetchGroup );
            }

            Object objectId = null;

            if ( id instanceof CompoundKey )
            {
                objectId = pm.newObjectIdInstance( clazz, id.toString() );
            }
            else
            {
                objectId = pm.newObjectIdInstance( clazz, id );
            }

            Object object = pm.getObjectById( objectId );

            object = pm.detachCopy( object );

            tx.commit();

            return object;
        }
        catch ( JDOObjectNotFoundException e )
        {
            throw new ObjectNotFoundException( "Unable to find Database Object [" + id + "] of type " + clazz.getName()
                + " using " + ( ( fetchGroup == null ) ? "no fetch-group" : "a fetch-group of [" + fetchGroup + "]" ),
                                               e, id );
        }
        catch ( JDOException e )
        {
View Full Code Here

    public Object getObjectById( Class<?> clazz, String id, String fetchGroup )
        throws ObjectNotFoundException, ArchivaDatabaseException
    {
        if ( StringUtils.isEmpty( id ) )
        {
            throw new ObjectNotFoundException( "Unable to get object '" + clazz.getName()
                + "' from jdo using null/empty id." );
        }

        return getObjectById( clazz, (Object) id, fetchGroup );
    }
View Full Code Here

        observableRepoIds.add( "repo1.mirror" );
        observableRepoIds.add( "public.releases" );
       
        userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
        repoBrowsingControl.expectAndThrow(
               repoBrowsing.selectVersion( "", observableRepoIds, "org.apache.archiva", "archiva-test", "1.0" ), new ObjectNotFoundException( "Artifact does not exist." ) );
       
        userReposControl.replay();
        repoBrowsingControl.replay();
       
        try
View Full Code Here

TOP

Related Classes of org.apache.maven.archiva.database.ObjectNotFoundException

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.