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

COVERAGE SUMMARY FOR SOURCE FILE [ServerManager.java]

nameclass, %method, %block, %line, %
ServerManager.java100% (1/1)15%  (2/13)26%  (32/125)18%  (5/28)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ServerManager100% (1/1)15%  (2/13)26%  (32/125)18%  (5/28)
createServerInDC (String, String, int, int): Server 0%   (0/1)0%   (0/57)0%   (0/12)
destroyServer (int): void 0%   (0/1)0%   (0/6)0%   (0/2)
getHardware (int): Hardware 0%   (0/1)0%   (0/6)0%   (0/1)
getImage (int): Image 0%   (0/1)0%   (0/6)0%   (0/1)
getServer (int): Server 0%   (0/1)0%   (0/6)0%   (0/1)
listHardware (): Iterable 0%   (0/1)0%   (0/3)0%   (0/1)
listImages (): Iterable 0%   (0/1)0%   (0/3)0%   (0/1)
listServers (): Iterable 0%   (0/1)0%   (0/3)0%   (0/1)
rebootServer (int): void 0%   (0/1)0%   (0/1)0%   (0/1)
startServer (int): void 0%   (0/1)0%   (0/1)0%   (0/1)
stopServer (int): void 0%   (0/1)0%   (0/1)0%   (0/1)
<static initializer> 100% (1/1)100% (29/29)100% (4/4)
ServerManager (): void 100% (1/1)100% (3/3)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.servermanager;
20 
21import java.util.Map;
22import java.util.concurrent.atomic.AtomicInteger;
23 
24import javax.inject.Singleton;
25 
26import com.google.common.collect.ImmutableMap;
27import com.google.common.collect.Maps;
28 
29/**
30 * This would be replaced with the real connection to the service that can
31 * create/list/reboot/get/destroy things
32 * 
33 * @author Adrian Cole
34 */
35@Singleton
36public class ServerManager {
37 
38   private final static Map<Integer, Server> servers = Maps.newHashMap();
39   private final static Map<Integer, Image> images = ImmutableMap.of(1, new Image(1, "ubuntu"));
40   private final static Map<Integer, Hardware> hardware = ImmutableMap.of(1, new Hardware(1, "small", 1, 512, 10));
41 
42   private final static AtomicInteger nodeIds = new AtomicInteger(0);
43 
44   /**
45    * simulate creating a server, as this is really going to happen with the api underneath
46    * 
47    * @param name
48    * @param name
49    * @param imageId
50    * @param hardwareId
51    * @return new server
52    */
53   public Server createServerInDC(String datacenter, String name, int imageId, int hardwareId) {
54      Server server = new Server();
55      server.id = nodeIds.getAndIncrement();
56      server.name = name;
57      server.datacenter = datacenter;
58      server.imageId = imageId;
59      server.hardwareId = hardwareId;
60      server.publicAddress = "7.1.1." + server.id;
61      server.privateAddress = "10.1.1." + server.id;
62      server.loginUser = "root";
63      server.password = "password";
64      servers.put(server.id, server);
65      return server;
66   }
67 
68   public Server getServer(int serverId) {
69      return servers.get(serverId);
70   }
71 
72   public Iterable<Server> listServers() {
73      return servers.values();
74   }
75 
76   public Image getImage(int imageId) {
77      return images.get(imageId);
78   }
79 
80   public Iterable<Image> listImages() {
81      return images.values();
82   }
83 
84   public Hardware getHardware(int hardwareId) {
85      return hardware.get(hardwareId);
86   }
87 
88   public Iterable<org.jclouds.servermanager.Hardware> listHardware() {
89      return hardware.values();
90   }
91 
92   public void destroyServer(int serverId) {
93      servers.remove(serverId);
94   }
95 
96   public void rebootServer(int serverId) {
97   }
98 
99   public void stopServer(int serverId) {
100   }
101   
102   public void startServer(int serverId) {
103   }
104}

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