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

COVERAGE SUMMARY FOR SOURCE FILE [NetworkConfigSection.java]

nameclass, %method, %block, %line, %
NetworkConfigSection.java100% (2/2)54%  (13/24)61%  (156/257)55%  (29.9/54)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class NetworkConfigSection100% (1/1)33%  (4/12)58%  (88/151)41%  (13.9/34)
equals (Object): boolean 0%   (0/1)0%   (0/39)0%   (0/13)
getDhcp (): Boolean 0%   (0/1)0%   (0/3)0%   (0/1)
getFenceMode (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getGateway (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getInternalToExternalNATRules (): Map 0%   (0/1)0%   (0/3)0%   (0/1)
getNetmask (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getNetwork (): String 0%   (0/1)0%   (0/3)0%   (0/1)
toBuilder (): NetworkConfigSection$Builder 0%   (0/1)0%   (0/4)0%   (0/1)
hashCode (): int 100% (1/1)90%  (18/20)98%  (3.9/4)
NetworkConfigSection (String, String, String, Boolean, String, String, Map): ... 100% (1/1)100% (26/26)100% (8/8)
builder (): NetworkConfigSection$Builder 100% (1/1)100% (4/4)100% (1/1)
toString (): String 100% (1/1)100% (40/40)100% (1/1)
     
class NetworkConfigSection$Builder100% (1/1)75%  (9/12)64%  (68/106)80%  (16/20)
fromNetworkConfigSection (NetworkConfigSection): NetworkConfigSection$Builder 0%   (0/1)0%   (0/22)0%   (0/1)
fromSection (Section): NetworkConfigSection$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
internalToExternalNATRules (Map): NetworkConfigSection$Builder 0%   (0/1)0%   (0/9)0%   (0/2)
NetworkConfigSection$Builder (): void 100% (1/1)100% (6/6)100% (2/2)
build (): NetworkConfigSection 100% (1/1)100% (18/18)100% (1/1)
dhcp (Boolean): NetworkConfigSection$Builder 100% (1/1)100% (5/5)100% (2/2)
fenceMode (String): NetworkConfigSection$Builder 100% (1/1)100% (5/5)100% (2/2)
gateway (String): NetworkConfigSection$Builder 100% (1/1)100% (5/5)100% (2/2)
info (String): NetworkConfigSection$Builder 100% (1/1)100% (7/7)100% (1/1)
internalToExternalNATRule (String, String): NetworkConfigSection$Builder 100% (1/1)100% (12/12)100% (2/2)
netmask (String): NetworkConfigSection$Builder 100% (1/1)100% (5/5)100% (2/2)
network (String): NetworkConfigSection$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.savvis.vpdc.domain;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.util.Map;
24 
25import org.jclouds.ovf.Section;
26 
27import com.google.common.collect.ImmutableMap;
28import com.google.common.collect.Maps;
29 
30/**
31 * 
32 * @author Adrian Cole
33 */
34public class NetworkConfigSection extends Section<NetworkConfigSection> {
35 
36   @SuppressWarnings("unchecked")
37   public static Builder builder() {
38      return new Builder();
39   }
40 
41   /**
42    * {@inheritDoc}
43    */
44   @Override
45   public Builder toBuilder() {
46      return builder().fromNetworkConfigSection(this);
47   }
48 
49   public static class Builder extends Section.Builder<NetworkConfigSection> {
50      private String network;
51      private String fenceMode;
52      private Boolean dhcp;
53      private String gateway;
54      private String netmask;
55      private Map<String, String> internalToExternalNATRules = Maps.newLinkedHashMap();
56 
57      public Builder network(String network) {
58         this.network = network;
59         return this;
60      }
61 
62      public Builder fenceMode(String fenceMode) {
63         this.fenceMode = fenceMode;
64         return this;
65      }
66 
67      public Builder dhcp(Boolean dhcp) {
68         this.dhcp = dhcp;
69         return this;
70      }
71 
72      public Builder gateway(String gateway) {
73         this.gateway = gateway;
74         return this;
75      }
76 
77      public Builder netmask(String netmask) {
78         this.netmask = netmask;
79         return this;
80      }
81 
82      public Builder internalToExternalNATRule(String internalIP, String externalIP) {
83         this.internalToExternalNATRules.put(checkNotNull(internalIP, "internalIP"), checkNotNull(externalIP,
84                  "externalIP"));
85         return this;
86      }
87 
88      public Builder internalToExternalNATRules(Map<String, String> internalToExternalNATRules) {
89         this.internalToExternalNATRules.putAll(checkNotNull(internalToExternalNATRules, "internalToExternalNATRules"));
90         return this;
91      }
92 
93      /**
94       * {@inheritDoc}
95       */
96      @Override
97      public NetworkConfigSection build() {
98         return new NetworkConfigSection(info, network, fenceMode, dhcp, gateway, netmask, internalToExternalNATRules);
99      }
100 
101      public Builder fromNetworkConfigSection(NetworkConfigSection in) {
102         return fromSection(in).network(in.getNetwork()).fenceMode(in.getFenceMode()).dhcp(in.getDhcp()).gateway(
103                  in.getGateway()).netmask(in.getNetmask()).internalToExternalNATRules(
104                  in.getInternalToExternalNATRules());
105      }
106 
107      /**
108       * {@inheritDoc}
109       */
110      @Override
111      public Builder fromSection(Section<NetworkConfigSection> in) {
112         return Builder.class.cast(super.fromSection(in));
113      }
114 
115      /**
116       * {@inheritDoc}
117       */
118      @Override
119      public Builder info(String info) {
120         return Builder.class.cast(super.info(info));
121      }
122 
123   }
124 
125   private final String network;
126   private final String fenceMode;
127   private final Boolean dhcp;
128   private final String gateway;
129   private final String netmask;
130   private final Map<String, String> internalToExternalNATRules;
131 
132   public NetworkConfigSection(String info, String network, String fenceMode, Boolean dhcp, String gateway,
133            String netmask, Map<String, String> internalToExternalNATRules) {
134      super(info);
135      this.network = network;
136      this.fenceMode = fenceMode;
137      this.dhcp = dhcp;
138      this.gateway = gateway;
139      this.netmask = netmask;
140      this.internalToExternalNATRules = ImmutableMap.copyOf(checkNotNull(internalToExternalNATRules,
141               "internalToExternalNATRules"));
142   }
143 
144   /**
145    * @return IP of the network's gateway
146    */
147   public String getGateway() {
148      return gateway;
149   }
150 
151   /**
152    * @return IP of the network's netmask
153    */
154   public String getNetmask() {
155      return netmask;
156   }
157 
158   /**
159    * @return map of internal to external ip when it has any nat1to1 enabled deployed VApp
160    */
161   public Map<String, String> getInternalToExternalNATRules() {
162      return internalToExternalNATRules;
163   }
164 
165   public String getNetwork() {
166      return network;
167   }
168 
169   public String getFenceMode() {
170      return fenceMode;
171   }
172 
173   public Boolean getDhcp() {
174      return dhcp;
175   }
176 
177   @Override
178   public int hashCode() {
179      final int prime = 31;
180      int result = super.hashCode();
181      result = prime * result + ((network == null) ? 0 : network.hashCode());
182      return result;
183   }
184 
185   @Override
186   public boolean equals(Object obj) {
187      if (this == obj)
188         return true;
189      if (!super.equals(obj))
190         return false;
191      if (getClass() != obj.getClass())
192         return false;
193      NetworkConfigSection other = (NetworkConfigSection) obj;
194      if (network == null) {
195         if (other.network != null)
196            return false;
197      } else if (!network.equals(other.network))
198         return false;
199      return true;
200   }
201 
202   @Override
203   public String toString() {
204      return String.format(
205               "[info=%s, network=%s, dhcp=%s, fenceMode=%s, gateway=%s, internalToExternalNATRules=%s, netmask=%s]",
206               info, network, dhcp, fenceMode, gateway, internalToExternalNATRules, netmask);
207   }
208 
209}

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