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

COVERAGE SUMMARY FOR SOURCE FILE [TerremarkBindComputeSuppliersByClass.java]

nameclass, %method, %block, %line, %
TerremarkBindComputeSuppliersByClass.java0%   (0/3)0%   (0/10)0%   (0/62)0%   (0/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TerremarkBindComputeSuppliersByClass0%   (0/1)0%   (0/5)0%   (0/11)0%   (0/6)
TerremarkBindComputeSuppliersByClass (): void 0%   (0/1)0%   (0/3)0%   (0/2)
defineDefaultLocationSupplier (): Class 0%   (0/1)0%   (0/2)0%   (0/1)
defineHardwareSupplier (): Class 0%   (0/1)0%   (0/2)0%   (0/1)
defineImageSupplier (): Class 0%   (0/1)0%   (0/2)0%   (0/1)
defineLocationSupplier (): Class 0%   (0/1)0%   (0/2)0%   (0/1)
     
class TerremarkBindComputeSuppliersByClass$DefaultVDC0%   (0/1)0%   (0/2)0%   (0/24)0%   (0/5)
TerremarkBindComputeSuppliersByClass$DefaultVDC (Supplier, TerremarkBindCompu... 0%   (0/1)0%   (0/15)0%   (0/4)
get (): Location 0%   (0/1)0%   (0/9)0%   (0/1)
     
class TerremarkBindComputeSuppliersByClass$DefaultVDC$IsDefaultVDC0%   (0/1)0%   (0/3)0%   (0/27)0%   (0/5)
TerremarkBindComputeSuppliersByClass$DefaultVDC$IsDefaultVDC (ReferenceType):... 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)

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.trmk.vcloud_0_8.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.trmk.vcloud_0_8.compute.suppliers.OrgAndVDCToLocationSupplier;
36import org.jclouds.trmk.vcloud_0_8.compute.suppliers.StaticHardwareSupplier;
37import org.jclouds.trmk.vcloud_0_8.compute.suppliers.VAppTemplatesInOrgs;
38import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
39import org.jclouds.trmk.vcloud_0_8.endpoints.VDC;
40 
41import com.google.common.base.Predicate;
42import com.google.common.base.Supplier;
43 
44/**
45 * @author Adrian Cole
46 */
47public class TerremarkBindComputeSuppliersByClass extends BindComputeSuppliersByClass {
48   @Override
49   protected Class<? extends Supplier<Set<? extends Hardware>>> defineHardwareSupplier() {
50      return StaticHardwareSupplier.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 Image>>> defineImageSupplier() {
103      return VAppTemplatesInOrgs.class;
104   }
105 
106}

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