EMMA Coverage Report (generated Mon Dec 09 15:12:29 EST 2013)
[all classes][org.jclouds.glesys.domain]

COVERAGE SUMMARY FOR SOURCE FILE [ServerDetails.java]

nameclass, %method, %block, %line, %
ServerDetails.java75%  (3/4)86%  (25/29)84%  (239/286)92%  (44/48)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ServerDetails$Builder100% (1/1)92%  (12/13)79%  (120/152)96%  (22/23)
fromServerDetails (ServerDetails): ServerDetails$Builder 0%   (0/1)0%   (0/32)0%   (0/1)
ServerDetails$Builder (): void 100% (1/1)100% (6/6)100% (2/2)
build (): ServerDetails 100% (1/1)100% (30/30)100% (1/1)
cost (Cost): ServerDetails$Builder 100% (1/1)100% (10/10)100% (2/2)
cpuCores (int): ServerDetails$Builder 100% (1/1)100% (7/7)100% (2/2)
description (String): ServerDetails$Builder 100% (1/1)100% (10/10)100% (2/2)
diskSizeGB (int): ServerDetails$Builder 100% (1/1)100% (7/7)100% (2/2)
ips (Ip []): ServerDetails$Builder 100% (1/1)100% (5/5)100% (1/1)
ips (Set): ServerDetails$Builder 100% (1/1)100% (11/11)100% (2/2)
memorySizeMB (int): ServerDetails$Builder 100% (1/1)100% (7/7)100% (2/2)
state (Server$State): ServerDetails$Builder 100% (1/1)100% (10/10)100% (2/2)
templateName (String): ServerDetails$Builder 100% (1/1)100% (10/10)100% (2/2)
transferGB (int): ServerDetails$Builder 100% (1/1)100% (7/7)100% (2/2)
     
class ServerDetails100% (1/1)77%  (10/13)88%  (111/126)87%  (20/23)
getCost (): Cost 0%   (0/1)0%   (0/3)0%   (0/1)
getTransferGB (): int 0%   (0/1)0%   (0/3)0%   (0/1)
toBuilder (): ServerDetails$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
ServerDetails (String, String, String, String, Server$State, String, String, ... 100% (1/1)96%  (46/48)100% (11/11)
builder (): ServerDetails$Builder 100% (1/1)100% (5/5)100% (1/1)
getCpuCores (): int 100% (1/1)100% (3/3)100% (1/1)
getDescription (): String 100% (1/1)100% (3/3)100% (1/1)
getDiskSizeGB (): int 100% (1/1)100% (3/3)100% (1/1)
getIps (): Set 100% (1/1)100% (3/3)100% (1/1)
getMemorySizeMB (): int 100% (1/1)100% (3/3)100% (1/1)
getState (): Server$State 100% (1/1)100% (3/3)100% (1/1)
getTemplateName (): String 100% (1/1)100% (3/3)100% (1/1)
string (): Objects$ToStringHelper 100% (1/1)100% (39/39)100% (1/1)
     
class ServerDetails$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)
     
class ServerDetails$ConcreteBuilder100% (1/1)100% (3/3)100% (8/8)100% (2/2)
ServerDetails$ConcreteBuilder (): void 100% (1/1)100% (3/3)100% (1/1)
ServerDetails$ConcreteBuilder (ServerDetails$1): void 100% (1/1)100% (3/3)100% (1/1)
self (): ServerDetails$ConcreteBuilder 100% (1/1)100% (2/2)100% (1/1)

