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

COVERAGE SUMMARY FOR SOURCE FILE [CatalogImpl.java]

nameclass, %method, %block, %line, %
CatalogImpl.java100% (1/1)33%  (4/12)20%  (59/289)22%  (15/68)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CatalogImpl100% (1/1)33%  (4/12)20%  (59/289)22%  (15/68)
compareTo (ReferenceType): int 0%   (0/1)0%   (0/11)0%   (0/1)
equals (Object): boolean 0%   (0/1)0%   (0/119)0%   (0/38)
getOrg (): ReferenceType 0%   (0/1)0%   (0/3)0%   (0/1)
getTasks (): List 0%   (0/1)0%   (0/3)0%   (0/1)
getType (): String 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/85)0%   (0/9)
isPublished (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
isReadOnly (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
CatalogImpl (String, String, URI, ReferenceType, String, Map, Iterable, boole... 100% (1/1)100% (50/50)100% (12/12)
getDescription (): String 100% (1/1)100% (3/3)100% (1/1)
getHref (): URI 100% (1/1)100% (3/3)100% (1/1)
getName (): String 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.LinkedHashMap;
25import java.util.List;
26import java.util.Map;
27 
28import org.jclouds.javax.annotation.Nullable;
29 
30import org.jclouds.vcloud.domain.Catalog;
31import org.jclouds.vcloud.domain.ReferenceType;
32import org.jclouds.vcloud.domain.Task;
33 
34import com.google.common.collect.Iterables;
35import com.google.common.collect.Lists;
36 
37/**
38 * Locations of resources in vCloud
39 * 
40 * @author Adrian Cole
41 * 
42 */
43public class CatalogImpl extends LinkedHashMap<String, ReferenceType> implements Catalog {
44 
45   /** The serialVersionUID */
46   private static final long serialVersionUID = 8464716396538298809L;
47   private final String name;
48   private final String type;
49   private final URI href;
50   private final ReferenceType org;
51   @Nullable
52   private final String description;
53   private final List<Task> tasks = Lists.newArrayList();
54   private final boolean published;
55   private final boolean readOnly;
56 
57   public CatalogImpl(String name, String type, URI href, ReferenceType org, @Nullable String description,
58            Map<String, ReferenceType> contents, Iterable<Task> tasks, boolean published, boolean readOnly) {
59      this.name = checkNotNull(name, "name");
60      this.type = checkNotNull(type, "type");
61      this.org = org;// TODO: once <1.0 is killed check not null
62      this.description = description;
63      this.href = checkNotNull(href, "href");
64      putAll(checkNotNull(contents, "contents"));
65      Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
66      this.published = published;
67      this.readOnly = readOnly;
68   }
69 
70   /**
71    * {@inheritDoc}
72    */
73   @Override
74   public URI getHref() {
75      return href;
76   }
77 
78   /**
79    * {@inheritDoc}
80    */
81   @Override
82   public String getName() {
83      return name;
84   }
85 
86   /**
87    * {@inheritDoc}
88    */
89   @Override
90   public ReferenceType getOrg() {
91      return org;
92   }
93 
94   /**
95    * {@inheritDoc}
96    */
97   public String getDescription() {
98      return description;
99   }
100 
101   /**
102    * {@inheritDoc}
103    */
104   @Override
105   public String getType() {
106      return type;
107   }
108 
109   /**
110    * {@inheritDoc}
111    */
112   @Override
113   public List<Task> getTasks() {
114      return tasks;
115   }
116 
117   /**
118    * {@inheritDoc}
119    */
120   @Override
121   public boolean isPublished() {
122      return published;
123   }
124 
125   /**
126    * {@inheritDoc}
127    */
128   @Override
129   public boolean isReadOnly() {
130      return readOnly;
131   }
132 
133   @Override
134   public int hashCode() {
135      final int prime = 31;
136      int result = super.hashCode();
137      result = prime * result + ((description == null) ? 0 : description.hashCode());
138      result = prime * result + ((href == null) ? 0 : href.hashCode());
139      result = prime * result + ((name == null) ? 0 : name.hashCode());
140      result = prime * result + ((org == null) ? 0 : org.hashCode());
141      result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
142      result = prime * result + ((type == null) ? 0 : type.hashCode());
143      return result;
144   }
145 
146   @Override
147   public boolean equals(Object obj) {
148      if (this == obj)
149         return true;
150      if (!super.equals(obj))
151         return false;
152      if (getClass() != obj.getClass())
153         return false;
154      CatalogImpl other = (CatalogImpl) obj;
155      if (description == null) {
156         if (other.description != null)
157            return false;
158      } else if (!description.equals(other.description))
159         return false;
160      if (href == null) {
161         if (other.href != null)
162            return false;
163      } else if (!href.equals(other.href))
164         return false;
165      if (name == null) {
166         if (other.name != null)
167            return false;
168      } else if (!name.equals(other.name))
169         return false;
170      if (org == null) {
171         if (other.org != null)
172            return false;
173      } else if (!org.equals(other.org))
174         return false;
175      if (tasks == null) {
176         if (other.tasks != null)
177            return false;
178      } else if (!tasks.equals(other.tasks))
179         return false;
180      if (type == null) {
181         if (other.type != null)
182            return false;
183      } else if (!type.equals(other.type))
184         return false;
185      return true;
186   }
187 
188   @Override
189   public int compareTo(ReferenceType o) {
190      return (this == o) ? 0 : getHref().compareTo(o.getHref());
191   }
192 
193}

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