EMMA Coverage Report (generated Wed Jun 22 19:47:49 EDT 2011)
[all classes][org.jclouds.aws.ec2.compute.suppliers]

COVERAGE SUMMARY FOR SOURCE FILE [AWSEC2HardwareSupplier.java]

nameclass, %method, %block, %line, %
AWSEC2HardwareSupplier.java0%   (0/2)0%   (0/4)0%   (0/119)0%   (0/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AWSEC2HardwareSupplier0%   (0/1)0%   (0/2)0%   (0/96)0%   (0/11)
AWSEC2HardwareSupplier (Supplier, String, String []): void 0%   (0/1)0%   (0/9)0%   (0/4)
get (): Set 0%   (0/1)0%   (0/87)0%   (0/7)
     
class AWSEC2HardwareSupplier$10%   (0/1)0%   (0/2)0%   (0/23)0%   (0/2)
AWSEC2HardwareSupplier$1 (AWSEC2HardwareSupplier, String): void 0%   (0/1)0%   (0/9)0%   (0/1)
apply (Location): boolean 0%   (0/1)0%   (0/14)0%   (0/1)

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.aws.ec2.compute.suppliers;
20 
21import static com.google.common.collect.Iterables.find;
22import static org.jclouds.aws.ec2.reference.AWSEC2Constants.PROPERTY_EC2_CC_AMIs;
23import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.c1_medium;
24import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.c1_xlarge;
25import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.cc1_4xlarge;
26import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_large;
27import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_small32;
28import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_xlarge;
29import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_2xlarge;
30import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_4xlarge;
31import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_xlarge;
32import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.t1_micro;
33 
34import java.util.Set;
35 
36import javax.inject.Inject;
37import javax.inject.Named;
38import javax.inject.Singleton;
39 
40import org.jclouds.collect.Memoized;
41import org.jclouds.compute.domain.Hardware;
42import org.jclouds.domain.Location;
43import org.jclouds.domain.LocationScope;
44import org.jclouds.ec2.compute.suppliers.EC2HardwareSupplier;
45import org.jclouds.location.Provider;
46 
47import com.google.common.base.Predicate;
48import com.google.common.base.Supplier;
49import com.google.common.collect.ImmutableSet;
50import com.google.common.collect.ImmutableSet.Builder;
51 
52/**
53 * 
54 * @author Adrian Cole
55 */
56@Singleton
57public class AWSEC2HardwareSupplier extends EC2HardwareSupplier {
58 
59   private final Supplier<Set<? extends Location>> locations;
60   private final String[] ccAmis;
61 
62   @Inject
63   public AWSEC2HardwareSupplier(@Memoized Supplier<Set<? extends Location>> locations, @Provider String providerName,
64            @Named(PROPERTY_EC2_CC_AMIs) String[] ccAmis) {
65      this.locations = locations;
66      this.ccAmis = ccAmis;
67   }
68 
69   @Override
70   public Set<? extends Hardware> get() {
71      Builder<Hardware> sizes = ImmutableSet.builder();
72      for (String ccAmi : ccAmis) {
73         final String region = ccAmi.split("/")[0];
74         Location location = find(locations.get(), new Predicate<Location>() {
75 
76            @Override
77            public boolean apply(Location input) {
78               return input.getScope() == LocationScope.REGION && input.getId().equals(region);
79            }
80 
81         });
82         sizes.add(cc1_4xlarge().location(location).supportsImageIds(ccAmi).build());
83      }
84      sizes.addAll(ImmutableSet.<Hardware> of(t1_micro().build(), c1_medium().build(), c1_xlarge().build(), m1_large()
85               .build(), m1_small32().build(), m1_xlarge().build(), m2_xlarge().build(), m2_2xlarge().build(),
86               m2_4xlarge().build()));
87      return sizes.build();
88   }
89}

[all classes][org.jclouds.aws.ec2.compute.suppliers]
EMMA 2.0.5312 (C) Vladimir Roubtsov