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 [AWSEC2ComputeServiceDependenciesModule.java]

nameclass, %method, %block, %line, %
AWSEC2ComputeServiceDependenciesModule.java100% (11/11)75%  (12/16)89%  (169/189)80%  (16/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AWSEC2ComputeServiceDependenciesModule100% (1/1)33%  (2/6)84%  (109/129)78%  (14/18)
placementGroupAvailable (PlacementGroupAvailable): Predicate 0%   (0/1)0%   (0/8)0%   (0/1)
placementGroupDeleted (PlacementGroupDeleted): Predicate 0%   (0/1)0%   (0/8)0%   (0/1)
placementGroupMap (CreateSecurityGroupIfNeeded): Map 0%   (0/1)0%   (0/2)0%   (0/1)
provideClusterComputeIds (): Set 0%   (0/1)0%   (0/2)0%   (0/1)
AWSEC2ComputeServiceDependenciesModule (): void 100% (1/1)100% (3/3)100% (1/1)
configure (): void 100% (1/1)100% (106/106)100% (13/13)
     
class AWSEC2ComputeServiceDependenciesModule$1100% (1/1)100% (1/1)100% (6/6)100% (1/1)
AWSEC2ComputeServiceDependenciesModule$1 (AWSEC2ComputeServiceDependenciesMod... 100% (1/1)100% (6/6)100% (1/1)
     
class AWSEC2ComputeServiceDependenciesModule$10100% (1/1)100% (1/1)100% (6/6)100% (1/1)
AWSEC2ComputeServiceDependenciesModule$10 (AWSEC2ComputeServiceDependenciesMo... 100% (1/1)100% (6/6)100% (1/1)
     
class AWSEC2ComputeServiceDependenciesModule$2100% (1/1)100% (1/1)100% (6/6)100% (1/1)
AWSEC2ComputeServiceDependenciesModule$2 (AWSEC2ComputeServiceDependenciesMod... 100% (1/1)100% (6/6)100% (1/1)
     
class AWSEC2ComputeServiceDependenciesModule$3100% (1/1)100% (1/1)100% (6/6)100% (1/1)
AWSEC2ComputeServiceDependenciesModule$3 (AWSEC2ComputeServiceDependenciesMod... 100% (1/1)100% (6/6)100% (1/1)
     
class AWSEC2ComputeServiceDependenciesModule$4100% (1/1)100% (1/1)100% (6/6)100% (1/1)
AWSEC2ComputeServiceDependenciesModule$4 (AWSEC2ComputeServiceDependenciesMod... 100% (1/1)100% (6/6)100% (1/1)
     
class AWSEC2ComputeServiceDependenciesModule$5100% (1/1)100% (1/1)100% (6/6)100% (1/1)
AWSEC2ComputeServiceDependenciesModule$5 (AWSEC2ComputeServiceDependenciesMod... 100% (1/1)100% (6/6)100% (1/1)
     
class AWSEC2ComputeServiceDependenciesModule$6100% (1/1)100% (1/1)100% (6/6)100% (1/1)
AWSEC2ComputeServiceDependenciesModule$6 (AWSEC2ComputeServiceDependenciesMod... 100% (1/1)100% (6/6)100% (1/1)
     
class AWSEC2ComputeServiceDependenciesModule$7100% (1/1)100% (1/1)100% (6/6)100% (1/1)
AWSEC2ComputeServiceDependenciesModule$7 (AWSEC2ComputeServiceDependenciesMod... 100% (1/1)100% (6/6)100% (1/1)
     
class AWSEC2ComputeServiceDependenciesModule$8100% (1/1)100% (1/1)100% (6/6)100% (1/1)
AWSEC2ComputeServiceDependenciesModule$8 (AWSEC2ComputeServiceDependenciesMod... 100% (1/1)100% (6/6)100% (1/1)
     
class AWSEC2ComputeServiceDependenciesModule$9100% (1/1)100% (1/1)100% (6/6)100% (1/1)
AWSEC2ComputeServiceDependenciesModule$9 (AWSEC2ComputeServiceDependenciesMod... 100% (1/1)100% (6/6)100% (1/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.config;
20 
21import static com.google.common.collect.Maps.newLinkedHashMap;
22 
23import java.util.Map;
24import java.util.Set;
25import java.util.concurrent.TimeUnit;
26 
27import javax.inject.Named;
28import javax.inject.Singleton;
29 
30import org.jclouds.aws.ec2.AWSEC2AsyncClient;
31import org.jclouds.aws.ec2.AWSEC2Client;
32import org.jclouds.aws.ec2.compute.AWSEC2ComputeService;
33import org.jclouds.aws.ec2.compute.AWSEC2TemplateOptions;
34import org.jclouds.aws.ec2.compute.suppliers.CallForImages;
35import org.jclouds.aws.ec2.domain.PlacementGroup;
36import org.jclouds.aws.ec2.domain.RegionNameAndPublicKeyMaterial;
37import org.jclouds.aws.ec2.functions.ImportOrReturnExistingKeypair;
38import org.jclouds.aws.ec2.predicates.PlacementGroupAvailable;
39import org.jclouds.aws.ec2.predicates.PlacementGroupDeleted;
40import org.jclouds.compute.ComputeService;
41import org.jclouds.compute.ComputeServiceContext;
42import org.jclouds.compute.domain.Image;
43import org.jclouds.compute.domain.NodeMetadata;
44import org.jclouds.compute.domain.TemplateBuilder;
45import org.jclouds.compute.internal.ComputeServiceContextImpl;
46import org.jclouds.compute.options.TemplateOptions;
47import org.jclouds.domain.Credentials;
48import org.jclouds.ec2.compute.config.EC2ComputeServiceDependenciesModule;
49import org.jclouds.ec2.compute.domain.RegionAndName;
50import org.jclouds.ec2.compute.domain.RegionNameAndIngressRules;
51import org.jclouds.ec2.compute.functions.CreateSecurityGroupIfNeeded;
52import org.jclouds.ec2.compute.functions.CreateUniqueKeyPair;
53import org.jclouds.ec2.compute.functions.CredentialsForInstance;
54import org.jclouds.ec2.compute.functions.RegionAndIdToImage;
55import org.jclouds.ec2.compute.functions.RunningInstanceToNodeMetadata;
56import org.jclouds.ec2.compute.internal.EC2TemplateBuilderImpl;
57import org.jclouds.ec2.domain.KeyPair;
58import org.jclouds.ec2.domain.RunningInstance;
59import org.jclouds.predicates.RetryablePredicate;
60import org.jclouds.rest.RestContext;
61import org.jclouds.rest.internal.RestContextImpl;
62 
63import com.google.common.base.Function;
64import com.google.common.base.Predicate;
65import com.google.common.collect.Sets;
66import com.google.inject.Provides;
67import com.google.inject.Scopes;
68import com.google.inject.TypeLiteral;
69import com.google.inject.assistedinject.FactoryModuleBuilder;
70 
71/**
72 * 
73 * @author Adrian Cole
74 */
75public class AWSEC2ComputeServiceDependenciesModule extends EC2ComputeServiceDependenciesModule {
76   @Override
77   protected void configure() {
78      bind(TemplateBuilder.class).to(EC2TemplateBuilderImpl.class);
79      bind(TemplateOptions.class).to(AWSEC2TemplateOptions.class);
80      bind(ComputeService.class).to(AWSEC2ComputeService.class);
81      bind(new TypeLiteral<Function<RunningInstance, NodeMetadata>>() {
82      }).to(RunningInstanceToNodeMetadata.class);
83      bind(new TypeLiteral<Function<RunningInstance, Credentials>>() {
84      }).to(CredentialsForInstance.class);
85      bind(new TypeLiteral<Function<RegionNameAndIngressRules, String>>() {
86      }).to(CreateSecurityGroupIfNeeded.class);
87      bind(new TypeLiteral<Function<RegionAndName, KeyPair>>() {
88      }).to(CreateUniqueKeyPair.class);
89      bind(new TypeLiteral<Function<RegionNameAndPublicKeyMaterial, KeyPair>>() {
90      }).to(ImportOrReturnExistingKeypair.class);
91      bind(new TypeLiteral<Function<RegionAndName, Image>>() {
92      }).to(RegionAndIdToImage.class);
93      bind(new TypeLiteral<ComputeServiceContext>() {
94      }).to(new TypeLiteral<ComputeServiceContextImpl<AWSEC2Client, AWSEC2AsyncClient>>() {
95      }).in(Scopes.SINGLETON);
96      bind(new TypeLiteral<RestContext<AWSEC2Client, AWSEC2AsyncClient>>() {
97      }).to(new TypeLiteral<RestContextImpl<AWSEC2Client, AWSEC2AsyncClient>>() {
98      }).in(Scopes.SINGLETON);
99      install(new FactoryModuleBuilder().build(CallForImages.Factory.class));
100   }
101 
102   @Provides
103   @Singleton
104   @Named("AVAILABLE")
105   protected Predicate<PlacementGroup> placementGroupAvailable(PlacementGroupAvailable available) {
106      return new RetryablePredicate<PlacementGroup>(available, 60, 1, TimeUnit.SECONDS);
107   }
108 
109   @Provides
110   @Singleton
111   @Named("DELETED")
112   protected Predicate<PlacementGroup> placementGroupDeleted(PlacementGroupDeleted deleted) {
113      return new RetryablePredicate<PlacementGroup>(deleted, 60, 1, TimeUnit.SECONDS);
114   }
115 
116   @Provides
117   @Singleton
118   @Named("PLACEMENT")
119   protected Map<RegionAndName, String> placementGroupMap(CreateSecurityGroupIfNeeded in) {
120      // doesn't seem to clear when someone issues remove(key)
121      // return new MapMaker().makeComputingMap(in);
122      return newLinkedHashMap();
123   }
124 
125   @Provides
126   @ClusterCompute
127   @Singleton
128   protected Set<String> provideClusterComputeIds() {
129      return Sets.newLinkedHashSet();
130   }
131 
132}

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