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

COVERAGE SUMMARY FOR SOURCE FILE [DeploymentOptionSection.java]

nameclass, %method, %block, %line, %
DeploymentOptionSection.java0%   (0/2)0%   (0/14)0%   (0/150)0%   (0/34)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DeploymentOptionSection0%   (0/1)0%   (0/7)0%   (0/96)0%   (0/24)
DeploymentOptionSection (String, Iterable): void 0%   (0/1)0%   (0/11)0%   (0/3)
builder (): DeploymentOptionSection$Builder 0%   (0/1)0%   (0/4)0%   (0/1)
equals (Object): boolean 0%   (0/1)0%   (0/39)0%   (0/13)
getConfigurations (): Set 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/20)0%   (0/4)
toBuilder (): DeploymentOptionSection$Builder 0%   (0/1)0%   (0/4)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/15)0%   (0/1)
     
class DeploymentOptionSection$Builder0%   (0/1)0%   (0/7)0%   (0/54)0%   (0/10)
DeploymentOptionSection$Builder (): void 0%   (0/1)0%   (0/6)0%   (0/2)
build (): DeploymentOptionSection 0%   (0/1)0%   (0/8)0%   (0/1)
configuration (Configuration): DeploymentOptionSection$Builder 0%   (0/1)0%   (0/9)0%   (0/2)
configurations (Iterable): DeploymentOptionSection$Builder 0%   (0/1)0%   (0/9)0%   (0/2)
fromDeploymentOptionSection (DeploymentOptionSection): DeploymentOptionSectio... 0%   (0/1)0%   (0/8)0%   (0/1)
fromSection (Section): DeploymentOptionSection$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
info (String): DeploymentOptionSection$Builder 0%   (0/1)0%   (0/7)0%   (0/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.ovf;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.util.Set;
24 
25import com.google.common.collect.ImmutableSet;
26import com.google.common.collect.Sets;
27 
28/**
29 * The DeploymentOptionSection specifies a discrete set of intended resource configurations. The
30 * author of an OVF package can include sizing metadata for different configurations. A consumer of
31 * the OVF shall select a configuration, for example, by prompting the user. The selected
32 * configuration is visible in the OVF environment, enabling guest software to adapt to the selected
33 * configuration.
34 * 
35 * @author Adrian Cole
36 */
37public class DeploymentOptionSection extends Section<DeploymentOptionSection> {
38 
39   @SuppressWarnings("unchecked")
40   public static Builder builder() {
41      return new Builder();
42   }
43 
44   /**
45    * {@inheritDoc}
46    */
47   @Override
48   public Builder toBuilder() {
49      return builder().fromDeploymentOptionSection(this);
50   }
51 
52   public static class Builder extends Section.Builder<DeploymentOptionSection> {
53      protected Set<Configuration> configurations = Sets.newLinkedHashSet();
54 
55      /**
56       * @see DeploymentOptionSection#getConfigurations
57       */
58      public Builder configuration(Configuration configuration) {
59         this.configurations.add(checkNotNull(configuration, "configuration"));
60         return this;
61      }
62 
63      /**
64       * @see DeploymentOptionSection#getConfigurations
65       */
66      public Builder configurations(Iterable<Configuration> configurations) {
67         this.configurations = ImmutableSet.<Configuration> copyOf(checkNotNull(configurations, "configurations"));
68         return this;
69      }
70 
71      /**
72       * {@inheritDoc}
73       */
74      @Override
75      public DeploymentOptionSection build() {
76         return new DeploymentOptionSection(info, configurations);
77      }
78 
79      public Builder fromDeploymentOptionSection(DeploymentOptionSection in) {
80         return info(in.getInfo()).configurations(in.getConfigurations());
81      }
82 
83      /**
84       * {@inheritDoc}
85       */
86      @Override
87      public Builder fromSection(Section<DeploymentOptionSection> in) {
88         return Builder.class.cast(super.fromSection(in));
89      }
90 
91      /**
92       * {@inheritDoc}
93       */
94      @Override
95      public Builder info(String info) {
96         return Builder.class.cast(super.info(info));
97      }
98 
99   }
100 
101   protected final Set<Configuration> configurations;
102 
103   public DeploymentOptionSection(String info, Iterable<Configuration> configurations) {
104      super(info);
105      this.configurations = ImmutableSet.<Configuration> copyOf(checkNotNull(configurations, "configurations"));
106 
107   }
108 
109   @Override
110   public int hashCode() {
111      final int prime = 31;
112      int result = super.hashCode();
113      result = prime * result + ((configurations == null) ? 0 : configurations.hashCode());
114      return result;
115   }
116 
117   @Override
118   public boolean equals(Object obj) {
119      if (this == obj)
120         return true;
121      if (!super.equals(obj))
122         return false;
123      if (getClass() != obj.getClass())
124         return false;
125      DeploymentOptionSection other = (DeploymentOptionSection) obj;
126      if (configurations == null) {
127         if (other.configurations != null)
128            return false;
129      } else if (!configurations.equals(other.configurations))
130         return false;
131      return true;
132   }
133 
134   @Override
135   public String toString() {
136      return String.format("[info=%s, configurations=%s]", info, configurations);
137   }
138 
139   public Set<Configuration> getConfigurations() {
140      return configurations;
141   }
142 
143}

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