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

COVERAGE SUMMARY FOR SOURCE FILE [NovaComputeServiceDependenciesModule.java]

nameclass, %method, %block, %line, %
NovaComputeServiceDependenciesModule.java100% (9/9)92%  (11/12)99%  (166/168)92%  (11/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class NovaComputeServiceDependenciesModule100% (1/1)75%  (3/4)98%  (118/120)90%  (9/10)
provideServerToNodeState (): Map 0%   (0/1)0%   (0/2)0%   (0/1)
<static initializer> 100% (1/1)100% (52/52)100% (1/1)
NovaComputeServiceDependenciesModule (): void 100% (1/1)100% (3/3)100% (1/1)
configure (): void 100% (1/1)100% (63/63)100% (7/7)
     
class NovaComputeServiceDependenciesModule$1100% (1/1)100% (1/1)100% (6/6)100% (1/1)
NovaComputeServiceDependenciesModule$1 (NovaComputeServiceDependenciesModule)... 100% (1/1)100% (6/6)100% (1/1)
     
class NovaComputeServiceDependenciesModule$2100% (1/1)100% (1/1)100% (6/6)100% (1/1)
NovaComputeServiceDependenciesModule$2 (NovaComputeServiceDependenciesModule)... 100% (1/1)100% (6/6)100% (1/1)
     
class NovaComputeServiceDependenciesModule$3100% (1/1)100% (1/1)100% (6/6)100% (1/1)
NovaComputeServiceDependenciesModule$3 (NovaComputeServiceDependenciesModule)... 100% (1/1)100% (6/6)100% (1/1)
     
class NovaComputeServiceDependenciesModule$4100% (1/1)100% (1/1)100% (6/6)100% (1/1)
NovaComputeServiceDependenciesModule$4 (NovaComputeServiceDependenciesModule)... 100% (1/1)100% (6/6)100% (1/1)
     
class NovaComputeServiceDependenciesModule$5100% (1/1)100% (1/1)100% (6/6)100% (1/1)
NovaComputeServiceDependenciesModule$5 (NovaComputeServiceDependenciesModule)... 100% (1/1)100% (6/6)100% (1/1)
     
class NovaComputeServiceDependenciesModule$6100% (1/1)100% (1/1)100% (6/6)100% (1/1)
NovaComputeServiceDependenciesModule$6 (NovaComputeServiceDependenciesModule)... 100% (1/1)100% (6/6)100% (1/1)
     
class NovaComputeServiceDependenciesModule$7100% (1/1)100% (1/1)100% (6/6)100% (1/1)
NovaComputeServiceDependenciesModule$7 (NovaComputeServiceDependenciesModule)... 100% (1/1)100% (6/6)100% (1/1)
     
class NovaComputeServiceDependenciesModule$8100% (1/1)100% (1/1)100% (6/6)100% (1/1)
NovaComputeServiceDependenciesModule$8 (NovaComputeServiceDependenciesModule)... 100% (1/1)100% (6/6)100% (1/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.nova.compute.config;
20 
21import java.util.Map;
22 
23import javax.inject.Singleton;
24 
25import org.jclouds.openstack.nova.NovaAsyncClient;
26import org.jclouds.openstack.nova.NovaClient;
27import org.jclouds.openstack.nova.compute.functions.NovaImageToImage;
28import org.jclouds.openstack.nova.compute.functions.NovaImageToOperatingSystem;
29import org.jclouds.openstack.nova.compute.functions.FlavorToHardware;
30import org.jclouds.openstack.nova.compute.functions.ServerToNodeMetadata;
31import org.jclouds.openstack.nova.domain.Flavor;
32import org.jclouds.openstack.nova.domain.Server;
33import org.jclouds.openstack.nova.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 NovaComputeServiceContext}; requires {@link BaseComputeService}
55 * bound.
56 * 
57 * @author Adrian Cole
58 */
59public class NovaComputeServiceDependenciesModule 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.openstack.nova.domain.Image, Image>>() {
67      }).to(NovaImageToImage.class);
68 
69      bind(new TypeLiteral<Function<org.jclouds.openstack.nova.domain.Image, OperatingSystem>>() {
70      }).to(NovaImageToOperatingSystem.class);
71 
72      bind(new TypeLiteral<Function<Flavor, Hardware>>() {
73      }).to(FlavorToHardware.class);
74 
75      bind(new TypeLiteral<ComputeServiceContext>() {
76      }).to(new TypeLiteral<ComputeServiceContextImpl<NovaClient, NovaAsyncClient>>() {
77      }).in(Scopes.SINGLETON);
78      bind(new TypeLiteral<RestContext<NovaClient, NovaAsyncClient>>() {
79      }).to(new TypeLiteral<RestContextImpl<NovaClient, NovaAsyncClient>>() {
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.RESCUE, NodeState.PENDING)//
93            .put(ServerStatus.BUILD, NodeState.PENDING)//
94            .put(ServerStatus.PASSWORD, NodeState.PENDING)//
95            .put(ServerStatus.REBUILD, NodeState.PENDING)//
96            .put(ServerStatus.DELETE_IP, NodeState.PENDING)//
97            .put(ServerStatus.REBOOT, NodeState.PENDING)//
98            .put(ServerStatus.HARD_REBOOT, NodeState.PENDING)//
99            .put(ServerStatus.UNKNOWN, NodeState.UNRECOGNIZED)//
100            .put(ServerStatus.UNRECOGNIZED, NodeState.UNRECOGNIZED).build();
101 
102   @Singleton
103   @Provides
104   Map<ServerStatus, NodeState> provideServerToNodeState() {
105      return serverToNodeState;
106   }
107 
108}

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