EMMA Coverage Report (generated Wed Jun 22 19:47:49 EDT 2011)
[all classes][org.jclouds.aws.ec2.domain]

COVERAGE SUMMARY FOR SOURCE FILE [SpotInstanceRequest.java]

nameclass, %method, %block, %line, %
SpotInstanceRequest.java100% (4/4)62%  (33/53)68%  (625/921)62%  (115.7/186)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SpotInstanceRequest100% (1/1)38%  (8/21)58%  (348/604)56%  (69.7/124)
compareTo (SpotInstanceRequest): int 0%   (0/1)0%   (0/6)0%   (0/1)
getAvailabilityZoneGroup (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getCreateTime (): Date 0%   (0/1)0%   (0/3)0%   (0/1)
getFaultCode (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getFaultMessage (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getInstanceId (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getLaunchGroup (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getProductDescription (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getSpotPrice (): float 0%   (0/1)0%   (0/3)0%   (0/1)
getType (): SpotInstanceRequest$Type 0%   (0/1)0%   (0/3)0%   (0/1)
getValidFrom (): Date 0%   (0/1)0%   (0/3)0%   (0/1)
getValidUntil (): Date 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/77)0%   (0/1)
equals (Object): boolean 100% (1/1)51%  (116/229)44%  (32/72)
hashCode (): int 100% (1/1)85%  (156/183)92%  (15.7/17)
SpotInstanceRequest (String, String, Date, String, String, String, String, La... 100% (1/1)100% (60/60)100% (17/17)
builder (): SpotInstanceRequest$Builder 100% (1/1)100% (4/4)100% (1/1)
getId (): String 100% (1/1)100% (3/3)100% (1/1)
getLaunchSpecification (): LaunchSpecification 100% (1/1)100% (3/3)100% (1/1)
getRegion (): String 100% (1/1)100% (3/3)100% (1/1)
getState (): SpotInstanceRequest$State 100% (1/1)100% (3/3)100% (1/1)
     
class SpotInstanceRequest$Builder100% (1/1)72%  (13/18)84%  (134/159)79%  (38/48)
faultCode (String): SpotInstanceRequest$Builder 0%   (0/1)0%   (0/5)0%   (0/2)
faultMessage (String): SpotInstanceRequest$Builder 0%   (0/1)0%   (0/5)0%   (0/2)
instanceId (String): SpotInstanceRequest$Builder 0%   (0/1)0%   (0/5)0%   (0/2)
validFrom (Date): SpotInstanceRequest$Builder 0%   (0/1)0%   (0/5)0%   (0/2)
validUntil (Date): SpotInstanceRequest$Builder 0%   (0/1)0%   (0/5)0%   (0/2)
SpotInstanceRequest$Builder (): void 100% (1/1)100% (3/3)100% (1/1)
availabilityZoneGroup (String): SpotInstanceRequest$Builder 100% (1/1)100% (5/5)100% (2/2)
build (): SpotInstanceRequest 100% (1/1)100% (34/34)100% (1/1)
clear (): SpotInstanceRequest$Builder 100% (1/1)100% (47/47)100% (16/16)
createTime (Date): SpotInstanceRequest$Builder 100% (1/1)100% (5/5)100% (2/2)
id (String): SpotInstanceRequest$Builder 100% (1/1)100% (5/5)100% (2/2)
launchGroup (String): SpotInstanceRequest$Builder 100% (1/1)100% (5/5)100% (2/2)
launchSpecification (LaunchSpecification): SpotInstanceRequest$Builder 100% (1/1)100% (5/5)100% (2/2)
productDescription (String): SpotInstanceRequest$Builder 100% (1/1)100% (5/5)100% (2/2)
region (String): SpotInstanceRequest$Builder 100% (1/1)100% (5/5)100% (2/2)
spotPrice (float): SpotInstanceRequest$Builder 100% (1/1)100% (5/5)100% (2/2)
state (SpotInstanceRequest$State): SpotInstanceRequest$Builder 100% (1/1)100% (5/5)100% (2/2)
type (SpotInstanceRequest$Type): SpotInstanceRequest$Builder 100% (1/1)100% (5/5)100% (2/2)
     
class SpotInstanceRequest$State100% (1/1)71%  (5/7)87%  (77/89)43%  (3/7)
toString (): String 0%   (0/1)0%   (0/3)0%   (0/1)
value (): String 0%   (0/1)0%   (0/6)0%   (0/1)
fromValue (String): SpotInstanceRequest$State 100% (1/1)75%  (9/12)33%  (1/3)
<static initializer> 100% (1/1)100% (54/54)100% (2/2)
SpotInstanceRequest$State (String, int): void 100% (1/1)100% (5/5)100% (1/1)
valueOf (String): SpotInstanceRequest$State 100% (1/1)100% (5/5)100% (1/1)
values (): SpotInstanceRequest$State [] 100% (1/1)100% (4/4)100% (1/1)
     
class SpotInstanceRequest$Type100% (1/1)100% (7/7)96%  (66/69)71%  (5/7)
fromValue (String): SpotInstanceRequest$Type 100% (1/1)75%  (9/12)33%  (1/3)
<static initializer> 100% (1/1)100% (34/34)100% (2/2)
SpotInstanceRequest$Type (String, int): void 100% (1/1)100% (5/5)100% (1/1)
toString (): String 100% (1/1)100% (3/3)100% (1/1)
value (): String 100% (1/1)100% (6/6)100% (1/1)
valueOf (String): SpotInstanceRequest$Type 100% (1/1)100% (5/5)100% (1/1)
values (): SpotInstanceRequest$Type [] 100% (1/1)100% (4/4)100% (1/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.aws.ec2.domain;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.util.Date;
24 
25import com.google.common.base.CaseFormat;
26 
27/**
28 * 
29 * @author Adrian Cole
30 */
31public class SpotInstanceRequest implements Comparable<SpotInstanceRequest> {
32   public static Builder builder() {
33      return new Builder();
34   }
35 
36   public static class Builder {
37      private String region;
38      private String availabilityZoneGroup;
39      private Date createTime;
40      private String faultCode;
41      private String faultMessage;
42      private String instanceId;
43      private String launchGroup;
44      private LaunchSpecification launchSpecification;
45      private String productDescription;
46      private String id;
47      private float spotPrice;
48      private State state;
49      private Type type;
50      private Date validFrom;
51      private Date validUntil;
52 
53      public Builder clear() {
54         this.region = null;
55         this.availabilityZoneGroup = null;
56         this.createTime = null;
57         this.faultCode = null;
58         this.faultMessage = null;
59         this.instanceId = null;
60         this.launchGroup = null;
61         this.launchSpecification = null;
62         this.productDescription = null;
63         this.id = null;
64         this.spotPrice = 0;
65         this.state = null;
66         this.type = null;
67         this.validFrom = null;
68         this.validUntil = null;
69         return this;
70      }
71 
72      public Builder region(String region) {
73         this.region = region;
74         return this;
75      }
76 
77      public Builder availabilityZoneGroup(String availabilityZoneGroup) {
78         this.availabilityZoneGroup = availabilityZoneGroup;
79         return this;
80      }
81 
82      public Builder createTime(Date createTime) {
83         this.createTime = createTime;
84         return this;
85      }
86 
87      public Builder faultCode(String faultCode) {
88         this.faultCode = faultCode;
89         return this;
90      }
91 
92      public Builder faultMessage(String faultMessage) {
93         this.faultMessage = faultMessage;
94         return this;
95      }
96 
97      public Builder instanceId(String instanceId) {
98         this.instanceId = instanceId;
99         return this;
100      }
101 
102      public Builder launchGroup(String launchGroup) {
103         this.launchGroup = launchGroup;
104         return this;
105      }
106 
107      public Builder launchSpecification(LaunchSpecification launchSpecification) {
108         this.launchSpecification = launchSpecification;
109         return this;
110      }
111 
112      public Builder productDescription(String productDescription) {
113         this.productDescription = productDescription;
114         return this;
115      }
116 
117      public Builder id(String id) {
118         this.id = id;
119         return this;
120      }
121 
122      public Builder spotPrice(float spotPrice) {
123         this.spotPrice = spotPrice;
124         return this;
125      }
126 
127      public Builder state(State state) {
128         this.state = state;
129         return this;
130      }
131 
132      public Builder type(Type type) {
133         this.type = type;
134         return this;
135      }
136 
137      public Builder validFrom(Date validFrom) {
138         this.validFrom = validFrom;
139         return this;
140      }
141 
142      public Builder validUntil(Date validUntil) {
143         this.validUntil = validUntil;
144         return this;
145      }
146 
147      public SpotInstanceRequest build() {
148         return new SpotInstanceRequest(region, availabilityZoneGroup, createTime, faultCode, faultMessage, instanceId,
149               launchGroup, launchSpecification, productDescription, id, spotPrice, state, type, validFrom, validUntil);
150      }
151   }
152 
153   public enum Type {
154      ONE_TIME, PERSISTENT, UNRECOGNIZED;
155 
156      public String value() {
157         return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()));
158      }
159 
160      @Override
161      public String toString() {
162         return value();
163      }
164 
165      public static Type fromValue(String type) {
166         try {
167            return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(type, "type")));
168         } catch (IllegalArgumentException e) {
169            return UNRECOGNIZED;
170         }
171      }
172   }
173 
174   public enum State {
175      OPEN, ACTIVE, CANCELLED, CLOSED, UNRECOGNIZED;
176 
177      public String value() {
178         return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()));
179      }
180 
181      @Override
182      public String toString() {
183         return value();
184      }
185 
186      public static State fromValue(String state) {
187         try {
188            return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "type")));
189         } catch (IllegalArgumentException e) {
190            return UNRECOGNIZED;
191         }
192      }
193   }
194 
195   private final String region;
196   private final String availabilityZoneGroup;
197   private final Date createTime;
198   private final String faultCode;
199   private final String faultMessage;
200   private final String instanceId;
201   private final String launchGroup;
202   private final LaunchSpecification launchSpecification;
203   private final String productDescription;
204   private final String id;
205   private final float spotPrice;
206   private final State state;
207   private final Type type;
208   private final Date validFrom;
209   private final Date validUntil;
210 
211   public SpotInstanceRequest(String region, String availabilityZoneGroup, Date createTime, String faultCode,
212         String faultMessage, String instanceId, String launchGroup, LaunchSpecification launchSpecification,
213         String productDescription, String id, float spotPrice, State state, Type type, Date validFrom, Date validUntil) {
214      this.region = checkNotNull(region, "region");
215      this.availabilityZoneGroup = availabilityZoneGroup;
216      this.createTime = createTime;
217      this.faultCode = faultCode;
218      this.faultMessage = faultMessage;
219      this.instanceId = instanceId;
220      this.launchGroup = launchGroup;
221      this.launchSpecification = launchSpecification;
222      this.productDescription = productDescription;
223      this.id = checkNotNull(id, "id");
224      this.spotPrice = spotPrice;
225      this.state = checkNotNull(state, "state");
226      this.type = checkNotNull(type, "type");
227      this.validFrom = validFrom;
228      this.validUntil = validUntil;
229   }
230 
231   /**
232    * @return spot instance requests are in a region
233    */
234   public String getRegion() {
235      return region;
236   }
237 
238   public String getAvailabilityZoneGroup() {
239      return availabilityZoneGroup;
240   }
241 
242   public Date getCreateTime() {
243      return createTime;
244   }
245 
246   public String getFaultCode() {
247      return faultCode;
248   }
249 
250   public String getFaultMessage() {
251      return faultMessage;
252   }
253 
254   public String getInstanceId() {
255      return instanceId;
256   }
257 
258   public String getLaunchGroup() {
259      return launchGroup;
260   }
261 
262   public LaunchSpecification getLaunchSpecification() {
263      return launchSpecification;
264   }
265 
266   public String getProductDescription() {
267      return productDescription;
268   }
269 
270   public String getId() {
271      return id;
272   }
273 
274   public float getSpotPrice() {
275      return spotPrice;
276   }
277 
278   public State getState() {
279      return state;
280   }
281 
282   public Type getType() {
283      return type;
284   }
285 
286   public Date getValidFrom() {
287      return validFrom;
288   }
289 
290   public Date getValidUntil() {
291      return validUntil;
292   }
293 
294   @Override
295   public int hashCode() {
296      final int prime = 31;
297      int result = 1;
298      result = prime * result + ((availabilityZoneGroup == null) ? 0 : availabilityZoneGroup.hashCode());
299      result = prime * result + ((createTime == null) ? 0 : createTime.hashCode());
300      result = prime * result + ((faultCode == null) ? 0 : faultCode.hashCode());
301      result = prime * result + ((faultMessage == null) ? 0 : faultMessage.hashCode());
302      result = prime * result + ((id == null) ? 0 : id.hashCode());
303      result = prime * result + ((instanceId == null) ? 0 : instanceId.hashCode());
304      result = prime * result + ((launchGroup == null) ? 0 : launchGroup.hashCode());
305      result = prime * result + ((launchSpecification == null) ? 0 : launchSpecification.hashCode());
306      result = prime * result + ((productDescription == null) ? 0 : productDescription.hashCode());
307      result = prime * result + ((region == null) ? 0 : region.hashCode());
308      result = prime * result + Float.floatToIntBits(spotPrice);
309      result = prime * result + ((type == null) ? 0 : type.hashCode());
310      result = prime * result + ((validFrom == null) ? 0 : validFrom.hashCode());
311      result = prime * result + ((validUntil == null) ? 0 : validUntil.hashCode());
312      return result;
313   }
314 
315   @Override
316   public boolean equals(Object obj) {
317      if (this == obj)
318         return true;
319      if (obj == null)
320         return false;
321      if (getClass() != obj.getClass())
322         return false;
323      SpotInstanceRequest other = (SpotInstanceRequest) obj;
324      if (availabilityZoneGroup == null) {
325         if (other.availabilityZoneGroup != null)
326            return false;
327      } else if (!availabilityZoneGroup.equals(other.availabilityZoneGroup))
328         return false;
329      if (createTime == null) {
330         if (other.createTime != null)
331            return false;
332      } else if (!createTime.equals(other.createTime))
333         return false;
334      if (faultCode == null) {
335         if (other.faultCode != null)
336            return false;
337      } else if (!faultCode.equals(other.faultCode))
338         return false;
339      if (faultMessage == null) {
340         if (other.faultMessage != null)
341            return false;
342      } else if (!faultMessage.equals(other.faultMessage))
343         return false;
344      if (id == null) {
345         if (other.id != null)
346            return false;
347      } else if (!id.equals(other.id))
348         return false;
349      if (instanceId == null) {
350         if (other.instanceId != null)
351            return false;
352      } else if (!instanceId.equals(other.instanceId))
353         return false;
354      if (launchGroup == null) {
355         if (other.launchGroup != null)
356            return false;
357      } else if (!launchGroup.equals(other.launchGroup))
358         return false;
359      if (launchSpecification == null) {
360         if (other.launchSpecification != null)
361            return false;
362      } else if (!launchSpecification.equals(other.launchSpecification))
363         return false;
364      if (productDescription == null) {
365         if (other.productDescription != null)
366            return false;
367      } else if (!productDescription.equals(other.productDescription))
368         return false;
369      if (region == null) {
370         if (other.region != null)
371            return false;
372      } else if (!region.equals(other.region))
373         return false;
374      if (Float.floatToIntBits(spotPrice) != Float.floatToIntBits(other.spotPrice))
375         return false;
376      if (type != other.type)
377         return false;
378      if (validFrom == null) {
379         if (other.validFrom != null)
380            return false;
381      } else if (!validFrom.equals(other.validFrom))
382         return false;
383      if (validUntil == null) {
384         if (other.validUntil != null)
385            return false;
386      } else if (!validUntil.equals(other.validUntil))
387         return false;
388      return true;
389   }
390 
391   @Override
392   public String toString() {
393      return "[region=" + region + ", id=" + id + ", spotPrice=" + spotPrice + ", state=" + state
394            + ", availabilityZoneGroup=" + availabilityZoneGroup + ", createTime=" + createTime + ", faultCode="
395            + faultCode + ", type=" + type + ", instanceId=" + instanceId + ", launchGroup=" + launchGroup
396            + ", launchSpecification=" + launchSpecification + ", productDescription=" + productDescription
397            + ", validFrom=" + validFrom + ", validUntil=" + validUntil + "]";
398   }
399 
400   @Override
401   public int compareTo(SpotInstanceRequest arg0) {
402      return createTime.compareTo(arg0.createTime);
403   }
404 
405}

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