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

COVERAGE SUMMARY FOR SOURCE FILE [ProductSection.java]

nameclass, %method, %block, %line, %
ProductSection.java100% (2/2)50%  (7/14)40%  (60/150)32%  (11/34)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ProductSection100% (1/1)43%  (3/7)31%  (30/96)21%  (5/24)
equals (Object): boolean 0%   (0/1)0%   (0/39)0%   (0/13)
getProperties (): Set 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/20)0%   (0/4)
toBuilder (): ProductSection$Builder 0%   (0/1)0%   (0/4)0%   (0/1)
ProductSection (String, Iterable): void 100% (1/1)100% (11/11)100% (3/3)
builder (): ProductSection$Builder 100% (1/1)100% (4/4)100% (1/1)
toString (): String 100% (1/1)100% (15/15)100% (1/1)
     
class ProductSection$Builder100% (1/1)57%  (4/7)56%  (30/54)60%  (6/10)
fromDeploymentOptionSection (ProductSection): ProductSection$Builder 0%   (0/1)0%   (0/8)0%   (0/1)
fromSection (Section): ProductSection$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
properties (Iterable): ProductSection$Builder 0%   (0/1)0%   (0/9)0%   (0/2)
ProductSection$Builder (): void 100% (1/1)100% (6/6)100% (2/2)
build (): ProductSection 100% (1/1)100% (8/8)100% (1/1)
info (String): ProductSection$Builder 100% (1/1)100% (7/7)100% (1/1)
property (Property): ProductSection$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.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 ProductSection element specifies product-information for an appliance, such as product name,
30 * version, and vendor.
31 * 
32 * @author Adrian Cole
33 */
34public class ProductSection extends Section<ProductSection> {
35 
36   @SuppressWarnings("unchecked")
37   public static Builder builder() {
38      return new Builder();
39   }
40 
41   /**
42    * {@inheritDoc}
43    */
44   @Override
45   public Builder toBuilder() {
46      return builder().fromDeploymentOptionSection(this);
47   }
48 
49   public static class Builder extends Section.Builder<ProductSection> {
50      protected Set<Property> properties = Sets.newLinkedHashSet();
51 
52      /**
53       * @see ProductSection#getPropertys
54       */
55      public Builder property(Property property) {
56         this.properties.add(checkNotNull(property, "property"));
57         return this;
58      }
59 
60      /**
61       * @see ProductSection#getPropertys
62       */
63      public Builder properties(Iterable<Property> properties) {
64         this.properties = ImmutableSet.<Property> copyOf(checkNotNull(properties, "properties"));
65         return this;
66      }
67 
68      /**
69       * {@inheritDoc}
70       */
71      @Override
72      public ProductSection build() {
73         return new ProductSection(info, properties);
74      }
75 
76      public Builder fromDeploymentOptionSection(ProductSection in) {
77         return info(in.getInfo()).properties(in.getProperties());
78      }
79 
80      /**
81       * {@inheritDoc}
82       */
83      @Override
84      public Builder fromSection(Section<ProductSection> in) {
85         return Builder.class.cast(super.fromSection(in));
86      }
87 
88      /**
89       * {@inheritDoc}
90       */
91      @Override
92      public Builder info(String info) {
93         return Builder.class.cast(super.info(info));
94      }
95 
96   }
97 
98   protected final Set<Property> properties;
99 
100   public ProductSection(String info, Iterable<Property> properties) {
101      super(info);
102      this.properties = ImmutableSet.<Property> copyOf(checkNotNull(properties, "properties"));
103 
104   }
105 
106   @Override
107   public int hashCode() {
108      final int prime = 31;
109      int result = super.hashCode();
110      result = prime * result + ((properties == null) ? 0 : properties.hashCode());
111      return result;
112   }
113 
114   @Override
115   public boolean equals(Object obj) {
116      if (this == obj)
117         return true;
118      if (!super.equals(obj))
119         return false;
120      if (getClass() != obj.getClass())
121         return false;
122      ProductSection other = (ProductSection) obj;
123      if (properties == null) {
124         if (other.properties != null)
125            return false;
126      } else if (!properties.equals(other.properties))
127         return false;
128      return true;
129   }
130 
131   @Override
132   public String toString() {
133      return String.format("[info=%s, properties=%s]", info, properties);
134   }
135 
136   public Set<Property> getProperties() {
137      return properties;
138   }
139 
140}

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