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

COVERAGE SUMMARY FOR SOURCE FILE [VAppTemplateImpl.java]

nameclass, %method, %block, %line, %
VAppTemplateImpl.java100% (1/1)75%  (9/12)21%  (73/356)26%  (20/77)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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