1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.extension

File AbstractExtensionScm.java

 

Coverage histogram

../../../img/srcFileCovDistChart9.png
38% of files have more coverage

Code metrics

4
17
6
1
99
54
8
0.47
2.83
6
1.33

Classes

Class Line # Actions
AbstractExtensionScm 33 17 0% 8 4
0.851851985.2%
 

Contributing tests

This file is covered by 10 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.extension;
21   
22    import java.util.Objects;
23   
24    import org.apache.commons.lang3.StringUtils;
25    import org.apache.commons.lang3.builder.HashCodeBuilder;
26   
27    /**
28    * Base class or implementations of {@link ExtensionScm}.
29    *
30    * @version $Id: 71e1b442cf081234b2a0ccbba986409cf49bae14 $
31    * @since 6.3M1
32    */
 
33    public abstract class AbstractExtensionScm implements ExtensionScm
34    {
35    private ExtensionScmConnection connection;
36   
37    private ExtensionScmConnection developerConnection;
38   
39    private String url;
40   
41    /**
42    * @param url the browsable URL
43    * @param connection the read connection
44    * @param developerConnection the write connection
45    */
 
46  26878 toggle public AbstractExtensionScm(String url, ExtensionScmConnection connection,
47    ExtensionScmConnection developerConnection)
48    {
49  26878 this.url = url;
50  26878 this.connection = connection;
51  26878 this.developerConnection = developerConnection;
52    }
53   
 
54  13030 toggle @Override
55    public ExtensionScmConnection getConnection()
56    {
57  13030 return this.connection;
58    }
59   
 
60  12982 toggle @Override
61    public ExtensionScmConnection getDeveloperConnection()
62    {
63  12982 return this.developerConnection;
64    }
65   
 
66  13051 toggle @Override
67    public String getUrl()
68    {
69  13051 return this.url;
70    }
71   
 
72  1 toggle @Override
73    public boolean equals(Object obj)
74    {
75  1 if (obj == this) {
76  0 return true;
77    }
78   
79  1 if (obj instanceof ExtensionScm) {
80  1 ExtensionScm scm = (ExtensionScm) obj;
81  1 return StringUtils.equals(this.url, scm.getUrl()) && Objects.equals(this.connection, scm.getConnection())
82    && Objects.equals(this.developerConnection, scm.getDeveloperConnection());
83    }
84   
85  0 return false;
86    }
87   
 
88  55 toggle @Override
89    public int hashCode()
90    {
91  55 HashCodeBuilder builder = new HashCodeBuilder();
92   
93  55 builder.append(this.connection);
94  55 builder.append(this.developerConnection);
95  55 builder.append(this.url);
96   
97  55 return builder.toHashCode();
98    }
99    }