EMMA Coverage Report (generated Tue Jun 21 05:51:52 EDT 2011)
[all classes][org.jclouds.cloudservers.compute.config]

COVERAGE SUMMARY FOR SOURCE FILE [CloudServersComputeServiceDependenciesModule.java]

nameclass, %method, %block, %line, %
CloudServersComputeServiceDependenciesModule.java100% (9/9)92%  (11/12)99%  (190/192)92%  (11/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CloudServersComputeServiceDependenciesModule100% (1/1)75%  (3/4)99%  (142/144)90%  (9/10)
provideServerToNodeState (): Map 0%   (0/1)0%   (0/2)0%   (0/1)
<static initializer> 100% (1/1)100% (76/76)100% (1/1)
CloudServersComputeServiceDependenciesModule (): void 100% (1/1)100% (3/3)100% (1/1)
configure (): void 100% (1/1)100% (63/63)100% (7/7)
     
class CloudServersComputeServiceDependenciesModule$1100% (1/1)100% (1/1)100% (6/6)100% (1/1)
CloudServersComputeServiceDependenciesModule$1 (CloudServersComputeServiceDep... 100% (1/1)100% (6/6)100% (1/1)
     
class CloudServersComputeServiceDependenciesModule$2100% (1/1)100% (1/1)100% (6/6)100% (1/1)
CloudServersComputeServiceDependenciesModule$2 (CloudServersComputeServiceDep... 100% (1/1)100% (6/6)100% (1/1)
     
class CloudServersComputeServiceDependenciesModule$3100% (1/1)100% (1/1)100% (6/6)100% (1/1)
CloudServersComputeServiceDependenciesModule$3 (CloudServersComputeServiceDep... 100% (1/1)100% (6/6)100% (1/1)
     
class CloudServersComputeServiceDependenciesModule$4100% (1/1)100% (1/1)100% (6/6)100% (1/1)
CloudServersComputeServiceDependenciesModule$4 (CloudServersComputeServiceDep... 100% (1/1)100% (6/6)100% (1/1)
     
class CloudServersComputeServiceDependenciesModule$5100% (1/1)100% (1/1)100% (6/6)100% (1/1)
CloudServersComputeServiceDependenciesModule$5 (CloudServersComputeServiceDep... 100% (1/1)100% (6/6)100% (1/1)
     
class CloudServersComputeServiceDependenciesModule$6100% (1/1)100% (1/1)100% (6/6)100% (1/1)
CloudServersComputeServiceDependenciesModule$6 (CloudServersComputeServiceDep... 100% (1/1)100% (6/6)100% (1/1)
     
class CloudServersComputeServiceDependenciesModule$7100% (1/1)100% (1/1)100% (6/6)100% (1/1)
CloudServersComputeServiceDependenciesModule$7 (CloudServersComputeServiceDep... 100% (1/1)100% (6/6)100% (1/1)
     
class CloudServersComputeServiceDependenciesModule$8100% (1/1)100% (1/1)100% (6/6)100% (1/1)
CloudServersComputeServiceDependenciesModule$8 (CloudServersComputeServiceDep... 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.cloudservers.compute.config;
20 
21import java.util.Map;
22 
23import javax.inject.Singleton;
24 
25import org.jclouds.cloudservers.CloudServersAsyncClient;
26import org.jclouds.cloudservers.CloudServersClient;
27import org.jclouds.cloudservers.compute.functions.CloudServersImageToImage;
28import org.jclouds.cloudservers.compute.functions.CloudServersImageToOperatingSystem;
29import org.jclouds.cloudservers.compute.functions.FlavorToHardware;
30import org.jclouds.cloudservers.compute.functions.ServerToNodeMetadata;
31import org.jclouds.cloudservers.domain.Flavor;
32import org.jclouds.cloudservers.domain.Server;
33import org.jclouds.cloudservers.domain.ServerStatus;
34import org.jclouds.compute.ComputeServiceContext;
35import org.jclouds.compute.domain.Hardware;
36import org.jclouds.compute.domain.Image;
37import org.jclouds.compute.domain.NodeMetadata;
38import org.jclouds.compute.domain.NodeState;
39import org.jclouds.compute.domain.OperatingSystem;
40import org.jclouds.compute.internal.BaseComputeService;
41import org.jclouds.compute.internal.ComputeServiceContextImpl;
42import org.jclouds.rest.RestContext;
43import org.jclouds.rest.internal.RestContextImpl;
44 
45import com.google.common.annotations.VisibleForTesting;
46import com.google.common.base.Function;
47import com.google.common.collect.ImmutableMap;
48import com.google.inject.AbstractModule;
49import com.google.inject.Provides;
50import com.google.inject.Scopes;
51import com.google.inject.TypeLiteral;
52 
53/**
54 * Configures the {@link CloudServersComputeServiceContext}; requires {@link BaseComputeService}
55 * bound.
56 * 
57 * @author Adrian Cole
58 */
59public class CloudServersComputeServiceDependenciesModule extends AbstractModule {
60 
61   @Override
62   protected void configure() {
63      bind(new TypeLiteral<Function<Server, NodeMetadata>>() {
64      }).to(ServerToNodeMetadata.class);
65 
66      bind(new TypeLiteral<Function<org.jclouds.cloudservers.domain.Image, Image>>() {
67      }).to(CloudServersImageToImage.class);
68 
69      bind(new TypeLiteral<Function<org.jclouds.cloudservers.domain.Image, OperatingSystem>>() {
70      }).to(CloudServersImageToOperatingSystem.class);
71 
72      bind(new TypeLiteral<Function<Flavor, Hardware>>() {
73      }).to(FlavorToHardware.class);
74 
75      bind(new TypeLiteral<ComputeServiceContext>() {
76      }).to(new TypeLiteral<ComputeServiceContextImpl<CloudServersClient, CloudServersAsyncClient>>() {
77      }).in(Scopes.SINGLETON);
78      bind(new TypeLiteral<RestContext<CloudServersClient, CloudServersAsyncClient>>() {
79      }).to(new TypeLiteral<RestContextImpl<CloudServersClient, CloudServersAsyncClient>>() {
80      }).in(Scopes.SINGLETON);
81   }
82 
83   @VisibleForTesting
84   public static final Map<ServerStatus, NodeState> serverToNodeState = ImmutableMap
85            .<ServerStatus, NodeState> builder().put(ServerStatus.ACTIVE, NodeState.RUNNING)//
86            .put(ServerStatus.SUSPENDED, NodeState.SUSPENDED)//
87            .put(ServerStatus.DELETED, NodeState.TERMINATED)//
88            .put(ServerStatus.QUEUE_RESIZE, NodeState.PENDING)//
89            .put(ServerStatus.PREP_RESIZE, NodeState.PENDING)//
90            .put(ServerStatus.RESIZE, NodeState.PENDING)//
91            .put(ServerStatus.VERIFY_RESIZE, NodeState.PENDING)//
92            .put(ServerStatus.QUEUE_MOVE, NodeState.PENDING)//
93            .put(ServerStatus.PREP_MOVE, NodeState.PENDING)//
94            .put(ServerStatus.MOVE, NodeState.PENDING)//
95            .put(ServerStatus.VERIFY_MOVE, NodeState.PENDING)//
96            .put(ServerStatus.RESCUE, NodeState.PENDING)//
97            .put(ServerStatus.ERROR, NodeState.ERROR)//
98            .put(ServerStatus.BUILD, NodeState.PENDING)//
99            .put(ServerStatus.RESTORING, NodeState.PENDING)//
100            .put(ServerStatus.PASSWORD, NodeState.PENDING)//
101            .put(ServerStatus.REBUILD, NodeState.PENDING)//
102            .put(ServerStatus.DELETE_IP, NodeState.PENDING)//
103            .put(ServerStatus.SHARE_IP_NO_CONFIG, NodeState.PENDING)//
104            .put(ServerStatus.SHARE_IP, NodeState.PENDING)//
105            .put(ServerStatus.REBOOT, NodeState.PENDING)//
106            .put(ServerStatus.HARD_REBOOT, NodeState.PENDING)//
107            .put(ServerStatus.UNKNOWN, NodeState.UNRECOGNIZED)//
108            .put(ServerStatus.UNRECOGNIZED, NodeState.UNRECOGNIZED).build();
109 
110   @Singleton
111   @Provides
112   Map<ServerStatus, NodeState> provideServerToNodeState() {
113      return serverToNodeState;
114   }
115 
116}

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