Return-Path: X-Original-To: apmail-archiva-dev-archive@www.apache.org Delivered-To: apmail-archiva-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B589210AF4 for ; Sun, 2 Jun 2013 01:43:30 +0000 (UTC) Received: (qmail 74066 invoked by uid 500); 2 Jun 2013 01:43:30 -0000 Delivered-To: apmail-archiva-dev-archive@archiva.apache.org Received: (qmail 73871 invoked by uid 500); 2 Jun 2013 01:43:29 -0000 Mailing-List: contact dev-help@archiva.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@archiva.apache.org Delivered-To: mailing list dev@archiva.apache.org Received: (qmail 73668 invoked by uid 99); 2 Jun 2013 01:43:29 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Jun 2013 01:43:29 +0000 Received: from localhost (HELO mail-ob0-f169.google.com) (127.0.0.1) (smtp-auth username olamy, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Jun 2013 00:26:38 +0000 Received: by mail-ob0-f169.google.com with SMTP id up14so5345624obb.14 for ; Sat, 01 Jun 2013 17:26:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=915YOrk3Mo3PQUmhzlSA92rrJMOIrDqRoqGBtYhxXWQ=; b=iPmT12Tryca/XulhWcBQGVOoVzAI+fwkBEvBGOYKklJK7OUPTNfsGD2xIE2mJPdcRd w3Obv8q4/ByRFslKuVEqkVcVsrPRDC8MFKTnfGgSc/YADQzU824mFWwZW0Z179zaab09 XDMhEocCFnu48H1B9I0UJlzlzf8b2htj5AXt41X8xwD3GUGp7IvDlXlBsGKA6OhLFlYY qXMpoVKOkD3mxHXI1yB1SarMsw30PBGGbCeEndm/VWa8qNYpDccOvZ2uBbY7NK7vnhBM X+LYJg+1WIKB8TLtI1TAakur3JU2funOPvW1xl/gQZ3H5QbCxqSmvCgXXq/rN8PtBGSi TfCQ== X-Received: by 10.60.35.201 with SMTP id k9mr7844220oej.102.1370132798022; Sat, 01 Jun 2013 17:26:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.5.196 with HTTP; Sat, 1 Jun 2013 17:26:17 -0700 (PDT) In-Reply-To: <35a6-51aa1080-1-59e62d00@123848320> References: <32b7-51a9f480-1-58cdd680@72541904> <35a6-51aa1080-1-59e62d00@123848320> From: Olivier Lamy Date: Sun, 2 Jun 2013 10:26:17 +1000 Message-ID: Subject: 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/ To: dev@archiva.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable yes :-) 2013/6/2 Eric Barboni : > Olivier to you mean merge in trunk ?; > > Le Samedi 1 Juin 2013 15:17 CEST, "Eric Barboni" a= =E9crit: > >> >> Le Samedi 1 Juin 2013 14:04 CEST, Olivier Lamy a =E9c= rit: >> >> > 2013/5/28 Eric Barboni : >> > > Yep sorry will patch when back home (svn is broken on my office lapt= op ) >> > >> > 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 i= s already done >> >> >> >> > >> > Thanks. >> > >> > > >> > > -----Message d'origine----- >> > > De : Olivier Lamy [mailto:olamy@apache.org] >> > > Envoy=E9 : mardi 28 mai 2013 01:26 >> > > =C0 : dev@archiva.apache.org >> > > Objet : Re: svn commit: r1486718 - in >> > > /archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archi= va-rest/ >> > > archiva-rest-services/src: main/java/org/apache/archiva/rest/service= s/ >> > > test/java/org/apache/archiva/rest/services/ >> > > >> > > 2013/5/28 : >> > >> 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/archiv= a-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/archiv= a-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/archi= va- >> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/se= rvi >> > >> ces/AbstractArchivaRestTest.java >> > >> >> > >> Modified: >> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archi= va- >> > >> rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/se= rvi >> > >> ces/DefaultPluginsServices.java >> > >> URL: >> > >> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/arch= iva >> > >> -modules/archiva-web/archiva-rest/archiva-rest-services/src/main/ja= va/ >> > >> org/apache/archiva/rest/services/DefaultPluginsServices.java?rev=3D= 14867 >> > >> 18&r1=3D1486717&r2=3D1486718&view=3Ddiff >> > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D> >> = =3D=3D=3D=3D=3D=3D=3D=3D >> > >> --- >> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archi= va- >> > >> rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/se= rvi >> > >> ces/DefaultPluginsServices.java (original) >> > >> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/a= rch >> > >> +++ iva-rest/archiva-rest-services/src/main/java/org/apache/archiva= /re >> > >> +++ st/services/DefaultPluginsServices.java Mon May 27 22:04:25 201= 3 >> > >> @@ -39,20 +39,23 @@ public class DefaultPluginsServices >> > >> >> > >> private List repositoryType =3D new ArrayList(= ); >> > >> private List adminFeatures =3D new ArrayList()= ; >> > >> + private ApplicationContext appCont; >> > >> >> > >> @Inject >> > >> public DefaultPluginsServices( ApplicationContext applicationC= ontext >> > > ) >> > >> { >> > >> - feed( repositoryType, "repository", applicationContext );>= >> - feed( adminFeatures, "features", applicationContext ); > >> > >> + System.err.println( "appCont" ); >> > >> + this.appCont =3D applicationContext; >> > >> } >> > >> >> > >> - private void feed( List repository, String key, >> > > ApplicationContext applicationContext ) >> > >> + private void feed( List repository, String key ) throw= s >> > >> + ArchivaRestServiceException >> > >> { >> > >> + System.err.println( "feeed" ); >> > > >> > > Not possible to use logger ? >> > > >> > >> + repository.clear(); >> > >> Resource[] xmlResources; >> > >> try >> > >> { >> > >> - xmlResources =3D applicationContext.getResources( "/**= /" + key >> > > + "/**/main.js" ); >> > >> + xmlResources =3D appCont.getResources( "/**/" + key +>= >> + "/**/main.js" ); >> > >> for ( Resource rc : xmlResources ) >> > >> { >> > >> String tmp =3D rc.getURL().toString(); @@ -60,8 +6= 3,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 =3D 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/archi= va- >> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/se= rvi >> > >> ces/AbstractArchivaRestTest.java >> > >> URL: >> > >> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/arch= iva >> > >> -modules/archiva-web/archiva-rest/archiva-rest-services/src/test/ja= va/ >> > >> org/apache/archiva/rest/services/AbstractArchivaRestTest.java?rev= =3D1486 >> > >> 718&r1=3D1486717&r2=3D1486718&view=3Ddiff >> > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D> >> = =3D=3D=3D=3D=3D=3D=3D=3D >> > >> --- >> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archi= va- >> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/se= rvi >> > >> ces/AbstractArchivaRestTest.java (original) >> > >> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/a= rch >> > >> +++ iva-rest/archiva-rest-services/src/test/java/org/apache/archiva= /re >> > >> +++ st/services/AbstractArchivaRestTest.java Mon May 27 22:04:25 20= 13 >> > >> @@ -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 =3D getService( PluginsService.clas= s, null >> > > ); >> > >> + WebClient.client( service ).accept( MediaType.TEXT_PLAIN )= ; >> > >> + WebClient.client( service ).type( MediaType.TEXT_PLAIN ); >> > >> + return service; >> > >> + } >> > >> >> > >> protected RemoteRepositoriesService getRemoteRepositoriesServi= ce() >> > >> { >> > >> >> > >> Added: >> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archi= va- >> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/se= rvi >> > >> ces/PluginServiceTest.java >> > >> URL: >> > >> http://svn.apache.org/viewvc/archiva/branches/archiva-MRM-1756/arch= iva >> > >> -modules/archiva-web/archiva-rest/archiva-rest-services/src/test/ja= va/ >> > >> org/apache/archiva/rest/services/PluginServiceTest.java?rev=3D14867= 18&vi >> > >> ew=3Dauto >> > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D> >> = =3D=3D=3D=3D=3D=3D=3D=3D >> > >> --- >> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archi= va- >> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/se= rvi >> > >> ces/PluginServiceTest.java (added) >> > >> +++ archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/a= rch >> > >> +++ 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 =3D getPluginsService(); >> > >> + String value =3D res.getAdminPlugins(); >> > >> + assertEquals( "", value ); >> > >> + } >> > >> + >> > >> + >> > >> +} >> > >> >> > >> Propchange: >> > >> archiva/branches/archiva-MRM-1756/archiva-modules/archiva-web/archi= va- >> > >> rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/se= rvi >> > >> ces/PluginServiceTest.java >> > >> >> > > --------------------------------------------------------------------= -------- >> > > -- >> > >> svn:eol-style =3D 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 >> >> >> >> > > > > --=20 Olivier Lamy Ecetera: http://ecetera.com.au http://twitter.com/olamy | http://linkedin.com/in/olamy