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

COVERAGE SUMMARY FOR SOURCE FILE [CreateDriveRequest.java]

nameclass, %method, %block, %line, %
CreateDriveRequest.java100% (2/2)81%  (13/16)44%  (108/243)44%  (19/43)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CreateDriveRequest100% (1/1)50%  (3/6)16%  (26/161)20%  (6/30)
equals (Object): boolean 0%   (0/1)0%   (0/55)0%   (0/18)
hashCode (): int 0%   (0/1)0%   (0/33)0%   (0/5)
toString (): String 0%   (0/1)0%   (0/47)0%   (0/1)
CreateDriveRequest (String, long, ClaimType, Iterable, Iterable, Map, String,... 100% (1/1)100% (20/20)100% (4/4)
getAvoid (): Set 100% (1/1)100% (3/3)100% (1/1)
getEncryptionCipher (): String 100% (1/1)100% (3/3)100% (1/1)
     
class CreateDriveRequest$Builder100% (1/1)100% (10/10)100% (82/82)100% (13/13)
CreateDriveRequest$Builder (): void 100% (1/1)100% (6/6)100% (2/2)
avoid (Iterable): CreateDriveRequest$Builder 100% (1/1)100% (9/9)100% (2/2)
build (): CreateDriveRequest 100% (1/1)100% (20/20)100% (1/1)
claimType (ClaimType): CreateDriveRequest$Builder 100% (1/1)100% (7/7)100% (1/1)
encryptionCipher (String): CreateDriveRequest$Builder 100% (1/1)100% (5/5)100% (2/2)
name (String): CreateDriveRequest$Builder 100% (1/1)100% (7/7)100% (1/1)
readers (Iterable): CreateDriveRequest$Builder 100% (1/1)100% (7/7)100% (1/1)
size (long): CreateDriveRequest$Builder 100% (1/1)100% (7/7)100% (1/1)
tags (Iterable): CreateDriveRequest$Builder 100% (1/1)100% (7/7)100% (1/1)
userMetadata (Map): CreateDriveRequest$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 CreateDriveRequest extends Drive {
36   public static class Builder extends Drive.Builder {
37 
38      private Set<String> avoid = ImmutableSet.of();
39 
40      @Nullable
41      private String encryptionCipher;
42 
43      public Builder avoid(Iterable<String> avoid) {
44         this.avoid = ImmutableSet.copyOf(checkNotNull(avoid, "avoid"));
45         return this;
46      }
47 
48      /**
49       * {@inheritDoc}
50       */
51      @Override
52      public Builder claimType(ClaimType claimType) {
53         return Builder.class.cast(super.claimType(claimType));
54      }
55 
56      public Builder encryptionCipher(String encryptionCipher) {
57         this.encryptionCipher = encryptionCipher;
58         return this;
59      }
60 
61      /**
62       * {@inheritDoc}
63       */
64      @Override
65      public Builder name(String name) {
66         return Builder.class.cast(super.name(name));
67      }
68 
69      /**
70       * {@inheritDoc}
71       */
72      @Override
73      public Builder readers(Iterable<String> readers) {
74         return Builder.class.cast(super.readers(readers));
75      }
76 
77      /**
78       * {@inheritDoc}
79       */
80      @Override
81      public Builder size(long size) {
82         return Builder.class.cast(super.size(size));
83      }
84 
85      /**
86       * {@inheritDoc}
87       */
88      @Override
89      public Builder tags(Iterable<String> tags) {
90         return Builder.class.cast(super.tags(tags));
91      }
92 
93      /**
94       * {@inheritDoc}
95       */
96      @Override
97      public Builder userMetadata(Map<String, String> userMetadata) {
98         return Builder.class.cast(super.userMetadata(userMetadata));
99      }
100 
101      public CreateDriveRequest build() {
102         return new CreateDriveRequest(name, size, claimType, readers, tags, userMetadata, encryptionCipher, avoid);
103      }
104   }
105 
106   private final Set<String> avoid;
107   @Nullable
108   private final String encryptionCipher;
109 
110   public CreateDriveRequest(String name, long size, @Nullable ClaimType claimType, Iterable<String> readers,
111         Iterable<String> tags, Map<String, String> userMetadata, @Nullable String encryptionCipher,
112         Iterable<String> avoid) {
113      super(null, name, size, claimType, readers, tags, userMetadata);
114      this.encryptionCipher = encryptionCipher;
115      this.avoid = ImmutableSet.copyOf(checkNotNull(avoid, "avoid"));
116   }
117 
118   /**
119    * 
120    * @return list of existing drives to ensure this new drive is created on physical different
121    *         hardware than those existing drives
122    */
123   public Set<String> getAvoid() {
124      return avoid;
125   }
126 
127   /**
128    * 
129    * @return either 'none' or 'aes-xts-plain' (the default)
130    */
131   @Nullable
132   public String getEncryptionCipher() {
133      return encryptionCipher;
134   }
135 
136   @Override
137   public int hashCode() {
138      final int prime = 31;
139      int result = super.hashCode();
140      result = prime * result + ((avoid == null) ? 0 : avoid.hashCode());
141      result = prime * result + ((encryptionCipher == null) ? 0 : encryptionCipher.hashCode());
142      return result;
143   }
144 
145   @Override
146   public boolean equals(Object obj) {
147      if (this == obj)
148         return true;
149      if (!super.equals(obj))
150         return false;
151      if (getClass() != obj.getClass())
152         return false;
153      CreateDriveRequest other = (CreateDriveRequest) obj;
154      if (avoid == null) {
155         if (other.avoid != null)
156            return false;
157      } else if (!avoid.equals(other.avoid))
158         return false;
159      if (encryptionCipher == null) {
160         if (other.encryptionCipher != null)
161            return false;
162      } else if (!encryptionCipher.equals(other.encryptionCipher))
163         return false;
164      return true;
165   }
166 
167   @Override
168   public String toString() {
169      return "[name=" + name + ", size=" + size + ", claimType=" + claimType + ", readers=" + readers + ", tags="
170            + tags + ", userMetadata=" + userMetadata + ", avoid=" + avoid + ", encryptionCipher=" + encryptionCipher
171            + "]";
172   }
173 
174}

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