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

COVERAGE SUMMARY FOR SOURCE FILE [Drive.java]

nameclass, %method, %block, %line, %
Drive.java100% (2/2)76%  (13/17)38%  (149/388)42%  (34/80)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Drive100% (1/1)71%  (5/7)38%  (84/223)48%  (21/44)
hashCode (): int 0%   (0/1)0%   (0/71)0%   (0/8)
toString (): String 0%   (0/1)0%   (0/37)0%   (0/1)
equals (Object): boolean 100% (1/1)63%  (53/84)48%  (13/27)
Drive (String, String, long, ClaimType, Iterable, Iterable): void 100% (1/1)100% (22/22)100% (5/5)
getClaimType (): ClaimType 100% (1/1)100% (3/3)100% (1/1)
getReaders (): Set 100% (1/1)100% (3/3)100% (1/1)
getSize (): long 100% (1/1)100% (3/3)100% (1/1)
     
class Drive$Builder100% (1/1)80%  (8/10)39%  (65/165)36%  (13/36)
equals (Object): boolean 0%   (0/1)0%   (0/54)0%   (0/17)
hashCode (): int 0%   (0/1)0%   (0/46)0%   (0/6)
Drive$Builder (): void 100% (1/1)100% (9/9)100% (3/3)
build (): Drive 100% (1/1)100% (16/16)100% (1/1)
claimType (ClaimType): Drive$Builder 100% (1/1)100% (5/5)100% (2/2)
name (String): Drive$Builder 100% (1/1)100% (7/7)100% (1/1)
readers (Iterable): Drive$Builder 100% (1/1)100% (9/9)100% (2/2)
size (long): Drive$Builder 100% (1/1)100% (5/5)100% (2/2)
use (Iterable): Drive$Builder 100% (1/1)100% (7/7)100% (1/1)
uuid (String): Drive$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.cloudsigma.domain;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.util.Set;
24 
25import org.jclouds.javax.annotation.Nullable;
26 
27import com.google.common.collect.ImmutableSet;
28 
29/**
30 * 
31 * @author Adrian Cole
32 */
33public class Drive extends Item {
34   public static class Builder extends Item.Builder {
35      protected long size;
36      protected ClaimType claimType = ClaimType.EXCLUSIVE;
37      protected Set<String> readers = ImmutableSet.of();
38 
39      public Builder claimType(ClaimType claimType) {
40         this.claimType = claimType;
41         return this;
42      }
43 
44      public Builder readers(Iterable<String> readers) {
45         this.readers = ImmutableSet.copyOf(checkNotNull(readers, "readers"));
46         return this;
47      }
48 
49      public Builder size(long size) {
50         this.size = size;
51         return this;
52      }
53 
54      /**
55       * {@inheritDoc}
56       */
57      @Override
58      public Builder uuid(String uuid) {
59         return Builder.class.cast(super.uuid(uuid));
60      }
61 
62      /**
63       * {@inheritDoc}
64       */
65      @Override
66      public Builder name(String name) {
67         return Builder.class.cast(super.name(name));
68      }
69 
70      /**
71       * {@inheritDoc}
72       */
73      @Override
74      public Builder use(Iterable<String> use) {
75         return Builder.class.cast(super.use(use));
76      }
77 
78      public Drive build() {
79         return new Drive(uuid, name, size, claimType, readers, use);
80      }
81 
82      @Override
83      public int hashCode() {
84         final int prime = 31;
85         int result = super.hashCode();
86         result = prime * result + ((claimType == null) ? 0 : claimType.hashCode());
87         result = prime * result + ((readers == null) ? 0 : readers.hashCode());
88         result = prime * result + (int) (size ^ (size >>> 32));
89         return result;
90      }
91 
92      @Override
93      public boolean equals(Object obj) {
94         if (this == obj)
95            return true;
96         if (!super.equals(obj))
97            return false;
98         if (getClass() != obj.getClass())
99            return false;
100         Builder other = (Builder) obj;
101         if (claimType != other.claimType)
102            return false;
103         if (readers == null) {
104            if (other.readers != null)
105               return false;
106         } else if (!readers.equals(other.readers))
107            return false;
108         if (size != other.size)
109            return false;
110         return true;
111      }
112   }
113 
114   protected final long size;
115   protected final ClaimType claimType;
116   protected final Set<String> readers;
117 
118   public Drive(@Nullable String uuid, String name, long size, @Nullable ClaimType claimType, Iterable<String> readers,
119         Iterable<String> use) {
120      super(uuid, name, use);
121      this.size = size;
122      this.claimType = checkNotNull(claimType, "set claimType to exclusive, not null");
123      this.readers = ImmutableSet.copyOf(checkNotNull(readers, "readers"));
124   }
125 
126   /**
127    * 
128    * @return either 'exclusive' (the default) or 'shared' to allow multiple servers to access a
129    *         drive simultaneously
130    */
131   @Nullable
132   public ClaimType getClaimType() {
133      return claimType;
134   }
135 
136   /**
137    * 
138    * @return list of users allowed to read from a drive or 'ffffffff-ffff-ffff-ffff-ffffffffffff'
139    *         for all users
140    */
141   public Set<String> getReaders() {
142      return readers;
143   }
144 
145   /**
146    * 
147    * @return size of drive in bytes
148    */
149   public long getSize() {
150      return size;
151   }
152 
153   @Override
154   public int hashCode() {
155      final int prime = 31;
156      int result = 1;
157      result = prime * result + ((claimType == null) ? 0 : claimType.hashCode());
158      result = prime * result + ((name == null) ? 0 : name.hashCode());
159      result = prime * result + ((readers == null) ? 0 : readers.hashCode());
160      result = prime * result + (int) (size ^ (size >>> 32));
161      result = prime * result + ((use == null) ? 0 : use.hashCode());
162      return result;
163   }
164 
165   @Override
166   public boolean equals(Object obj) {
167      if (this == obj)
168         return true;
169      if (obj == null)
170         return false;
171      if (getClass() != obj.getClass())
172         return false;
173      Drive other = (Drive) obj;
174      if (claimType != other.claimType)
175         return false;
176      if (name == null) {
177         if (other.name != null)
178            return false;
179      } else if (!name.equals(other.name))
180         return false;
181      if (readers == null) {
182         if (other.readers != null)
183            return false;
184      } else if (!readers.equals(other.readers))
185         return false;
186      if (size != other.size)
187         return false;
188      if (use == null) {
189         if (other.use != null)
190            return false;
191      } else if (!use.equals(other.use))
192         return false;
193      return true;
194   }
195 
196   @Override
197   public String toString() {
198      return "[uuid=" + uuid + ", name=" + name + ", use=" + use + ", size=" + size + ", claimType=" + claimType
199            + ", readers=" + readers + "]";
200   }
201 
202}

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