EMMA Coverage Report (generated Tue Jun 21 05:51:52 EDT 2011)
[all classes][org.jclouds.compute.domain.internal]

COVERAGE SUMMARY FOR SOURCE FILE [ImageImpl.java]

nameclass, %method, %block, %line, %
ImageImpl.java0%   (0/1)0%   (0/9)0%   (0/274)0%   (0/54)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ImageImpl0%   (0/1)0%   (0/9)0%   (0/274)0%   (0/54)
ImageImpl (String, String, String, Location, URI, Map, OperatingSystem, Strin... 0%   (0/1)0%   (0/31)0%   (0/7)
equals (Object): boolean 0%   (0/1)0%   (0/103)0%   (0/33)
getAdminPassword (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getDefaultCredentials (): Credentials 0%   (0/1)0%   (0/3)0%   (0/1)
getDescription (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getOperatingSystem (): OperatingSystem 0%   (0/1)0%   (0/3)0%   (0/1)
getVersion (): String 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/72)0%   (0/8)
toString (): String 0%   (0/1)0%   (0/53)0%   (0/1)

1/**
2 *
3 * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4 *
5 * ====================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * 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, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ====================================================================
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;
25 
26import javax.annotation.Nullable;
27 
28import org.jclouds.compute.domain.ComputeType;
29import org.jclouds.compute.domain.Image;
30import org.jclouds.compute.domain.OperatingSystem;
31import org.jclouds.domain.Credentials;
32import org.jclouds.domain.Location;
33 
34/**
35 * @author Adrian Cole
36 */
37public class ImageImpl extends ComputeMetadataImpl implements Image {
38 
39   /** The serialVersionUID */
40   private static final long serialVersionUID = 7856744554191025307L;
41 
42   private final OperatingSystem operatingSystem;
43   private final String version;
44   private final String description;
45   @Nullable
46   private final String adminPassword;
47   private final Credentials defaultCredentials;
48 
49   public ImageImpl(String providerId, String name, String id, Location location, URI uri,
50            Map<String, String> userMetadata, OperatingSystem operatingSystem, String description,
51            @Nullable String version, @Nullable String adminPassword, @Nullable Credentials defaultCredentials) {
52      super(ComputeType.IMAGE, providerId, name, id, location, uri, userMetadata);
53      this.operatingSystem = checkNotNull(operatingSystem, "operatingSystem");
54      this.version = version;
55      this.description = checkNotNull(description, "description");
56      this.adminPassword = adminPassword;
57      this.defaultCredentials = defaultCredentials;
58   }
59 
60   /**
61    * {@inheritDoc}
62    */
63   @Override
64   public OperatingSystem getOperatingSystem() {
65      return operatingSystem;
66   }
67 
68   /**
69    * {@inheritDoc}
70    */
71   @Override
72   public String getVersion() {
73      return version;
74   }
75 
76   /**
77    * {@inheritDoc}
78    */
79   @Override
80   public String getDescription() {
81      return description;
82   }
83 
84   /**
85    * {@inheritDoc}
86    */
87   @Override
88   public Credentials getDefaultCredentials() {
89      return defaultCredentials;
90   }
91 
92   /**
93    * {@inheritDoc}
94    */
95   @Override
96   public String getAdminPassword() {
97      return adminPassword;
98   }
99 
100   @Override
101   public String toString() {
102      return "[id=" + getId() + ", name=" + getName() + ", operatingSystem=" + operatingSystem + ", description="
103               + description + ", version=" + version + ", location=" + getLocation() + ", loginUser="
104               + ((defaultCredentials != null) ? defaultCredentials.identity : null) + ", userMetadata="
105               + getUserMetadata() + "]";
106   }
107 
108   @Override
109   public int hashCode() {
110      final int prime = 31;
111      int result = super.hashCode();
112      result = prime * result + ((adminPassword == null) ? 0 : adminPassword.hashCode());
113      result = prime * result + ((defaultCredentials == null) ? 0 : defaultCredentials.hashCode());
114      result = prime * result + ((description == null) ? 0 : description.hashCode());
115      result = prime * result + ((operatingSystem == null) ? 0 : operatingSystem.hashCode());
116      result = prime * result + ((version == null) ? 0 : version.hashCode());
117      return result;
118   }
119 
120   @Override
121   public boolean equals(Object obj) {
122      if (this == obj)
123         return true;
124      if (!super.equals(obj))
125         return false;
126      if (getClass() != obj.getClass())
127         return false;
128      ImageImpl other = (ImageImpl) obj;
129      if (adminPassword == null) {
130         if (other.adminPassword != null)
131            return false;
132      } else if (!adminPassword.equals(other.adminPassword))
133         return false;
134      if (defaultCredentials == null) {
135         if (other.defaultCredentials != null)
136            return false;
137      } else if (!defaultCredentials.equals(other.defaultCredentials))
138         return false;
139      if (description == null) {
140         if (other.description != null)
141            return false;
142      } else if (!description.equals(other.description))
143         return false;
144      if (operatingSystem == null) {
145         if (other.operatingSystem != null)
146            return false;
147      } else if (!operatingSystem.equals(other.operatingSystem))
148         return false;
149      if (version == null) {
150         if (other.version != null)
151            return false;
152      } else if (!version.equals(other.version))
153         return false;
154      return true;
155   }
156 
157}

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