Package org.apache.maven.archiva.database

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


        taskExecutor = (TaskExecutor) lookup( TaskExecutor.class, "test-repository-scanning" );
    }

    public void testExecutor() throws Exception
    {
        RepositoryDAO repoDao = dao.getRepositoryDAO();

        File repoDir = new File( getBasedir(), "src/test/repositories/default-repository" );

        assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );

        String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" );
       
        // Create it
        ArchivaRepository repo =
            repoDao.createRepository( "testRepo", "Test Repository", repoUri );
        assertNotNull( repo );

        // Set some mandatory values
        repo.getModel().setCreationSource( "Test Case" );
        repo.getModel().setLayoutName( "default" );

        // Save it.
        ArchivaRepository repoSaved = repoDao.saveRepository( repo );
        assertNotNull( repoSaved );
        assertNotNull( repoSaved.getModel() );
        assertEquals( "testRepo", JDOHelper.getObjectId( repoSaved.getModel() ).toString() );

        RepositoryTask repoTask = new RepositoryTask();
View Full Code Here


    extends AbstractArchivaDatabaseTestCase
{
    public void testRepositoryCRUD()
        throws ArchivaDatabaseException
    {
        RepositoryDAO repoDao = dao.getRepositoryDAO();

        // Create it
        ArchivaRepository repo = repoDao.createRepository( "testRepo", "Test Repository",
                                                           "http://localhost:8080/repository/foo" );
        assertNotNull( repo );

        // Set some mandatory values
        repo.getModel().setCreationSource( "Test Case" );
        repo.getModel().setLayoutName( "default" );

        // Save it.
        ArchivaRepository repoSaved = repoDao.saveRepository( repo );
        assertNotNull( repoSaved );
        assertNotNull( repoSaved.getModel() );
        assertEquals( "testRepo", JDOHelper.getObjectId( repoSaved.getModel() ).toString() );

        // Test that something has been saved.
        List repos = repoDao.getRepositories();
        assertNotNull( repos );
        assertEquals( 1, repos.size() );

        // Test that retreived object is what we expect.
        ArchivaRepository firstRepo = (ArchivaRepository) repos.get( 0 );
        assertNotNull( firstRepo );
        assertEquals( "testRepo", repo.getId() );
        assertEquals( "Test Repository", repo.getModel().getName() );
        assertEquals( "Test Case", repo.getModel().getCreationSource() );
        assertEquals( "default", repo.getModel().getLayoutName() );

        // Change value and save.
        repoSaved.getModel().setCreationSource( "Changed" );
        repoDao.saveRepository( repoSaved );

        // Test that only 1 object is saved.
        assertEquals( 1, repoDao.getRepositories().size() );

        // Get the specific repo.
        ArchivaRepository actualRepo = repoDao.getRepository( "testRepo" );
        assertNotNull( actualRepo );

        // Test expected values.
        assertEquals( "testRepo", actualRepo.getId() );
        assertEquals( "http://localhost:8080/repository/foo", actualRepo.getUrl().toString() );
        assertEquals( "Changed", actualRepo.getModel().getCreationSource() );

        // Test that only 1 object is saved.
        assertEquals( 1, repoDao.getRepositories().size() );

        // Delete object.
        repoDao.deleteRepository( actualRepo );
        assertEquals( 0, repoDao.getRepositories().size() );
    }
View Full Code Here

        taskExecutor = (TaskExecutor) lookup( TaskExecutor.class, "test-repository-scanning" );
    }

    public void testExecutor() throws Exception
    {
        RepositoryDAO repoDao = dao.getRepositoryDAO();

        File repoDir = new File( getBasedir(), "src/test/repositories/default-repository" );

        assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );

        String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" );
       
        // Create it
        ArchivaRepository repo =
            repoDao.createRepository( "testRepo", "Test Repository", repoUri );
        assertNotNull( repo );

        // Set some mandatory values
        repo.getModel().setCreationSource( "Test Case" );
        repo.getModel().setLayoutName( "default" );

        // Save it.
        ArchivaRepository repoSaved = repoDao.saveRepository( repo );
        assertNotNull( repoSaved );
        assertNotNull( repoSaved.getModel() );
        assertEquals( "testRepo", JDOHelper.getObjectId( repoSaved.getModel() ).toString() );

        RepositoryTask repoTask = new RepositoryTask();
View Full Code Here

    }

    public void testExecutor()
        throws Exception
    {
        RepositoryDAO repoDao = dao.getRepositoryDAO();

        File repoDir = new File( getBasedir(), "src/test/repositories/default-repository" );

        assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );

        String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" );

        // Create it
        ArchivaRepository repo = repoDao.createRepository( "testRepo", "Test Repository", repoUri );
        assertNotNull( repo );

        // Set some mandatory values
        repo.getModel().setCreationSource( "Test Case" );
        repo.getModel().setLayoutName( "default" );

        // Save it.
        ArchivaRepository repoSaved = repoDao.saveRepository( repo );
        assertNotNull( repoSaved );
        assertNotNull( repoSaved.getModel() );
        assertEquals( "testRepo", JDOHelper.getObjectId( repoSaved.getModel() ).toString() );

        ArtifactDAO adao = dao.getArtifactDAO();
View Full Code Here

    extends AbstractArchivaDatabaseTestCase
{
    public void testRepositoryCRUD()
        throws ArchivaDatabaseException
    {
        RepositoryDAO repoDao = dao.getRepositoryDAO();

        // Create it
        ArchivaRepository repo = repoDao.createRepository( "testRepo", "Test Repository",
                                                           "http://localhost:8080/repository/foo" );
        assertNotNull( repo );

        // Set some mandatory values
        repo.getModel().setCreationSource( "Test Case" );
        repo.getModel().setLayoutName( "default" );

        // Save it.
        ArchivaRepository repoSaved = repoDao.saveRepository( repo );
        assertNotNull( repoSaved );
        assertNotNull( repoSaved.getModel() );
        assertEquals( "testRepo", JDOHelper.getObjectId( repoSaved.getModel() ).toString() );

        // Test that something has been saved.
        List repos = repoDao.getRepositories();
        assertNotNull( repos );
        assertEquals( 1, repos.size() );

        // Test that retreived object is what we expect.
        ArchivaRepository firstRepo = (ArchivaRepository) repos.get( 0 );
        assertNotNull( firstRepo );
        assertEquals( "testRepo", repo.getId() );
        assertEquals( "Test Repository", repo.getModel().getName() );
        assertEquals( "Test Case", repo.getModel().getCreationSource() );
        assertEquals( "default", repo.getModel().getLayoutName() );

        // Change value and save.
        repoSaved.getModel().setCreationSource( "Changed" );
        repoDao.saveRepository( repoSaved );

        // Test that only 1 object is saved.
        assertEquals( 1, repoDao.getRepositories().size() );

        // Get the specific repo.
        ArchivaRepository actualRepo = repoDao.getRepository( "testRepo" );
        assertNotNull( actualRepo );

        // Test expected values.
        assertEquals( "testRepo", actualRepo.getId() );
        assertEquals( "http://localhost:8080/repository/foo", actualRepo.getUrl().toString() );
        assertEquals( "Changed", actualRepo.getModel().getCreationSource() );

        // Test that only 1 object is saved.
        assertEquals( 1, repoDao.getRepositories().size() );

        // Delete object.
        repoDao.deleteRepository( actualRepo );
        assertEquals( 0, repoDao.getRepositories().size() );
    }
View Full Code Here

TOP

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

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.