use of org.apache.archiva.admin.model.beans.UiConfiguration in project archiva by apache.
the class DefaultArchivaAdministration method updateUiConfiguration.
@Override
public void updateUiConfiguration(UiConfiguration uiConfiguration) throws RepositoryAdminException {
Configuration configuration = getArchivaConfiguration().getConfiguration();
if (uiConfiguration != null) {
UserInterfaceOptions userInterfaceOptions = getModelMapper().map(uiConfiguration, UserInterfaceOptions.class);
configuration.getWebapp().setUi(userInterfaceOptions);
} else {
configuration.getWebapp().setUi(null);
}
saveConfiguration(configuration);
}
use of org.apache.archiva.admin.model.beans.UiConfiguration in project archiva by apache.
the class ArchivaAdministrationTest method uiConfiguration.
@Test
public void uiConfiguration() throws Exception {
UiConfiguration oldUi = archivaAdministration.getUiConfiguration();
assertNotNull(oldUi);
// assert default values
assertFalse(oldUi.isDisableEasterEggs());
assertTrue(oldUi.isAppletFindEnabled());
assertTrue(oldUi.isShowFindArtifacts());
assertFalse(oldUi.isDisableRegistration());
UiConfiguration ui = archivaAdministration.getUiConfiguration();
ui.setAppletFindEnabled(false);
ui.setShowFindArtifacts(false);
ui.setDisableEasterEggs(true);
ui.setDisableRegistration(true);
archivaAdministration.updateUiConfiguration(ui);
ui = archivaAdministration.getUiConfiguration();
assertTrue(ui.isDisableEasterEggs());
assertFalse(ui.isAppletFindEnabled());
assertFalse(ui.isShowFindArtifacts());
assertTrue(ui.isDisableRegistration());
archivaAdministration.updateUiConfiguration(oldUi);
}
use of org.apache.archiva.admin.model.beans.UiConfiguration in project archiva by apache.
the class ArchivaAdministrationServiceTest method uiConfigurationUpdate_ApplicationUrlHasTrailingSlash.
@Test
public void uiConfigurationUpdate_ApplicationUrlHasTrailingSlash() throws Exception {
UiConfiguration ui = getArchivaAdministrationService().getUiConfiguration();
assertNotNull(ui);
assertNull(ui.getApplicationUrl());
String url = "http://foo.fr/bar/";
ui.setApplicationUrl(url);
getArchivaAdministrationService().setUiConfiguration(ui);
ui = getArchivaAdministrationService().getUiConfiguration();
assertEquals("http://foo.fr/bar", ui.getApplicationUrl());
// test if multiple '/' is trailing
url = "http://foo.fr/bar//";
ui.setApplicationUrl(url);
getArchivaAdministrationService().setUiConfiguration(ui);
ui = getArchivaAdministrationService().getUiConfiguration();
assertEquals("http://foo.fr/bar", ui.getApplicationUrl());
}
use of org.apache.archiva.admin.model.beans.UiConfiguration in project archiva by apache.
the class SearchServiceTest method searchWithSearchRequestBundleSymbolicNameTwoVersion.
@Test
public void searchWithSearchRequestBundleSymbolicNameTwoVersion() throws Exception {
UiConfiguration uiConfiguration = new UiConfiguration();
uiConfiguration.setApplicationUrl(null);
getArchivaAdministrationService().setUiConfiguration(uiConfiguration);
SearchService searchService = getSearchService(authorizationHeader);
SearchRequest searchRequest = new SearchRequest();
searchRequest.setBundleSymbolicName("org.apache.karaf.features.core");
List<Artifact> artifacts = searchService.searchArtifacts(searchRequest);
assertThat(artifacts).isNotNull().hasSize(2);
for (Artifact artifact : artifacts) {
log.info("url: {}", artifact.getUrl());
String version = artifact.getVersion();
//
Assertions.assertThat(artifact.getUrl()).isEqualTo("http://localhost:" + port + "/repository/test-repo/org/apache/karaf/features/org.apache.karaf.features.core/" + version + "/org.apache.karaf.features.core-" + version + ".jar");
}
}
use of org.apache.archiva.admin.model.beans.UiConfiguration in project archiva by apache.
the class ArchivaAdministrationServiceTest method uiConfigurationReadUpdate.
@Test
public void uiConfigurationReadUpdate() throws Exception {
UiConfiguration ui = getArchivaAdministrationService().getUiConfiguration();
assertNotNull(ui);
// assert default values
assertFalse(ui.isDisableEasterEggs());
assertFalse(ui.isDisableRegistration());
assertTrue(ui.isAppletFindEnabled());
assertTrue(ui.isShowFindArtifacts());
assertNull(ui.getApplicationUrl());
ui.setAppletFindEnabled(false);
ui.setShowFindArtifacts(false);
ui.setDisableEasterEggs(true);
ui.setDisableRegistration(true);
String url = "http://foo.fr/bar";
ui.setApplicationUrl(url);
getArchivaAdministrationService().setUiConfiguration(ui);
ui = getArchivaAdministrationService().getUiConfiguration();
assertTrue(ui.isDisableEasterEggs());
assertTrue(ui.isDisableRegistration());
assertFalse(ui.isAppletFindEnabled());
assertFalse(ui.isShowFindArtifacts());
assertEquals(url, ui.getApplicationUrl());
}
Aggregations