EMMA Coverage Report (generated Wed Oct 26 13:47:17 EDT 2011)
[all classes][org.jclouds.compute.domain]

COVERAGE SUMMARY FOR SOURCE FILE [NodeMetadataBuilder.java]

nameclass, %method, %block, %line, %
NodeMetadataBuilder.java100% (1/1)100% (22/22)100% (233/233)100% (37/37)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class NodeMetadataBuilder100% (1/1)100% (22/22)100% (233/233)100% (37/37)
NodeMetadataBuilder (): void 100% (1/1)100% (13/13)100% (5/5)
adminPassword (String): NodeMetadataBuilder 100% (1/1)100% (5/5)100% (2/2)
build (): NodeMetadata 100% (1/1)100% (40/40)100% (1/1)
credentials (Credentials): NodeMetadataBuilder 100% (1/1)100% (5/5)100% (2/2)
fromNodeMetadata (NodeMetadata): NodeMetadataBuilder 100% (1/1)100% (58/58)100% (1/1)
group (String): NodeMetadataBuilder 100% (1/1)100% (5/5)100% (2/2)
hardware (Hardware): NodeMetadataBuilder 100% (1/1)100% (5/5)100% (2/2)
hostname (String): NodeMetadataBuilder 100% (1/1)100% (5/5)100% (2/2)
id (String): NodeMetadataBuilder 100% (1/1)100% (7/7)100% (1/1)
ids (String): NodeMetadataBuilder 100% (1/1)100% (7/7)100% (1/1)
imageId (String): NodeMetadataBuilder 100% (1/1)100% (5/5)100% (2/2)
location (Location): NodeMetadataBuilder 100% (1/1)100% (7/7)100% (1/1)
loginPort (int): NodeMetadataBuilder 100% (1/1)100% (5/5)100% (2/2)
name (String): NodeMetadataBuilder 100% (1/1)100% (7/7)100% (1/1)
operatingSystem (OperatingSystem): NodeMetadataBuilder 100% (1/1)100% (5/5)100% (2/2)
privateAddresses (Iterable): NodeMetadataBuilder 100% (1/1)100% (9/9)100% (2/2)
providerId (String): NodeMetadataBuilder 100% (1/1)100% (7/7)100% (1/1)
publicAddresses (Iterable): NodeMetadataBuilder 100% (1/1)100% (9/9)100% (2/2)
state (NodeState): NodeMetadataBuilder 100% (1/1)100% (8/8)100% (2/2)
tags (Iterable): NodeMetadataBuilder 100% (1/1)100% (7/7)100% (1/1)
uri (URI): NodeMetadataBuilder 100% (1/1)100% (7/7)100% (1/1)
userMetadata (Map): NodeMetadataBuilder 100% (1/1)100% (7/7)100% (1/1)

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.compute.domain;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.net.URI;
24import java.util.Map;
25import java.util.Set;
26 
27import org.jclouds.javax.annotation.Nullable;
28 
29import org.jclouds.compute.domain.internal.NodeMetadataImpl;
30import org.jclouds.domain.Credentials;
31import org.jclouds.domain.Location;
32 
33import com.google.common.collect.ImmutableSet;
34import com.google.common.collect.Sets;
35 
36/**
37 * @author Adrian Cole
38 */
39public class NodeMetadataBuilder extends ComputeMetadataBuilder {
40   private NodeState state;
41   private Set<String> publicAddresses = Sets.newLinkedHashSet();
42   private Set<String> privateAddresses = Sets.newLinkedHashSet();
43   @Nullable
44   private String adminPassword;
45   @Nullable
46   private Credentials credentials;
47   @Nullable
48   private String group;
49   private int loginPort = 22;
50   @Nullable
51   private String imageId;
52   @Nullable
53   private Hardware hardware;
54   @Nullable
55   private OperatingSystem os;
56   @Nullable
57   private String hostname;
58 
59   public NodeMetadataBuilder() {
60      super(ComputeType.NODE);
61   }
62 
63   public NodeMetadataBuilder loginPort(int loginPort) {
64      this.loginPort = loginPort;
65      return this;
66   }
67 
68   public NodeMetadataBuilder state(NodeState state) {
69      this.state = checkNotNull(state, "state");
70      return this;
71   }
72 
73   public NodeMetadataBuilder publicAddresses(Iterable<String> publicAddresses) {
74      this.publicAddresses = ImmutableSet.copyOf(checkNotNull(publicAddresses, "publicAddresses"));
75      return this;
76   }
77 
78   public NodeMetadataBuilder privateAddresses(Iterable<String> privateAddresses) {
79      this.privateAddresses = ImmutableSet.copyOf(checkNotNull(privateAddresses, "privateAddresses"));
80      return this;
81   }
82 
83   public NodeMetadataBuilder credentials(@Nullable Credentials credentials) {
84      this.credentials = credentials;
85      return this;
86   }
87 
88   public NodeMetadataBuilder adminPassword(@Nullable String adminPassword) {
89      this.adminPassword = adminPassword;
90      return this;
91   }
92 
93   public NodeMetadataBuilder group(@Nullable String group) {
94      this.group = group;
95      return this;
96   }
97 
98   public NodeMetadataBuilder imageId(@Nullable String imageId) {
99      this.imageId = imageId;
100      return this;
101   }
102 
103   public NodeMetadataBuilder hardware(@Nullable Hardware hardware) {
104      this.hardware = hardware;
105      return this;
106   }
107 
108   public NodeMetadataBuilder operatingSystem(@Nullable OperatingSystem os) {
109      this.os = os;
110      return this;
111   }
112 
113   public NodeMetadataBuilder hostname(String hostname) {
114      this.hostname = hostname;
115      return this;
116   }
117 
118   @Override
119   public NodeMetadataBuilder id(String id) {
120      return NodeMetadataBuilder.class.cast(super.id(id));
121   }
122 
123   @Override
124   public NodeMetadataBuilder tags(Iterable<String> tags) {
125      return NodeMetadataBuilder.class.cast(super.tags(tags));
126   }
127 
128   @Override
129   public NodeMetadataBuilder ids(String id) {
130      return NodeMetadataBuilder.class.cast(super.ids(id));
131   }
132 
133   @Override
134   public NodeMetadataBuilder providerId(String providerId) {
135      return NodeMetadataBuilder.class.cast(super.providerId(providerId));
136   }
137 
138   @Override
139   public NodeMetadataBuilder name(String name) {
140      return NodeMetadataBuilder.class.cast(super.name(name));
141   }
142 
143   @Override
144   public NodeMetadataBuilder location(Location location) {
145      return NodeMetadataBuilder.class.cast(super.location(location));
146   }
147 
148   @Override
149   public NodeMetadataBuilder uri(URI uri) {
150      return NodeMetadataBuilder.class.cast(super.uri(uri));
151   }
152 
153   @Override
154   public NodeMetadataBuilder userMetadata(Map<String, String> userMetadata) {
155      return NodeMetadataBuilder.class.cast(super.userMetadata(userMetadata));
156   }
157 
158   @Override
159   public NodeMetadata build() {
160      return new NodeMetadataImpl(providerId, name, id, location, uri, userMetadata, tags, group, hardware, imageId,
161               os, state, loginPort, publicAddresses, privateAddresses, adminPassword, credentials, hostname);
162   }
163 
164   public static NodeMetadataBuilder fromNodeMetadata(NodeMetadata node) {
165      return new NodeMetadataBuilder().providerId(node.getProviderId()).name(node.getName()).id(node.getId()).location(
166               node.getLocation()).uri(node.getUri()).userMetadata(node.getUserMetadata()).tags(node.getTags()).group(
167               node.getGroup()).hardware(node.getHardware()).imageId(node.getImageId()).operatingSystem(
168               node.getOperatingSystem()).state(node.getState()).loginPort(node.getLoginPort()).publicAddresses(
169               node.getPublicAddresses()).privateAddresses(node.getPrivateAddresses()).adminPassword(
170               node.getAdminPassword()).credentials(node.getCredentials()).hostname(node.getHostname());
171   }
172 
173}

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