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();
}
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);
}
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();
}
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);
}
}
Aggregations