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

COVERAGE SUMMARY FOR SOURCE FILE [GetIpListOptions.java]

nameclass, %method, %block, %line, %
GetIpListOptions.java50%  (1/2)36%  (4/11)40%  (44/111)44%  (8.4/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class GetIpListOptions$Builder0%   (0/1)0%   (0/5)0%   (0/28)0%   (0/5)
GetIpListOptions$Builder (): void 0%   (0/1)0%   (0/3)0%   (0/1)
create (): GetIpListOptions 0%   (0/1)0%   (0/4)0%   (0/1)
inDatacenter (String): GetIpListOptions 0%   (0/1)0%   (0/8)0%   (0/1)
limitToType (IpType): GetIpListOptions 0%   (0/1)0%   (0/6)0%   (0/1)
unassignedPublicIps (): GetIpListOptions 0%   (0/1)0%   (0/7)0%   (0/1)
     
class GetIpListOptions100% (1/1)67%  (4/6)53%  (44/83)59%  (8.9/15)
inDatacenter (String): GetIpListOptions 0%   (0/1)0%   (0/18)0%   (0/3)
onlyAssigned (): GetIpListOptions 0%   (0/1)0%   (0/19)0%   (0/3)
onlyUnassigned (): GetIpListOptions 100% (1/1)95%  (18/19)98%  (2.9/3)
onlyWithType (IpType): GetIpListOptions 100% (1/1)95%  (18/19)98%  (2.9/3)
<static initializer> 100% (1/1)100% (5/5)100% (1/1)
GetIpListOptions (): 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.checkNotNull;
22import static com.google.common.base.Preconditions.checkState;
23import static org.jclouds.gogrid.reference.GoGridQueryParams.DATACENTER_KEY;
24import static org.jclouds.gogrid.reference.GoGridQueryParams.IP_STATE_KEY;
25import static org.jclouds.gogrid.reference.GoGridQueryParams.IP_TYPE_KEY;
26 
27import org.jclouds.gogrid.domain.IpState;
28import org.jclouds.gogrid.domain.IpType;
29import org.jclouds.http.options.BaseHttpRequestOptions;
30 
31/**
32 * @author Oleksiy Yarmula
33 */
34public class GetIpListOptions extends BaseHttpRequestOptions {
35 
36   public static final GetIpListOptions NONE = new GetIpListOptions();
37 
38   public GetIpListOptions onlyAssigned() {
39      checkState(!queryParameters.containsKey(IP_STATE_KEY),
40               "Can't have multiple values for whether IP is assigned");
41      queryParameters.put(IP_STATE_KEY, IpState.ASSIGNED.toString());
42      return this;
43   }
44 
45   public GetIpListOptions onlyUnassigned() {
46      checkState(!queryParameters.containsKey(IP_STATE_KEY),
47               "Can't have multiple values for whether IP is assigned");
48      queryParameters.put(IP_STATE_KEY, IpState.UNASSIGNED.toString());
49      return this;
50   }
51 
52   public GetIpListOptions onlyWithType(IpType type) {
53      checkState(!queryParameters.containsKey(IP_TYPE_KEY),
54               "Can't have multiple values for ip type limit");
55      queryParameters.put(IP_TYPE_KEY, type.toString());
56      return this;
57   }
58 
59   public GetIpListOptions inDatacenter(String datacenterId) {
60      checkState(!queryParameters.containsKey(DATACENTER_KEY), "Can't have duplicate datacenter id");
61      queryParameters.put(DATACENTER_KEY, datacenterId);
62      return this;
63   }
64 
65   public static class Builder {
66 
67      public GetIpListOptions inDatacenter(String datacenterId) {
68         return new GetIpListOptions().inDatacenter(checkNotNull(datacenterId));
69      }
70 
71      public GetIpListOptions create() {
72         return new GetIpListOptions();
73      }
74 
75      public GetIpListOptions limitToType(IpType type) {
76         return new GetIpListOptions().onlyWithType(type);
77      }
78 
79      public GetIpListOptions unassignedPublicIps() {
80         return new GetIpListOptions().onlyWithType(IpType.PUBLIC).onlyUnassigned();
81      }
82   }
83 
84}

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