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

COVERAGE SUMMARY FOR SOURCE FILE [AddServerOptions.java]

nameclass, %method, %block, %line, %
AddServerOptions.java100% (2/2)83%  (5/6)92%  (61/66)95%  (12.4/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AddServerOptions$Builder100% (1/1)67%  (2/3)83%  (15/18)80%  (4/5)
AddServerOptions$Builder (): void 0%   (0/1)0%   (0/3)0%   (0/1)
asSandboxType (): AddServerOptions 100% (1/1)100% (7/7)100% (2/2)
withDescription (String): AddServerOptions 100% (1/1)100% (8/8)100% (2/2)
     
class AddServerOptions100% (1/1)100% (3/3)96%  (46/48)99%  (8.9/9)
asSandboxType (): AddServerOptions 100% (1/1)94%  (17/18)98%  (2.9/3)
withDescription (String): AddServerOptions 100% (1/1)96%  (26/27)99%  (4/4)
AddServerOptions (): void 100% (1/1)100% (3/3)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.gogrid.options;
20 
21import static com.google.common.base.Preconditions.checkArgument;
22import static com.google.common.base.Preconditions.checkState;
23import static org.jclouds.gogrid.reference.GoGridQueryParams.DESCRIPTION_KEY;
24import static org.jclouds.gogrid.reference.GoGridQueryParams.IS_SANDBOX_KEY;
25 
26import org.jclouds.http.options.BaseHttpRequestOptions;
27 
28/**
29 * @author Oleksiy Yarmula
30 */
31public class AddServerOptions extends BaseHttpRequestOptions {
32 
33   public AddServerOptions withDescription(String description) {
34      checkArgument(description.length() <= 500, "Description cannot be longer than 500 characters");
35      checkState(!queryParameters.containsKey(DESCRIPTION_KEY),
36               "Can't have duplicate server description");
37      queryParameters.put(DESCRIPTION_KEY, description);
38      return this;
39   }
40 
41   /**
42    * Make server a sandbox instance. By default, it's not.
43    * 
44    * @return itself for convenience
45    */
46   public AddServerOptions asSandboxType() {
47      checkState(!queryParameters.containsKey(IS_SANDBOX_KEY),
48               "Can only have one sandbox option per server");
49      queryParameters.put(IS_SANDBOX_KEY, "true");
50      return this;
51   }
52 
53   public static class Builder {
54      /**
55       * @see AddServerOptions#withDescription(String)
56       */
57      public static AddServerOptions withDescription(String description) {
58         AddServerOptions options = new AddServerOptions();
59         return options.withDescription(description);
60      }
61 
62      /**
63       * @see AddServerOptions#asSandboxType()
64       */
65      public static AddServerOptions asSandboxType() {
66         AddServerOptions options = new AddServerOptions();
67         return options.asSandboxType();
68      }
69   }
70}

[all classes][org.jclouds.gogrid.options]
EMMA 2.0.5312 (C) Vladimir Roubtsov