You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by sk...@apache.org on 2013/05/28 00:04:26 UTC

svn commit: r1486718 - in /archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src: main/java/org/apache/archiva/rest/services/ test/java/org/apache/archiva/rest/services/

Author: skygo
Date: Mon May 27 22:04:25 2013
New Revision: 1486718

URL: http://svn.apache.org/r1486718
Log:
rewrite try some tests

Added:
    archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java   (with props)
Modified:
    archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java
    archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java

Modified: archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java?rev=1486718&r1=1486717&r2=1486718&view=diff
==============================================================================
--- archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java (original)
+++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java Mon May 27 22:04:25 2013
@@ -39,20 +39,23 @@ public class DefaultPluginsServices
 
     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();
@@ -60,8 +63,10 @@ public class DefaultPluginsServices
                 repository.add( "archiva/admin/" + key + "/" + tmp + "/main" );
             }
         }
-        catch ( IOException ex )
+        catch ( IOException e )
         {
+
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -70,6 +75,8 @@ public class DefaultPluginsServices
             throws ArchivaRestServiceException
     {
         // rebuild
+        feed( repositoryType, "repository" );
+        feed( adminFeatures, "features" );
         StringBuilder sb = new StringBuilder();
         for ( String repoType : repositoryType )
         {
@@ -79,8 +86,15 @@ public class DefaultPluginsServices
         {
             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();
+        }
 
     }
 }

Modified: archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java?rev=1486718&r1=1486717&r2=1486718&view=diff
==============================================================================
--- archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java (original)
+++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java Mon May 27 22:04:25 2013
@@ -53,6 +53,7 @@ import javax.ws.rs.core.MediaType;
 import java.io.File;
 import java.util.Collections;
 import java.util.Date;
+import org.apache.archiva.rest.api.services.PluginsService;
 
 /**
  * @author Olivier Lamy
@@ -165,6 +166,14 @@ public abstract class AbstractArchivaRes
     {
         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()
     {

Added: archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java?rev=1486718&view=auto
==============================================================================
--- archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java (added)
+++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java Mon May 27 22:04:25 2013
@@ -0,0 +1,45 @@
+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 );
+    }
+
+   
+}

Propchange: archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Re: svn commit: r1486718 - in /archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src: main/java/org/apache/archiva/rest/services/ test/java/org/apache/archiva/rest/services/

Posted by Olivier Lamy <ol...@apache.org>.
yes :-)

2013/6/2 Eric Barboni <Er...@irit.fr>:
>  Olivier to you mean merge in trunk ?;
>
> Le Samedi 1 Juin 2013 15:17 CEST, "Eric Barboni" <Er...@irit.fr> a écrit:
>
>>
>> Le Samedi 1 Juin 2013 14:04 CEST, Olivier Lamy <ol...@apache.org> a écrit:
>>
>> > 2013/5/28 Eric Barboni <sk...@apache.org>:
>> > > Yep sorry will patch when back home (svn is broken on my office laptop )
>> >
>> > No worries.
>> >
>> > As the release is out. Do you can to merge your branch now ?
>> >
>> I will try :D
>>
>>
>> > >
>> > > I'm not sure how to fake resources js for testing non empy result.>
>> > I miss you here :-)
>> > More details ?
>> Well :)
>>
>>  in fact I do a test on a the default webapp (no js file) and result is no plugin.
>>  but I do want to test with fake file
>>    js\archiva\admin\features\generaladmin\main.js
>>  to be able to compare.
>>  I'm lost on what is the settings class configuration to no alter what is already done
>>
>>
>>
>> >
>> > Thanks.
>> >
>> > >
>> > > -----Message d'origine-----
>> > > De : Olivier Lamy [mailto:olamy@apache.org]
>> > > Envoyé : mardi 28 mai 2013 01:26
>> > > À : dev@archiva.apache.org
>> > > Objet : Re: svn commit: r1486718 - in
>> > > /archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/
>> > > archiva-rest-services/src: main/java/org/apache/archiva/rest/services/
>> > > test/java/org/apache/archiva/rest/services/
>> > >
>> > > 2013/5/28  <sk...@apache.org>:
>> > >> Author: skygo
>> > >> Date: Mon May 27 22:04:25 2013
>> > >> New Revision: 1486718
>> > >>
>> > >> URL: http://svn.apache.org/r1486718
>> > >> Log:
>> > >> rewrite try some tests
>> > >>
>> > >> Added:
>> > >>
>> > > archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/a
>> > > rchiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginSe
>> > > rviceTest.java   (with props)
>> > >> Modified:
>> > >>
>> > > archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/a
>> > > rchiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultP
>> > > luginsServices.java
>> > >>
>> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
>> > >> ces/AbstractArchivaRestTest.java
>> > >>
>> > >> Modified:
>> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> > >> rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/servi
>> > >> ces/DefaultPluginsServices.java
>> > >> URL:
>> > >> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva
>> > >> -modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/
>> > >> org/apache/archiva/rest/services/DefaultPluginsServices.java?rev=14867
>> > >> 18&r1=1486717&r2=1486718&view=diff
>> > >> ======================================================================> >> ========
>> > >> ---
>> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> > >> rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/servi
>> > >> ces/DefaultPluginsServices.java (original)
>> > >> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/arch
>> > >> +++ iva-rest/archiva-rest-services/src/main/java/org/apache/archiva/re
>> > >> +++ st/services/DefaultPluginsServices.java Mon May 27 22:04:25 2013
>> > >> @@ -39,20 +39,23 @@ public class DefaultPluginsServices
>> > >>
>> > >>      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" );
>> > >
>> > > Not possible to use logger ?
>> > >
>> > >> +        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(); @@ -60,8 +63,10
>> > >> @@ public class DefaultPluginsServices
>> > >>                  repository.add( "archiva/admin/" + key + "/" + tmp +
>> > > "/main" );
>> > >>              }
>> > >>          }
>> > >> -        catch ( IOException ex )
>> > >> +        catch ( IOException e )
>> > >>          {
>> > >> +
>> > >> +            throw new ArchivaRestServiceException( e.getMessage(), e
>> > >> + );
>> > >>          }
>> > >>      }
>> > >>
>> > >> @@ -70,6 +75,8 @@ public class DefaultPluginsServices
>> > >>              throws ArchivaRestServiceException
>> > >>      {
>> > >>          // rebuild
>> > >> +        feed( repositoryType, "repository" );
>> > >> +        feed( adminFeatures, "features" );
>> > >>          StringBuilder sb = new StringBuilder();
>> > >>          for ( String repoType : repositoryType )
>> > >>          {
>> > >> @@ -79,8 +86,15 @@ public class DefaultPluginsServices
>> > >>          {
>> > >>              sb.append( repoType ).append( "|" );
>> > >>          }
>> > >> -
>> > >> -        return sb.substring( 0, sb.length() - 1 );
>> > >> +        System.err.println( "sb" + sb.toString() );
>> > >
>> > > same
>> > >
>> > >> +        if ( sb.length() > 1 )
>> > >> +        {
>> > >> +            return sb.substring( 0, sb.length() - 1 );
>> > >> +        }
>> > >> +        else
>> > >> +        {
>> > >> +            return sb.toString();
>> > >> +        }
>> > >>
>> > >>      }
>> > >>  }
>> > >>
>> > >> Modified:
>> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
>> > >> ces/AbstractArchivaRestTest.java
>> > >> URL:
>> > >> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva
>> > >> -modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/
>> > >> org/apache/archiva/rest/services/AbstractArchivaRestTest.java?rev=1486
>> > >> 718&r1=1486717&r2=1486718&view=diff
>> > >> ======================================================================> >> ========
>> > >> ---
>> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
>> > >> ces/AbstractArchivaRestTest.java (original)
>> > >> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/arch
>> > >> +++ iva-rest/archiva-rest-services/src/test/java/org/apache/archiva/re
>> > >> +++ st/services/AbstractArchivaRestTest.java Mon May 27 22:04:25 2013
>> > >> @@ -53,6 +53,7 @@ import javax.ws.rs.core.MediaType;  import
>> > >> java.io.File;  import java.util.Collections;  import java.util.Date;
>> > >> +import org.apache.archiva.rest.api.services.PluginsService;
>> > >>
>> > >>  /**
>> > >>   * @author Olivier Lamy
>> > >> @@ -165,6 +166,14 @@ public abstract class AbstractArchivaRes
>> > >>      {
>> > >>          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()
>> > >>      {
>> > >>
>> > >> Added:
>> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
>> > >> ces/PluginServiceTest.java
>> > >> URL:
>> > >> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva
>> > >> -modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/
>> > >> org/apache/archiva/rest/services/PluginServiceTest.java?rev=1486718&vi
>> > >> ew=auto
>> > >> ======================================================================> >> ========
>> > >> ---
>> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
>> > >> ces/PluginServiceTest.java (added)
>> > >> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/arch
>> > >> +++ iva-rest/archiva-rest-services/src/test/java/org/apache/archiva/re
>> > >> +++ st/services/PluginServiceTest.java Mon May 27 22:04:25 2013
>
>> > >> @@ -0,0 +1,45 @@
>> > >> +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 );
>> > >> +    }
>> > >> +
>> > >> +
>> > >> +}
>> > >>
>> > >> Propchange:
>> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
>> > >> ces/PluginServiceTest.java
>> > >>
>> > > ----------------------------------------------------------------------------
>> > > --
>> > >>     svn:eol-style = native
>> > >>
>> > >>
>> > >
>> > >
>> > >
>> > > --
>> > > Olivier Lamy
>> > > Ecetera: http://ecetera.com.au
>> > > http://twitter.com/olamy | http://linkedin.com/in/olamy
>> > >
>> >
>> >
>> >
>> > --
>> > Olivier Lamy
>> > Ecetera: http://ecetera.com.au
>> > http://twitter.com/olamy | http://linkedin.com/in/olamy
>>
>>
>>
>>
>
>
>
>



-- 
Olivier Lamy
Ecetera: http://ecetera.com.au
http://twitter.com/olamy | http://linkedin.com/in/olamy

Re: svn commit: r1486718 - in /archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src: main/java/org/apache/archiva/rest/services/ test/java/org/apache/archiva/rest/services/

Posted by Eric Barboni <Er...@irit.fr>.
 Olivier to you mean merge in trunk ?; 

Le Samedi 1 Juin 2013 15:17 CEST, "Eric Barboni" <Er...@irit.fr> a écrit: 
 
>  
> Le Samedi 1 Juin 2013 14:04 CEST, Olivier Lamy <ol...@apache.org> a écrit: 
>  
> > 2013/5/28 Eric Barboni <sk...@apache.org>:
> > > Yep sorry will patch when back home (svn is broken on my office laptop )
> > 
> > No worries.
> > 
> > As the release is out. Do you can to merge your branch now ?
> > 
> I will try :D
> 
> 
> > >
> > > I'm not sure how to fake resources js for testing non empy result.> 
> > I miss you here :-)
> > More details ?
> Well :) 
> 
>  in fact I do a test on a the default webapp (no js file) and result is no plugin.
>  but I do want to test with fake file 
>    js\archiva\admin\features\generaladmin\main.js
>  to be able to compare.
>  I'm lost on what is the settings class configuration to no alter what is already done
> 
> 
> 
> > 
> > Thanks.
> > 
> > >
> > > -----Message d'origine-----
> > > De : Olivier Lamy [mailto:olamy@apache.org]
> > > Envoyé : mardi 28 mai 2013 01:26
> > > À : dev@archiva.apache.org
> > > Objet : Re: svn commit: r1486718 - in
> > > /archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/
> > > archiva-rest-services/src: main/java/org/apache/archiva/rest/services/
> > > test/java/org/apache/archiva/rest/services/
> > >
> > > 2013/5/28  <sk...@apache.org>:
> > >> Author: skygo
> > >> Date: Mon May 27 22:04:25 2013
> > >> New Revision: 1486718
> > >>
> > >> URL: http://svn.apache.org/r1486718
> > >> Log:
> > >> rewrite try some tests
> > >>
> > >> Added:
> > >>
> > > archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/a
> > > rchiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginSe
> > > rviceTest.java   (with props)
> > >> Modified:
> > >>
> > > archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/a
> > > rchiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultP
> > > luginsServices.java
> > >>
> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> > >> ces/AbstractArchivaRestTest.java
> > >>
> > >> Modified:
> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> > >> rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/servi
> > >> ces/DefaultPluginsServices.java
> > >> URL:
> > >> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva
> > >> -modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/
> > >> org/apache/archiva/rest/services/DefaultPluginsServices.java?rev=14867
> > >> 18&r1=1486717&r2=1486718&view=diff
> > >> ======================================================================> >> ========
> > >> ---
> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> > >> rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/servi
> > >> ces/DefaultPluginsServices.java (original)
> > >> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/arch
> > >> +++ iva-rest/archiva-rest-services/src/main/java/org/apache/archiva/re
> > >> +++ st/services/DefaultPluginsServices.java Mon May 27 22:04:25 2013
> > >> @@ -39,20 +39,23 @@ public class DefaultPluginsServices
> > >>
> > >>      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" );
> > >
> > > Not possible to use logger ?
> > >
> > >> +        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(); @@ -60,8 +63,10
> > >> @@ public class DefaultPluginsServices
> > >>                  repository.add( "archiva/admin/" + key + "/" + tmp +
> > > "/main" );
> > >>              }
> > >>          }
> > >> -        catch ( IOException ex )
> > >> +        catch ( IOException e )
> > >>          {
> > >> +
> > >> +            throw new ArchivaRestServiceException( e.getMessage(), e
> > >> + );
> > >>          }
> > >>      }
> > >>
> > >> @@ -70,6 +75,8 @@ public class DefaultPluginsServices
> > >>              throws ArchivaRestServiceException
> > >>      {
> > >>          // rebuild
> > >> +        feed( repositoryType, "repository" );
> > >> +        feed( adminFeatures, "features" );
> > >>          StringBuilder sb = new StringBuilder();
> > >>          for ( String repoType : repositoryType )
> > >>          {
> > >> @@ -79,8 +86,15 @@ public class DefaultPluginsServices
> > >>          {
> > >>              sb.append( repoType ).append( "|" );
> > >>          }
> > >> -
> > >> -        return sb.substring( 0, sb.length() - 1 );
> > >> +        System.err.println( "sb" + sb.toString() );
> > >
> > > same
> > >
> > >> +        if ( sb.length() > 1 )
> > >> +        {
> > >> +            return sb.substring( 0, sb.length() - 1 );
> > >> +        }
> > >> +        else
> > >> +        {
> > >> +            return sb.toString();
> > >> +        }
> > >>
> > >>      }
> > >>  }
> > >>
> > >> Modified:
> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> > >> ces/AbstractArchivaRestTest.java
> > >> URL:
> > >> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva
> > >> -modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/
> > >> org/apache/archiva/rest/services/AbstractArchivaRestTest.java?rev=1486
> > >> 718&r1=1486717&r2=1486718&view=diff
> > >> ======================================================================> >> ========
> > >> ---
> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> > >> ces/AbstractArchivaRestTest.java (original)
> > >> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/arch
> > >> +++ iva-rest/archiva-rest-services/src/test/java/org/apache/archiva/re
> > >> +++ st/services/AbstractArchivaRestTest.java Mon May 27 22:04:25 2013
> > >> @@ -53,6 +53,7 @@ import javax.ws.rs.core.MediaType;  import
> > >> java.io.File;  import java.util.Collections;  import java.util.Date;
> > >> +import org.apache.archiva.rest.api.services.PluginsService;
> > >>
> > >>  /**
> > >>   * @author Olivier Lamy
> > >> @@ -165,6 +166,14 @@ public abstract class AbstractArchivaRes
> > >>      {
> > >>          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()
> > >>      {
> > >>
> > >> Added:
> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> > >> ces/PluginServiceTest.java
> > >> URL:
> > >> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva
> > >> -modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/
> > >> org/apache/archiva/rest/services/PluginServiceTest.java?rev=1486718&vi
> > >> ew=auto
> > >> ======================================================================> >> ========
> > >> ---
> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> > >> ces/PluginServiceTest.java (added)
> > >> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/arch
> > >> +++ iva-rest/archiva-rest-services/src/test/java/org/apache/archiva/re
> > >> +++ st/services/PluginServiceTest.java Mon May 27 22:04:25 2013
> > >> @@ -0,0 +1,45 @@
> > >> +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 );
> > >> +    }
> > >> +
> > >> +
> > >> +}
> > >>
> > >> Propchange:
> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> > >> ces/PluginServiceTest.java
> > >>
> > > ----------------------------------------------------------------------------
> > > --
> > >>     svn:eol-style = native
> > >>
> > >>
> > >
> > >
> > >
> > > --
> > > Olivier Lamy
> > > Ecetera: http://ecetera.com.au
> > > http://twitter.com/olamy | http://linkedin.com/in/olamy
> > >
> > 
> > 
> > 
> > --
> > Olivier Lamy
> > Ecetera: http://ecetera.com.au
> > http://twitter.com/olamy | http://linkedin.com/in/olamy
>  
>  
>  
>  
 
 
 
 

Re: svn commit: r1486718 - in /archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src: main/java/org/apache/archiva/rest/services/ test/java/org/apache/archiva/rest/services/

Posted by Eric Barboni <Er...@irit.fr>.
 
Le Samedi 1 Juin 2013 14:04 CEST, Olivier Lamy <ol...@apache.org> a écrit: 
 
> 2013/5/28 Eric Barboni <sk...@apache.org>:
> > Yep sorry will patch when back home (svn is broken on my office laptop )
> 
> No worries.
> 
> As the release is out. Do you can to merge your branch now ?
> 
I will try :D


> >
> > I'm not sure how to fake resources js for testing non empy result.
> 
> I miss you here :-)
> More details ?
Well :) 

 in fact I do a test on a the default webapp (no js file) and result is no plugin.
 but I do want to test with fake file 
   js\archiva\admin\features\generaladmin\main.js
 to be able to compare.
 I'm lost on what is the settings class configuration to no alter what is already done



> 
> Thanks.
> 
> >
> > -----Message d'origine-----
> > De : Olivier Lamy [mailto:olamy@apache.org]
> > Envoyé : mardi 28 mai 2013 01:26
> > À : dev@archiva.apache.org
> > Objet : Re: svn commit: r1486718 - in
> > /archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/
> > archiva-rest-services/src: main/java/org/apache/archiva/rest/services/
> > test/java/org/apache/archiva/rest/services/
> >
> > 2013/5/28  <sk...@apache.org>:
> >> Author: skygo
> >> Date: Mon May 27 22:04:25 2013
> >> New Revision: 1486718
> >>
> >> URL: http://svn.apache.org/r1486718
> >> Log:
> >> rewrite try some tests
> >>
> >> Added:
> >>
> > archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/a
> > rchiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginSe
> > rviceTest.java   (with props)
> >> Modified:
> >>
> > archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/a
> > rchiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultP
> > luginsServices.java
> >>
> >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> >> ces/AbstractArchivaRestTest.java
> >>
> >> Modified:
> >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> >> rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/servi
> >> ces/DefaultPluginsServices.java
> >> URL:
> >> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva
> >> -modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/
> >> org/apache/archiva/rest/services/DefaultPluginsServices.java?rev=14867
> >> 18&r1=1486717&r2=1486718&view=diff
> >> ======================================================================
> >> ========
> >> ---
> >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> >> rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/servi
> >> ces/DefaultPluginsServices.java (original)
> >> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/arch
> >> +++ iva-rest/archiva-rest-services/src/main/java/org/apache/archiva/re
> >> +++ st/services/DefaultPluginsServices.java Mon May 27 22:04:25 2013
> >> @@ -39,20 +39,23 @@ public class DefaultPluginsServices
> >>
> >>      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" );
> >
> > Not possible to use logger ?
> >
> >> +        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(); @@ -60,8 +63,10
> >> @@ public class DefaultPluginsServices
> >>                  repository.add( "archiva/admin/" + key + "/" + tmp +
> > "/main" );
> >>              }
> >>          }
> >> -        catch ( IOException ex )
> >> +        catch ( IOException e )
> >>          {
> >> +
> >> +            throw new ArchivaRestServiceException( e.getMessage(), e
> >> + );
> >>          }
> >>      }
> >>
> >> @@ -70,6 +75,8 @@ public class DefaultPluginsServices
> >>              throws ArchivaRestServiceException
> >>      {
> >>          // rebuild
> >> +        feed( repositoryType, "repository" );
> >> +        feed( adminFeatures, "features" );
> >>          StringBuilder sb = new StringBuilder();
> >>          for ( String repoType : repositoryType )
> >>          {
> >> @@ -79,8 +86,15 @@ public class DefaultPluginsServices
> >>          {
> >>              sb.append( repoType ).append( "|" );
> >>          }
> >> -
> >> -        return sb.substring( 0, sb.length() - 1 );
> >> +        System.err.println( "sb" + sb.toString() );
> >
> > same
> >
> >> +        if ( sb.length() > 1 )
> >> +        {
> >> +            return sb.substring( 0, sb.length() - 1 );
> >> +        }
> >> +        else
> >> +        {
> >> +            return sb.toString();
> >> +        }
> >>
> >>      }
> >>  }
> >>
> >> Modified:
> >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> >> ces/AbstractArchivaRestTest.java
> >> URL:
> >> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva
> >> -modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/
> >> org/apache/archiva/rest/services/AbstractArchivaRestTest.java?rev=1486
> >> 718&r1=1486717&r2=1486718&view=diff
> >> ======================================================================
> >> ========
> >> ---
> >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> >> ces/AbstractArchivaRestTest.java (original)
> >> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/arch
> >> +++ iva-rest/archiva-rest-services/src/test/java/org/apache/archiva/re
> >> +++ st/services/AbstractArchivaRestTest.java Mon May 27 22:04:25 2013
> >> @@ -53,6 +53,7 @@ import javax.ws.rs.core.MediaType;  import
> >> java.io.File;  import java.util.Collections;  import java.util.Date;
> >> +import org.apache.archiva.rest.api.services.PluginsService;
> >>
> >>  /**
> >>   * @author Olivier Lamy
> >> @@ -165,6 +166,14 @@ public abstract class AbstractArchivaRes
> >>      {
> >>          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()
> >>      {
> >>
> >> Added:
> >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> >> ces/PluginServiceTest.java
> >> URL:
> >> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva
> >> -modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/
> >> org/apache/archiva/rest/services/PluginServiceTest.java?rev=1486718&vi
> >> ew=auto
> >> ======================================================================
> >> ========
> >> ---
> >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> >> ces/PluginServiceTest.java (added)
> >> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/arch
> >> +++ iva-rest/archiva-rest-services/src/test/java/org/apache/archiva/re
> >> +++ st/services/PluginServiceTest.java Mon May 27 22:04:25 2013
> >> @@ -0,0 +1,45 @@
> >> +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 );
> >> +    }
> >> +
> >> +
> >> +}
> >>
> >> Propchange:
> >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> >> ces/PluginServiceTest.java
> >>
> > ----------------------------------------------------------------------------
> > --
> >>     svn:eol-style = native
> >>
> >>
> >
> >
> >
> > --
> > Olivier Lamy
> > Ecetera: http://ecetera.com.au
> > http://twitter.com/olamy | http://linkedin.com/in/olamy
> >
> 
> 
> 
> --
> Olivier Lamy
> Ecetera: http://ecetera.com.au
> http://twitter.com/olamy | http://linkedin.com/in/olamy
 
 
 
 

Re: svn commit: r1486718 - in /archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src: main/java/org/apache/archiva/rest/services/ test/java/org/apache/archiva/rest/services/

Posted by Olivier Lamy <ol...@apache.org>.
2013/5/28 Eric Barboni <sk...@apache.org>:
> Yep sorry will patch when back home (svn is broken on my office laptop )

No worries.

As the release is out. Do you can to merge your branch now ?

>
> I'm not sure how to fake resources js for testing non empy result.

I miss you here :-)
More details ?

Thanks.

>
> -----Message d'origine-----
> De : Olivier Lamy [mailto:olamy@apache.org]
> Envoyé : mardi 28 mai 2013 01:26
> À : dev@archiva.apache.org
> Objet : Re: svn commit: r1486718 - in
> /archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/
> archiva-rest-services/src: main/java/org/apache/archiva/rest/services/
> test/java/org/apache/archiva/rest/services/
>
> 2013/5/28  <sk...@apache.org>:
>> Author: skygo
>> Date: Mon May 27 22:04:25 2013
>> New Revision: 1486718
>>
>> URL: http://svn.apache.org/r1486718
>> Log:
>> rewrite try some tests
>>
>> Added:
>>
> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/a
> rchiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginSe
> rviceTest.java   (with props)
>> Modified:
>>
> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/a
> rchiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultP
> luginsServices.java
>>
>> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
>> ces/AbstractArchivaRestTest.java
>>
>> Modified:
>> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/servi
>> ces/DefaultPluginsServices.java
>> URL:
>> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva
>> -modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/
>> org/apache/archiva/rest/services/DefaultPluginsServices.java?rev=14867
>> 18&r1=1486717&r2=1486718&view=diff
>> ======================================================================
>> ========
>> ---
>> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/servi
>> ces/DefaultPluginsServices.java (original)
>> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/arch
>> +++ iva-rest/archiva-rest-services/src/main/java/org/apache/archiva/re
>> +++ st/services/DefaultPluginsServices.java Mon May 27 22:04:25 2013
>> @@ -39,20 +39,23 @@ public class DefaultPluginsServices
>>
>>      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" );
>
> Not possible to use logger ?
>
>> +        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(); @@ -60,8 +63,10
>> @@ public class DefaultPluginsServices
>>                  repository.add( "archiva/admin/" + key + "/" + tmp +
> "/main" );
>>              }
>>          }
>> -        catch ( IOException ex )
>> +        catch ( IOException e )
>>          {
>> +
>> +            throw new ArchivaRestServiceException( e.getMessage(), e
>> + );
>>          }
>>      }
>>
>> @@ -70,6 +75,8 @@ public class DefaultPluginsServices
>>              throws ArchivaRestServiceException
>>      {
>>          // rebuild
>> +        feed( repositoryType, "repository" );
>> +        feed( adminFeatures, "features" );
>>          StringBuilder sb = new StringBuilder();
>>          for ( String repoType : repositoryType )
>>          {
>> @@ -79,8 +86,15 @@ public class DefaultPluginsServices
>>          {
>>              sb.append( repoType ).append( "|" );
>>          }
>> -
>> -        return sb.substring( 0, sb.length() - 1 );
>> +        System.err.println( "sb" + sb.toString() );
>
> same
>
>> +        if ( sb.length() > 1 )
>> +        {
>> +            return sb.substring( 0, sb.length() - 1 );
>> +        }
>> +        else
>> +        {
>> +            return sb.toString();
>> +        }
>>
>>      }
>>  }
>>
>> Modified:
>> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
>> ces/AbstractArchivaRestTest.java
>> URL:
>> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva
>> -modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/
>> org/apache/archiva/rest/services/AbstractArchivaRestTest.java?rev=1486
>> 718&r1=1486717&r2=1486718&view=diff
>> ======================================================================
>> ========
>> ---
>> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
>> ces/AbstractArchivaRestTest.java (original)
>> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/arch
>> +++ iva-rest/archiva-rest-services/src/test/java/org/apache/archiva/re
>> +++ st/services/AbstractArchivaRestTest.java Mon May 27 22:04:25 2013
>> @@ -53,6 +53,7 @@ import javax.ws.rs.core.MediaType;  import
>> java.io.File;  import java.util.Collections;  import java.util.Date;
>> +import org.apache.archiva.rest.api.services.PluginsService;
>>
>>  /**
>>   * @author Olivier Lamy
>> @@ -165,6 +166,14 @@ public abstract class AbstractArchivaRes
>>      {
>>          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()
>>      {
>>
>> Added:
>> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
>> ces/PluginServiceTest.java
>> URL:
>> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva
>> -modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/
>> org/apache/archiva/rest/services/PluginServiceTest.java?rev=1486718&vi
>> ew=auto
>> ======================================================================
>> ========
>> ---
>> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
>> ces/PluginServiceTest.java (added)
>> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/arch
>> +++ iva-rest/archiva-rest-services/src/test/java/org/apache/archiva/re
>> +++ st/services/PluginServiceTest.java Mon May 27 22:04:25 2013
>> @@ -0,0 +1,45 @@
>> +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 );
>> +    }
>> +
>> +
>> +}
>>
>> Propchange:
>> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
>> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
>> ces/PluginServiceTest.java
>>
> ----------------------------------------------------------------------------
> --
>>     svn:eol-style = native
>>
>>
>
>
>
> --
> Olivier Lamy
> Ecetera: http://ecetera.com.au
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>



--
Olivier Lamy
Ecetera: http://ecetera.com.au
http://twitter.com/olamy | http://linkedin.com/in/olamy

RE: svn commit: r1486718 - in /archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src: main/java/org/apache/archiva/rest/services/ test/java/org/apache/archiva/rest/services/

Posted by Eric Barboni <sk...@apache.org>.
Yep sorry will patch when back home (svn is broken on my office laptop )

I'm not sure how to fake resources js for testing non empy result.

-----Message d'origine-----
De : Olivier Lamy [mailto:olamy@apache.org] 
Envoyé : mardi 28 mai 2013 01:26
À : dev@archiva.apache.org
Objet : Re: svn commit: r1486718 - in
/archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/
archiva-rest-services/src: main/java/org/apache/archiva/rest/services/
test/java/org/apache/archiva/rest/services/

2013/5/28  <sk...@apache.org>:
> Author: skygo
> Date: Mon May 27 22:04:25 2013
> New Revision: 1486718
>
> URL: http://svn.apache.org/r1486718
> Log:
> rewrite try some tests
>
> Added:
>
archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/a
rchiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginSe
rviceTest.java   (with props)
> Modified:
>
archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/a
rchiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultP
luginsServices.java
>     
> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> ces/AbstractArchivaRestTest.java
>
> Modified: 
> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/servi
> ces/DefaultPluginsServices.java
> URL: 
> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva
> -modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/
> org/apache/archiva/rest/services/DefaultPluginsServices.java?rev=14867
> 18&r1=1486717&r2=1486718&view=diff
> ======================================================================
> ========
> --- 
> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/servi
> ces/DefaultPluginsServices.java (original)
> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/arch
> +++ iva-rest/archiva-rest-services/src/main/java/org/apache/archiva/re
> +++ st/services/DefaultPluginsServices.java Mon May 27 22:04:25 2013
> @@ -39,20 +39,23 @@ public class DefaultPluginsServices
>
>      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" );

Not possible to use logger ?

> +        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(); @@ -60,8 +63,10 
> @@ public class DefaultPluginsServices
>                  repository.add( "archiva/admin/" + key + "/" + tmp +
"/main" );
>              }
>          }
> -        catch ( IOException ex )
> +        catch ( IOException e )
>          {
> +
> +            throw new ArchivaRestServiceException( e.getMessage(), e 
> + );
>          }
>      }
>
> @@ -70,6 +75,8 @@ public class DefaultPluginsServices
>              throws ArchivaRestServiceException
>      {
>          // rebuild
> +        feed( repositoryType, "repository" );
> +        feed( adminFeatures, "features" );
>          StringBuilder sb = new StringBuilder();
>          for ( String repoType : repositoryType )
>          {
> @@ -79,8 +86,15 @@ public class DefaultPluginsServices
>          {
>              sb.append( repoType ).append( "|" );
>          }
> -
> -        return sb.substring( 0, sb.length() - 1 );
> +        System.err.println( "sb" + sb.toString() );

same

> +        if ( sb.length() > 1 )
> +        {
> +            return sb.substring( 0, sb.length() - 1 );
> +        }
> +        else
> +        {
> +            return sb.toString();
> +        }
>
>      }
>  }
>
> Modified: 
> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> ces/AbstractArchivaRestTest.java
> URL: 
> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva
> -modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/
> org/apache/archiva/rest/services/AbstractArchivaRestTest.java?rev=1486
> 718&r1=1486717&r2=1486718&view=diff
> ======================================================================
> ========
> --- 
> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> ces/AbstractArchivaRestTest.java (original)
> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/arch
> +++ iva-rest/archiva-rest-services/src/test/java/org/apache/archiva/re
> +++ st/services/AbstractArchivaRestTest.java Mon May 27 22:04:25 2013
> @@ -53,6 +53,7 @@ import javax.ws.rs.core.MediaType;  import 
> java.io.File;  import java.util.Collections;  import java.util.Date;
> +import org.apache.archiva.rest.api.services.PluginsService;
>
>  /**
>   * @author Olivier Lamy
> @@ -165,6 +166,14 @@ public abstract class AbstractArchivaRes
>      {
>          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()
>      {
>
> Added: 
> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> ces/PluginServiceTest.java
> URL: 
> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva
> -modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/
> org/apache/archiva/rest/services/PluginServiceTest.java?rev=1486718&vi
> ew=auto 
> ======================================================================
> ========
> --- 
> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> ces/PluginServiceTest.java (added)
> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/arch
> +++ iva-rest/archiva-rest-services/src/test/java/org/apache/archiva/re
> +++ st/services/PluginServiceTest.java Mon May 27 22:04:25 2013
> @@ -0,0 +1,45 @@
> +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 );
> +    }
> +
> +
> +}
>
> Propchange: 
> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-
> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/servi
> ces/PluginServiceTest.java
>
----------------------------------------------------------------------------
--
>     svn:eol-style = native
>
>



--
Olivier Lamy
Ecetera: http://ecetera.com.au
http://twitter.com/olamy | http://linkedin.com/in/olamy


Re: svn commit: r1486718 - in /archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src: main/java/org/apache/archiva/rest/services/ test/java/org/apache/archiva/rest/services/

Posted by Olivier Lamy <ol...@apache.org>.
2013/5/28  <sk...@apache.org>:
> Author: skygo
> Date: Mon May 27 22:04:25 2013
> New Revision: 1486718
>
> URL: http://svn.apache.org/r1486718
> Log:
> rewrite try some tests
>
> Added:
>     archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java   (with props)
> Modified:
>     archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java
>     archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
>
> Modified: archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java
> URL: http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java?rev=1486718&r1=1486717&r2=1486718&view=diff
> ==============================================================================
> --- archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java (original)
> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java Mon May 27 22:04:25 2013
> @@ -39,20 +39,23 @@ public class DefaultPluginsServices
>
>      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" );

Not possible to use logger ?

> +        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();
> @@ -60,8 +63,10 @@ public class DefaultPluginsServices
>                  repository.add( "archiva/admin/" + key + "/" + tmp + "/main" );
>              }
>          }
> -        catch ( IOException ex )
> +        catch ( IOException e )
>          {
> +
> +            throw new ArchivaRestServiceException( e.getMessage(), e );
>          }
>      }
>
> @@ -70,6 +75,8 @@ public class DefaultPluginsServices
>              throws ArchivaRestServiceException
>      {
>          // rebuild
> +        feed( repositoryType, "repository" );
> +        feed( adminFeatures, "features" );
>          StringBuilder sb = new StringBuilder();
>          for ( String repoType : repositoryType )
>          {
> @@ -79,8 +86,15 @@ public class DefaultPluginsServices
>          {
>              sb.append( repoType ).append( "|" );
>          }
> -
> -        return sb.substring( 0, sb.length() - 1 );
> +        System.err.println( "sb" + sb.toString() );

same

> +        if ( sb.length() > 1 )
> +        {
> +            return sb.substring( 0, sb.length() - 1 );
> +        }
> +        else
> +        {
> +            return sb.toString();
> +        }
>
>      }
>  }
>
> Modified: archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
> URL: http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java?rev=1486718&r1=1486717&r2=1486718&view=diff
> ==============================================================================
> --- archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java (original)
> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java Mon May 27 22:04:25 2013
> @@ -53,6 +53,7 @@ import javax.ws.rs.core.MediaType;
>  import java.io.File;
>  import java.util.Collections;
>  import java.util.Date;
> +import org.apache.archiva.rest.api.services.PluginsService;
>
>  /**
>   * @author Olivier Lamy
> @@ -165,6 +166,14 @@ public abstract class AbstractArchivaRes
>      {
>          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()
>      {
>
> Added: archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java
> URL: http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java?rev=1486718&view=auto
> ==============================================================================
> --- archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java (added)
> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java Mon May 27 22:04:25 2013
> @@ -0,0 +1,45 @@
> +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 );
> +    }
> +
> +
> +}
>
> Propchange: archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java
> ------------------------------------------------------------------------------
>     svn:eol-style = native
>
>



--
Olivier Lamy
Ecetera: http://ecetera.com.au
http://twitter.com/olamy | http://linkedin.com/in/olamy