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

COVERAGE SUMMARY FOR SOURCE FILE [SwiftRestClientModule.java]

nameclass, %method, %block, %line, %
SwiftRestClientModule.java0%   (0/2)0%   (0/7)0%   (0/38)0%   (0/11)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SwiftRestClientModule0%   (0/1)0%   (0/5)0%   (0/24)0%   (0/8)
SwiftRestClientModule (): void 0%   (0/1)0%   (0/5)0%   (0/2)
configure (): void 0%   (0/1)0%   (0/9)0%   (0/3)
provideCommonSwiftClient (SwiftAsyncClient): CommonSwiftAsyncClient 0%   (0/1)0%   (0/2)0%   (0/1)
provideCommonSwiftClient (SwiftClient): CommonSwiftClient 0%   (0/1)0%   (0/2)0%   (0/1)
provideStorageUrl (OpenStackAuthAsyncClient$AuthenticationResponse): URI 0%   (0/1)0%   (0/6)0%   (0/1)
     
class SwiftRestClientModule$GetAuthenticationResponseForStorage0%   (0/1)0%   (0/2)0%   (0/14)0%   (0/3)
SwiftRestClientModule$GetAuthenticationResponseForStorage (AsyncClientFactory... 0%   (0/1)0%   (0/6)0%   (0/2)
authenticate (): Future 0%   (0/1)0%   (0/8)0%   (0/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.openstack.swift.config;
20 
21import java.net.URI;
22import java.util.concurrent.Future;
23 
24import javax.inject.Inject;
25import javax.inject.Named;
26import javax.inject.Singleton;
27 
28import org.jclouds.Constants;
29import org.jclouds.http.RequiresHttp;
30import org.jclouds.openstack.OpenStackAuthAsyncClient.AuthenticationResponse;
31import org.jclouds.openstack.config.OpenStackAuthenticationModule.GetAuthenticationResponse;
32import org.jclouds.openstack.reference.AuthHeaders;
33import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
34import org.jclouds.openstack.swift.CommonSwiftClient;
35import org.jclouds.openstack.swift.SwiftAsyncClient;
36import org.jclouds.openstack.swift.SwiftClient;
37import org.jclouds.rest.AsyncClientFactory;
38import org.jclouds.rest.ConfiguresRestClient;
39 
40import com.google.inject.Provides;
41 
42/**
43 * 
44 * @author Adrian Cole
45 */
46@ConfiguresRestClient
47@RequiresHttp
48public class SwiftRestClientModule extends BaseSwiftRestClientModule<SwiftClient, SwiftAsyncClient> {
49 
50   public SwiftRestClientModule() {
51      super(SwiftClient.class, SwiftAsyncClient.class);
52   }
53 
54   @Provides
55   @Singleton
56   CommonSwiftClient provideCommonSwiftClient(SwiftClient in) {
57      return in;
58   }
59 
60   @Provides
61   @Singleton
62   CommonSwiftAsyncClient provideCommonSwiftClient(SwiftAsyncClient in) {
63      return in;
64   }
65 
66   @Singleton
67   public static class GetAuthenticationResponseForStorage extends GetAuthenticationResponse {
68      @Inject
69      public GetAuthenticationResponseForStorage(AsyncClientFactory factory,
70               @Named(Constants.PROPERTY_IDENTITY) String user, @Named(Constants.PROPERTY_CREDENTIAL) String key) {
71         super(factory, user, key);
72      }
73 
74      protected Future<AuthenticationResponse> authenticate() {
75         return client.authenticateStorage(user, key);
76      }
77 
78   }
79 
80   protected URI provideStorageUrl(AuthenticationResponse response) {
81      return response.getServices().get(AuthHeaders.STORAGE_URL);
82   }
83   
84   @Override
85   protected void configure() {
86      bind(GetAuthenticationResponse.class).to(GetAuthenticationResponseForStorage.class);
87      super.configure();
88   }
89}

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