Author: dennisl
Date: Wed Sep 27 14:09:37 2006
New Revision: 450580

URL: http://svn.apache.org/viewvc?view=rev&rev=450580
Log:
[MIDEA-67] SCM connection URLs that use the pipe character as a delimiter are 
not handled.

Added:
    
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/MavenProjectWithScmConnectionWithPipeStub.java
   (with props)
    
maven/plugins/trunk/maven-idea-plugin/src/test/workspace-plugin-configs/connection-with-pipe-plugin-config.xml
   (with props)
Modified:
    
maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaWorkspaceMojo.java
    
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaWorkspaceTest.java

Modified: 
maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaWorkspaceMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaWorkspaceMojo.java?view=diff&rev=450580&r1=450579&r2=450580
==============================================================================
--- 
maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaWorkspaceMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaWorkspaceMojo.java
 Wed Sep 27 14:09:37 2006
@@ -132,7 +132,12 @@
             {
                 int startIndex = connection.indexOf( ":" );
 
-                int endIndex = connection.indexOf( ":", startIndex + 1 );
+                int endIndex = connection.indexOf( "|", startIndex + 1 );
+
+                if ( endIndex == -1 )
+                {
+                    endIndex = connection.indexOf( ":", startIndex + 1 );
+                }
 
                 if ( startIndex < endIndex )
                 {

Modified: 
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaWorkspaceTest.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaWorkspaceTest.java?view=diff&rev=450580&r1=450579&r2=450580
==============================================================================
--- 
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaWorkspaceTest.java
 (original)
+++ 
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaWorkspaceTest.java
 Wed Sep 27 14:09:37 2006
@@ -45,6 +45,18 @@
         assertEquals( "Test scm type from scm connection", "type", 
element.attributeValue( "value" ) );
     }
 
+    public void testScmConnectionWithPipeConfig()
+        throws Exception
+    {
+        Document iwsDocument = executeMojo( 
"src/test/workspace-plugin-configs/connection-with-pipe-plugin-config.xml" );
+
+        Element component = findComponent( iwsDocument.getRootElement(), 
"VcsManagerConfiguration" );
+
+        Element element = findElementByNameAttribute( component, "option", 
"ACTIVE_VCS_NAME" );
+
+        assertEquals( "Test scm type from scm connection", "type", 
element.attributeValue( "value" ) );
+    }
+
     public void testScmDevConnectionConfig()
         throws Exception
     {

Added: 
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/MavenProjectWithScmConnectionWithPipeStub.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/MavenProjectWithScmConnectionWithPipeStub.java?view=auto&rev=450580
==============================================================================
--- 
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/MavenProjectWithScmConnectionWithPipeStub.java
 (added)
+++ 
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/MavenProjectWithScmConnectionWithPipeStub.java
 Wed Sep 27 14:09:37 2006
@@ -0,0 +1,19 @@
+package org.apache.maven.plugin.idea.stubs;
+
+import org.apache.maven.model.Scm;
+
+/**
+ * @author Dennis Lundberg
+ */
+public class MavenProjectWithScmConnectionWithPipeStub
+    extends SimpleMavenProjectStub
+{
+    public Scm getScm()
+    {
+        Scm scm = new Scm();
+
+        scm.setConnection( "scm:type|" );
+
+        return scm;
+    }
+}

Propchange: 
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/MavenProjectWithScmConnectionWithPipeStub.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/plugins/trunk/maven-idea-plugin/src/test/workspace-plugin-configs/connection-with-pipe-plugin-config.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-idea-plugin/src/test/workspace-plugin-configs/connection-with-pipe-plugin-config.xml?view=auto&rev=450580
==============================================================================
--- 
maven/plugins/trunk/maven-idea-plugin/src/test/workspace-plugin-configs/connection-with-pipe-plugin-config.xml
 (added)
+++ 
maven/plugins/trunk/maven-idea-plugin/src/test/workspace-plugin-configs/connection-with-pipe-plugin-config.xml
 Wed Sep 27 14:09:37 2006
@@ -0,0 +1,32 @@
+<!--
+  ~
+  ~  Copyright 2006 The Apache Software Foundation.
+  ~
+  ~  Licensed 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.
+  ~
+  -->
+
+<project>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-idea-plugin</artifactId>
+        <configuration>
+          <executedProject 
implementation="org.apache.maven.plugin.idea.stubs.MavenProjectWithScmConnectionWithPipeStub"/>
+          <localRepo>${localRepository}</localRepo>
+          <overwrite>false</overwrite>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

Propchange: 
maven/plugins/trunk/maven-idea-plugin/src/test/workspace-plugin-configs/connection-with-pipe-plugin-config.xml
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to