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

COVERAGE SUMMARY FOR SOURCE FILE [VAppImpl.java]

nameclass, %method, %block, %line, %
VAppImpl.java100% (1/1)70%  (7/10)27%  (61/225)36%  (16/45)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VAppImpl100% (1/1)70%  (7/10)27%  (61/225)36%  (16/45)
equals (Object): boolean 0%   (0/1)0%   (0/62)0%   (0/20)
hashCode (): int 0%   (0/1)0%   (0/70)0%   (0/8)
toString (): String 0%   (0/1)0%   (0/32)0%   (0/1)
VAppImpl (String, String, URI, Status, ReferenceType, String, Iterable, boole... 100% (1/1)100% (43/43)100% (10/10)
getChildren (): Set 100% (1/1)100% (3/3)100% (1/1)
getDescription (): String 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)
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.VApp;
33import org.jclouds.vcloud.domain.Vm;
34 
35import com.google.common.collect.Iterables;
36import com.google.common.collect.Lists;
37import com.google.common.collect.Sets;
38 
39/**
40 * Locations of resources in vCloud
41 * 
42 * @author Adrian Cole
43 * 
44 */
45public class VAppImpl extends ReferenceTypeImpl implements VApp {
46 
47   private final Status status;
48   private final ReferenceType vdc;
49   @Nullable
50   private final String description;
51   private final List<Task> tasks = Lists.newArrayList();
52   private final boolean ovfDescriptorUploaded;
53   private final Set<Vm> children = Sets.newLinkedHashSet();
54 
55   public VAppImpl(String name, String type, URI id, Status status, ReferenceType vdc, @Nullable String description,
56            Iterable<Task> tasks, boolean ovfDescriptorUploaded, Iterable<? extends Vm> children) {
57      super(name, type, id);
58      this.status = checkNotNull(status, "status");
59      this.vdc = vdc;// TODO: once <1.0 is killed check not null
60      this.description = description;
61      Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
62      this.ovfDescriptorUploaded = ovfDescriptorUploaded;
63      Iterables.addAll(this.children, checkNotNull(children, "children"));
64   }
65 
66   /**
67    * {@inheritDoc}
68    */
69   @Override
70   public Status getStatus() {
71      return status;
72   }
73 
74   /**
75    * {@inheritDoc}
76    */
77   @Override
78   public ReferenceType getVDC() {
79      return vdc;
80   }
81 
82   /**
83    * {@inheritDoc}
84    */
85   @Override
86   public String getDescription() {
87      return description;
88   }
89 
90   /**
91    * {@inheritDoc}
92    */
93   @Override
94   public List<Task> getTasks() {
95      return tasks;
96   }
97 
98   /**
99    * {@inheritDoc}
100    */
101   @Override
102   public boolean isOvfDescriptorUploaded() {
103      return ovfDescriptorUploaded;
104   }
105 
106   /**
107    * {@inheritDoc}
108    */
109   @Override
110   public Set<? extends Vm> getChildren() {
111      return children;
112   }
113 
114   @Override
115   public int hashCode() {
116      final int prime = 31;
117      int result = super.hashCode();
118      result = prime * result + ((description == null) ? 0 : description.hashCode());
119      result = prime * result + (ovfDescriptorUploaded ? 1231 : 1237);
120      result = prime * result + ((status == null) ? 0 : status.hashCode());
121      result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
122      result = prime * result + ((vdc == null) ? 0 : vdc.hashCode());
123      return result;
124   }
125 
126   @Override
127   public boolean equals(Object obj) {
128      if (this == obj)
129         return true;
130      if (!super.equals(obj))
131         return false;
132      if (getClass() != obj.getClass())
133         return false;
134      VAppImpl other = (VAppImpl) obj;
135      if (description == null) {
136         if (other.description != null)
137            return false;
138      } else if (!description.equals(other.description))
139         return false;
140      if (ovfDescriptorUploaded != other.ovfDescriptorUploaded)
141         return false;
142      if (vdc == null) {
143         if (other.vdc != null)
144            return false;
145      } else if (!vdc.equals(other.vdc))
146         return false;
147      return true;
148   }
149 
150   @Override
151   public String toString() {
152      return "[id=" + getHref() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status="
153               + status + "]";
154   }
155 
156}

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