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

COVERAGE SUMMARY FOR SOURCE FILE [VCloudBindComputeSuppliersByClass.java]

nameclass, %method, %block, %line, %
VCloudBindComputeSuppliersByClass.java33%  (1/3)50%  (5/10)18%  (11/62)38%  (6/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VCloudBindComputeSuppliersByClass$DefaultVDC0%   (0/1)0%   (0/2)0%   (0/24)0%   (0/5)
VCloudBindComputeSuppliersByClass$DefaultVDC (Supplier, VCloudBindComputeSupp... 0%   (0/1)0%   (0/15)0%   (0/4)
get (): Location 0%   (0/1)0%   (0/9)0%   (0/1)
     
class VCloudBindComputeSuppliersByClass$DefaultVDC$IsDefaultVDC0%   (0/1)0%   (0/3)0%   (0/27)0%   (0/5)
VCloudBindComputeSuppliersByClass$DefaultVDC$IsDefaultVDC (ReferenceType): void 0%   (0/1)0%   (0/9)0%   (0/3)
apply (Location): boolean 0%   (0/1)0%   (0/16)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/2)0%   (0/1)
     
class VCloudBindComputeSuppliersByClass100% (1/1)100% (5/5)100% (11/11)100% (6/6)
VCloudBindComputeSuppliersByClass (): void 100% (1/1)100% (3/3)100% (2/2)
defineDefaultLocationSupplier (): Class 100% (1/1)100% (2/2)100% (1/1)
defineHardwareSupplier (): Class 100% (1/1)100% (2/2)100% (1/1)
defineImageSupplier (): Class 100% (1/1)100% (2/2)100% (1/1)
defineLocationSupplier (): Class 100% (1/1)100% (2/2)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.vcloud.compute.config;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22import static com.google.common.collect.Iterables.find;
23 
24import java.util.Set;
25 
26import javax.inject.Inject;
27import javax.inject.Singleton;
28 
29import org.jclouds.collect.Memoized;
30import org.jclouds.compute.config.BindComputeSuppliersByClass;
31import org.jclouds.compute.domain.Hardware;
32import org.jclouds.compute.domain.Image;
33import org.jclouds.domain.Location;
34import org.jclouds.domain.LocationScope;
35import org.jclouds.vcloud.compute.suppliers.OrgAndVDCToLocationSupplier;
36import org.jclouds.vcloud.compute.suppliers.VCloudHardwareSupplier;
37import org.jclouds.vcloud.compute.suppliers.VCloudImageSupplier;
38import org.jclouds.vcloud.domain.ReferenceType;
39import org.jclouds.vcloud.endpoints.VDC;
40 
41import com.google.common.base.Predicate;
42import com.google.common.base.Supplier;
43/**
44 * @author Adrian Cole
45 */
46public class VCloudBindComputeSuppliersByClass extends BindComputeSuppliersByClass {
47 
48   @Override
49   protected Class<? extends Supplier<Set<? extends Image>>> defineImageSupplier() {
50      return VCloudImageSupplier.class;
51   }
52 
53   @Override
54   protected Class<? extends Supplier<Set<? extends Location>>> defineLocationSupplier() {
55      return OrgAndVDCToLocationSupplier.class;
56   }
57 
58   @Override
59   protected Class<? extends Supplier<Location>> defineDefaultLocationSupplier() {
60      return DefaultVDC.class;
61   }
62 
63   @Singleton
64   public static class DefaultVDC implements Supplier<Location> {
65      @Singleton
66      public static final class IsDefaultVDC implements Predicate<Location> {
67         private final ReferenceType defaultVDC;
68 
69         @Inject
70         IsDefaultVDC(@VDC ReferenceType defaultVDC) {
71            this.defaultVDC = checkNotNull(defaultVDC, "defaultVDC");
72         }
73 
74         @Override
75         public boolean apply(Location input) {
76            return input.getScope() == LocationScope.ZONE && input.getId().equals(defaultVDC.getHref().toASCIIString());
77         }
78 
79         @Override
80         public String toString() {
81            return "isDefaultVDC()";
82         }
83      }
84 
85      private final Supplier<Set<? extends Location>> locationsSupplier;
86      private final IsDefaultVDC isDefaultVDC;
87 
88      @Inject
89      DefaultVDC(@Memoized Supplier<Set<? extends Location>> locationsSupplier, IsDefaultVDC isDefaultVDC) {
90         this.locationsSupplier = checkNotNull(locationsSupplier, "locationsSupplierSupplier");
91         this.isDefaultVDC = checkNotNull(isDefaultVDC, "isDefaultVDC");
92      }
93 
94      @Override
95      public Location get() {
96         return find(locationsSupplier.get(), isDefaultVDC);
97      }
98 
99   }
100 
101   @Override
102   protected Class<? extends Supplier<Set<? extends Hardware>>> defineHardwareSupplier() {
103      return VCloudHardwareSupplier.class;
104   }
105}

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