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

COVERAGE SUMMARY FOR SOURCE FILE [CreateDriveRequest.java]

nameclass, %method, %block, %line, %
CreateDriveRequest.java100% (2/2)67%  (10/15)40%  (92/228)38%  (16/42)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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