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

COVERAGE SUMMARY FOR SOURCE FILE [EC2ComputeServiceContextModule.java]

nameclass, %method, %block, %line, %
EC2ComputeServiceContextModule.java50%  (1/2)50%  (3/6)49%  (24/49)73%  (8/11)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class EC2ComputeServiceContextModule$10%   (0/1)0%   (0/2)0%   (0/13)0%   (0/2)
EC2ComputeServiceContextModule$1 (EC2ComputeServiceContextModule, RegionAndNa... 0%   (0/1)0%   (0/9)0%   (0/1)
get (): Map 0%   (0/1)0%   (0/4)0%   (0/1)
     
class EC2ComputeServiceContextModule100% (1/1)75%  (3/4)67%  (24/36)89%  (8/9)
provideRegionAndNameToImageSupplierCache (long, RegionAndNameToImageSupplier)... 0%   (0/1)0%   (0/12)0%   (0/1)
EC2ComputeServiceContextModule (): void 100% (1/1)100% (3/3)100% (1/1)
configure (): void 100% (1/1)100% (15/15)100% (5/5)
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.ec2.compute.config;
20 
21import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
22 
23import java.util.Map;
24 
25import javax.inject.Named;
26import javax.inject.Singleton;
27 
28import org.jclouds.compute.ComputeServiceContext;
29import org.jclouds.compute.config.BaseComputeServiceContextModule;
30import org.jclouds.compute.domain.Image;
31import org.jclouds.ec2.compute.EC2ComputeService;
32import org.jclouds.ec2.compute.domain.RegionAndName;
33import org.jclouds.ec2.compute.suppliers.RegionAndNameToImageSupplier;
34import org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
35 
36import com.google.common.base.Supplier;
37import com.google.inject.Provides;
38 
39/**
40 * Configures the {@link ComputeServiceContext}; requires {@link EC2ComputeService} bound.
41 * 
42 * @author Adrian Cole
43 */
44public class EC2ComputeServiceContextModule extends BaseComputeServiceContextModule {
45   @Override
46   protected void configure() {
47      installDependencies();
48      install(new EC2BindComputeStrategiesByClass());
49      install(new EC2BindComputeSuppliersByClass());
50      super.configure();
51   }
52   
53   protected void installDependencies(){
54      install(new EC2ComputeServiceDependenciesModule());
55   }
56 
57   @Provides
58   @Singleton
59   protected Supplier<Map<RegionAndName, ? extends Image>> provideRegionAndNameToImageSupplierCache(
60            @Named(PROPERTY_SESSION_INTERVAL) long seconds, final RegionAndNameToImageSupplier supplier) {
61      return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<RegionAndName, ? extends Image>>(
62               authException, seconds, new Supplier<Map<RegionAndName, ? extends Image>>() {
63                  @Override
64                  public Map<RegionAndName, ? extends Image> get() {
65                     return supplier.get();
66                  }
67               });
68   }
69 
70}

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