EMMA Coverage Report (generated Mon Oct 17 05:41:20 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)88%  (169/191)80%  (16/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AWSEC2ComputeServiceDependenciesModule100% (1/1)33%  (2/6)83%  (109/131)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 (CreatePlacementGroupIfNeeded): Cache 0%   (0/1)0%   (0/4)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 * 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.aws.ec2.compute.config;
20 
21import java.util.Set;
22import java.util.concurrent.TimeUnit;
23 
24import javax.inject.Named;
25import javax.inject.Singleton;
26 
27import org.jclouds.aws.ec2.AWSEC2AsyncClient;
28import org.jclouds.aws.ec2.AWSEC2Client;
29import org.jclouds.aws.ec2.compute.AWSEC2ComputeService;
30import org.jclouds.aws.ec2.compute.AWSEC2TemplateOptions;
31import org.jclouds.aws.ec2.compute.suppliers.CallForImages;
32import org.jclouds.aws.ec2.domain.PlacementGroup;
33import org.jclouds.aws.ec2.domain.RegionNameAndPublicKeyMaterial;
34import org.jclouds.aws.ec2.functions.CreatePlacementGroupIfNeeded;
35import org.jclouds.aws.ec2.functions.ImportOrReturnExistingKeypair;
36import org.jclouds.aws.ec2.predicates.PlacementGroupAvailable;
37import org.jclouds.aws.ec2.predicates.PlacementGroupDeleted;
38import org.jclouds.compute.ComputeService;
39import org.jclouds.compute.ComputeServiceContext;
40import org.jclouds.compute.domain.Image;
41import org.jclouds.compute.domain.NodeMetadata;
42import org.jclouds.compute.domain.TemplateBuilder;
43import org.jclouds.compute.internal.ComputeServiceContextImpl;
44import org.jclouds.compute.options.TemplateOptions;
45import org.jclouds.domain.Credentials;
46import org.jclouds.ec2.compute.config.EC2ComputeServiceDependenciesModule;
47import org.jclouds.ec2.compute.domain.RegionAndName;
48import org.jclouds.ec2.compute.functions.CreateSecurityGroupIfNeeded;
49import org.jclouds.ec2.compute.functions.CreateUniqueKeyPair;
50import org.jclouds.ec2.compute.functions.CredentialsForInstance;
51import org.jclouds.ec2.compute.functions.RegionAndIdToImage;
52import org.jclouds.ec2.compute.functions.RunningInstanceToNodeMetadata;
53import org.jclouds.ec2.compute.internal.EC2TemplateBuilderImpl;
54import org.jclouds.ec2.domain.KeyPair;
55import org.jclouds.ec2.domain.RunningInstance;
56import org.jclouds.predicates.RetryablePredicate;
57import org.jclouds.rest.RestContext;
58import org.jclouds.rest.internal.RestContextImpl;
59 
60import com.google.common.base.Function;
61import com.google.common.base.Predicate;
62import com.google.common.cache.Cache;
63import com.google.common.cache.CacheBuilder;
64import com.google.common.cache.CacheLoader;
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<CacheLoader<RunningInstance, Credentials>>() {
84      }).to(CredentialsForInstance.class);
85      bind(new TypeLiteral<CacheLoader<RegionAndName, 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<CacheLoader<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 Cache<RegionAndName, String> placementGroupMap(CreatePlacementGroupIfNeeded in) {
120      return CacheBuilder.newBuilder().build(in);
121   }
122 
123   @Provides
124   @ClusterCompute
125   @Singleton
126   protected Set<String> provideClusterComputeIds() {
127      return Sets.newLinkedHashSet();
128   }
129 
130}

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