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

COVERAGE SUMMARY FOR SOURCE FILE [VmImpl.java]

nameclass, %method, %block, %line, %
VmImpl.java100% (1/1)85%  (11/13)43%  (155/363)41%  (30.4/75)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VmImpl100% (1/1)85%  (11/13)43%  (155/363)41%  (30.4/75)
equals (Object): boolean 0%   (0/1)0%   (0/135)0%   (0/43)
toString (): String 0%   (0/1)0%   (0/62)0%   (0/1)
hashCode (): int 100% (1/1)89%  (87/98)94%  (9.4/10)
VmImpl (String, String, URI, Status, ReferenceType, String, Iterable, VCloudV... 100% (1/1)100% (41/41)100% (12/12)
getDescription (): String 100% (1/1)100% (3/3)100% (1/1)
getGuestCustomizationSection (): GuestCustomizationSection 100% (1/1)100% (3/3)100% (1/1)
getNetworkConnectionSection (): NetworkConnectionSection 100% (1/1)100% (3/3)100% (1/1)
getOperatingSystemSection (): VCloudOperatingSystemSection 100% (1/1)100% (3/3)100% (1/1)
getParent (): ReferenceType 100% (1/1)100% (3/3)100% (1/1)
getStatus (): Status 100% (1/1)100% (3/3)100% (1/1)
getTasks (): List 100% (1/1)100% (3/3)100% (1/1)
getVAppScopedLocalId (): String 100% (1/1)100% (3/3)100% (1/1)
getVirtualHardwareSection (): VCloudVirtualHardwareSection 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;
25 
26import org.jclouds.javax.annotation.Nullable;
27 
28import org.jclouds.vcloud.domain.GuestCustomizationSection;
29import org.jclouds.vcloud.domain.NetworkConnectionSection;
30import org.jclouds.vcloud.domain.ReferenceType;
31import org.jclouds.vcloud.domain.Status;
32import org.jclouds.vcloud.domain.Task;
33import org.jclouds.vcloud.domain.Vm;
34import org.jclouds.vcloud.domain.ovf.VCloudOperatingSystemSection;
35import org.jclouds.vcloud.domain.ovf.VCloudVirtualHardwareSection;
36 
37import com.google.common.collect.Iterables;
38import com.google.common.collect.Lists;
39 
40/**
41 * Locations of resources in vCloud
42 * 
43 * @author Adrian Cole
44 * 
45 */
46public class VmImpl extends ReferenceTypeImpl implements Vm {
47 
48   @Nullable
49   private final Status status;
50   private final ReferenceType vApp;
51   @Nullable
52   private final String description;
53   private final List<Task> tasks = Lists.newArrayList();
54   @Nullable
55   private final VCloudVirtualHardwareSection hardware;
56   private final String vAppScopedLocalId;
57   private final VCloudOperatingSystemSection os;
58   @Nullable
59   private final GuestCustomizationSection guestCustomization;
60   @Nullable
61   private final NetworkConnectionSection networkConnectionSection;
62 
63   public VmImpl(String name, String type, URI id, @Nullable Status status, ReferenceType vApp,
64            @Nullable String description, Iterable<Task> tasks, @Nullable VCloudVirtualHardwareSection hardware,
65            @Nullable VCloudOperatingSystemSection os, @Nullable NetworkConnectionSection networkConnectionSection,
66            @Nullable GuestCustomizationSection guestCustomization, @Nullable String vAppScopedLocalId) {
67      super(name, type, id);
68      this.status = status;
69      this.vApp = vApp;// TODO: once <1.0 is killed check not null
70      this.description = description;
71      Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
72      this.hardware = hardware;
73      this.os = os;
74      this.networkConnectionSection = networkConnectionSection;
75      this.guestCustomization = guestCustomization;
76      this.vAppScopedLocalId = vAppScopedLocalId;
77   }
78 
79   /**
80    * {@inheritDoc}
81    */
82   @Override
83   @Nullable
84   public Status getStatus() {
85      return status;
86   }
87 
88   /**
89    * {@inheritDoc}
90    */
91   @Override
92   public ReferenceType getParent() {
93      return vApp;
94   }
95 
96   /**
97    * {@inheritDoc}
98    */
99   @Override
100   public String getDescription() {
101      return description;
102   }
103 
104   /**
105    * {@inheritDoc}
106    */
107   @Override
108   public List<Task> getTasks() {
109      return tasks;
110   }
111 
112   /**
113    * {@inheritDoc}
114    */
115   @Override
116   public VCloudVirtualHardwareSection getVirtualHardwareSection() {
117      return hardware;
118   }
119 
120   /**
121    * {@inheritDoc}
122    */
123   @Override
124   public VCloudOperatingSystemSection getOperatingSystemSection() {
125      return os;
126   }
127 
128   /**
129    * {@inheritDoc}
130    */
131   @Override
132   public NetworkConnectionSection getNetworkConnectionSection() {
133      return networkConnectionSection;
134   }
135 
136   /**
137    * {@inheritDoc}
138    */
139   @Override
140   public GuestCustomizationSection getGuestCustomizationSection() {
141      return guestCustomization;
142   }
143 
144   /**
145    * {@inheritDoc}
146    */
147   @Override
148   public String getVAppScopedLocalId() {
149      return vAppScopedLocalId;
150   }
151 
152   @Override
153   public int hashCode() {
154      final int prime = 31;
155      int result = super.hashCode();
156      result = prime * result + ((description == null) ? 0 : description.hashCode());
157      result = prime * result + ((guestCustomization == null) ? 0 : guestCustomization.hashCode());
158      result = prime * result + ((hardware == null) ? 0 : hardware.hashCode());
159      result = prime * result + ((networkConnectionSection == null) ? 0 : networkConnectionSection.hashCode());
160      result = prime * result + ((os == null) ? 0 : os.hashCode());
161      result = prime * result + ((vApp == null) ? 0 : vApp.hashCode());
162      result = prime * result + ((vAppScopedLocalId == null) ? 0 : vAppScopedLocalId.hashCode());
163      return result;
164   }
165 
166   @Override
167   public boolean equals(Object obj) {
168      if (this == obj)
169         return true;
170      if (!super.equals(obj))
171         return false;
172      if (getClass() != obj.getClass())
173         return false;
174      VmImpl other = (VmImpl) obj;
175      if (description == null) {
176         if (other.description != null)
177            return false;
178      } else if (!description.equals(other.description))
179         return false;
180      if (guestCustomization == null) {
181         if (other.guestCustomization != null)
182            return false;
183      } else if (!guestCustomization.equals(other.guestCustomization))
184         return false;
185      if (hardware == null) {
186         if (other.hardware != null)
187            return false;
188      } else if (!hardware.equals(other.hardware))
189         return false;
190      if (networkConnectionSection == null) {
191         if (other.networkConnectionSection != null)
192            return false;
193      } else if (!networkConnectionSection.equals(other.networkConnectionSection))
194         return false;
195      if (os == null) {
196         if (other.os != null)
197            return false;
198      } else if (!os.equals(other.os))
199         return false;
200      if (vApp == null) {
201         if (other.vApp != null)
202            return false;
203      } else if (!vApp.equals(other.vApp))
204         return false;
205      if (vAppScopedLocalId == null) {
206         if (other.vAppScopedLocalId != null)
207            return false;
208      } else if (!vAppScopedLocalId.equals(other.vAppScopedLocalId))
209         return false;
210      return true;
211   }
212 
213   @Override
214   public String toString() {
215      return "[href=" + getHref() + ", name=" + getName() + ", type=" + getType() + ", description=" + description
216               + ", status=" + status + ", tasks=" + tasks + ", vApp=" + vApp + ", hardware=" + hardware + ", os=" + os
217               + ", network=" + networkConnectionSection + ", vAppScopedLocalId=" + vAppScopedLocalId + "]";
218   }
219 
220}

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