continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r685384 - in /continuum/trunk: continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/ continuum-commons/src/test/java/org/apache/maven/continuum/utils/ continuum-commons/src/test/resources/org/apache/maven/...
Date Tue, 12 Aug 2008 23:58:16 GMT
Author: olamy
Date: Tue Aug 12 16:58:15 2008
New Revision: 685384

URL: http://svn.apache.org/viewvc?rev=685384&view=rev
Log:
fix units

Added:
    continuum/trunk/continuum-commons/src/test/resources/org/apache/maven/continuum/utils/
    continuum/trunk/continuum-commons/src/test/resources/org/apache/maven/continuum/utils/ContinuumUrlValidatorTest.xml
  (with props)
Modified:
    continuum/trunk/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
    continuum/trunk/continuum-commons/src/test/java/org/apache/maven/continuum/utils/ContinuumUrlValidatorTest.java
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
    continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
    continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/application.xml

Modified: continuum/trunk/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java?rev=685384&r1=685383&r2=685384&view=diff
==============================================================================
--- continuum/trunk/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
(original)
+++ continuum/trunk/continuum-base/continuum-configuration/src/main/java/org/apache/continuum/configuration/DefaultContinuumConfiguration.java
Tue Aug 12 16:58:15 2008
@@ -84,7 +84,7 @@
 
             this.generalConfiguration = new GeneralConfiguration();
             this.generalConfiguration.setBaseUrl( getConfigurationString( BASE_URL_KEY )
);
-            log.info( "BaseUrl=" +this.generalConfiguration.getBaseUrl() );
+            log.info( "BaseUrl=" + this.generalConfiguration.getBaseUrl() );
             // TODO check if files exists ?
             String buildOutputDirectory = getConfigurationString( BUILDOUTPUT_DIR_KEY );
             if ( buildOutputDirectory != null )
@@ -124,7 +124,10 @@
 
     private String getConfigurationString( String key )
     {
-        log.info( "Configuration=" + configuration );
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Configuration=" + configuration );
+        }
         return configuration.getString( key );
     }
 

Modified: continuum/trunk/continuum-commons/src/test/java/org/apache/maven/continuum/utils/ContinuumUrlValidatorTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-commons/src/test/java/org/apache/maven/continuum/utils/ContinuumUrlValidatorTest.java?rev=685384&r1=685383&r2=685384&view=diff
==============================================================================
--- continuum/trunk/continuum-commons/src/test/java/org/apache/maven/continuum/utils/ContinuumUrlValidatorTest.java
(original)
+++ continuum/trunk/continuum-commons/src/test/java/org/apache/maven/continuum/utils/ContinuumUrlValidatorTest.java
Tue Aug 12 16:58:15 2008
@@ -1,6 +1,8 @@
 package org.apache.maven.continuum.utils;
 
-import junit.framework.TestCase;
+import java.io.File;
+
+import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -26,94 +28,117 @@
  * @version $Id$
  */
 public class ContinuumUrlValidatorTest
