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

COVERAGE SUMMARY FOR SOURCE FILE [ServerInfo.java]

nameclass, %method, %block, %line, %
ServerInfo.java100% (2/2)77%  (20/26)67%  (271/406)73%  (47.7/65)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ServerInfo100% (1/1)38%  (3/8)51%  (135/263)62%  (26.7/43)
getMetrics (): ServerMetrics 0%   (0/1)0%   (0/3)0%   (0/1)
getStarted (): Date 0%   (0/1)0%   (0/3)0%   (0/1)
getStatus (): ServerStatus 0%   (0/1)0%   (0/3)0%   (0/1)
getUser (): String 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/87)0%   (0/1)
equals (Object): boolean 100% (1/1)71%  (55/78)56%  (14/25)
hashCode (): int 100% (1/1)90%  (53/59)96%  (6.7/7)
ServerInfo (String, String, int, Integer, int, boolean, Map, Iterable, Iterab... 100% (1/1)100% (27/27)100% (6/6)
     
class ServerInfo$Builder100% (1/1)94%  (17/18)95%  (136/143)95%  (21/22)
tags (Iterable): ServerInfo$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
ServerInfo$Builder (): void 100% (1/1)100% (3/3)100% (1/1)
bootDeviceIds (Iterable): ServerInfo$Builder 100% (1/1)100% (7/7)100% (1/1)
build (): ServerInfo 100% (1/1)100% (36/36)100% (1/1)
cpu (int): ServerInfo$Builder 100% (1/1)100% (7/7)100% (1/1)
devices (Map): ServerInfo$Builder 100% (1/1)100% (7/7)100% (1/1)
mem (int): ServerInfo$Builder 100% (1/1)100% (7/7)100% (1/1)
metrics (ServerMetrics): ServerInfo$Builder 100% (1/1)100% (5/5)100% (2/2)
name (String): ServerInfo$Builder 100% (1/1)100% (7/7)100% (1/1)
nics (Iterable): ServerInfo$Builder 100% (1/1)100% (7/7)100% (1/1)
persistent (boolean): ServerInfo$Builder 100% (1/1)100% (7/7)100% (1/1)
smp (Integer): ServerInfo$Builder 100% (1/1)100% (7/7)100% (1/1)
started (Date): ServerInfo$Builder 100% (1/1)100% (5/5)100% (2/2)
status (ServerStatus): ServerInfo$Builder 100% (1/1)100% (5/5)100% (2/2)
user (String): ServerInfo$Builder 100% (1/1)100% (5/5)100% (2/2)
userMetadata (Map): ServerInfo$Builder 100% (1/1)100% (7/7)100% (1/1)
uuid (String): ServerInfo$Builder 100% (1/1)100% (7/7)100% (1/1)
vnc (VNC): ServerInfo$Builder 100% (1/1)100% (7/7)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.elasticstack.domain;
20 
21import java.util.Date;
22import java.util.Map;
23 
24import org.jclouds.javax.annotation.Nullable;
25 
26/**
27 * 
28 * @author Adrian Cole
29 */
30public class ServerInfo extends Server {
31 
32   public static class Builder extends Server.Builder {
33      protected ServerStatus status;
34      protected Date started;
35      protected String user;
36      protected ServerMetrics metrics;
37 
38      public Builder status(ServerStatus status) {
39         this.status = status;
40         return this;
41      }
42 
43      public Builder started(Date started) {
44         this.started = started;
45         return this;
46      }
47 
48      public Builder user(String user) {
49         this.user = user;
50         return this;
51      }
52 
53      public Builder metrics(ServerMetrics metrics) {
54         this.metrics = metrics;
55         return this;
56      }
57 
58      /**
59       * {@inheritDoc}
60       */
61      @Override
62      public Builder cpu(int cpu) {
63         return Builder.class.cast(super.cpu(cpu));
64      }
65 
66      /**
67       * {@inheritDoc}
68       */
69      @Override
70      public Builder smp(Integer smp) {
71         return Builder.class.cast(super.smp(smp));
72      }
73 
74      /**
75       * {@inheritDoc}
76       */
77      @Override
78      public Builder mem(int mem) {
79         return Builder.class.cast(super.mem(mem));
80      }
81 
82      /**
83       * {@inheritDoc}
84       */
85      @Override
86      public Builder persistent(boolean persistent) {
87         return Builder.class.cast(super.persistent(persistent));
88      }
89 
90      /**
91       * {@inheritDoc}
92       */
93      @Override
94      public Builder devices(Map<String, ? extends Device> devices) {
95         return Builder.class.cast(super.devices(devices));
96      }
97 
98      /**
99       * {@inheritDoc}
100       */
101      @Override
102      public Builder bootDeviceIds(Iterable<String> bootDeviceIds) {
103         return Builder.class.cast(super.bootDeviceIds(bootDeviceIds));
104      }
105 
106      /**
107       * {@inheritDoc}
108       */
109      @Override
110      public Builder nics(Iterable<NIC> nics) {
111         return Builder.class.cast(super.nics(nics));
112      }
113 
114      /**
115       * {@inheritDoc}
116       */
117      @Override
118      public Builder vnc(VNC vnc) {
119         return Builder.class.cast(super.vnc(vnc));
120      }
121 
122      /**
123       * {@inheritDoc}
124       */
125      @Override
126      public Builder uuid(String uuid) {
127         return Builder.class.cast(super.uuid(uuid));
128      }
129 
130      /**
131       * {@inheritDoc}
132       */
133      @Override
134      public Builder name(String name) {
135         return Builder.class.cast(super.name(name));
136      }
137 
138      /**
139       * {@inheritDoc}
140       */
141      @Override
142      public Builder tags(Iterable<String> tags) {
143         return Builder.class.cast(super.tags(tags));
144      }
145 
146      /**
147       * {@inheritDoc}
148       */
149      @Override
150      public Builder userMetadata(Map<String, String> userMetadata) {
151         return Builder.class.cast(super.userMetadata(userMetadata));
152      }
153 
154      public ServerInfo build() {
155         return new ServerInfo(uuid, name, cpu, smp, mem, persistent, devices, bootDeviceIds, tags, userMetadata, nics,
156               vnc, status, started, user, metrics);
157      }
158   }
159 
160   protected final ServerStatus status;
161   @Nullable
162   protected final Date started;
163   @Nullable
164   protected final String user;
165   protected final ServerMetrics metrics;
166 
167   public ServerInfo(String uuid, String name, int cpu, Integer smp, int mem, boolean persistent,
168         Map<String, ? extends Device> devices, Iterable<String> bootDeviceIds, Iterable<String> tags,
169         Map<String, String> userMetadata, Iterable<NIC> nics, VNC vnc, ServerStatus status, Date started, String user,
170         @Nullable ServerMetrics metrics) {
171      super(uuid, name, cpu, smp, mem, persistent, devices, bootDeviceIds, tags, userMetadata, nics, vnc);
172      this.status = status;
173      this.started = started;
174      this.user = user;
175      this.metrics = metrics;
176   }
177 
178   /**
179    * 
180    * @return active | stopped | paused | dumped | dead
181    */
182   public ServerStatus getStatus() {
183      return status;
184   }
185 
186   // TODO undocumented
187   public Date getStarted() {
188      return started;
189   }
190 
191   /**
192    * 
193    * @return metrics, if the server is running, or null
194    */
195   @Nullable
196   public ServerMetrics getMetrics() {
197      return metrics;
198   }
199 
200   // TODO undocumented
201   /**
202    * 
203    * @return owner of the server.
204    */
205   public String getUser() {
206      return user;
207   }
208 
209   @Override
210   public int hashCode() {
211      final int prime = 31;
212      int result = super.hashCode();
213      result = prime * result + ((metrics == null) ? 0 : metrics.hashCode());
214      result = prime * result + ((started == null) ? 0 : started.hashCode());
215      result = prime * result + ((status == null) ? 0 : status.hashCode());
216      result = prime * result + ((user == null) ? 0 : user.hashCode());
217      return result;
218   }
219 
220   @Override
221   public boolean equals(Object obj) {
222      if (this == obj)
223         return true;
224      if (!super.equals(obj))
225         return false;
226      if (getClass() != obj.getClass())
227         return false;
228      ServerInfo other = (ServerInfo) obj;
229      if (metrics == null) {
230         if (other.metrics != null)
231            return false;
232      } else if (!metrics.equals(other.metrics))
233         return false;
234      if (started == null) {
235         if (other.started != null)
236            return false;
237      } else if (!started.equals(other.started))
238         return false;
239      if (status != other.status)
240         return false;
241      if (user == null) {
242         if (other.user != null)
243            return false;
244      } else if (!user.equals(other.user))
245         return false;
246      return true;
247   }
248 
249   @Override
250   public String toString() {
251      return "[cpu=" + cpu + ", smp=" + smp + ", mem=" + mem + ", persistent=" + persistent + ", devices=" + devices
252            + ", bootDeviceIds=" + bootDeviceIds + ", nics=" + nics + ", vnc=" + vnc + ", uuid=" + uuid + ", name="
253            + name + ", tags=" + tags + ", userMetadata=" + userMetadata + ", status=" + status + ", started="
254            + started + ", user=" + user + ", metrics=" + metrics + "]";
255   }
256 
257}

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