use of org.apache.archiva.configuration.provider.ArchivaConfiguration in project archiva by apache.
the class RepositoryServletTest method testGetRepositoryAfterDelete.
@Test
public void testGetRepositoryAfterDelete() throws Exception {
RepositoryServlet servlet = RepositoryServlet.class.cast(findServlet("repository"));
assertNotNull(servlet);
ArchivaConfiguration archivaConfiguration = servlet.getConfiguration();
Configuration c = archivaConfiguration.getConfiguration();
c.removeManagedRepository(c.findManagedRepositoryById(REPOID_INTERNAL));
saveConfiguration(archivaConfiguration);
repositoryRegistry.removeRepository(REPOID_INTERNAL);
org.apache.archiva.repository.ManagedRepository repository = servlet.getRepository(REPOID_INTERNAL);
assertNull(repository);
}
use of org.apache.archiva.configuration.provider.ArchivaConfiguration in project archiva by apache.
the class AbstractRepositoryServletTestCase method setUp.
@Before
@Override
public void setUp() throws Exception {
super.setUp();
System.setProperty("appserver.base", getAppserverBase().toAbsolutePath().toString());
log.info("setUp appserverBase={}, projectBase={}, workingDir={}", getAppserverBase(), getProjectBase(), Paths.get("").toString());
repositoryRegistry.getRepositories().stream().forEach(r -> {
try {
repositoryRegistry.removeRepository(r);
} catch (RepositoryException e) {
e.printStackTrace();
}
});
org.apache.archiva.common.utils.FileUtils.deleteDirectory(getAppserverBase());
Path testConf = getProjectBase().resolve("src/test/resources/repository-archiva.xml");
Path testConfDest = getAppserverBase().resolve("conf/archiva.xml");
if (Files.exists(testConfDest)) {
org.apache.archiva.common.utils.FileUtils.deleteQuietly(testConfDest);
}
FileUtils.copyFile(testConf.toFile(), testConfDest.toFile());
repoRootInternal = getAppserverBase().resolve("data/repositories/internal");
repoRootLegacy = getAppserverBase().resolve("data/repositories/legacy");
Configuration config = archivaConfiguration.getConfiguration();
config.getManagedRepositories().clear();
config.addManagedRepository(createManagedRepository(REPOID_INTERNAL, "Internal Test Repo", repoRootInternal, true));
config.getProxyConnectors().clear();
config.getRemoteRepositories().clear();
saveConfiguration(archivaConfiguration);
// repositoryRegistry.reload();
// ArchivaIndexingContext ctx = repositoryRegistry.getManagedRepository( REPOID_INTERNAL ).getIndexingContext( );
// try
// {
// if (repositoryRegistry.getIndexManager(RepositoryType.MAVEN)!=null) {
// repositoryRegistry.getIndexManager(RepositoryType.MAVEN).pack(ctx);
// }
// } finally
// {
// if (ctx!=null)
// {
// ctx.close( );
// }
// }
}
use of org.apache.archiva.configuration.provider.ArchivaConfiguration in project archiva by apache.
the class ReinitServlet method doGet.
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
ApplicationContext applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(req.getServletContext());
ArchivaConfiguration archivaConfiguration = applicationContext.getBean(ArchivaConfiguration.class);
archivaConfiguration.reload();
}
use of org.apache.archiva.configuration.provider.ArchivaConfiguration in project archiva by apache.
the class FileMetadataRepositoryTest method createTestConfiguration.
protected static ArchivaConfiguration createTestConfiguration(Path directory) {
ArchivaConfiguration config = mock(ArchivaConfiguration.class);
Configuration configData = new Configuration();
configData.addManagedRepository(createManagedRepository(TEST_REPO_ID, directory));
configData.addManagedRepository(createManagedRepository("other-repo", directory));
when(config.getConfiguration()).thenReturn(configData);
return config;
}
Aggregations