maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] silkentrance closed pull request #190: MPOM-211
Date Mon, 29 Oct 2018 20:37:10 GMT
silkentrance closed pull request #190: MPOM-211
URL: https://github.com/apache/maven/pull/190
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java b/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java
index e10ce0f2dd..3d8bb4f96f 100644
--- a/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java
+++ b/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java
@@ -1925,12 +1925,25 @@ protected void mergeIssueManagement_Url( IssueManagement target, IssueManagement
 
     protected void mergeScm( Scm target, Scm source, boolean sourceDominant, Map<Object,
Object> context )
     {
+        mergeScm_Id( target, source, sourceDominant, context );
         mergeScm_Url( target, source, sourceDominant, context );
         mergeScm_Connection( target, source, sourceDominant, context );
         mergeScm_DeveloperConnection( target, source, sourceDominant, context );
         mergeScm_Tag( target, source, sourceDominant, context );
     }
 
+    protected void mergeScm_Id( Scm target, Scm source, boolean sourceDominant, Map<Object,
Object> context )
+    {
+        String src = source.getId();
+        if ( src != null )
+        {
+            if ( sourceDominant || target.getId() == null )
+            {
+                target.setId( src );
+            }
+        }
+    }
+
     protected void mergeScm_Url( Scm target, Scm source, boolean sourceDominant, Map<Object,
Object> context )
     {
         String src = source.getUrl();
diff --git a/maven-model/src/main/mdo/maven.mdo b/maven-model/src/main/mdo/maven.mdo
index 959c653032..3e21788f55 100644
--- a/maven-model/src/main/mdo/maven.mdo
+++ b/maven-model/src/main/mdo/maven.mdo
@@ -1662,6 +1662,16 @@
           </description>
           <type>String</type>
         </field>
+        <field>
+          <name>id</name>
+          <version>4.0.0+</version>
+          <description>
+            <![CDATA[
+            The optional server id. The server id allows you to associate an Scm with a server
entry in the settings.xml, where sensible information such as credentials can be stored in
a more secure way.
+            ]]>
+          </description>
+          <type>String</type>
+        </field>
       </fields>
       <codeSegments>
         <codeSegment>
@@ -1676,6 +1686,57 @@
     public void setChildInheritAppendPath( boolean childInheritAppendPath )
     {
         this.childInheritAppendPath = String.valueOf( childInheritAppendPath );
+    }
+            ]]>
+          </code>
+        </codeSegment>
+        <codeSegment>
+          <version>4.0.0+</version>
+          <code>
+            <![CDATA[
+    /**
+     * Return the hashCode.
+     *
+     * @return int
+     */
+    public int hashCode()
+    {
+        int result = java.util.Objects.hashCode( this.id );
+        result = result * 29 + java.util.Objects.hashCode( this.url );
+        result = result * 29 + java.util.Objects.hashCode( this.connection );
+        result = result * 29 + java.util.Objects.hashCode( this.developerConnection );
+        result = result * 29 + java.util.Objects.hashCode( this.tag );
+        result = result * 29 + java.util.Objects.hashCode( this.childInheritAppendPath );
+
+        return result;
+    }
+            ]]>
+          </code>
+        </codeSegment>
+        <codeSegment>
+          <version>4.0.0+</version>
+          <code>
+            <![CDATA[
+    /**
+     * Return whether this equals the specified object obj.
+     *
+     * @return boolean
+     */
+    public boolean equals( Object obj )
+    {
+        if ( super.equals( obj ) || obj instanceof Scm )
+        {
+          Scm other = ( Scm ) obj;
+
+          return java.util.Objects.equals( this.id, other.id )
+                 && java.util.Objects.equals( this.url, other.url )
+                 && java.util.Objects.equals( this.connection, other.connection )
+                 && java.util.Objects.equals( this.developerConnection, other.developerConnection
)
+                 && java.util.Objects.equals( this.tag, other.tag )
+                 && java.util.Objects.equals( this.childInheritAppendPath, other.childInheritAppendPath
);
+        }
+
+        return false;
     }
             ]]>
           </code>
diff --git a/maven-model/src/test/java/org/apache/maven/model/ScmTest.java b/maven-model/src/test/java/org/apache/maven/model/ScmTest.java
index 4d7699310e..0164668955 100644
--- a/maven-model/src/test/java/org/apache/maven/model/ScmTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/ScmTest.java
@@ -32,7 +32,13 @@
 
     public void testHashCodeNullSafe()
     {
-        new Scm().hashCode();
+        assertEquals( 64186976, new Scm().hashCode() );
+        assertEquals( new Scm().hashCode(), new Scm().hashCode() );
+    }
+
+    public void testHashCodeReturnsExpectedValue()
+    {
+        assertEquals( -2102869462, this.createTestCase().hashCode() );
     }
 
     public void testEqualsNullSafe()
@@ -48,9 +54,25 @@ public void testEqualsIdentity()
         assertTrue( thing.equals( thing ) );
     }
 
+    public void testEqualsSame()
+    {
+        assertTrue( this.createTestCase().equals( this.createTestCase() ) );
+    }
+
     public void testToStringNullSafe()
     {
         assertNotNull( new Scm().toString() );
     }
 
+    private Scm createTestCase()
+    {
+        Scm scm = new Scm();
+        scm.setId("id");
+        scm.setUrl("url");
+        scm.setConnection("connection");
+        scm.setDeveloperConnection("developerConnection");
+        scm.setChildInheritAppendPath(true);
+
+        return scm;
+    }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message