EMMA Coverage Report (generated Wed Jun 22 19:47:49 EDT 2011)
[all classes][org.jclouds.vcloud.domain.network.internal]

COVERAGE SUMMARY FOR SOURCE FILE [VCloudExpressOrgNetworkAdapter.java]

nameclass, %method, %block, %line, %
VCloudExpressOrgNetworkAdapter.java100% (1/1)100% (2/2)78%  (100/128)89%  (9.8/11)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VCloudExpressOrgNetworkAdapter100% (1/1)100% (2/2)78%  (100/128)89%  (9.8/11)
parseConfiguration (VCloudExpressNetwork): OrgNetwork$Configuration 100% (1/1)75%  (83/111)87%  (7.8/9)
VCloudExpressOrgNetworkAdapter (VCloudExpressNetwork): void 100% (1/1)100% (17/17)100% (2/2)

1/**
2 *
3 * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4 *
5 * ====================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * 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, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ====================================================================
18 */
19package org.jclouds.vcloud.domain.network.internal;
20 
21import org.jclouds.vcloud.domain.Task;
22import org.jclouds.vcloud.domain.network.DhcpService;
23import org.jclouds.vcloud.domain.network.Features;
24import org.jclouds.vcloud.domain.network.FenceMode;
25import org.jclouds.vcloud.domain.network.FirewallService;
26import org.jclouds.vcloud.domain.network.IpRange;
27import org.jclouds.vcloud.domain.network.IpScope;
28import org.jclouds.vcloud.domain.network.NatService;
29import org.jclouds.vcloud.domain.network.VCloudExpressNetwork;
30 
31import com.google.common.collect.ImmutableSet;
32import com.google.common.collect.Iterables;
33 
34/**
35 * 
36 * @author Adrian Cole
37 */
38public class VCloudExpressOrgNetworkAdapter extends OrgNetworkImpl {
39 
40   public VCloudExpressOrgNetworkAdapter(VCloudExpressNetwork in) {
41      super(in.getName(), in.getType(), in.getHref(), null, in.getDescription(), ImmutableSet.<Task> of(),
42               parseConfiguration(in), null, ImmutableSet.<String> of());
43   }
44 
45   static Configuration parseConfiguration(VCloudExpressNetwork in) {
46 
47      String dns1 = (in.getDnsServers().size() > 0) ? Iterables.get(in.getDnsServers(), 0) : null;
48      String dns2 = (in.getDnsServers().size() > 1) ? Iterables.get(in.getDnsServers(), 1) : null;
49 
50      String gateway = in.getGateway();
51 
52      String netmask = in.getNetmask();
53 
54      FenceMode mode = in.getFenceModes().size() > 0 ? Iterables.get(in.getFenceModes(), 0) : FenceMode.BRIDGED;
55 
56      DhcpService dhcp = in.isDhcp() != null && in.isDhcp() ? new DhcpService(true, null, null, null) : null;
57 
58      NatService nat = in.getNatRules().size() > 0 ? new NatService(true, null, null, in.getNatRules()) : null;
59 
60      FirewallService firewall = in.getFirewallRules().size() > 0 ? new FirewallService(true, in.getFirewallRules())
61               : null;
62      return new OrgNetworkImpl.ConfigurationImpl(new IpScope(true, gateway, netmask, dns1, dns2, null, ImmutableSet
63               .<IpRange> of(), ImmutableSet.<String> of()), null, mode, new Features(dhcp, firewall, nat));
64   }
65}

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