import org.apache.archiva.common.utils.FileUtil;
import org.apache.archiva.redback.rest.services.AbstractRestServicesTest;
import org.apache.archiva.rest.api.services.ArchivaAdministrationService;
+import org.apache.archiva.rest.api.services.ArchivaRuntimeConfigurationService;
import org.apache.archiva.rest.api.services.BrowseService;
import org.apache.archiva.rest.api.services.CommonServices;
import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
return service;
}
+ protected ArchivaRuntimeConfigurationService getArchivaRuntimeConfigurationService()
+ {
+ ArchivaRuntimeConfigurationService service = JAXRSClientFactory.create(
+ getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
+ ArchivaRuntimeConfigurationService.class, Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+
+ WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE );
+ WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE );
+
+ WebClient.client( service ).header( "Authorization", authorizationHeader );
+ WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 );
+ return service;
+ }
+
protected BrowseService getBrowseService( String authzHeader, boolean useXml )
{
BrowseService service =
--- /dev/null
+package org.apache.archiva.rest.services;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.admin.model.beans.ArchivaRuntimeConfiguration;
+import org.junit.Test;
+
+/**
+ * @author Olivier Lamy
+ */
+public class ArchivaRuntimeConfigurationServiceTest
+ extends AbstractArchivaRestTest
+{
+ @Test
+ public void nonnullConfiguration()
+ throws Exception
+ {
+ ArchivaRuntimeConfiguration archivaRuntimeConfiguration =
+ getArchivaRuntimeConfigurationService().getArchivaRuntimeConfigurationAdmin();
+ assertEquals( "jdo", archivaRuntimeConfiguration.getUserManagerImpl() );
+ }
+
+ @Test
+ public void update()
+ throws Exception
+ {
+ ArchivaRuntimeConfiguration archivaRuntimeConfiguration =
+ getArchivaRuntimeConfigurationService().getArchivaRuntimeConfigurationAdmin();
+ assertEquals( "jdo", archivaRuntimeConfiguration.getUserManagerImpl() );
+
+ archivaRuntimeConfiguration.setUserManagerImpl( "foo" );
+
+ getArchivaRuntimeConfigurationService().updateArchivaRuntimeConfiguration( archivaRuntimeConfiguration );
+
+ archivaRuntimeConfiguration = getArchivaRuntimeConfigurationService().getArchivaRuntimeConfigurationAdmin();
+ assertEquals( "foo", archivaRuntimeConfiguration.getUserManagerImpl() );
+
+
+ }
+
+
+}