EMMA Coverage Report (generated Wed Oct 26 13:47:17 EDT 2011)
[all classes][org.jclouds.compute.domain.internal]

COVERAGE SUMMARY FOR SOURCE FILE [ImageImpl.java]

nameclass, %method, %block, %line, %
ImageImpl.java100% (1/1)78%  (7/9)38%  (107/280)36%  (19.4/54)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ImageImpl100% (1/1)78%  (7/9)38%  (107/280)36%  (19.4/54)
equals (Object): boolean 0%   (0/1)0%   (0/103)0%   (0/33)
toString (): String 0%   (0/1)0%   (0/58)0%   (0/1)
hashCode (): int 100% (1/1)83%  (60/72)92%  (7.4/8)
ImageImpl (String, String, String, Location, URI, Map, Set, OperatingSystem, ... 100% (1/1)100% (32/32)100% (7/7)
getAdminPassword (): String 100% (1/1)100% (3/3)100% (1/1)
getDefaultCredentials (): Credentials 100% (1/1)100% (3/3)100% (1/1)
getDescription (): String 100% (1/1)100% (3/3)100% (1/1)
getOperatingSystem (): OperatingSystem 100% (1/1)100% (3/3)100% (1/1)
getVersion (): 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.compute.domain.internal;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.net.URI;
24import java.util.Map;
25import java.util.Set;
26 
27import org.jclouds.javax.annotation.Nullable;
28 
29import org.jclouds.compute.domain.ComputeType;
30import org.jclouds.compute.domain.Image;
31import org.jclouds.compute.domain.OperatingSystem;
32import org.jclouds.domain.Credentials;
33import org.jclouds.domain.Location;
34 
35/**
36 * @author Adrian Cole
37 */
38public class ImageImpl extends ComputeMetadataImpl implements Image {
39 
40   /** The serialVersionUID */
41   private static final long serialVersionUID = 7856744554191025307L;
42 
43   private final OperatingSystem operatingSystem;
44   private final String version;
45   private final String description;
46   @Nullable
47   private final String adminPassword;
48   private final Credentials defaultCredentials;
49 
50   public ImageImpl(String providerId, String name, String id, Location location, URI uri,
51            Map<String, String> userMetadata,  Set<String> tags, OperatingSystem operatingSystem, String description,
52            @Nullable String version, @Nullable String adminPassword, @Nullable Credentials defaultCredentials) {
53      super(ComputeType.IMAGE, providerId, name, id, location, uri, userMetadata, tags);
54      this.operatingSystem = checkNotNull(operatingSystem, "operatingSystem");
55      this.version = version;
56      this.description = checkNotNull(description, "description");
57      this.adminPassword = adminPassword;
58      this.defaultCredentials = defaultCredentials;
59   }
60 
61   /**
62    * {@inheritDoc}
63    */
64   @Override
65   public OperatingSystem getOperatingSystem() {
66      return operatingSystem;
67   }
68 
69   /**
70    * {@inheritDoc}
71    */
72   @Override
73   public String getVersion() {
74      return version;
75   }
76 
77   /**
78    * {@inheritDoc}
79    */
80   @Override
81   public String getDescription() {
82      return description;
83   }
84 
85   /**
86    * {@inheritDoc}
87    */
88   @Override
89   public Credentials getDefaultCredentials() {
90      return defaultCredentials;
91   }
92 
93   /**
94    * {@inheritDoc}
95    */
96   @Override
97   public String getAdminPassword() {
98      return adminPassword;
99   }
100 
101   @Override
102   public String toString() {
103      return "[id=" + getId() + ", name=" + getName() + ", operatingSystem=" + operatingSystem + ", description="
104               + description + ", version=" + version + ", location=" + getLocation() + ", loginUser="
105               + ((defaultCredentials != null) ? defaultCredentials.identity : null) + ", userMetadata="
106               + getUserMetadata() + ", tags=" + tags + "]";
107   }
108 
109   @Override
110   public int hashCode() {
111      final int prime = 31;
112      int result = super.hashCode();
113      result = prime * result + ((adminPassword == null) ? 0 : adminPassword.hashCode());
114      result = prime * result + ((defaultCredentials == null) ? 0 : defaultCredentials.hashCode());
115      result = prime * result + ((description == null) ? 0 : description.hashCode());
116      result = prime * result + ((operatingSystem == null) ? 0 : operatingSystem.hashCode());
117      result = prime * result + ((version == null) ? 0 : version.hashCode());
118      return result;
119   }
120 
121   @Override
122   public boolean equals(Object obj) {
123      if (this == obj)
124         return true;
125      if (!super.equals(obj))
126         return false;
127      if (getClass() != obj.getClass())
128         return false;
129      ImageImpl other = (ImageImpl) obj;
130      if (adminPassword == null) {
131         if (other.adminPassword != null)
132            return false;
133      } else if (!adminPassword.equals(other.adminPassword))
134         return false;
135      if (defaultCredentials == null) {
136         if (other.defaultCredentials != null)
137            return false;
138      } else if (!defaultCredentials.equals(other.defaultCredentials))
139         return false;
140      if (description == null) {
141         if (other.description != null)
142            return false;
143      } else if (!description.equals(other.description))
144         return false;
145      if (operatingSystem == null) {
146         if (other.operatingSystem != null)
147            return false;
148      } else if (!operatingSystem.equals(other.operatingSystem))
149         return false;
150      if (version == null) {
151         if (other.version != null)
152            return false;
153      } else if (!version.equals(other.version))
154         return false;
155      return true;
156   }
157 
158}

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