EMMA Coverage Report (generated Wed Aug 10 12:30:04 EDT 2011)
[all classes][org.jclouds.aws.ec2.compute.config]

COVERAGE SUMMARY FOR SOURCE FILE [AWSEC2ComputeServiceContextModule.java]

nameclass, %method, %block, %line, %
AWSEC2ComputeServiceContextModule.java50%  (1/2)43%  (3/7)73%  (84/115)82%  (18/22)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AWSEC2ComputeServiceContextModule$10%   (0/1)0%   (0/2)0%   (0/13)0%   (0/2)
AWSEC2ComputeServiceContextModule$1 (AWSEC2ComputeServiceContextModule, AWSRe... 0%   (0/1)0%   (0/9)0%   (0/1)
get (): Map 0%   (0/1)0%   (0/4)0%   (0/1)
     
class AWSEC2ComputeServiceContextModule100% (1/1)60%  (3/5)82%  (84/102)90%  (18/20)
provideRegionAndNameToImageSupplierCache (long, AWSRegionAndNameToImageSuppli... 0%   (0/1)0%   (0/12)0%   (0/1)
provideTemplate (Injector, TemplateBuilder): TemplateBuilder 0%   (0/1)0%   (0/6)0%   (0/1)
AWSEC2ComputeServiceContextModule (): void 100% (1/1)100% (3/3)100% (1/1)
configure (): void 100% (1/1)100% (75/75)100% (15/15)
installDependencies (): void 100% (1/1)100% (6/6)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.aws.ec2.compute.config;
20 
21import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
22import static org.jclouds.compute.domain.OsFamily.AMZN_LINUX;
23 
24import java.util.Map;
25 
26import javax.inject.Named;
27import javax.inject.Singleton;
28 
29import org.jclouds.aws.ec2.compute.AWSEC2TemplateBuilderImpl;
30import org.jclouds.aws.ec2.compute.functions.AWSRunningInstanceToNodeMetadata;
31import org.jclouds.aws.ec2.compute.predicates.AWSEC2InstancePresent;
32import org.jclouds.aws.ec2.compute.strategy.AWSEC2CreateNodesInGroupThenAddToSet;
33import org.jclouds.aws.ec2.compute.strategy.AWSEC2DestroyNodeStrategy;
34import org.jclouds.aws.ec2.compute.strategy.AWSEC2GetNodeMetadataStrategy;
35import org.jclouds.aws.ec2.compute.strategy.AWSEC2ListNodesStrategy;
36import org.jclouds.aws.ec2.compute.strategy.AWSEC2ReviseParsedImage;
37import org.jclouds.aws.ec2.compute.strategy.CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions;
38import org.jclouds.aws.ec2.compute.suppliers.AWSEC2HardwareSupplier;
39import org.jclouds.aws.ec2.compute.suppliers.AWSRegionAndNameToImageSupplier;
40import org.jclouds.compute.config.BaseComputeServiceContextModule;
41import org.jclouds.compute.domain.Image;
42import org.jclouds.compute.domain.TemplateBuilder;
43import org.jclouds.ec2.compute.config.EC2BindComputeStrategiesByClass;
44import org.jclouds.ec2.compute.config.EC2BindComputeSuppliersByClass;
45import org.jclouds.ec2.compute.domain.RegionAndName;
46import org.jclouds.ec2.compute.functions.RunningInstanceToNodeMetadata;
47import org.jclouds.ec2.compute.internal.EC2TemplateBuilderImpl;
48import org.jclouds.ec2.compute.predicates.InstancePresent;
49import org.jclouds.ec2.compute.strategy.CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions;
50import org.jclouds.ec2.compute.strategy.EC2CreateNodesInGroupThenAddToSet;
51import org.jclouds.ec2.compute.strategy.EC2DestroyNodeStrategy;
52import org.jclouds.ec2.compute.strategy.EC2GetNodeMetadataStrategy;
53import org.jclouds.ec2.compute.strategy.EC2ListNodesStrategy;
54import org.jclouds.ec2.compute.strategy.ReviseParsedImage;
55import org.jclouds.ec2.compute.suppliers.EC2HardwareSupplier;
56import org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
57 
58import com.google.common.base.Supplier;
59import com.google.inject.Injector;
60import com.google.inject.Provides;
61 
62/**
63 * 
64 * @author Adrian Cole
65 */
66public class AWSEC2ComputeServiceContextModule extends BaseComputeServiceContextModule {
67   @Override
68   protected void configure() {
69      super.configure();
70      installDependencies();
71      install(new EC2BindComputeStrategiesByClass());
72      install(new EC2BindComputeSuppliersByClass());
73      bind(ReviseParsedImage.class).to(AWSEC2ReviseParsedImage.class);
74      bind(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class).to(
75            CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class);
76      bind(EC2HardwareSupplier.class).to(AWSEC2HardwareSupplier.class);
77      bind(EC2TemplateBuilderImpl.class).to(AWSEC2TemplateBuilderImpl.class);
78      bind(EC2GetNodeMetadataStrategy.class).to(AWSEC2GetNodeMetadataStrategy.class);
79      bind(EC2ListNodesStrategy.class).to(AWSEC2ListNodesStrategy.class);
80      bind(EC2DestroyNodeStrategy.class).to(AWSEC2DestroyNodeStrategy.class);
81      bind(InstancePresent.class).to(AWSEC2InstancePresent.class);
82      bind(EC2CreateNodesInGroupThenAddToSet.class).to(AWSEC2CreateNodesInGroupThenAddToSet.class);
83      bind(RunningInstanceToNodeMetadata.class).to(AWSRunningInstanceToNodeMetadata.class);
84   }
85 
86   protected void installDependencies() {
87      install(new AWSEC2ComputeServiceDependenciesModule());
88   }
89 
90   @Provides
91   @Singleton
92   protected Supplier<Map<RegionAndName, ? extends Image>> provideRegionAndNameToImageSupplierCache(
93         @Named(PROPERTY_SESSION_INTERVAL) long seconds, final AWSRegionAndNameToImageSupplier supplier) {
94      return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<RegionAndName, ? extends Image>>(
95            authException, seconds, new Supplier<Map<RegionAndName, ? extends Image>>() {
96               @Override
97               public Map<RegionAndName, ? extends Image> get() {
98                  return supplier.get();
99               }
100            });
101   }
102 
103   @Override
104   protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
105      return template.osFamily(AMZN_LINUX).os64Bit(true);
106   }
107}

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