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