Search in sources :

Example 6 with UserInterfaceOptions

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;
}
Also used : UserInterfaceOptions(org.apache.archiva.configuration.model.UserInterfaceOptions)

Example 7 with UserInterfaceOptions

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;
}
Also used : WebappConfiguration(org.apache.archiva.configuration.model.WebappConfiguration) UserInterfaceOptions(org.apache.archiva.configuration.model.UserInterfaceOptions)

Example 8 with UserInterfaceOptions

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());
}
Also used : WebappConfiguration(org.apache.archiva.configuration.model.WebappConfiguration) UserInterfaceOptions(org.apache.archiva.configuration.model.UserInterfaceOptions) RepositoryScanningConfiguration(org.apache.archiva.configuration.model.RepositoryScanningConfiguration)

Example 9 with UserInterfaceOptions

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());
}
Also used : WebappConfiguration(org.apache.archiva.configuration.model.WebappConfiguration) UserInterfaceOptions(org.apache.archiva.configuration.model.UserInterfaceOptions) RepositoryScanningConfiguration(org.apache.archiva.configuration.model.RepositoryScanningConfiguration)

Example 10 with UserInterfaceOptions

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());
}
Also used : WebappConfiguration(org.apache.archiva.configuration.model.WebappConfiguration) ManagedRepositoryConfiguration(org.apache.archiva.configuration.model.ManagedRepositoryConfiguration) ProxyConnectorConfiguration(org.apache.archiva.configuration.model.ProxyConnectorConfiguration) RepositoryGroupConfiguration(org.apache.archiva.configuration.model.RepositoryGroupConfiguration) Configuration(org.apache.archiva.configuration.model.Configuration) RepositoryScanningConfiguration(org.apache.archiva.configuration.model.RepositoryScanningConfiguration) RemoteRepositoryConfiguration(org.apache.archiva.configuration.model.RemoteRepositoryConfiguration) WebappConfiguration(org.apache.archiva.configuration.model.WebappConfiguration) ContextConfiguration(org.springframework.test.context.ContextConfiguration) NetworkProxyConfiguration(org.apache.archiva.configuration.model.NetworkProxyConfiguration) UserInterfaceOptions(org.apache.archiva.configuration.model.UserInterfaceOptions) Test(org.junit.Test)

Aggregations

UserInterfaceOptions (org.apache.archiva.configuration.model.UserInterfaceOptions)11 WebappConfiguration (org.apache.archiva.configuration.model.WebappConfiguration)10 RepositoryScanningConfiguration (org.apache.archiva.configuration.model.RepositoryScanningConfiguration)7 Configuration (org.apache.archiva.configuration.model.Configuration)6 ManagedRepositoryConfiguration (org.apache.archiva.configuration.model.ManagedRepositoryConfiguration)5 NetworkProxyConfiguration (org.apache.archiva.configuration.model.NetworkProxyConfiguration)5 ProxyConnectorConfiguration (org.apache.archiva.configuration.model.ProxyConnectorConfiguration)5 RemoteRepositoryConfiguration (org.apache.archiva.configuration.model.RemoteRepositoryConfiguration)5 RepositoryGroupConfiguration (org.apache.archiva.configuration.model.RepositoryGroupConfiguration)5 Test (org.junit.Test)5 ContextConfiguration (org.springframework.test.context.ContextConfiguration)5 Path (java.nio.file.Path)4 LegacyArtifactPath (org.apache.archiva.configuration.model.LegacyArtifactPath)4