Search in sources :

Example 1 with RepositorySessionFactory

use of org.apache.archiva.metadata.repository.RepositorySessionFactory in project archiva by apache.

the class DuplicateArtifactsConsumerTest method setUp.

@Before
@Override
public void setUp() throws Exception {
    super.setUp();
    assertNotNull(consumer);
    config = new BasicManagedRepository(TEST_REPO, TEST_REPO, Paths.get("target"));
    config.setLocation(Paths.get("target/test-repository").toAbsolutePath().toUri());
    metadataRepository = mock(MetadataRepository.class);
    RepositorySession session = mock(RepositorySession.class);
    when(session.getRepository()).thenReturn(metadataRepository);
    RepositorySessionFactory factory = applicationContext.getBean(RepositorySessionFactory.class);
    // (RepositorySessionFactory) lookup( RepositorySessionFactory.class );
    when(factory.createSession()).thenReturn(session);
    when(pathTranslator.getArtifactForPath(TEST_REPO, TEST_FILE)).thenReturn(TEST_METADATA);
}
Also used : MetadataRepository(org.apache.archiva.metadata.repository.MetadataRepository) BasicManagedRepository(org.apache.archiva.repository.BasicManagedRepository) RepositorySessionFactory(org.apache.archiva.metadata.repository.RepositorySessionFactory) RepositorySession(org.apache.archiva.metadata.repository.RepositorySession) Before(org.junit.Before)

Example 2 with RepositorySessionFactory

use of org.apache.archiva.metadata.repository.RepositorySessionFactory in project archiva by apache.

the class TestRepositorySessionFactoryBean method createInstance.

@Override
protected RepositorySessionFactory createInstance() throws Exception {
    RepositorySessionFactory repositorySessionFactory = getBeanFactory().getBean("repositorySessionFactory#" + this.beanId, RepositorySessionFactory.class);
    logger.info("create RepositorySessionFactory instance of {}", repositorySessionFactory.getClass().getName());
    if (!repositorySessionFactory.isOpen()) {
        repositorySessionFactory.open();
    }
    return repositorySessionFactory;
}
Also used : RepositorySessionFactory(org.apache.archiva.metadata.repository.RepositorySessionFactory)

Aggregations

RepositorySessionFactory (org.apache.archiva.metadata.repository.RepositorySessionFactory)2 MetadataRepository (org.apache.archiva.metadata.repository.MetadataRepository)1 RepositorySession (org.apache.archiva.metadata.repository.RepositorySession)1 BasicManagedRepository (org.apache.archiva.repository.BasicManagedRepository)1 Before (org.junit.Before)1