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

COVERAGE SUMMARY FOR SOURCE FILE [NatService.java]

nameclass, %method, %block, %line, %
NatService.java0%   (0/1)0%   (0/8)0%   (0/194)0%   (0/44)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class NatService0%   (0/1)0%   (0/8)0%   (0/194)0%   (0/44)
NatService (boolean, NatType, NatPolicy, Iterable): void 0%   (0/1)0%   (0/23)0%   (0/7)
equals (Object): boolean 0%   (0/1)0%   (0/76)0%   (0/25)
getNatRules (): List 0%   (0/1)0%   (0/3)0%   (0/1)
getPolicy (): NatPolicy 0%   (0/1)0%   (0/3)0%   (0/1)
getType (): NatType 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/56)0%   (0/7)
isEnabled (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/27)0%   (0/1)

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.network;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.util.List;
24 
25import org.jclouds.javax.annotation.Nullable;
26 
27import org.jclouds.vcloud.domain.network.nat.NatPolicy;
28import org.jclouds.vcloud.domain.network.nat.NatRule;
29import org.jclouds.vcloud.domain.network.nat.NatType;
30 
31import com.google.common.collect.Iterables;
32import com.google.common.collect.Lists;
33 
34/**
35 * The NatService element defines the network address translation capabilities of a network.
36 */
37public class NatService {
38   private final boolean enabled;
39   @Nullable
40   private final NatType type;
41   @Nullable
42   private final NatPolicy policy;
43   private final List<NatRule> natRules = Lists.newArrayList();
44 
45   public NatService(boolean enabled, @Nullable NatType type, @Nullable NatPolicy policy,
46            Iterable<? extends NatRule> natRules) {
47      this.enabled = enabled;
48      this.type = type;
49      this.policy = policy;
50      Iterables.addAll(this.natRules, checkNotNull(natRules, "natRules"));
51   }
52 
53   /**
54    * @return Nat rules for the network
55    * 
56    * @since vcloud api 0.8
57    */
58   public List<? extends NatRule> getNatRules() {
59      return natRules;
60   }
61 
62   /**
63    * @return true if the service is enabled
64    * 
65    * @since vcloud api 0.9
66    */
67   public boolean isEnabled() {
68      return enabled;
69   }
70 
71   /**
72    * @return specifies how Network Address Translation is implemented by the NAT service
73    * 
74    * @since vcloud api 0.9
75    */
76   @Nullable
77   public NatType getType() {
78      return type;
79   }
80 
81   /**
82    * @return specifies how packets are handled by the NAT service.
83    * 
84    * @since vcloud api 0.9
85    */
86   @Nullable
87   public NatPolicy getPolicy() {
88      return policy;
89   }
90 
91   @Override
92   public int hashCode() {
93      final int prime = 31;
94      int result = 1;
95      result = prime * result + (enabled ? 1231 : 1237);
96      result = prime * result + ((natRules == null) ? 0 : natRules.hashCode());
97      result = prime * result + ((policy == null) ? 0 : policy.hashCode());
98      result = prime * result + ((type == null) ? 0 : type.hashCode());
99      return result;
100   }
101 
102   @Override
103   public boolean equals(Object obj) {
104      if (this == obj)
105         return true;
106      if (obj == null)
107         return false;
108      if (getClass() != obj.getClass())
109         return false;
110      NatService other = (NatService) obj;
111      if (enabled != other.enabled)
112         return false;
113      if (natRules == null) {
114         if (other.natRules != null)
115            return false;
116      } else if (!natRules.equals(other.natRules))
117         return false;
118      if (policy == null) {
119         if (other.policy != null)
120            return false;
121      } else if (!policy.equals(other.policy))
122         return false;
123      if (type == null) {
124         if (other.type != null)
125            return false;
126      } else if (!type.equals(other.type))
127         return false;
128      return true;
129   }
130 
131   @Override
132   public String toString() {
133      return "[enabled=" + enabled + ", natRules=" + natRules + ", policy=" + policy + ", type=" + type + "]";
134   }
135 
136}

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