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

COVERAGE SUMMARY FOR SOURCE FILE [TerremarkVCloudComputeServiceContextModule.java]

nameclass, %method, %block, %line, %
TerremarkVCloudComputeServiceContextModule.java0%   (0/5)0%   (0/14)0%   (0/134)0%   (0/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TerremarkVCloudComputeServiceContextModule0%   (0/1)0%   (0/9)0%   (0/95)0%   (0/17)
TerremarkVCloudComputeServiceContextModule (): void 0%   (0/1)0%   (0/3)0%   (0/1)
bindVAppConverter (): void 0%   (0/1)0%   (0/10)0%   (0/2)
configure (): void 0%   (0/1)0%   (0/46)0%   (0/8)
credentialsMap (): ConcurrentMap 0%   (0/1)0%   (0/4)0%   (0/1)
defineComputeStrategyModule (): BindComputeStrategiesByClass 0%   (0/1)0%   (0/4)0%   (0/1)
defineComputeSupplierModule (): BindComputeSuppliersByClass 0%   (0/1)0%   (0/4)0%   (0/1)
providePassword (SecureRandom): String 0%   (0/1)0%   (0/10)0%   (0/1)
provideSuffix (SecureRandom): Supplier 0%   (0/1)0%   (0/6)0%   (0/1)
provideTemplate (Injector, TemplateBuilder): TemplateBuilder 0%   (0/1)0%   (0/8)0%   (0/1)
     
class TerremarkVCloudComputeServiceContextModule$10%   (0/1)0%   (0/2)0%   (0/21)0%   (0/2)
TerremarkVCloudComputeServiceContextModule$1 (TerremarkVCloudComputeServiceCo... 0%   (0/1)0%   (0/9)0%   (0/1)
get (): String 0%   (0/1)0%   (0/12)0%   (0/1)
     
class TerremarkVCloudComputeServiceContextModule$20%   (0/1)0%   (0/1)0%   (0/6)0%   (0/1)
TerremarkVCloudComputeServiceContextModule$2 (TerremarkVCloudComputeServiceCo... 0%   (0/1)0%   (0/6)0%   (0/1)
     
class TerremarkVCloudComputeServiceContextModule$30%   (0/1)0%   (0/1)0%   (0/6)0%   (0/1)
TerremarkVCloudComputeServiceContextModule$3 (TerremarkVCloudComputeServiceCo... 0%   (0/1)0%   (0/6)0%   (0/1)
     
class TerremarkVCloudComputeServiceContextModule$40%   (0/1)0%   (0/1)0%   (0/6)0%   (0/1)
TerremarkVCloudComputeServiceContextModule$4 (TerremarkVCloudComputeServiceCo... 0%   (0/1)0%   (0/6)0%   (0/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.vcloud.terremark.compute.config;
20 
21import static org.jclouds.compute.domain.OsFamily.UBUNTU;
22 
23import java.security.SecureRandom;
24import java.util.concurrent.ConcurrentHashMap;
25import java.util.concurrent.ConcurrentMap;
26 
27import javax.inject.Named;
28import javax.inject.Singleton;
29 
30import org.jclouds.compute.ComputeService;
31import org.jclouds.compute.config.BindComputeStrategiesByClass;
32import org.jclouds.compute.config.BindComputeSuppliersByClass;
33import org.jclouds.compute.domain.NodeMetadata;
34import org.jclouds.compute.domain.TemplateBuilder;
35import org.jclouds.compute.options.TemplateOptions;
36import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
37import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
38import org.jclouds.vcloud.compute.config.VCloudExpressComputeServiceContextModule;
39import org.jclouds.vcloud.domain.VCloudExpressVApp;
40import org.jclouds.vcloud.terremark.compute.TerremarkVCloudComputeClient;
41import org.jclouds.vcloud.terremark.compute.TerremarkVCloudComputeService;
42import org.jclouds.vcloud.terremark.compute.domain.KeyPairCredentials;
43import org.jclouds.vcloud.terremark.compute.domain.OrgAndName;
44import org.jclouds.vcloud.terremark.compute.functions.NodeMetadataToOrgAndName;
45import org.jclouds.vcloud.terremark.compute.functions.TerremarkVCloudExpressVAppToNodeMetadata;
46import org.jclouds.vcloud.terremark.compute.options.TerremarkVCloudTemplateOptions;
47import org.jclouds.vcloud.terremark.compute.strategy.ParseVAppTemplateDescriptionToGetDefaultLoginCredentials;
48 
49import com.google.common.base.Function;
50import com.google.common.base.Supplier;
51import com.google.inject.Injector;
52import com.google.inject.Provides;
53import com.google.inject.TypeLiteral;
54 
55/**
56 * Configures the {@link TerremarkVCloudComputeServiceContext}; requires
57 * {@link TerremarkVCloudComputeClientImpl} bound.
58 * 
59 * @author Adrian Cole
60 */
61public class TerremarkVCloudComputeServiceContextModule extends VCloudExpressComputeServiceContextModule {
62 
63   @Provides
64   @Singleton
65   Supplier<String> provideSuffix(final SecureRandom random) {
66      return new Supplier<String>() {
67         @Override
68         public String get() {
69            return random.nextInt(4096) + "";
70         }
71      };
72 
73   }
74 
75   // prefer jeos as the copy time is much shorter
76   @Override
77   protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
78      return template.osFamily(UBUNTU).osDescriptionMatches(".*JeOS.*").os64Bit(true);
79   }
80 
81   @Override
82   protected void configure() {
83      super.configure();
84      bind(new TypeLiteral<Function<NodeMetadata, OrgAndName>>() {
85      }).to(new TypeLiteral<NodeMetadataToOrgAndName>() {
86      });
87      bind(TemplateOptions.class).to(TerremarkVCloudTemplateOptions.class);
88      bind(ComputeService.class).to(TerremarkVCloudComputeService.class);
89      bind(VCloudExpressComputeClient.class).to(TerremarkVCloudComputeClient.class);
90      bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(
91            ParseVAppTemplateDescriptionToGetDefaultLoginCredentials.class);
92      bind(SecureRandom.class).toInstance(new SecureRandom());
93   }
94 
95   @Override
96   protected void bindVAppConverter() {
97      bind(new TypeLiteral<Function<VCloudExpressVApp, NodeMetadata>>() {
98      }).to(TerremarkVCloudExpressVAppToNodeMetadata.class);
99   }
100 
101   @Override
102   public BindComputeStrategiesByClass defineComputeStrategyModule() {
103      return new TerremarkBindComputeStrategiesByClass();
104   }
105 
106   @Override
107   public BindComputeSuppliersByClass defineComputeSupplierModule() {
108      return new TerremarkBindComputeSuppliersByClass();
109   }
110 
111   @Provides
112   @Singleton
113   ConcurrentMap<OrgAndName, KeyPairCredentials> credentialsMap() {
114      return new ConcurrentHashMap<OrgAndName, KeyPairCredentials>();
115   }
116 
117   @Named("PASSWORD")
118   @Provides
119   String providePassword(SecureRandom random) {
120      return random.nextLong() + "";
121   }
122 
123}

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