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

COVERAGE SUMMARY FOR SOURCE FILE [OSTemplate.java]

nameclass, %method, %block, %line, %
OSTemplate.java75%  (3/4)65%  (15/23)68%  (144/211)76%  (27.4/36)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OSTemplate100% (1/1)42%  (5/12)62%  (80/130)64%  (13.4/21)
getMinDiskSize (): int 0%   (0/1)0%   (0/3)0%   (0/1)
getMinMemSize (): int 0%   (0/1)0%   (0/3)0%   (0/1)
getOs (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getPlatform (): String 0%   (0/1)0%   (0/3)0%   (0/1)
string (): Objects$ToStringHelper 0%   (0/1)0%   (0/23)0%   (0/1)
toBuilder (): OSTemplate$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/4)0%   (0/1)
equals (Object): boolean 100% (1/1)89%  (31/35)84%  (3.4/4)
OSTemplate (String, int, int, String, String): void 100% (1/1)100% (27/27)100% (7/7)
builder (): OSTemplate$Builder 100% (1/1)100% (5/5)100% (1/1)
getName (): String 100% (1/1)100% (3/3)100% (1/1)
hashCode (): int 100% (1/1)100% (14/14)100% (1/1)
     
class OSTemplate$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)
     
class OSTemplate$Builder100% (1/1)88%  (7/8)77%  (56/73)92%  (12/13)
fromOSTemplate (OSTemplate): OSTemplate$Builder 0%   (0/1)0%   (0/17)0%   (0/1)
OSTemplate$Builder (): void 100% (1/1)100% (3/3)100% (1/1)
build (): OSTemplate 100% (1/1)100% (14/14)100% (1/1)
minDiskSize (int): OSTemplate$Builder 100% (1/1)100% (6/6)100% (2/2)
minMemSize (int): OSTemplate$Builder 100% (1/1)100% (6/6)100% (2/2)
name (String): OSTemplate$Builder 100% (1/1)100% (9/9)100% (2/2)
os (String): OSTemplate$Builder 100% (1/1)100% (9/9)100% (2/2)
platform (String): OSTemplate$Builder 100% (1/1)100% (9/9)100% (2/2)
     
class OSTemplate$ConcreteBuilder100% (1/1)100% (3/3)100% (8/8)100% (2/2)
OSTemplate$ConcreteBuilder (): void 100% (1/1)100% (3/3)100% (1/1)
OSTemplate$ConcreteBuilder (OSTemplate$1): void 100% (1/1)100% (3/3)100% (1/1)
self (): OSTemplate$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;
22 
23import com.google.common.base.Objects;
24import com.google.common.base.Objects.ToStringHelper;
25 
26/**
27 * Operating system template
28 *
29 * @author Adam Lowe
30 * @see <a href= "https://customer.glesys.com/api.php?a=doc#server_templates" />
31 */
32public class OSTemplate {
33 
34   public static Builder<?> builder() {
35      return new ConcreteBuilder();
36   }
37 
38   public Builder<?> toBuilder() {
39      return new ConcreteBuilder().fromOSTemplate(this);
40   }
41 
42   public abstract static class Builder<T extends Builder<T>> {
43      protected abstract T self();
44 
45      protected String name;
46      protected int minDiskSize;
47      protected int minMemSize;
48      protected String os;
49      protected String platform;
50 
51      /**
52       * @see OSTemplate#getName()
53       */
54      public T name(String name) {
55         this.name = checkNotNull(name, "name");
56         return self();
57      }
58 
59      /**
60       * @see OSTemplate#getMinDiskSize()
61       */
62      public T minDiskSize(int minDiskSize) {
63         this.minDiskSize = minDiskSize;
64         return self();
65      }
66 
67      /**
68       * @see OSTemplate#getMinMemSize()
69       */
70      public T minMemSize(int minMemSize) {
71         this.minMemSize = minMemSize;
72         return self();
73      }
74 
75      /**
76       * @see OSTemplate#getOs()
77       */
78      public T os(String os) {
79         this.os = checkNotNull(os, "os");
80         return self();
81      }
82 
83      /**
84       * @see OSTemplate#getPlatform()
85       */
86      public T platform(String platform) {
87         this.platform = checkNotNull(platform, "platform");
88         return self();
89      }
90 
91      public OSTemplate build() {
92         return new OSTemplate(name, minDiskSize, minMemSize, os, platform);
93      }
94 
95      public T fromOSTemplate(OSTemplate in) {
96         return this.name(in.getName())
97               .minDiskSize(in.getMinDiskSize())
98               .minMemSize(in.getMinMemSize())
99               .os(in.getOs())
100               .platform(in.getPlatform());
101      }
102   }
103 
104   private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
105      @Override
106      protected ConcreteBuilder self() {
107         return this;
108      }
109   }
110 
111   private final String name;
112   private final int minDiskSize;
113   private final int minMemSize;
114   private final String os;
115   private final String platform;
116 
117   @ConstructorProperties({
118         "name", "minimumdisksize", "minimummemorysize", "operatingsystem", "platform"
119   })
120   protected OSTemplate(String name, int minDiskSize, int minMemSize, String os, String platform) {
121      this.name = checkNotNull(name, "name");
122      this.minDiskSize = minDiskSize;
123      this.minMemSize = minMemSize;
124      this.os = checkNotNull(os, "os");
125      this.platform = checkNotNull(platform, "platform");
126   }
127 
128   /**
129    */
130   public String getName() {
131      return this.name;
132   }
133 
134   /**
135    * @return the minimum allowed disk size in GB
136    * @see org.jclouds.glesys.domain.AllowedArgumentsForCreateServer#getDiskSizesInGB()
137    */
138   public int getMinDiskSize() {
139      return this.minDiskSize;
140   }
141 
142   /**
143    * @return the minimum allowed memory size in MB
144    * @see org.jclouds.glesys.domain.AllowedArgumentsForCreateServer#getMemorySizesInMB()
145    */
146   public int getMinMemSize() {
147      return this.minMemSize;
148   }
149 
150   /**
151    * @return the name of the operating system type ex. "linux"
152    */
153   public String getOs() {
154      return this.os;
155   }
156 
157   /**
158    * @return the name of the platform this template is available in, ex. "Xen"
159    */
160   public String getPlatform() {
161      return this.platform;
162   }
163 
164   @Override
165   public int hashCode() {
166      return Objects.hashCode(name, platform);
167   }
168 
169   @Override
170   public boolean equals(Object obj) {
171      if (this == obj) return true;
172      if (obj == null || getClass() != obj.getClass()) return false;
173      OSTemplate that = OSTemplate.class.cast(obj);
174      return Objects.equal(this.name, that.name)
175            && Objects.equal(this.platform, that.platform);
176   }
177 
178   protected ToStringHelper string() {
179      return Objects.toStringHelper("")
180            .add("name", name).add("minDiskSize", minDiskSize).add("minMemSize", minMemSize).add("os", os).add("platform", platform);
181   }
182 
183   @Override
184   public String toString() {
185      return string().toString();
186   }
187 
188}

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