Search in sources :

Example 1 with DefaultMetadataResolver

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

the class JcrRepositoryStatisticsGatheringTest method setupSpec.

@BeforeClass
public static void setupSpec() throws IOException, InvalidFileStoreVersionException {
    Path directory = Paths.get("target/test-repositories");
    if (Files.exists(directory)) {
        org.apache.archiva.common.utils.FileUtils.deleteDirectory(directory);
    }
    directory = Paths.get("target/jcr");
    if (Files.exists(directory)) {
        org.apache.archiva.common.utils.FileUtils.deleteDirectory(directory);
    }
    List<MetadataFacetFactory> factories = AbstractMetadataRepositoryTest.createTestMetadataFacetFactories();
    MetadataService metadataService = new MetadataService();
    metadataService.setMetadataFacetFactories(factories);
    JcrRepositorySessionFactory jcrSessionFactory = new JcrRepositorySessionFactory();
    jcrSessionFactory.setMetadataResolver(new DefaultMetadataResolver());
    jcrSessionFactory.setMetadataService(metadataService);
    jcrSessionFactory.open();
    sessionFactory = jcrSessionFactory;
    repository = jcrSessionFactory.getMetadataRepository();
}
Also used : Path(java.nio.file.Path) DefaultMetadataResolver(org.apache.archiva.metadata.repository.DefaultMetadataResolver) MetadataService(org.apache.archiva.metadata.repository.MetadataService) MetadataFacetFactory(org.apache.archiva.metadata.model.MetadataFacetFactory) BeforeClass(org.junit.BeforeClass)

Example 2 with DefaultMetadataResolver

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

the class JcrMetadataRepositoryTest method setupSpec.

@BeforeAll
public static void setupSpec() throws IOException, InvalidFileStoreVersionException {
    Path directory = Paths.get("target/test-repositories");
    if (Files.exists(directory)) {
        org.apache.archiva.common.utils.FileUtils.deleteDirectory(directory);
    }
    List<MetadataFacetFactory> factories = createTestMetadataFacetFactories();
    MetadataService metadataService = new MetadataService();
    metadataService.setMetadataFacetFactories(factories);
    JcrRepositorySessionFactory jcrSessionFactory = new JcrRepositorySessionFactory();
    jcrSessionFactory.setMetadataResolver(new DefaultMetadataResolver());
    jcrSessionFactory.setMetadataService(metadataService);
    jcrSessionFactory.open();
    sessionFactory = jcrSessionFactory;
    repository = jcrSessionFactory.getMetadataRepository();
}
Also used : Path(java.nio.file.Path) DefaultMetadataResolver(org.apache.archiva.metadata.repository.DefaultMetadataResolver) MetadataService(org.apache.archiva.metadata.repository.MetadataService) MetadataFacetFactory(org.apache.archiva.metadata.model.MetadataFacetFactory) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

Path (java.nio.file.Path)2 MetadataFacetFactory (org.apache.archiva.metadata.model.MetadataFacetFactory)2 DefaultMetadataResolver (org.apache.archiva.metadata.repository.DefaultMetadataResolver)2 MetadataService (org.apache.archiva.metadata.repository.MetadataService)2 BeforeClass (org.junit.BeforeClass)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1