Hi,

Seems that space or some special character are not allowed because of xss.
See Brett comment in https://jira.codehaus.org/browse/MRM-1556
Happy to find the rationale :p

Eric

-----Message d'origine-----
De : Olivier Lamy [mailto:ol...@apache.org] 
Envoyé : samedi 11 août 2012 11:44
À : dev@archiva.apache.org
Objet : Re: svn commit: r1371207 -
/archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-service
s/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.jav
a

Hi,
Maybe it could be better to fix repo with spaces rather than skipping issues
with that :-).
I have an other week of holidays but I can have a look when back.

--
Olivier


2012/8/9  <sk...@apache.org>:
> Author: skygo
> Date: Thu Aug  9 13:37:38 2012
> New Revision: 1371207
>
> URL: http://svn.apache.org/viewvc?rev=1371207&view=rev
> Log:
> Skip tests if module is installed in a path with space. (Repository 
> will be invalid)
>
> Modified:
>     
> archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-se
> rvices/src/test/java/org/apache/archiva/rest/services/AbstractArchivaR
> estTest.java
>
> Modified: 
> archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-se
> rvices/src/test/java/org/apache/archiva/rest/services/AbstractArchivaR
> estTest.java
> URL: 
> http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web
> /archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/r
> est/services/AbstractArchivaRestTest.java?rev=1371207&r1=1371206&r2=13
> 71207&view=diff 
> ======================================================================
> ========
> --- 
> archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-se
> rvices/src/test/java/org/apache/archiva/rest/services/AbstractArchivaR
> estTest.java (original)
> +++ archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-res
> +++ t-services/src/test/java/org/apache/archiva/rest/services/Abstract
> +++ ArchivaRestTest.java Thu Aug  9 13:37:38 2012
> @@ -46,7 +46,10 @@ import java.io.File;  import java.util.Collections;  
> import java.util.Date;  import 
> org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
> +import org.junit.Assume;
> +import org.junit.BeforeClass;
>  import org.junit.runner.RunWith;
> +import org.slf4j.LoggerFactory;
>
>  /**
>   * @author Olivier Lamy
> @@ -67,22 +70,31 @@ public abstract class AbstractArchivaRes
>
>      // END SNIPPET: authz-header
>
> -
> +    @BeforeClass
> +    public static void chekRepo() {
> +        Assume.assumeTrue( !System.getProperty( "appserver.base"
).contains(" ") );
> +        LoggerFactory.getLogger( AbstractArchivaRestTest.class.getName()
).
> +                error( "Rest services unit test must be run in a folder
with no space" );
> +        // skygo: was not possible to fix path in this particular module
> +        // Skip test if not in proper folder , otherwise test are not
fair coz repository
> +        // cannot have space in their name.
> +    }
> +
>      @Override
>      @Before
>      public void startServer()
>          throws Exception
> -    {
> +    {
>          File appServerBase = new File( System.getProperty( 
> "appserver.base" ) );
>
>          File jcrDirectory = new File( appServerBase, "jcr" );
> -
> +
>          if ( jcrDirectory.exists() )
>          {
>              FileUtils.deleteDirectory( jcrDirectory );
>          }
>
> -        super.startServer();
> +        super.startServer();
>      }
>
>      @Override
> @@ -91,6 +103,7 @@ public abstract class AbstractArchivaRes
>          return
"classpath*:META-INF/spring-context.xml,classpath:META-INF/spring-context-te
st.xml";
>      }
>
> +    @Override
>      protected String getRestServicesPath()
>      {
>          return "restServices";
> @@ -233,7 +246,7 @@ public abstract class AbstractArchivaRes
>
>      protected SearchService getSearchService( String authzHeader )
>      {
> -        // START SNIPPET: cxf-searchservice-creation
> +        // START SNIPPET: cxf-searchservice-creation
>          SearchService service =
>              JAXRSClientFactory.create( getBaseUrl() + "/" +
getRestServicesPath() + "/archivaServices/",
>                                         SearchService.class, @@ -373,7 
> +386,7 @@ public abstract class AbstractArchivaRes
>          }
>
>      }
> -
> +
>      protected void createAndIndexRepo( String testRepoId, String
repoPath, boolean scan )
>          throws Exception
>      {
> @@ -391,7 +404,7 @@ public abstract class AbstractArchivaRes
>          {
>              FileUtils.deleteDirectory( badContent );
>          }
> -
> +
>          managedRepository.setLocation( new File( repoPath ).getPath() );
>          managedRepository.setIndexDirectory(
>              System.getProperty( "java.io.tmpdir" ) + 
> "/target/.index-" + Long.toString( new Date().getTime() ) );
>
>



--
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

Reply via email to