Search in sources :

Example 1 with MetadataService

use of org.apache.archiva.metadata.repository.MetadataService 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 MetadataService

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

the class FileMetadataRepositoryTest method setUp.

@BeforeEach
@Override
public void setUp() throws Exception {
    super.setUp();
    assertMaxTries = 1;
    assertRetrySleepMs = 10;
    Path directory = Paths.get("target/test-repositories");
    if (Files.exists(directory)) {
        org.apache.archiva.common.utils.FileUtils.deleteDirectory(directory);
    }
    ArchivaConfiguration config = createTestConfiguration(directory);
    List<MetadataFacetFactory> factories = createTestMetadataFacetFactories();
    MetadataService metadataService = new MetadataService();
    metadataService.setMetadataFacetFactories(factories);
    this.repository = new FileMetadataRepository(metadataService, config);
}
Also used : Path(java.nio.file.Path) ArchivaConfiguration(org.apache.archiva.configuration.provider.ArchivaConfiguration) MetadataService(org.apache.archiva.metadata.repository.MetadataService) MetadataFacetFactory(org.apache.archiva.metadata.model.MetadataFacetFactory) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with MetadataService

use of org.apache.archiva.metadata.repository.MetadataService 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)

Example 4 with MetadataService

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

the class CassandraMetadataRepositoryTest method setUp.

@BeforeEach
public void setUp(TestInfo testInfo) throws Exception {
    cTime = System.currentTimeMillis();
    super.setUp();
    assertMaxTries = 1;
    assertRetrySleepMs = 10;
    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);
    this.cmr = new CassandraMetadataRepository(metadataService, cassandraArchivaManager);
    sessionFactory = mock(RepositorySessionFactory.class);
    session = mock(RepositorySession.class);
    when(sessionFactory.createSession()).thenReturn(session);
    if (!clearedTables.get()) {
        clearReposAndNamespace(cassandraArchivaManager, clearedTables);
    }
}
Also used : Path(java.nio.file.Path) RepositorySessionFactory(org.apache.archiva.metadata.repository.RepositorySessionFactory) RepositorySession(org.apache.archiva.metadata.repository.RepositorySession) MetadataService(org.apache.archiva.metadata.repository.MetadataService) MetadataFacetFactory(org.apache.archiva.metadata.model.MetadataFacetFactory) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Path (java.nio.file.Path)4 MetadataFacetFactory (org.apache.archiva.metadata.model.MetadataFacetFactory)4 MetadataService (org.apache.archiva.metadata.repository.MetadataService)4 DefaultMetadataResolver (org.apache.archiva.metadata.repository.DefaultMetadataResolver)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 ArchivaConfiguration (org.apache.archiva.configuration.provider.ArchivaConfiguration)1 RepositorySession (org.apache.archiva.metadata.repository.RepositorySession)1 RepositorySessionFactory (org.apache.archiva.metadata.repository.RepositorySessionFactory)1 BeforeClass (org.junit.BeforeClass)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1