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

COVERAGE SUMMARY FOR SOURCE FILE [SlicehostComputeServiceDependenciesModule.java]

nameclass, %method, %block, %line, %
SlicehostComputeServiceDependenciesModule.java100% (9/9)92%  (11/12)99%  (136/138)92%  (11/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SlicehostComputeServiceDependenciesModule100% (1/1)75%  (3/4)98%  (88/90)90%  (9/10)
provideSliceToNodeState (): Map 0%   (0/1)0%   (0/2)0%   (0/1)
<static initializer> 100% (1/1)100% (22/22)100% (1/1)
SlicehostComputeServiceDependenciesModule (): void 100% (1/1)100% (3/3)100% (1/1)
configure (): void 100% (1/1)100% (63/63)100% (7/7)
     
class SlicehostComputeServiceDependenciesModule$1100% (1/1)100% (1/1)100% (6/6)100% (1/1)
SlicehostComputeServiceDependenciesModule$1 (SlicehostComputeServiceDependenc... 100% (1/1)100% (6/6)100% (1/1)
     
class SlicehostComputeServiceDependenciesModule$2100% (1/1)100% (1/1)100% (6/6)100% (1/1)
SlicehostComputeServiceDependenciesModule$2 (SlicehostComputeServiceDependenc... 100% (1/1)100% (6/6)100% (1/1)
     
class SlicehostComputeServiceDependenciesModule$3100% (1/1)100% (1/1)100% (6/6)100% (1/1)
SlicehostComputeServiceDependenciesModule$3 (SlicehostComputeServiceDependenc... 100% (1/1)100% (6/6)100% (1/1)
     
class SlicehostComputeServiceDependenciesModule$4100% (1/1)100% (1/1)100% (6/6)100% (1/1)
SlicehostComputeServiceDependenciesModule$4 (SlicehostComputeServiceDependenc... 100% (1/1)100% (6/6)100% (1/1)
     
class SlicehostComputeServiceDependenciesModule$5100% (1/1)100% (1/1)100% (6/6)100% (1/1)
SlicehostComputeServiceDependenciesModule$5 (SlicehostComputeServiceDependenc... 100% (1/1)100% (6/6)100% (1/1)
     
class SlicehostComputeServiceDependenciesModule$6100% (1/1)100% (1/1)100% (6/6)100% (1/1)
SlicehostComputeServiceDependenciesModule$6 (SlicehostComputeServiceDependenc... 100% (1/1)100% (6/6)100% (1/1)
     
class SlicehostComputeServiceDependenciesModule$7100% (1/1)100% (1/1)100% (6/6)100% (1/1)
SlicehostComputeServiceDependenciesModule$7 (SlicehostComputeServiceDependenc... 100% (1/1)100% (6/6)100% (1/1)
     
class SlicehostComputeServiceDependenciesModule$8100% (1/1)100% (1/1)100% (6/6)100% (1/1)
SlicehostComputeServiceDependenciesModule$8 (SlicehostComputeServiceDependenc... 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.slicehost.compute.config;
20 
21import java.util.Map;
22 
23import javax.inject.Singleton;
24 
25import org.jclouds.compute.ComputeServiceContext;
26import org.jclouds.compute.domain.Hardware;
27import org.jclouds.compute.domain.Image;
28import org.jclouds.compute.domain.NodeMetadata;
29import org.jclouds.compute.domain.NodeState;
30import org.jclouds.compute.domain.OperatingSystem;
31import org.jclouds.compute.internal.BaseComputeService;
32import org.jclouds.compute.internal.ComputeServiceContextImpl;
33import org.jclouds.rest.RestContext;
34import org.jclouds.rest.internal.RestContextImpl;
35import org.jclouds.slicehost.SlicehostAsyncClient;
36import org.jclouds.slicehost.SlicehostClient;
37import org.jclouds.slicehost.compute.functions.FlavorToHardware;
38import org.jclouds.slicehost.compute.functions.SliceToNodeMetadata;
39import org.jclouds.slicehost.compute.functions.SlicehostImageToImage;
40import org.jclouds.slicehost.compute.functions.SlicehostImageToOperatingSystem;
41import org.jclouds.slicehost.domain.Flavor;
42import org.jclouds.slicehost.domain.Slice;
43 
44import com.google.common.annotations.VisibleForTesting;
45import com.google.common.base.Function;
46import com.google.common.collect.ImmutableMap;
47import com.google.inject.AbstractModule;
48import com.google.inject.Provides;
49import com.google.inject.Scopes;
50import com.google.inject.TypeLiteral;
51 
52/**
53 * Configures the {@link SlicehostComputeServiceContext}; requires {@link BaseComputeService} bound.
54 * 
55 * @author Adrian Cole
56 */
57public class SlicehostComputeServiceDependenciesModule extends AbstractModule {
58 
59   @Override
60   protected void configure() {
61      bind(new TypeLiteral<Function<Slice, NodeMetadata>>() {
62      }).to(SliceToNodeMetadata.class);
63 
64      bind(new TypeLiteral<Function<org.jclouds.slicehost.domain.Image, Image>>() {
65      }).to(SlicehostImageToImage.class);
66 
67      bind(new TypeLiteral<Function<org.jclouds.slicehost.domain.Image, OperatingSystem>>() {
68      }).to(SlicehostImageToOperatingSystem.class);
69      bind(new TypeLiteral<Function<Flavor, Hardware>>() {
70      }).to(FlavorToHardware.class);
71 
72      bind(new TypeLiteral<ComputeServiceContext>() {
73      }).to(new TypeLiteral<ComputeServiceContextImpl<SlicehostClient, SlicehostAsyncClient>>() {
74      }).in(Scopes.SINGLETON);
75      bind(new TypeLiteral<RestContext<SlicehostClient, SlicehostAsyncClient>>() {
76      }).to(new TypeLiteral<RestContextImpl<SlicehostClient, SlicehostAsyncClient>>() {
77      }).in(Scopes.SINGLETON);
78 
79   }
80 
81   @VisibleForTesting
82   public static final Map<Slice.Status, NodeState> sliceStatusToNodeState = ImmutableMap
83            .<Slice.Status, NodeState> builder().put(Slice.Status.ACTIVE, NodeState.RUNNING)//
84            .put(Slice.Status.BUILD, NodeState.PENDING)//
85            .put(Slice.Status.REBOOT, NodeState.PENDING)//
86            .put(Slice.Status.HARD_REBOOT, NodeState.PENDING)//
87            .put(Slice.Status.TERMINATED, NodeState.TERMINATED)//
88            .put(Slice.Status.UNRECOGNIZED, NodeState.UNRECOGNIZED)//
89            .build();
90 
91   @Singleton
92   @Provides
93   Map<Slice.Status, NodeState> provideSliceToNodeState() {
94      return sliceStatusToNodeState;
95   }
96}

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