Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
KnownHostEntry |
|
| 3.4;3,4 |
1 | package org.apache.maven.wagon.providers.ssh.knownhost; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one | |
5 | * or more contributor license agreements. See the NOTICE file | |
6 | * distributed with this work for additional information | |
7 | * regarding copyright ownership. The ASF licenses this file | |
8 | * to you under the Apache License, Version 2.0 (the | |
9 | * "License"); you may not use this file except in compliance | |
10 | * with the License. You may obtain a copy of the License at | |
11 | * | |
12 | * http://www.apache.org/licenses/LICENSE-2.0 | |
13 | * | |
14 | * Unless required by applicable law or agreed to in writing, | |
15 | * software distributed under the License is distributed on an | |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
17 | * KIND, either express or implied. See the License for the | |
18 | * specific language governing permissions and limitations | |
19 | * under the License. | |
20 | */ | |
21 | ||
22 | public class KnownHostEntry | |
23 | { | |
24 | ||
25 | private String hostName; | |
26 | ||
27 | private String keyType; | |
28 | ||
29 | private String keyValue; | |
30 | ||
31 | public KnownHostEntry() | |
32 | 0 | { |
33 | 0 | } |
34 | ||
35 | public KnownHostEntry( String hostName, String keyType, String keyValue ) | |
36 | 9 | { |
37 | 9 | this.hostName = hostName; |
38 | 9 | this.keyType = keyType; |
39 | 9 | this.keyValue = keyValue; |
40 | 9 | } |
41 | ||
42 | public String getHostName() | |
43 | { | |
44 | 0 | return hostName; |
45 | } | |
46 | ||
47 | public void setHostName( String hostName ) | |
48 | { | |
49 | 0 | this.hostName = hostName; |
50 | 0 | } |
51 | ||
52 | public String getKeyType() | |
53 | { | |
54 | 0 | return keyType; |
55 | } | |
56 | ||
57 | public void setKeyType( String keyType ) | |
58 | { | |
59 | 0 | this.keyType = keyType; |
60 | 0 | } |
61 | ||
62 | public String getKeyValue() | |
63 | { | |
64 | 0 | return keyValue; |
65 | } | |
66 | ||
67 | public void setKeyValue( String keyValue ) | |
68 | { | |
69 | 0 | this.keyValue = keyValue; |
70 | 0 | } |
71 | ||
72 | public int hashCode() | |
73 | { | |
74 | 11 | final int prime = 31; |
75 | 11 | int result = 1; |
76 | 11 | result = prime * result + ( ( hostName == null ) ? 0 : hostName.hashCode() ); |
77 | 11 | result = prime * result + ( ( keyType == null ) ? 0 : keyType.hashCode() ); |
78 | 11 | result = prime * result + ( ( keyValue == null ) ? 0 : keyValue.hashCode() ); |
79 | 11 | return result; |
80 | } | |
81 | ||
82 | public boolean equals( Object obj ) | |
83 | { | |
84 | 2 | if ( this == obj ) |
85 | { | |
86 | 0 | return true; |
87 | } | |
88 | ||
89 | 2 | if ( obj == null ) |
90 | { | |
91 | 0 | return false; |
92 | } | |
93 | ||
94 | 2 | if ( getClass() != obj.getClass() ) |
95 | { | |
96 | 0 | return false; |
97 | } | |
98 | ||
99 | 2 | KnownHostEntry other = (KnownHostEntry) obj; |
100 | 2 | if ( hostName == null ) |
101 | { | |
102 | 0 | if ( other.hostName != null ) |
103 | { | |
104 | 0 | return false; |
105 | } | |
106 | } | |
107 | 2 | else if ( !hostName.equals( other.hostName ) ) |
108 | { | |
109 | 0 | return false; |
110 | } | |
111 | ||
112 | 2 | if ( keyType == null ) |
113 | { | |
114 | 0 | if ( other.keyType != null ) |
115 | { | |
116 | 0 | return false; |
117 | } | |
118 | } | |
119 | 2 | else if ( !keyType.equals( other.keyType ) ) |
120 | { | |
121 | 0 | return false; |
122 | } | |
123 | ||
124 | 2 | if ( keyValue == null ) |
125 | { | |
126 | 0 | if ( other.keyValue != null ) |
127 | { | |
128 | 0 | return false; |
129 | } | |
130 | } | |
131 | 2 | else if ( !keyValue.equals( other.keyValue ) ) |
132 | { | |
133 | 0 | return false; |
134 | } | |
135 | 2 | return true; |
136 | } | |
137 | ||
138 | } |