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

COVERAGE SUMMARY FOR SOURCE FILE [Device.java]

nameclass, %method, %block, %line, %
Device.java100% (2/2)67%  (6/9)28%  (37/130)36%  (12/33)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Device100% (1/1)50%  (3/6)18%  (21/114)22%  (6/27)
equals (Object): boolean 0%   (0/1)0%   (0/44)0%   (0/15)
hashCode (): int 0%   (0/1)0%   (0/32)0%   (0/5)
toString (): String 0%   (0/1)0%   (0/17)0%   (0/1)
Device (String, MediaType): void 100% (1/1)100% (15/15)100% (4/4)
getDriveUuid (): String 100% (1/1)100% (3/3)100% (1/1)
getMediaType (): MediaType 100% (1/1)100% (3/3)100% (1/1)
     
class Device$Builder100% (1/1)100% (3/3)100% (16/16)100% (6/6)
Device$Builder (): void 100% (1/1)100% (6/6)100% (2/2)
mediaType (MediaType): Device$Builder 100% (1/1)100% (5/5)100% (2/2)
uuid (String): Device$Builder 100% (1/1)100% (5/5)100% (2/2)

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.cloudsigma.domain;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23/**
24 * 
25 * @author Adrian Cole
26 */
27public abstract class Device {
28   public static abstract class Builder {
29      protected String uuid;
30      protected MediaType mediaType = MediaType.DISK;
31 
32      public Builder mediaType(MediaType mediaType) {
33         this.mediaType = mediaType;
34         return this;
35      }
36 
37      public Builder uuid(String uuid) {
38         this.uuid = uuid;
39         return this;
40      }
41 
42      public abstract Device build();
43   }
44 
45   protected final String driveUuid;
46   protected final MediaType mediaType;
47 
48   public Device(String driveUuid, MediaType mediaType) {
49      this.driveUuid = checkNotNull(driveUuid, "driveUuid");
50      this.mediaType = checkNotNull(mediaType, "mediaType");
51   }
52 
53   /**
54    * id generated based on the device bus, unit, and/or index numbers;
55    */
56   public abstract String getId();
57 
58   /**
59    * 
60    * @return Drive UUID to connect as specified device.
61    */
62   public String getDriveUuid() {
63      return driveUuid;
64   }
65 
66   /**
67    * 
68    * @return set to 'cdrom' to simulate a cdrom, set to 'disk' or leave unset to simulate a hard
69    *         disk.
70    */
71   public MediaType getMediaType() {
72      return mediaType;
73   }
74 
75   @Override
76   public int hashCode() {
77      final int prime = 31;
78      int result = 1;
79      result = prime * result + ((driveUuid == null) ? 0 : driveUuid.hashCode());
80      result = prime * result + ((mediaType == null) ? 0 : mediaType.hashCode());
81      return result;
82   }
83 
84   @Override
85   public boolean equals(Object obj) {
86      if (this == obj)
87         return true;
88      if (obj == null)
89         return false;
90      if (getClass() != obj.getClass())
91         return false;
92      Device other = (Device) obj;
93      if (driveUuid == null) {
94         if (other.driveUuid != null)
95            return false;
96      } else if (!driveUuid.equals(other.driveUuid))
97         return false;
98      if (mediaType != other.mediaType)
99         return false;
100      return true;
101   }
102 
103   @Override
104   public String toString() {
105      return "[driveUuid=" + driveUuid + ", mediaType=" + mediaType + "]";
106   }
107}

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