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

COVERAGE SUMMARY FOR SOURCE FILE [Console.java]

nameclass, %method, %block, %line, %
Console.java75%  (3/4)57%  (12/21)60%  (123/204)70%  (22.3/32)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Console100% (1/1)27%  (3/11)50%  (67/134)54%  (10.3/19)
getHost (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getPassword (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getPort (): int 0%   (0/1)0%   (0/3)0%   (0/1)
getProtocol (): String 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/20)0%   (0/1)
string (): Objects$ToStringHelper 0%   (0/1)0%   (0/19)0%   (0/1)
toBuilder (): Console$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)88%  (38/43)83%  (3.3/4)
Console (String, int, String, String): void 100% (1/1)100% (24/24)100% (6/6)
builder (): Console$Builder 100% (1/1)100% (5/5)100% (1/1)
     
class Console$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)
     
class Console$Builder100% (1/1)86%  (6/7)77%  (48/62)91%  (10/11)
fromConsole (Console): Console$Builder 0%   (0/1)0%   (0/14)0%   (0/1)
Console$Builder (): void 100% (1/1)100% (3/3)100% (1/1)
build (): Console 100% (1/1)100% (12/12)100% (1/1)
host (String): Console$Builder 100% (1/1)100% (9/9)100% (2/2)
password (String): Console$Builder 100% (1/1)100% (9/9)100% (2/2)
port (int): Console$Builder 100% (1/1)100% (6/6)100% (2/2)
protocol (String): Console$Builder 100% (1/1)100% (9/9)100% (2/2)
     
class Console$ConcreteBuilder100% (1/1)100% (3/3)100% (8/8)100% (2/2)
Console$ConcreteBuilder (): void 100% (1/1)100% (3/3)100% (1/1)
Console$ConcreteBuilder (Console$1): void 100% (1/1)100% (3/3)100% (1/1)
self (): Console$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 * Connection information to connect to a server with VNC.
28 *
29 * @author Adam Lowe
30 * @see <a href="https://customer.glesys.com/api.php?a=doc#server_console" />
31 */
32public class Console {
33 
34   public static Builder<?> builder() {
35      return new ConcreteBuilder();
36   }
37 
38   public Builder<?> toBuilder() {
39      return new ConcreteBuilder().fromConsole(this);
40   }
41 
42   public abstract static class Builder<T extends Builder<T>> {
43      protected abstract T self();
44 
45      protected String host;
46      protected int port;
47      protected String protocol;
48      protected String password;
49 
50      /**
51       * @see Console#getHost()
52       */
53      public T host(String host) {
54         this.host = checkNotNull(host, "host");
55         return self();
56      }
57 
58      /**
59       * @see Console#getPort()
60       */
61      public T port(int port) {
62         this.port = port;
63         return self();
64      }
65 
66      /**
67       * @see Console#getProtocol()
68       */
69      public T protocol(String protocol) {
70         this.protocol = checkNotNull(protocol, "protocol");
71         return self();
72      }
73 
74      /**
75       * @see Console#getPassword()
76       */
77      public T password(String password) {
78         this.password = checkNotNull(password, "password");
79         return self();
80      }
81 
82      public Console build() {
83         return new Console(host, port, protocol, password);
84      }
85 
86      public T fromConsole(Console in) {
87         return this.host(in.getHost()).port(in.getPort()).protocol(in.getProtocol()).password(in.getPassword());
88      }
89   }
90 
91   private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
92      @Override
93      protected ConcreteBuilder self() {
94         return this;
95      }
96   }
97 
98   private final String host;
99   private final int port;
100   private final String protocol;
101   private final String password;
102 
103   @ConstructorProperties({
104         "host", "port", "protocol", "password"
105   })
106   protected Console(String host, int port, String protocol, String password) {
107      this.host = checkNotNull(host, "host");
108      this.port = port;
109      this.protocol = checkNotNull(protocol, "protocol");
110      this.password = checkNotNull(password, "password");
111   }
112 
113   /**
114    * @return the host name to use to connect to the server
115    */
116   public String getHost() {
117      return this.host;
118   }
119 
120   /**
121    * @return the port to use to connect to the server
122    */
123   public int getPort() {
124      return this.port;
125   }
126 
127   /**
128    * @return the protocol to use to connect to the server
129    */
130   public String getProtocol() {
131      return this.protocol;
132   }
133 
134   /**
135    * @return the password to use to connect to the server
136    */
137   public String getPassword() {
138      return this.password;
139   }
140 
141   @Override
142   public int hashCode() {
143      return Objects.hashCode(host, port, protocol);
144   }
145 
146   @Override
147   public boolean equals(Object obj) {
148      if (this == obj) return true;
149      if (obj == null || getClass() != obj.getClass()) return false;
150      Console that = Console.class.cast(obj);
151      return Objects.equal(this.host, that.host)
152            && Objects.equal(this.port, that.port)
153            && Objects.equal(this.protocol, that.protocol);
154   }
155 
156   protected ToStringHelper string() {
157      return Objects.toStringHelper("").add("host", host).add("port", port).add("protocol", protocol)
158            .add("password", password);
159   }
160 
161   @Override
162   public String toString() {
163      return string().toString();
164   }
165 
166}

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