use of org.apache.archiva.configuration.model.UserInterfaceOptions in project archiva by apache.
the class ConfigurationRegistryReader method readUserInterfaceOptions.
private UserInterfaceOptions readUserInterfaceOptions(String prefix, Registry registry) {
UserInterfaceOptions value = new UserInterfaceOptions();
boolean showFindArtifacts = registry.getBoolean(prefix + "showFindArtifacts", value.isShowFindArtifacts());
value.setShowFindArtifacts(showFindArtifacts);
boolean appletFindEnabled = registry.getBoolean(prefix + "appletFindEnabled", value.isAppletFindEnabled());
value.setAppletFindEnabled(appletFindEnabled);
boolean disableEasterEggs = registry.getBoolean(prefix + "disableEasterEggs", value.isDisableEasterEggs());
value.setDisableEasterEggs(disableEasterEggs);
// String applicationUrl = registry.getString( prefix + "applicationUrl", value.getApplicationUrl() );
List<String> applicationUrlList = registry.getList(prefix + "applicationUrl");
String applicationUrl = value.getApplicationUrl();
if (applicationUrlList != null && !applicationUrlList.isEmpty()) {
StringBuilder sb = new StringBuilder();
for (int i = 0, size = applicationUrlList.size(); i < size; i++) {
sb.append(applicationUrlList.get(i));
if (i < size - 1) {
sb.append(',');
}
}
applicationUrl = sb.toString();
}
value.setApplicationUrl(applicationUrl);
boolean disableRegistration = registry.getBoolean(prefix + "disableRegistration", value.isDisableRegistration());
value.setDisableRegistration(disableRegistration);
return value;
}
use of org.apache.archiva.configuration.model.UserInterfaceOptions in project archiva by apache.
the class ConfigurationRegistryReader method readWebappConfiguration.
private WebappConfiguration readWebappConfiguration(String prefix, Registry registry) {
WebappConfiguration value = new WebappConfiguration();
UserInterfaceOptions ui = readUserInterfaceOptions(prefix + "ui.", registry);
value.setUi(ui);
return value;
}
use of org.apache.archiva.configuration.model.UserInterfaceOptions in project archiva by apache.
the class ArchivaConfigurationMRM789Test method assertConfiguration.
/**
* Ensures that the provided configuration matches the details present in the archiva-default.xml file.
*/
private void assertConfiguration(Configuration configuration, int managedExpected, int remoteExpected, int proxyConnectorExpected) throws Exception {
assertEquals("check managed repositories: " + configuration.getManagedRepositories(), managedExpected, configuration.getManagedRepositories().size());
assertEquals("check remote repositories: " + configuration.getRemoteRepositories(), remoteExpected, configuration.getRemoteRepositories().size());
assertEquals("check proxy connectors:" + configuration.getProxyConnectors(), proxyConnectorExpected, configuration.getProxyConnectors().size());
RepositoryScanningConfiguration repoScanning = configuration.getRepositoryScanning();
assertNotNull("check repository scanning", repoScanning);
assertEquals("check file types", 4, repoScanning.getFileTypes().size());
assertEquals("check known consumers", 9, repoScanning.getKnownContentConsumers().size());
assertEquals("check invalid consumers", 1, repoScanning.getInvalidContentConsumers().size());
List<String> patterns = filetypes.getFileTypePatterns("artifacts");
assertNotNull("check 'artifacts' file type", patterns);
assertEquals("check 'artifacts' patterns", 13, patterns.size());
WebappConfiguration webapp = configuration.getWebapp();
assertNotNull("check webapp", webapp);
UserInterfaceOptions ui = webapp.getUi();
assertNotNull("check webapp ui", ui);
assertTrue("check showFindArtifacts", ui.isShowFindArtifacts());
assertTrue("check appletFindEnabled", ui.isAppletFindEnabled());
}
use of org.apache.archiva.configuration.model.UserInterfaceOptions in project archiva by apache.
the class ArchivaConfigurationTest method assertConfiguration.
/**
* Ensures that the provided configuration matches the details present in the archiva-default.xml file.
*/
private void assertConfiguration(Configuration configuration, int managedExpected, int remoteExpected, int proxyConnectorExpected) throws Exception {
assertEquals("check managed repositories: " + configuration.getManagedRepositories(), managedExpected, configuration.getManagedRepositories().size());
assertEquals("check remote repositories: " + configuration.getRemoteRepositories(), remoteExpected, configuration.getRemoteRepositories().size());
assertEquals("check proxy connectors:" + configuration.getProxyConnectors(), proxyConnectorExpected, configuration.getProxyConnectors().size());
RepositoryScanningConfiguration repoScanning = configuration.getRepositoryScanning();
assertNotNull("check repository scanning", repoScanning);
assertEquals("check file types", 4, repoScanning.getFileTypes().size());
assertEquals("check known consumers", 9, repoScanning.getKnownContentConsumers().size());
assertEquals("check invalid consumers", 1, repoScanning.getInvalidContentConsumers().size());
List<String> patterns = filetypes.getFileTypePatterns("artifacts");
assertNotNull("check 'artifacts' file type", patterns);
assertEquals("check 'artifacts' patterns", 13, patterns.size());
WebappConfiguration webapp = configuration.getWebapp();
assertNotNull("check webapp", webapp);
UserInterfaceOptions ui = webapp.getUi();
assertNotNull("check webapp ui", ui);
assertTrue("check showFindArtifacts", ui.isShowFindArtifacts());
assertTrue("check appletFindEnabled", ui.isAppletFindEnabled());
}
use of org.apache.archiva.configuration.model.UserInterfaceOptions in project archiva by apache.
the class ArchivaConfigurationTest method testGetConfigurationFromRegistryWithTwoConfigurationResources.
@Test
public void testGetConfigurationFromRegistryWithTwoConfigurationResources() throws Exception {
ArchivaConfiguration archivaConfiguration = lookup(ArchivaConfiguration.class, "test-configuration-both");
Configuration configuration = archivaConfiguration.getConfiguration();
// from base
assertEquals("check repositories", 2, configuration.getManagedRepositories().size());
assertEquals("check repositories", 2, configuration.getRemoteRepositories().size());
// from user
assertEquals("check proxy connectors", 2, configuration.getProxyConnectors().size());
WebappConfiguration webapp = configuration.getWebapp();
assertNotNull("check webapp", webapp);
UserInterfaceOptions ui = webapp.getUi();
assertNotNull("check webapp ui", ui);
// from base
assertFalse("check showFindArtifacts", ui.isShowFindArtifacts());
// from user
assertFalse("check appletFindEnabled", ui.isAppletFindEnabled());
}
Aggregations