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

COVERAGE SUMMARY FOR SOURCE FILE [VCloudPropertiesBuilder.java]

nameclass, %method, %block, %line, %
VCloudPropertiesBuilder.java100% (1/1)67%  (4/6)83%  (77/93)81%  (17/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VCloudPropertiesBuilder100% (1/1)67%  (4/6)83%  (77/93)81%  (17/21)
withApiVersion (String): VCloudPropertiesBuilder 0%   (0/1)0%   (0/8)0%   (0/2)
withSchemaVersion (String): VCloudPropertiesBuilder 0%   (0/1)0%   (0/8)0%   (0/2)
VCloudPropertiesBuilder (Properties): void 100% (1/1)100% (4/4)100% (2/2)
build (): Properties 100% (1/1)100% (5/5)100% (2/2)
defaultProperties (): Properties 100% (1/1)100% (46/46)100% (10/10)
setNs (): void 100% (1/1)100% (22/22)100% (3/3)

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.vcloud;
20 
21import static org.jclouds.Constants.PROPERTY_API_VERSION;
22import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
23import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE;
24import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED;
25import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_VERSION_SCHEMA;
26import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
27import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
28 
29import java.util.Properties;
30 
31import org.jclouds.PropertiesBuilder;
32import org.jclouds.vcloud.domain.network.FenceMode;
33 
34/**
35 * Builds properties used in VCloud Clients
36 * 
37 * @author Adrian Cole
38 */
39public class VCloudPropertiesBuilder extends PropertiesBuilder {
40   @Override
41   protected Properties defaultProperties() {
42      Properties properties = super.defaultProperties();
43      properties.setProperty(PROPERTY_API_VERSION, "1.0");
44      properties.setProperty(PROPERTY_VCLOUD_VERSION_SCHEMA, "1");
45      properties.setProperty(PROPERTY_SESSION_INTERVAL, 8 * 60 + "");
46      properties.setProperty(PROPERTY_VCLOUD_XML_SCHEMA, "http://vcloud.safesecureweb.com/ns/vcloud.xsd");
47      properties.setProperty("jclouds.dns_name_length_min", "1");
48      properties.setProperty("jclouds.dns_name_length_max", "80");
49      properties.setProperty(PROPERTY_VCLOUD_DEFAULT_FENCEMODE, FenceMode.BRIDGED.toString());
50      // TODO integrate this with the {@link ComputeTimeouts} instead of having a single timeout for
51      // everything.
52      properties.setProperty(PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED, 600l * 1000l + "");
53      return properties;
54   }
55 
56   public VCloudPropertiesBuilder(Properties properties) {
57      super(properties);
58   }
59 
60   protected void setNs() {
61      if (properties.getProperty(PROPERTY_VCLOUD_XML_NAMESPACE) == null)
62         properties.setProperty(PROPERTY_VCLOUD_XML_NAMESPACE, "http://www.vmware.com/vcloud/v"
63                  + properties.getProperty(PROPERTY_VCLOUD_VERSION_SCHEMA));
64   }
65 
66   public VCloudPropertiesBuilder withApiVersion(String version) {
67      properties.setProperty(PROPERTY_API_VERSION, "1.0");
68      return this;
69   }
70 
71   public VCloudPropertiesBuilder withSchemaVersion(String version) {
72      properties.setProperty(PROPERTY_VCLOUD_VERSION_SCHEMA, "1.0");
73      return this;
74   }
75 
76   @Override
77   public Properties build() {
78      setNs();
79      return super.build();
80   }
81}

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