Search in sources :

Example 16 with BasicManagedRepository

use of org.apache.archiva.repository.base.managed.BasicManagedRepository in project archiva by apache.

the class RepositoryProviderMock method createStagingInstance.

@Override
public ManagedRepository createStagingInstance(ManagedRepositoryConfiguration configuration) throws RepositoryException {
    String id = configuration.getId() + StagingRepositoryFeature.STAGING_REPO_POSTFIX;
    BasicManagedRepository managedRepository = null;
    try {
        managedRepository = BasicManagedRepository.newFilesystemInstance(id, configuration.getName(), Paths.get("target/repositories").resolve(id));
    } catch (IOException e) {
        throw new RepositoryException(e);
    }
    updateManagedInstance(managedRepository, configuration);
    return managedRepository;
}
Also used : BasicManagedRepository(org.apache.archiva.repository.base.managed.BasicManagedRepository) RepositoryException(org.apache.archiva.repository.RepositoryException) IOException(java.io.IOException)

Example 17 with BasicManagedRepository

use of org.apache.archiva.repository.base.managed.BasicManagedRepository in project archiva by apache.

the class RssFeedServletTest method setUp.

@Before
@Override
public void setUp() throws Exception {
    final MockServletContext mockServletContext = new MockServletContext();
    WebApplicationContext webApplicationContext = new TestWebapplicationContext(applicationContext, mockServletContext);
    mockServletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, webApplicationContext);
    MockServletConfig mockServletConfig = new MockServletConfig() {

        @Override
        public ServletContext getServletContext() {
            return mockServletContext;
        }
    };
    repositoryRegistry.reload();
    repositoryRegistry.putRepository(new BasicManagedRepository("internal", "internal", new FilesystemStorage(Paths.get("target/appserver-base/repositories/internal"), new DefaultFileLockManager())));
    rssFeedServlet.init(mockServletConfig);
}
Also used : BasicManagedRepository(org.apache.archiva.repository.base.managed.BasicManagedRepository) FilesystemStorage(org.apache.archiva.repository.storage.fs.FilesystemStorage) MockServletConfig(org.springframework.mock.web.MockServletConfig) DefaultFileLockManager(org.apache.archiva.common.filelock.DefaultFileLockManager) MockServletContext(org.springframework.mock.web.MockServletContext) WebApplicationContext(org.springframework.web.context.WebApplicationContext) Before(org.junit.Before)

Example 18 with BasicManagedRepository

use of org.apache.archiva.repository.base.managed.BasicManagedRepository in project archiva by apache.

the class RepositoryProviderMock method createManagedInstance.

@Override
public ManagedRepository createManagedInstance(ManagedRepositoryConfiguration configuration) throws RepositoryException {
    BasicManagedRepository managedRepository = null;
    try {
        managedRepository = BasicManagedRepository.newFilesystemInstance(configuration.getId(), configuration.getName(), Paths.get("target/repositories").resolve(configuration.getId()));
    } catch (IOException e) {
        throw new RepositoryException(e);
    }
    updateManagedInstance(managedRepository, configuration);
    return managedRepository;
}
Also used : BasicManagedRepository(org.apache.archiva.repository.base.managed.BasicManagedRepository) RepositoryException(org.apache.archiva.repository.RepositoryException) IOException(java.io.IOException)

Example 19 with BasicManagedRepository

use of org.apache.archiva.repository.base.managed.BasicManagedRepository in project archiva by apache.

the class BasicRepositoryGroupValidatorTest method createRepository.

protected EditableManagedRepository createRepository(String id, String name, Path location) throws IOException {
    BasicManagedRepository repo = BasicManagedRepository.newFilesystemInstance(id, name, location);
    repo.setLocation(location.toAbsolutePath().toUri());
    repo.setContent(new ManagedRepositoryContentMock());
    return repo;
}
Also used : BasicManagedRepository(org.apache.archiva.repository.base.managed.BasicManagedRepository) ManagedRepositoryContentMock(org.apache.archiva.repository.mock.ManagedRepositoryContentMock)

