EMMA Coverage Report (generated Wed Jun 22 19:47:49 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)83%  (162/196)71%  (15/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AWSEC2ComputeServiceDependenciesModule100% (1/1)33%  (2/6)75%  (102/136)68%  (13/19)
ccAmis (String): String [] 0%   (0/1)0%   (0/16)0%   (0/3)
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)
AWSEC2ComputeServiceDependenciesModule (): void 100% (1/1)100% (3/3)100% (1/1)
configure (): void 100% (1/1)100% (99/99)100% (12/12)
     
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.Iterables.toArray;
22import static com.google.common.collect.Maps.newLinkedHashMap;
23import static org.jclouds.aws.ec2.reference.AWSEC2Constants.PROPERTY_EC2_CC_AMIs;
24 
25import java.util.Map;
26import java.util.concurrent.TimeUnit;
27 
28import javax.inject.Named;
29import javax.inject.Singleton;
30 
31import org.jclouds.aws.ec2.AWSEC2AsyncClient;
32import org.jclouds.aws.ec2.AWSEC2Client;
33import org.jclouds.aws.ec2.compute.AWSEC2ComputeService;
34import org.jclouds.aws.ec2.compute.AWSEC2TemplateOptions;
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.base.Splitter;
66import com.google.inject.Provides;
67import com.google.inject.Scopes;
68import com.google.inject.TypeLiteral;
69 
70/**
71 * 
72 * @author Adrian Cole
73 */
74public class AWSEC2ComputeServiceDependenciesModule extends EC2ComputeServiceDependenciesModule {
75   @Override
76   protected void configure() {
77      bind(TemplateBuilder.class).to(EC2TemplateBuilderImpl.class);
78      bind(TemplateOptions.class).to(AWSEC2TemplateOptions.class);
79      bind(ComputeService.class).to(AWSEC2ComputeService.class);
80      bind(new TypeLiteral<Function<RunningInstance, NodeMetadata>>() {
81      }).to(RunningInstanceToNodeMetadata.class);
82      bind(new TypeLiteral<Function<RunningInstance, Credentials>>() {
83      }).to(CredentialsForInstance.class);
84      bind(new TypeLiteral<Function<RegionNameAndIngressRules, String>>() {
85      }).to(CreateSecurityGroupIfNeeded.class);
86      bind(new TypeLiteral<Function<RegionAndName, KeyPair>>() {
87      }).to(CreateUniqueKeyPair.class);
88      bind(new TypeLiteral<Function<RegionNameAndPublicKeyMaterial, KeyPair>>() {
89      }).to(ImportOrReturnExistingKeypair.class);
90      bind(new TypeLiteral<Function<RegionAndName, Image>>() {
91      }).to(RegionAndIdToImage.class);
92      bind(new TypeLiteral<ComputeServiceContext>() {
93      }).to(new TypeLiteral<ComputeServiceContextImpl<AWSEC2Client, AWSEC2AsyncClient>>() {
94      }).in(Scopes.SINGLETON);
95      bind(new TypeLiteral<RestContext<AWSEC2Client, AWSEC2AsyncClient>>() {
96      }).to(new TypeLiteral<RestContextImpl<AWSEC2Client, AWSEC2AsyncClient>>() {
97      }).in(Scopes.SINGLETON);
98   }
99 
100   @Provides
101   @Singleton
102   @Named("AVAILABLE")
103   protected Predicate<PlacementGroup> placementGroupAvailable(PlacementGroupAvailable available) {
104      return new RetryablePredicate<PlacementGroup>(available, 60, 1, TimeUnit.SECONDS);
105   }
106 
107   @Provides
108   @Singleton
109   @Named("DELETED")
110   protected Predicate<PlacementGroup> placementGroupDeleted(PlacementGroupDeleted deleted) {
111      return new RetryablePredicate<PlacementGroup>(deleted, 60, 1, TimeUnit.SECONDS);
112   }
113 
114   @Provides
115   @Singleton
116   @Named("PLACEMENT")
117   protected Map<RegionAndName, String> placementGroupMap(CreateSecurityGroupIfNeeded in) {
118      // doesn't seem to clear when someone issues remove(key)
119      // return new MapMaker().makeComputingMap(in);
120      return newLinkedHashMap();
121   }
122 
123   @Provides
124   @Singleton
125   @Named(PROPERTY_EC2_CC_AMIs)
126   protected String[] ccAmis(@Named(PROPERTY_EC2_CC_AMIs) String ccAmis) {
127      if (ccAmis.trim().equals(""))
128         return new String[] {};
129      return toArray(Splitter.on(',').split(ccAmis), String.class);
130   }
131}

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