Search in sources :

Example 1 with JcrMetadataRepository

use of org.apache.archiva.metadata.repository.jcr.JcrMetadataRepository in project archiva by apache.

the class JcrRepositoryStatisticsGatheringTest method setUp.

@Before
public void setUp() throws Exception {
    Map<String, MetadataFacetFactory> factories = AbstractMetadataRepositoryTest.createTestMetadataFacetFactories();
    assertNotNull(jcrRepository);
    // TODO: probably don't need to use Spring for this
    JcrMetadataRepository jcrMetadataRepository = new JcrMetadataRepository(factories, jcrRepository);
    session = jcrMetadataRepository.getJcrSession();
    try {
        session = jcrMetadataRepository.getJcrSession();
        // set up namespaces, etc.
        JcrMetadataRepository.initialize(session);
        // removing content is faster than deleting and re-copying the files from target/jcr
        session.getRootNode().getNode("repositories").remove();
    } catch (RepositoryException e) {
    // ignore
    }
    this.repository = jcrMetadataRepository;
}
Also used : JcrMetadataRepository(org.apache.archiva.metadata.repository.jcr.JcrMetadataRepository) RepositoryException(javax.jcr.RepositoryException) MetadataFacetFactory(org.apache.archiva.metadata.model.MetadataFacetFactory) Before(org.junit.Before)

Aggregations

RepositoryException (javax.jcr.RepositoryException)1 MetadataFacetFactory (org.apache.archiva.metadata.model.MetadataFacetFactory)1 JcrMetadataRepository (org.apache.archiva.metadata.repository.jcr.JcrMetadataRepository)1 Before (org.junit.Before)1