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

COVERAGE SUMMARY FOR SOURCE FILE [VDCImpl.java]

nameclass, %method, %block, %line, %
VDCImpl.java100% (1/1)83%  (15/18)22%  (118/535)28%  (33/117)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VDCImpl100% (1/1)83%  (15/18)22%  (118/535)28%  (33/117)
equals (Object): boolean 0%   (0/1)0%   (0/211)0%   (0/66)
hashCode (): int 0%   (0/1)0%   (0/169)0%   (0/17)
toString (): String 0%   (0/1)0%   (0/37)0%   (0/1)
VDCImpl (String, String, URI, VDCStatus, ReferenceType, String, Iterable, All... 100% (1/1)100% (76/76)100% (19/19)
getAllocationModel (): AllocationModel 100% (1/1)100% (3/3)100% (1/1)
getAvailableNetworks (): Map 100% (1/1)100% (3/3)100% (1/1)
getCpuCapacity (): Capacity 100% (1/1)100% (3/3)100% (1/1)
getDescription (): String 100% (1/1)100% (3/3)100% (1/1)
getMemoryCapacity (): Capacity 100% (1/1)100% (3/3)100% (1/1)
getNetworkQuota (): int 100% (1/1)100% (3/3)100% (1/1)
getNicQuota (): int 100% (1/1)100% (3/3)100% (1/1)
getOrg (): ReferenceType 100% (1/1)100% (3/3)100% (1/1)
getResourceEntities (): Map 100% (1/1)100% (3/3)100% (1/1)
getStatus (): VDCStatus 100% (1/1)100% (3/3)100% (1/1)
getStorageCapacity (): Capacity 100% (1/1)100% (3/3)100% (1/1)
getTasks (): List 100% (1/1)100% (3/3)100% (1/1)
getVmQuota (): int 100% (1/1)100% (3/3)100% (1/1)
isEnabled (): boolean 100% (1/1)100% (3/3)100% (1/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.internal;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.net.URI;
24import java.util.List;
25import java.util.Map;
26 
27import org.jclouds.javax.annotation.Nullable;
28 
29import org.jclouds.vcloud.domain.AllocationModel;
30import org.jclouds.vcloud.domain.Capacity;
31import org.jclouds.vcloud.domain.ReferenceType;
32import org.jclouds.vcloud.domain.Task;
33import org.jclouds.vcloud.domain.VDC;
34import org.jclouds.vcloud.domain.VDCStatus;
35 
36import com.google.common.collect.Iterables;
37import com.google.common.collect.Lists;
38import com.google.common.collect.Maps;
39 
40/**
41 * Locations of resources in vCloud
42 * 
43 * @author Adrian Cole
44 * 
45 */
46public class VDCImpl extends ReferenceTypeImpl implements VDC {
47 
48   private final VDCStatus status;
49   private final ReferenceType org;
50   @Nullable
51   private final String description;
52   private final List<Task> tasks = Lists.newArrayList();
53   private final AllocationModel allocationModel;
54   private final Capacity storageCapacity;
55   private final Capacity cpuCapacity;
56   private final Capacity memoryCapacity;
57   private final Map<String, ReferenceType> resourceEntities = Maps.newLinkedHashMap();
58   private final Map<String, ReferenceType> availableNetworks = Maps.newLinkedHashMap();
59   private final int nicQuota;
60   private final int networkQuota;
61   private final int vmQuota;
62   private final boolean isEnabled;
63 
64   public VDCImpl(String name, String type, URI id, VDCStatus status, ReferenceType org, @Nullable String description,
65            Iterable<Task> tasks, AllocationModel allocationModel, @Nullable Capacity storageCapacity,
66            @Nullable Capacity cpuCapacity, @Nullable Capacity memoryCapacity,
67            Map<String, ReferenceType> resourceEntities, Map<String, ReferenceType> availableNetworks, int nicQuota,
68            int networkQuota, int vmQuota, boolean isEnabled) {
69      super(name, type, id);
70      this.status = checkNotNull(status, "status");
71      this.org = org;// TODO: once <1.0 is killed check not null
72      this.description = description;
73      Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
74      this.allocationModel = checkNotNull(allocationModel, "allocationModel");
75      this.storageCapacity = storageCapacity;// TODO: once <1.0 is killed check not null
76      this.cpuCapacity = cpuCapacity;// TODO: once <1.0 is killed check not null
77      this.memoryCapacity = memoryCapacity;// TODO: once <1.0 is killed check not null
78      this.resourceEntities.putAll(checkNotNull(resourceEntities, "resourceEntities"));
79      this.availableNetworks.putAll(checkNotNull(availableNetworks, "availableNetworks"));
80      this.nicQuota = nicQuota;
81      this.networkQuota = networkQuota;
82      this.vmQuota = vmQuota;
83      this.isEnabled = isEnabled;
84   }
85 
86   /**
87    * {@inheritDoc}
88    */
89   @Override
90   public VDCStatus getStatus() {
91      return status;
92   }
93 
94   /**
95    * {@inheritDoc}
96    */
97   @Override
98   public ReferenceType getOrg() {
99      return org;
100   }
101 
102   /**
103    * {@inheritDoc}
104    */
105   @Override
106   public String getDescription() {
107      return description;
108   }
109 
110   /**
111    * {@inheritDoc}
112    */
113   @Override
114   public List<Task> getTasks() {
115      return tasks;
116   }
117 
118   /**
119    * {@inheritDoc}
120    */
121   @Override
122   public AllocationModel getAllocationModel() {
123      return allocationModel;
124   }
125 
126   /**
127    * {@inheritDoc}
128    */
129   @Override
130   public Capacity getStorageCapacity() {
131      return storageCapacity;
132   }
133 
134   /**
135    * {@inheritDoc}
136    */
137   @Override
138   public Capacity getCpuCapacity() {
139      return cpuCapacity;
140   }
141 
142   /**
143    * {@inheritDoc}
144    */
145   @Override
146   public Capacity getMemoryCapacity() {
147      return memoryCapacity;
148   }
149 
150   /**
151    * {@inheritDoc}
152    */
153   @Override
154   public Map<String, ReferenceType> getResourceEntities() {
155      return resourceEntities;
156   }
157 
158   /**
159    * {@inheritDoc}
160    */
161   @Override
162   public Map<String, ReferenceType> getAvailableNetworks() {
163      return availableNetworks;
164   }
165 
166   /**
167    * {@inheritDoc}
168    */
169   @Override
170   public int getNicQuota() {
171      return nicQuota;
172   }
173 
174   /**
175    * {@inheritDoc}
176    */
177   @Override
178   public int getNetworkQuota() {
179      return networkQuota;
180   }
181 
182   /**
183    * {@inheritDoc}
184    */
185   @Override
186   public int getVmQuota() {
187      return vmQuota;
188   }
189 
190   /**
191    * {@inheritDoc}
192    */
193   @Override
194   public boolean isEnabled() {
195      return isEnabled;
196   }
197 
198   @Override
199   public int hashCode() {
200      final int prime = 31;
201      int result = super.hashCode();
202      result = prime * result + ((allocationModel == null) ? 0 : allocationModel.hashCode());
203      result = prime * result + ((availableNetworks == null) ? 0 : availableNetworks.hashCode());
204      result = prime * result + ((cpuCapacity == null) ? 0 : cpuCapacity.hashCode());
205      result = prime * result + ((description == null) ? 0 : description.hashCode());
206      result = prime * result + (isEnabled ? 1231 : 1237);
207      result = prime * result + ((memoryCapacity == null) ? 0 : memoryCapacity.hashCode());
208      result = prime * result + networkQuota;
209      result = prime * result + nicQuota;
210      result = prime * result + ((org == null) ? 0 : org.hashCode());
211      result = prime * result + ((resourceEntities == null) ? 0 : resourceEntities.hashCode());
212      result = prime * result + ((status == null) ? 0 : status.hashCode());
213      result = prime * result + ((storageCapacity == null) ? 0 : storageCapacity.hashCode());
214      result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
215      result = prime * result + vmQuota;
216      return result;
217   }
218 
219   @Override
220   public boolean equals(Object obj) {
221      if (this == obj)
222         return true;
223      if (!super.equals(obj))
224         return false;
225      if (getClass() != obj.getClass())
226         return false;
227      VDCImpl other = (VDCImpl) obj;
228      if (allocationModel == null) {
229         if (other.allocationModel != null)
230            return false;
231      } else if (!allocationModel.equals(other.allocationModel))
232         return false;
233      if (availableNetworks == null) {
234         if (other.availableNetworks != null)
235            return false;
236      } else if (!availableNetworks.equals(other.availableNetworks))
237         return false;
238      if (cpuCapacity == null) {
239         if (other.cpuCapacity != null)
240            return false;
241      } else if (!cpuCapacity.equals(other.cpuCapacity))
242         return false;
243      if (description == null) {
244         if (other.description != null)
245            return false;
246      } else if (!description.equals(other.description))
247         return false;
248      if (isEnabled != other.isEnabled)
249         return false;
250      if (memoryCapacity == null) {
251         if (other.memoryCapacity != null)
252            return false;
253      } else if (!memoryCapacity.equals(other.memoryCapacity))
254         return false;
255      if (networkQuota != other.networkQuota)
256         return false;
257      if (nicQuota != other.nicQuota)
258         return false;
259      if (org == null) {
260         if (other.org != null)
261            return false;
262      } else if (!org.equals(other.org))
263         return false;
264      if (resourceEntities == null) {
265         if (other.resourceEntities != null)
266            return false;
267      } else if (!resourceEntities.equals(other.resourceEntities))
268         return false;
269      if (status == null) {
270         if (other.status != null)
271            return false;
272      } else if (!status.equals(other.status))
273         return false;
274      if (storageCapacity == null) {
275         if (other.storageCapacity != null)
276            return false;
277      } else if (!storageCapacity.equals(other.storageCapacity))
278         return false;
279      if (tasks == null) {
280         if (other.tasks != null)
281            return false;
282      } else if (!tasks.equals(other.tasks))
283         return false;
284      if (vmQuota != other.vmQuota)
285         return false;
286      return true;
287   }
288 
289   @Override
290   public String toString() {
291      return "[id=" + getHref() + ", name=" + getName() + ", org=" + org + ", description=" + description + ", status="
292               + status + ", isEnabled=" + isEnabled + "]";
293   }
294 
295}

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