-    extends TestCase
+    extends PlexusInSpringTestCase
 {
+    
+    protected ContinuumUrlValidator getContinuumUrlValidator()
+        throws Exception
+    {
+        return getContinuumUrlValidator( "continuumUrl" );
+    }
+
+    protected ContinuumUrlValidator getContinuumUrlValidator( String roleHint )
+        throws Exception
+    {
+        return (ContinuumUrlValidator) lookup( ContinuumUrlValidator.class, roleHint );
+    }    
 
     public void testSuccessHttp()
         throws Exception
     {
-        assertTrue( new ContinuumUrlValidator().validate( "http://svn.apache.org/repos/asf/continuum/trunk/pom.xml"
) );
+        assertTrue( getContinuumUrlValidator().validate( "http://svn.apache.org/repos/asf/continuum/trunk/pom.xml"
) );
     }
 
     public void testFailureHttp()
         throws Exception
     {
-        assertFalse( new ContinuumUrlValidator().validate( "ttp://svn.apache.org/repos/asf/continuum/trunk/pom.xml"
) );
+        assertFalse( getContinuumUrlValidator().validate( "ttp://svn.apache.org/repos/asf/continuum/trunk/pom.xml"
) );
     }
 
     public void testSuccessHttpWithAuth()
         throws Exception
     {
-        assertTrue( new ContinuumUrlValidator()
+        assertTrue( getContinuumUrlValidator()
             .validate( "https://username:password@svn.apache.org/repos/asf/continuum/trunk/pom.xml"
) );
     }
 
     public void testFailureHttpWithAuth()
         throws Exception
     {
-        assertFalse( new ContinuumUrlValidator()
+        assertFalse( getContinuumUrlValidator()
             .validate( "http://username:passwordsvn.apache.org/repos/asf/continuum/trunk/pom.xml"
) );
     }
 
     public void testFailureHttpWithFile()
         throws Exception
     {
-        assertFalse( new ContinuumUrlValidator().validate( "file:///home/zloug/pom.xml" )
);
+        assertFalse( getContinuumUrlValidator( "continuumUrlWithoutFile" ).validate( "file:///home/zloug/pom.xml"
) );
     }
 
     public void testSuccessHttps()
         throws Exception
     {
-        assertTrue( new ContinuumUrlValidator().validate( "https://svn.apache.org/repos/asf/continuum/trunk/pom.xml"
) );
+        assertTrue( getContinuumUrlValidator().validate( "https://svn.apache.org/repos/asf/continuum/trunk/pom.xml"
) );
     }
 
     public void testSuccessHttpsWithAuth()
         throws Exception
     {
-        assertTrue( new ContinuumUrlValidator()
+        assertTrue( getContinuumUrlValidator()
             .validate( "https://username:password@svn.apache.org/repos/asf/continuum/trunk/pom.xml"
) );
     }
 
     public void testSuccessHttpviewvc()
         throws Exception
     {
-        assertTrue( new ContinuumUrlValidator()
+        assertTrue( getContinuumUrlValidator()
             .validate( "http://svn.apache.org/viewvc/continuum/trunk/pom.xml?revision=681492&content-type=text%2Fplain"
) );
     }
 
     public void testSuccessHttpviewvcWithAuth()
         throws Exception
     {
-        assertTrue( new ContinuumUrlValidator()
-            .validate( "http://username:password@svn.apache.org/viewvc/continuum/trunk/pom.xml?revision=681492&content-type=text%2Fplain"
) );
+        assertTrue( getContinuumUrlValidator()
+            .validate(
+                       "http://username:password@svn.apache.org/viewvc/continuum/trunk/pom.xml?revision=681492&content-type=text%2Fplain"
) );
     }
 
     public void testSuccessHttpsviewvc()
         throws Exception
     {
-        assertTrue( new ContinuumUrlValidator()
-            .validate( "https://svn.apache.org/viewvc/continuum/trunk/pom.xml?revision=681492&content-type=text%2Fplain"
) );
+        assertTrue( getContinuumUrlValidator()
+            .validate(
+                       "https://svn.apache.org/viewvc/continuum/trunk/pom.xml?revision=681492&content-type=text%2Fplain"
) );
     }
 
     public void testSuccessHttpsviewvcWithAuth()
         throws Exception
     {
-        assertTrue( new ContinuumUrlValidator()
-            .validate( "https://username:password@svn.apache.org/viewvc/continuum/trunk/pom.xml?revision=681492&content-type=text%2Fplain"
) );
+        assertTrue( getContinuumUrlValidator()
+            .validate(
+                       "https://username:password@svn.apache.org/viewvc/continuum/trunk/pom.xml?revision=681492&content-type=text%2Fplain"
) );
     }
 
     public void testSuccessHttpfisheye()
         throws Exception
     {
-        assertTrue( new ContinuumUrlValidator()
+        assertTrue( getContinuumUrlValidator()
             .validate( "http://fisheye6.atlassian.com/browse/~raw,r=680040/continuum/trunk/pom.xml"
) );
     }
 
     public void testSuccessHttpsfisheye()
         throws Exception
     {
-        assertTrue( new ContinuumUrlValidator()
+        assertTrue( getContinuumUrlValidator()
             .validate( "https://fisheye6.atlassian.com/browse/~raw,r=680040/continuum/trunk/pom.xml"
) );
     }
+
+    public void testValidateFile()
+        throws Exception
+    {
+        File rootPom = getTestFile( "src/test/resources/log4j.xml" );
+        assertTrue( rootPom.exists() );
+        assertTrue( getContinuumUrlValidator().validate( rootPom.toURL().toExternalForm()
) );
+    }
    
 }

Added: continuum/trunk/continuum-commons/src/test/resources/org/apache/maven/continuum/utils/ContinuumUrlValidatorTest.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-commons/src/test/resources/org/apache/maven/continuum/utils/ContinuumUrlValidatorTest.xml?rev=685384&view=auto
==============================================================================
--- continuum/trunk/continuum-commons/src/test/resources/org/apache/maven/continuum/utils/ContinuumUrlValidatorTest.xml
(added)
+++ continuum/trunk/continuum-commons/src/test/resources/org/apache/maven/continuum/utils/ContinuumUrlValidatorTest.xml
Tue Aug 12 16:58:15 2008
@@ -0,0 +1,49 @@
+<!--
+  ~ 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.
+  -->
+
+<plexus>
+  <components>
+    <component>
+      <role>org.apache.maven.continuum.utils.ContinuumUrlValidator</role>
+      <role-hint>continuumUrl</role-hint>
+      <implementation>org.apache.maven.continuum.utils.ContinuumUrlValidator</implementation>
+      <configuration>
+        <allowedSchemes>
+          <allowedScheme>http</allowedScheme>
+          <allowedScheme>https</allowedScheme>
+          <allowedScheme>file</allowedScheme>
+        </allowedSchemes>
+      </configuration>
+    </component>
+
+    <component>
+      <role>org.apache.maven.continuum.utils.ContinuumUrlValidator</role>
+      <role-hint>continuumUrlWithoutFile</role-hint>
+      <implementation>org.apache.maven.continuum.utils.ContinuumUrlValidator</implementation>
+      <configuration>
+        <allowedSchemes>
+          <allowedScheme>http</allowedScheme>
+          <allowedScheme>https</allowedScheme>
+        </allowedSchemes>
+      </configuration>
+    </component>
+    
+    
+  </components>
+</plexus>

Propchange: continuum/trunk/continuum-commons/src/test/resources/org/apache/maven/continuum/utils/ContinuumUrlValidatorTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-commons/src/test/resources/org/apache/maven/continuum/utils/ContinuumUrlValidatorTest.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=685384&r1=685383&r2=685384&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Tue Aug 12 16:58:15 2008
@@ -1732,7 +1732,7 @@
     {
         if ( checkProtocol )
         {
-                if ( !urlValidator.validate( metadataUrl ) )
+            if ( !urlValidator.validate( metadataUrl ) )
             {
                 ContinuumProjectBuildingResult res = new ContinuumProjectBuildingResult();
                 res.addError( ContinuumProjectBuildingResult.ERROR_PROTOCOL_NOT_ALLOWED );

Modified: continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java?rev=685384&r1=685383&r2=685384&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
(original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
Tue Aug 12 16:58:15 2008
@@ -36,8 +36,11 @@
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
+import org.apache.maven.continuum.utils.ContinuumUrlValidator;
 import org.codehaus.plexus.taskqueue.TaskQueue;
 import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -46,6 +49,8 @@
 public class DefaultContinuumTest
     extends AbstractContinuumTest
 {
+    protected Logger log = LoggerFactory.getLogger( getClass() );
+    
     public void testContinuumConfiguration()
         throws Exception
     {
@@ -75,7 +80,15 @@
 
         File rootPom = getTestFile( "src/test/resources/projects/continuum/continuum-notifiers/pom.xml"
);
 
-        ContinuumProjectBuildingResult result = continuum.addMavenTwoProject( rootPom.toURL().toExternalForm()
);
+        assertTrue( rootPom.exists() );
+        
+        ContinuumUrlValidator validator = (ContinuumUrlValidator) lookup( ContinuumUrlValidator.class,
"continuumUrl" );
+        
+        String fileUrl = rootPom.toURL().toExternalForm();
+        
+        //assertTrue( validator.validate( fileUrl ) );
+        
+        ContinuumProjectBuildingResult result = continuum.addMavenTwoProject( fileUrl );
 
         assertNotNull( result );
 
@@ -85,9 +98,9 @@
 
         assertEquals( "result.projectGroups.size", 1, result.getProjectGroups().size() );
 
-        System.err.println( "number of projects: " + getProjectDao().getAllProjectsByName().size()
);
+        log.info( "number of projects: " + getProjectDao().getAllProjectsByName().size()
);
 
-        System.err.println(
+        log.info(
             "number of project groups: " + getProjectGroupDao().getAllProjectGroupsWithProjects().size()
);
 
         assertEquals( "Total project count", projectCount + 3, getProjectDao().getAllProjectsByName().size()
);

Modified: continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml?rev=685384&r1=685383&r2=685384&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
(original)
+++ continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
Tue Aug 12 16:58:15 2008
@@ -53,8 +53,8 @@
      |
     -->
     <component>
-      <role>org.codehaus.plexus.formica.validation.Validator</role>
-      <role-hint>url</role-hint>
+      <role>org.apache.maven.continuum.utils.ContinuumUrlValidator</role>
+      <role-hint>continuumUrl</role-hint>
       <implementation>org.apache.maven.continuum.utils.ContinuumUrlValidator</implementation>
       <configuration>
         <allowedSchemes>

Modified: continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/application.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/application.xml?rev=685384&r1=685383&r2=685384&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/application.xml (original)
+++ continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/application.xml Tue
Aug 12 16:58:15 2008
@@ -221,8 +221,8 @@
     </component>
 
     <component>
-      <role>org.codehaus.plexus.formica.validation.Validator</role>
-      <role-hint>url</role-hint>
+      <role>org.apache.maven.continuum.utils.ContinuumUrlValidator</role>
+      <role-hint>continuumUrl</role-hint>
       <implementation>org.apache.maven.continuum.utils.ContinuumUrlValidator</implementation>
       <configuration>
         <allowedSchemes>



Mime
View raw message