1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17package org.jclouds.glesys.domain;
18 
19import static com.google.common.base.Preconditions.checkNotNull;
20 
21import java.beans.ConstructorProperties;
22import java.util.Set;
23 
24import org.jclouds.javax.annotation.Nullable;
25 
26import com.google.common.base.Objects.ToStringHelper;
27import com.google.common.collect.ImmutableSet;
28 
29/**
30 * Detailed information about a server such as cpuCores, hardware configuration
31 * (cpu, memory and disk), ip addresses, cost, transfer, os and more.
32 *
33 * @author Adrian Cole
34 * @see <a href= "https://customer.glesys.com/api.php?a=doc#server_details" />
35 */
36public class ServerDetails extends Server {
37 
38   public static Builder<?> builder() {
39      return new ConcreteBuilder();
40   }
41 
42   public Builder<?> toBuilder() {
43      return new ConcreteBuilder().fromServerDetails(this);
44   }
45 
46   public abstract static class Builder<T extends Builder<T>> extends Server.Builder<T> {
47      protected Server.State state;
48      protected String description;
49      protected String templateName;
50      protected int cpuCores;
51      protected int memorySizeMB;
52      protected int diskSizeGB;
53      protected int transferGB;
54      protected Cost cost;
55      protected Set<Ip> ips = ImmutableSet.of();
56 
57      /**
58       * @see ServerDetails#getState()
59       */
60      public T state(Server.State state) {
61         this.state = checkNotNull(state, "state");
62         return self();
63      }
64 
65      /**
66       * @see ServerDetails#getDescription()
67       */
68      public T description(String description) {
69         this.description = checkNotNull(description, "description");
70         return self();
71      }
72 
73      /**
74       * @see ServerDetails#getTemplateName()
75       */
76      public T templateName(String templateName) {
77         this.templateName = checkNotNull(templateName, "templateName");
78         return self();
79      }
80 
81      /**
82       * @see ServerDetails#getCpuCores()
83       */
84      public T cpuCores(int cpuCores) {
85         this.cpuCores = cpuCores;
86         return self();
87      }
88 
89      /**
90       * @see ServerDetails#getMemorySizeMB()
91       */
92      public T memorySizeMB(int memorySizeMB) {
93         this.memorySizeMB = memorySizeMB;
94         return self();
95      }
96 
97      /**
98       * @see ServerDetails#getDiskSizeGB()
99       */
100      public T diskSizeGB(int diskSizeGB) {
101         this.diskSizeGB = diskSizeGB;
102         return self();
103      }
104 
105      /**
106       * @see ServerDetails#getTransferGB()
107       */
108      public T transferGB(int transferGB) {
109         this.transferGB = transferGB;
110         return self();
111      }
112 
113      /**
114       * @see ServerDetails#getCost()
115       */
116      public T cost(Cost cost) {
117         this.cost = checkNotNull(cost, "cost");
118         return self();
119      }
120 
121      /**
122       * @see ServerDetails#getIps()
123       */
124      public T ips(Set<Ip> ips) {
125         this.ips = ImmutableSet.copyOf(checkNotNull(ips, "ips"));
126         return self();
127      }
128 
129      public T ips(Ip... in) {
130         return ips(ImmutableSet.copyOf(in));
131      }
132 
133      public ServerDetails build() {
134         return new ServerDetails(id, hostname, datacenter, platform, state, description, templateName, cpuCores, memorySizeMB, diskSizeGB, transferGB, cost, ips);
135      }
136 
137      public T fromServerDetails(ServerDetails in) {
138         return super.fromServer(in)
139               .state(in.getState())
140               .description(in.getDescription())
141               .templateName(in.getTemplateName())
142               .cpuCores(in.getCpuCores())
143               .memorySizeMB(in.getMemorySizeMB())
144               .diskSizeGB(in.getDiskSizeGB())
145               .transferGB(in.getTransferGB())
146               .cost(in.getCost())
147               .ips(in.getIps());
148      }
149   }
150 
151   private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
152      @Override
153      protected ConcreteBuilder self() {
154         return this;
155      }
156   }
157 
158   private final Server.State state;
159   private final String description;
160   private final String templateName;
161   private final int cpuCores;
162   private final int memorySizeMB;
163   private final int diskSizeGB;
164   private final int transferGB;
165   private final Cost cost;
166   private final Set<Ip> ips;
167 
168   @ConstructorProperties({
169         "serverid", "hostname", "datacenter", "platform", "state", "description", "templatename", "cpucores",
170         "memorysize", "disksize", "transfer", "cost", "iplist"
171   })
172   protected ServerDetails(String id, String hostname, String datacenter, String platform, @Nullable Server.State state,
173                           @Nullable String description, String templateName, int cpuCores, int memorySizeMB,
174                           int diskSizeGB, int transferGB, Cost cost, @Nullable Set<Ip> ips) {
175      super(id, hostname, datacenter, platform);
176      this.state = state;
177      this.description = description;
178      this.templateName = checkNotNull(templateName, "templateName");
179      this.cpuCores = cpuCores;
180      this.memorySizeMB = memorySizeMB;
181      this.diskSizeGB = diskSizeGB;
182      this.transferGB = transferGB;
183      this.cost = checkNotNull(cost, "cost");
184      this.ips = ips == null ? ImmutableSet.<Ip>of() : ImmutableSet.copyOf(checkNotNull(ips, "ips"));
185   }
186 
187   /**
188    * @return the state of the server (e.g. "running")
189    */
190   public Server.State getState() {
191      return this.state;
192   }
193 
194   /**
195    * @return the user-specified description of the server
196    */
197   public String getDescription() {
198      return this.description;
199   }
200 
201   /**
202    * @return the name of the template used to create the server
203    */
204   public String getTemplateName() {
205      return this.templateName;
206   }
207 
208   /**
209    * @return number of cores on the server
210    */
211   public int getCpuCores() {
212      return this.cpuCores;
213   }
214 
215   /**
216    * @return the memory of the server in MB
217    */
218   public int getMemorySizeMB() {
219      return this.memorySizeMB;
220   }
221 
222   /**
223    * @return the disk of the server in GB
224    */
225   public int getDiskSizeGB() {
226      return this.diskSizeGB;
227   }
228 
229   /**
230    * @return the transfer of the server
231    */
232   public int getTransferGB() {
233      return this.transferGB;
234   }
235 
236   /**
237    * @return details of the cost of the server
238    */
239   public Cost getCost() {
240      return this.cost;
241   }
242 
243   /**
244    * @return the ip addresses assigned to the server
245    */
246   public Set<Ip> getIps() {
247      return this.ips;
248   }
249 
250   protected ToStringHelper string() {
251      return super.string().add("state", state).add("description", description).add("templateName", templateName)
252            .add("cpuCores", cpuCores).add("memorySizeMB", memorySizeMB).add("diskSizeGB", diskSizeGB)
253            .add("transferGB", transferGB).add("cost", cost).add("ips", ips);
254   }
255 
256}

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