EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.aws.config]

COVERAGE SUMMARY FOR SOURCE FILE [WithZonesFormSigningRestClientModule.java]

nameclass, %method, %block, %line, %
WithZonesFormSigningRestClientModule.java33%  (1/3)11%  (1/9)8%   (5/62)15%  (2/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class WithZonesFormSigningRestClientModule$10%   (0/1)0%   (0/1)0%   (0/6)0%   (0/1)
WithZonesFormSigningRestClientModule$1 (WithZonesFormSigningRestClientModule)... 0%   (0/1)0%   (0/6)0%   (0/1)
     
class WithZonesFormSigningRestClientModule$20%   (0/1)0%   (0/2)0%   (0/15)0%   (0/2)
WithZonesFormSigningRestClientModule$2 (WithZonesFormSigningRestClientModule,... 0%   (0/1)0%   (0/9)0%   (0/1)
apply (String): URI 0%   (0/1)0%   (0/6)0%   (0/1)
     
class WithZonesFormSigningRestClientModule100% (1/1)17%  (1/6)12%  (5/41)17%  (2/12)
WithZonesFormSigningRestClientModule (Class, Class, Map): void 0%   (0/1)0%   (0/6)0%   (0/2)
bindZonesToProvider (): void 0%   (0/1)0%   (0/4)0%   (0/2)
bindZonesToProvider (Class): void 0%   (0/1)0%   (0/13)0%   (0/2)
configure (): void 0%   (0/1)0%   (0/5)0%   (0/3)
provideZones (Map, Map): Map 0%   (0/1)0%   (0/8)0%   (0/1)
WithZonesFormSigningRestClientModule (Class, Class): void 100% (1/1)100% (5/5)100% (2/2)

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.config;
20 
21import java.net.URI;
22import java.util.Map;
23 
24import javax.inject.Singleton;
25 
26import org.jclouds.http.RequiresHttp;
27import org.jclouds.location.Region;
28import org.jclouds.location.Zone;
29import org.jclouds.location.config.ProvideZonesViaProperties;
30import org.jclouds.rest.ConfiguresRestClient;
31 
32import com.google.common.base.Function;
33import com.google.common.collect.Maps;
34import com.google.inject.Provides;
35import com.google.inject.Scopes;
36import com.google.inject.TypeLiteral;
37 
38/**
39 * 
40 * @author Adrian Cole
41 */
42@ConfiguresRestClient
43@RequiresHttp
44public class WithZonesFormSigningRestClientModule<S, A> extends FormSigningRestClientModule<S, A> {
45 
46   public WithZonesFormSigningRestClientModule(Class<S> syncClientType, Class<A> asyncClientType,
47         Map<Class<?>, Class<?>> delegates) {
48      super(syncClientType, asyncClientType, delegates);
49   }
50 
51   public WithZonesFormSigningRestClientModule(Class<S> syncClientType, Class<A> asyncClientType) {
52      super(syncClientType, asyncClientType);
53   }
54 
55   protected void bindZonesToProvider() {
56      bindZonesToProvider(ProvideZonesViaProperties.class);
57   }
58 
59   protected void bindZonesToProvider(Class<? extends javax.inject.Provider<Map<String, String>>> providerClass) {
60      bind(new TypeLiteral<Map<String, String>>() {
61      }).annotatedWith(Zone.class).toProvider(providerClass).in(Scopes.SINGLETON);
62   }
63 
64   @Override
65   protected void configure() {
66      super.configure();
67      bindZonesToProvider();
68   }
69 
70   @Provides
71   @Singleton
72   @Zone
73   protected Map<String, URI> provideZones(@Region final Map<String, URI> regionToEndpoint,
74         @Zone Map<String, String> availabilityZoneToRegion) {
75      return Maps.transformValues(availabilityZoneToRegion, new Function<String, URI>() {
76 
77         @Override
78         public URI apply(String from) {
79 
80            return regionToEndpoint.get(from);
81         }
82 
83      });
84   }
85 
86}

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