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

COVERAGE SUMMARY FOR SOURCE FILE [OperatingSystem.java]

nameclass, %method, %block, %line, %
OperatingSystem.java100% (2/2)56%  (9/16)51%  (83/162)49%  (19/39)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OperatingSystem100% (1/1)50%  (5/10)46%  (52/114)39%  (11/28)
compareTo (OperatingSystem): int 0%   (0/1)0%   (0/10)0%   (0/1)
equals (Object): boolean 0%   (0/1)0%   (0/28)0%   (0/10)
getId (): int 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/18)0%   (0/4)
toBuilder (): OperatingSystem$Builder 0%   (0/1)0%   (0/3)0%   (0/1)
OperatingSystem (): void 100% (1/1)100% (9/9)100% (4/4)
OperatingSystem (int, Iterable): void 100% (1/1)100% (19/19)100% (6/6)
builder (): OperatingSystem$Builder 100% (1/1)100% (4/4)100% (1/1)
getPasswords (): Set 100% (1/1)100% (3/3)100% (1/1)
toString (): String 100% (1/1)100% (17/17)100% (1/1)
     
class OperatingSystem$Builder100% (1/1)67%  (4/6)65%  (31/48)73%  (8/11)
fromOperatingSystem (OperatingSystem): OperatingSystem$Builder 0%   (0/1)0%   (0/8)0%   (0/1)
passwords (Iterable): OperatingSystem$Builder 0%   (0/1)0%   (0/9)0%   (0/2)
OperatingSystem$Builder (): void 100% (1/1)100% (9/9)100% (3/3)
build (): OperatingSystem 100% (1/1)100% (8/8)100% (1/1)
id (int): OperatingSystem$Builder 100% (1/1)100% (5/5)100% (2/2)
password (Password): OperatingSystem$Builder 100% (1/1)100% (9/9)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.softlayer.domain;
20 
21import com.google.common.collect.ImmutableSet;
22import com.google.common.collect.Sets;
23 
24import java.util.Set;
25 
26import static com.google.common.base.Preconditions.checkNotNull;
27 
28/**
29 * Extends the SoftLayer_Software_Component data type to include operating system specific properties.
30 * 
31 * @author Jason King
32 * @see <a href=
33 *      "http://sldn.softlayer.com/reference/datatypes/SoftLayer_Software_Component_OperatingSystem"
34 *      />
35 */
36public class OperatingSystem implements Comparable<OperatingSystem> {
37 
38   // There are other properties
39 
40   public static Builder builder() {
41      return new Builder();
42   }
43 
44   public static class Builder {
45      private int id = -1;
46      private Set<Password> passwords = Sets.newLinkedHashSet();
47 
48      public Builder id(int id) {
49         this.id = id;
50         return this;
51      }
52 
53      public Builder password(Password password) {
54         this.passwords.add(checkNotNull(password, "password"));
55         return this;
56      }
57 
58      public Builder passwords(Iterable<Password> passwords) {
59         this.passwords = ImmutableSet.<Password> copyOf(checkNotNull(passwords, "passwords"));
60         return this;
61      }
62 
63      public OperatingSystem build() {
64         return new OperatingSystem(id, passwords);
65      }
66 
67      public static Builder fromOperatingSystem(OperatingSystem in) {
68         return OperatingSystem.builder()
69                               .id(in.getId())
70                               .passwords(in.getPasswords());
71      }
72   }
73 
74   private int id = -1;
75   private Set<Password> passwords = Sets.newLinkedHashSet();
76 
77   // for deserializer
78   OperatingSystem() {
79 
80   }
81 
82   public OperatingSystem(int id,Iterable<Password> passwords) {
83      this.id = id;
84      this.passwords = ImmutableSet.<Password> copyOf(checkNotNull(passwords, "passwords"));
85   }
86 
87   @Override
88   public int compareTo(OperatingSystem arg0) {
89      return new Integer(id).compareTo(arg0.getId());
90   }
91 
92   /**
93    * @return An ID number identifying this Software Component (Software Installation)
94    */
95   public int getId() {
96      return id;
97   }
98 
99   /**
100    * 
101    * @return Username/Password pairs used for access to this Software Installation.
102    */
103   public Set<Password> getPasswords() {
104      return passwords;
105   }
106 
107   public Builder toBuilder() {
108      return Builder.fromOperatingSystem(this);
109   }
110 
111   @Override
112   public int hashCode() {
113      final int prime = 31;
114      int result = 1;
115      result = prime * result + (id ^ (id >>> 32));
116      return result;
117   }
118 
119   @Override
120   public boolean equals(Object obj) {
121      if (this == obj)
122         return true;
123      if (obj == null)
124         return false;
125      if (getClass() != obj.getClass())
126         return false;
127      OperatingSystem other = (OperatingSystem) obj;
128      if (id != other.id)
129         return false;
130      return true;
131   }
132 
133   @Override
134   public String toString() {
135      return "[id=" + id + ", passwords=" + passwords + "]";
136   }
137}

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