Example 20 with BasicManagedRepository

use of org.apache.archiva.repository.base.managed.BasicManagedRepository in project archiva by apache.

the class NewVersionsOfArtifactRssFeedProcessorTest method setUp.

@Before
@Override
public void setUp() throws Exception {
    super.setUp();
    newVersionsProcessor = new NewVersionsOfArtifactRssFeedProcessor();
    newVersionsProcessor.setGenerator(new RssFeedGenerator());
    metadataRepository = mock(MetadataRepository.class);
    sessionFactory = mock(RepositorySessionFactory.class);
    session = mock(RepositorySession.class);
    when(sessionFactory.createSession()).thenReturn(session);
    when(session.getRepository()).thenReturn(metadataRepository);
    repositoryRegistry = mock(ArchivaRepositoryRegistry.class);
    List<Repository> reg = new ArrayList<>();
    reg.add(new BasicManagedRepository(TEST_REPO, TEST_REPO, new FilesystemStorage(Paths.get("target/test-storage"), new DefaultFileLockManager())));
    when(repositoryRegistry.getRepositories()).thenReturn(reg);
    newVersionsProcessor.setRepositorySessionFactory(sessionFactory);
    newVersionsProcessor.setRepositoryRegistry(repositoryRegistry);
}
Also used : MetadataRepository(org.apache.archiva.metadata.repository.MetadataRepository) Repository(org.apache.archiva.repository.Repository) MetadataRepository(org.apache.archiva.metadata.repository.MetadataRepository) BasicManagedRepository(org.apache.archiva.repository.base.managed.BasicManagedRepository) BasicManagedRepository(org.apache.archiva.repository.base.managed.BasicManagedRepository) RepositorySessionFactory(org.apache.archiva.metadata.repository.RepositorySessionFactory) FilesystemStorage(org.apache.archiva.repository.storage.fs.FilesystemStorage) ArrayList(java.util.ArrayList) DefaultFileLockManager(org.apache.archiva.common.filelock.DefaultFileLockManager) RepositorySession(org.apache.archiva.metadata.repository.RepositorySession) RssFeedGenerator(org.apache.archiva.rss.RssFeedGenerator) ArchivaRepositoryRegistry(org.apache.archiva.repository.base.ArchivaRepositoryRegistry) Before(org.junit.Before)

Aggregations

BasicManagedRepository (org.apache.archiva.repository.base.managed.BasicManagedRepository)20 IOException (java.io.IOException)8 RepositoryException (org.apache.archiva.repository.RepositoryException)8 DefaultFileLockManager (org.apache.archiva.common.filelock.DefaultFileLockManager)6 FilesystemStorage (org.apache.archiva.repository.storage.fs.FilesystemStorage)6 Path (java.nio.file.Path)4 StagingRepositoryFeature (org.apache.archiva.repository.features.StagingRepositoryFeature)4 ArtifactCleanupFeature (org.apache.archiva.repository.features.ArtifactCleanupFeature)3 IndexCreationFeature (org.apache.archiva.repository.features.IndexCreationFeature)3 Before (org.junit.Before)3 Test (org.junit.jupiter.api.Test)3 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2 FileLockManager (org.apache.archiva.common.filelock.FileLockManager)2 EditableManagedRepository (org.apache.archiva.repository.EditableManagedRepository)2 MavenManagedRepository (org.apache.archiva.rest.api.v2.model.MavenManagedRepository)2 ManagedRepositoryConfiguration (org.apache.archiva.configuration.model.ManagedRepositoryConfiguration)1 InvalidRepositoryContentConsumer (org.apache.archiva.consumers.InvalidRepositoryContentConsumer)1 KnownRepositoryContentConsumer (org.apache.archiva.consumers.KnownRepositoryContentConsumer)1 MetadataRepository (org.apache.archiva.metadata.repository.MetadataRepository)1