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

COVERAGE SUMMARY FOR SOURCE FILE [Drive.java]

nameclass, %method, %block, %line, %
Drive.java100% (2/2)78%  (14/18)39%  (168/432)43%  (37/87)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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