private List<String> repositoryType = new ArrayList<String>();
private List<String> adminFeatures = new ArrayList<String>();
+ private ApplicationContext appCont;
@Inject
public DefaultPluginsServices( ApplicationContext applicationContext )
{
- feed( repositoryType, "repository", applicationContext );
- feed( adminFeatures, "features", applicationContext );
+ System.err.println( "appCont" );
+ this.appCont = applicationContext;
}
- private void feed( List<String> repository, String key, ApplicationContext applicationContext )
+ private void feed( List<String> repository, String key ) throws ArchivaRestServiceException
{
+ System.err.println( "feeed" );
+ repository.clear();
Resource[] xmlResources;
try
{
- xmlResources = applicationContext.getResources( "/**/" + key + "/**/main.js" );
+ xmlResources = appCont.getResources( "/**/" + key + "/**/main.js" );
for ( Resource rc : xmlResources )
{
String tmp = rc.getURL().toString();
repository.add( "archiva/admin/" + key + "/" + tmp + "/main" );
}
}
- catch ( IOException ex )
+ catch ( IOException e )
{
+
+ throw new ArchivaRestServiceException( e.getMessage(), e );
}
}
throws ArchivaRestServiceException
{
// rebuild
+ feed( repositoryType, "repository" );
+ feed( adminFeatures, "features" );
StringBuilder sb = new StringBuilder();
for ( String repoType : repositoryType )
{
{
sb.append( repoType ).append( "|" );
}
-
- return sb.substring( 0, sb.length() - 1 );
+ System.err.println( "sb" + sb.toString() );
+ if ( sb.length() > 1 )
+ {
+ return sb.substring( 0, sb.length() - 1 );
+ }
+ else
+ {
+ return sb.toString();
+ }
}
}
import java.io.File;
import java.util.Collections;
import java.util.Date;
+import org.apache.archiva.rest.api.services.PluginsService;
/**
* @author Olivier Lamy
{
return getService( PingService.class, null );
}
+
+ protected PluginsService getPluginsService()
+ {
+ PluginsService service = getService( PluginsService.class, null );
+ WebClient.client( service ).accept( MediaType.TEXT_PLAIN );
+ WebClient.client( service ).type( MediaType.TEXT_PLAIN );
+ return service;
+ }
protected RemoteRepositoriesService getRemoteRepositoriesService()
{
--- /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 static junit.framework.TestCase.assertEquals;
+import org.apache.archiva.rest.api.services.PluginsService;
+import org.junit.Test;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4-M1
+ */
+public class PluginServiceTest
+ extends AbstractArchivaRestTest
+{
+
+ @Test
+ public void testGetPluginAdmin()
+ throws Exception
+ {
+ // 1000000L
+
+ PluginsService res = getPluginsService();
+ String value = res.getAdminPlugins();
+ assertEquals( "", value );
+ }
+
+
+}