EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.vcloud.domain]

COVERAGE SUMMARY FOR SOURCE FILE [NetworkConnectionSection.java]

nameclass, %method, %block, %line, %
NetworkConnectionSection.java100% (2/2)71%  (15/21)48%  (167/351)43%  (34.5/80)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class NetworkConnectionSection100% (1/1)75%  (9/12)44%  (121/273)37%  (23.5/64)
equals (Object): boolean 0%   (0/1)0%   (0/117)0%   (0/38)
toBuilder (): NetworkConnectionSection$Builder 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/22)0%   (0/1)
hashCode (): int 100% (1/1)88%  (74/84)94%  (8.5/9)
NetworkConnectionSection (String, URI, String, Integer, Iterable, ReferenceTy... 100% (1/1)100% (25/25)100% (8/8)
builder (): NetworkConnectionSection$Builder 100% (1/1)100% (4/4)100% (1/1)
getConnections (): Set 100% (1/1)100% (3/3)100% (1/1)
getEdit (): ReferenceType 100% (1/1)100% (3/3)100% (1/1)
getHref (): URI 100% (1/1)100% (3/3)100% (1/1)
getInfo (): String 100% (1/1)100% (3/3)100% (1/1)
getPrimaryNetworkConnectionIndex (): Integer 100% (1/1)100% (3/3)100% (1/1)
getType (): String 100% (1/1)100% (3/3)100% (1/1)
     
class NetworkConnectionSection$Builder100% (1/1)67%  (6/9)59%  (46/78)69%  (11/16)
edit (ReferenceType): NetworkConnectionSection$Builder 0%   (0/1)0%   (0/5)0%   (0/2)
fromNetworkConnectionSection (NetworkConnectionSection): NetworkConnectionSec... 0%   (0/1)0%   (0/22)0%   (0/1)
primaryNetworkConnectionIndex (Integer): NetworkConnectionSection$Builder 0%   (0/1)0%   (0/5)0%   (0/2)
NetworkConnectionSection$Builder (): void 100% (1/1)100% (6/6)100% (2/2)
build (): NetworkConnectionSection 100% (1/1)100% (16/16)100% (1/1)
connections (Iterable): NetworkConnectionSection$Builder 100% (1/1)100% (9/9)100% (2/2)
href (URI): NetworkConnectionSection$Builder 100% (1/1)100% (5/5)100% (2/2)
info (String): NetworkConnectionSection$Builder 100% (1/1)100% (5/5)100% (2/2)
type (String): NetworkConnectionSection$Builder 100% (1/1)100% (5/5)100% (2/2)

1/**
2 * Licensed to jclouds, Inc. (jclouds) under one or more
3 * contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  jclouds licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *   http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.jclouds.vcloud.domain;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.net.URI;
24import java.util.Set;
25 
26import com.google.common.collect.ImmutableSet;
27 
28/**
29 * The NetworkConnectionSection element specifies how a Vm is connected to a vApp network. It
30 * extends the ovf:NetworkConnection element.
31 * <p/>
32 * NOTE The OVF NetworkSection element and the vCloud API NetworkConnectionSection element specify
33 * many of the same parameters for a network connection. If both are present in a Vm body, the
34 * values specified in the NetworkConnectionSection override those specified in the NetworkSection.
35 */
36public class NetworkConnectionSection {
37   public static Builder builder() {
38      return new Builder();
39   }
40 
41   public static class Builder {
42      protected String type;
43      protected URI href;
44      protected String info;
45      protected Integer primaryNetworkConnectionIndex;
46      protected Set<NetworkConnection> connections = ImmutableSet.of();
47      protected ReferenceType edit;
48 
49      public Builder type(String type) {
50         this.type = type;
51         return this;
52      }
53 
54      public Builder href(URI href) {
55         this.href = href;
56         return this;
57      }
58 
59      public Builder info(String info) {
60         this.info = info;
61         return this;
62      }
63 
64      public Builder primaryNetworkConnectionIndex(Integer primaryNetworkConnectionIndex) {
65         this.primaryNetworkConnectionIndex = primaryNetworkConnectionIndex;
66         return this;
67      }
68 
69      public Builder connections(Iterable<? extends NetworkConnection> connections) {
70         this.connections = ImmutableSet.copyOf(checkNotNull(connections, "connections"));
71         return this;
72      }
73 
74      public Builder edit(ReferenceType edit) {
75         this.edit = edit;
76         return this;
77      }
78 
79      public NetworkConnectionSection build() {
80         return new NetworkConnectionSection(type, href, info, primaryNetworkConnectionIndex, connections, edit);
81      }
82 
83      public static Builder fromNetworkConnectionSection(NetworkConnectionSection in) {
84         return new Builder().type(in.getType()).href(in.getHref()).info(in.getInfo())
85               .primaryNetworkConnectionIndex(in.getPrimaryNetworkConnectionIndex()).connections(in.getConnections())
86               .edit(in.getEdit());
87      }
88   }
89 
90   protected final String type;
91   protected final URI href;
92   protected final String info;
93   protected final Integer primaryNetworkConnectionIndex;
94   protected final Set<NetworkConnection> connections;
95   protected final ReferenceType edit;
96 
97   public NetworkConnectionSection(String type, URI href, String info, Integer primaryNetworkConnectionIndex,
98         Iterable<NetworkConnection> connections, ReferenceType edit) {
99      this.type = type;
100      this.href = href;
101      this.info = info;
102      this.primaryNetworkConnectionIndex = primaryNetworkConnectionIndex;
103      this.connections = ImmutableSet.copyOf(checkNotNull(connections, "connections"));
104      this.edit = edit;
105   }
106 
107   /**
108    * 
109    * @return media type of this section
110    */
111   public String getType() {
112      return type;
113   }
114 
115   /**
116    * 
117    * @return URL to access this section
118    */
119   public URI getHref() {
120      return href;
121   }
122 
123   /**
124    * 
125    * @return
126    */
127   public String getInfo() {
128      return info;
129   }
130 
131   /**
132    * 
133    * @return The value of the rasd:AddressOnParent element of the device (NIC) supporting the
134    *         primary network connection to the containing virtual machine.
135    */
136   public Integer getPrimaryNetworkConnectionIndex() {
137      return primaryNetworkConnectionIndex;
138   }
139 
140   /**
141    * 
142    */
143   public Set<? extends NetworkConnection> getConnections() {
144      return connections;
145   }
146 
147   /**
148    * 
149    */
150   public ReferenceType getEdit() {
151      return edit;
152   }
153 
154   @Override
155   public int hashCode() {
156      final int prime = 31;
157      int result = 1;
158      result = prime * result + ((connections == null) ? 0 : connections.hashCode());
159      result = prime * result + ((edit == null) ? 0 : edit.hashCode());
160      result = prime * result + ((href == null) ? 0 : href.hashCode());
161      result = prime * result + ((info == null) ? 0 : info.hashCode());
162      result = prime * result
163            + ((primaryNetworkConnectionIndex == null) ? 0 : primaryNetworkConnectionIndex.hashCode());
164      result = prime * result + ((type == null) ? 0 : type.hashCode());
165      return result;
166   }
167 
168   @Override
169   public boolean equals(Object obj) {
170      if (this == obj)
171         return true;
172      if (obj == null)
173         return false;
174      if (getClass() != obj.getClass())
175         return false;
176      NetworkConnectionSection other = (NetworkConnectionSection) obj;
177      if (connections == null) {
178         if (other.connections != null)
179            return false;
180      } else if (!connections.equals(other.connections))
181         return false;
182      if (edit == null) {
183         if (other.edit != null)
184            return false;
185      } else if (!edit.equals(other.edit))
186         return false;
187      if (href == null) {
188         if (other.href != null)
189            return false;
190      } else if (!href.equals(other.href))
191         return false;
192      if (info == null) {
193         if (other.info != null)
194            return false;
195      } else if (!info.equals(other.info))
196         return false;
197      if (primaryNetworkConnectionIndex == null) {
198         if (other.primaryNetworkConnectionIndex != null)
199            return false;
200      } else if (!primaryNetworkConnectionIndex.equals(other.primaryNetworkConnectionIndex))
201         return false;
202      if (type == null) {
203         if (other.type != null)
204            return false;
205      } else if (!type.equals(other.type))
206         return false;
207      return true;
208   }
209 
210   public Builder toBuilder() {
211      return Builder.fromNetworkConnectionSection(this);
212   }
213 
214   @Override
215   public String toString() {
216      return "[href=" + href + ", connections=" + connections + ", primaryNetworkConnectionIndex="
217            + primaryNetworkConnectionIndex + "]";
218   }
219 
220}

[all classes][org.jclouds.vcloud.domain]
EMMA 2.0.5312 (C) Vladimir Roubtsov