EMMA Coverage Report (generated Wed Jun 22 19:47:49 EDT 2011)
[all classes][org.jclouds.scriptbuilder.statements.login]

COVERAGE SUMMARY FOR SOURCE FILE [DefaultConfiguration.java]

nameclass, %method, %block, %line, %
DefaultConfiguration.java0%   (0/2)0%   (0/7)0%   (0/73)0%   (0/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DefaultConfiguration0%   (0/1)0%   (0/5)0%   (0/32)0%   (0/9)
DefaultConfiguration (): void 0%   (0/1)0%   (0/20)0%   (0/5)
cryptFunction (): Function 0%   (0/1)0%   (0/3)0%   (0/1)
defaultAdminSshKeys (): Supplier 0%   (0/1)0%   (0/3)0%   (0/1)
defaultAdminUsername (): Supplier 0%   (0/1)0%   (0/3)0%   (0/1)
passwordGenerator (): Supplier 0%   (0/1)0%   (0/3)0%   (0/1)
     
class DefaultConfiguration$10%   (0/1)0%   (0/2)0%   (0/41)0%   (0/4)
DefaultConfiguration$1 (DefaultConfiguration): void 0%   (0/1)0%   (0/6)0%   (0/1)
get (): Map 0%   (0/1)0%   (0/35)0%   (0/3)

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.scriptbuilder.statements.login;
20 
21import static com.google.common.base.Charsets.UTF_8;
22 
23import java.io.File;
24import java.io.IOException;
25import java.util.Map;
26 
27import javax.inject.Singleton;
28 
29import org.jclouds.crypto.Sha512Crypt;
30import org.jclouds.crypto.SshKeys;
31import org.jclouds.scriptbuilder.statements.login.AdminAccess.Configuration;
32import org.jclouds.util.PasswordGenerator;
33 
34import com.google.common.base.Function;
35import com.google.common.base.Supplier;
36import com.google.common.base.Suppliers;
37import com.google.common.collect.ImmutableMap;
38import com.google.common.io.Files;
39 
40/**
41 * 
42 * @author Adrian Cole
43 * 
44 */
45@Singleton
46public class DefaultConfiguration implements Configuration {
47 
48   private final Supplier<String> defaultAdminUsername = Suppliers.ofInstance(System.getProperty("user.name"));
49   private final Supplier<Map<String, String>> defaultAdminSshKeys = new Supplier<Map<String, String>>() {
50 
51      @Override
52      public Map<String, String> get() {
53         try {
54            return ImmutableMap.of("public",
55                  Files.toString(new File(System.getProperty("user.home") + "/.ssh/id_rsa.pub"), UTF_8), "private",
56                  Files.toString(new File(System.getProperty("user.home") + "/.ssh/id_rsa"), UTF_8));
57         } catch (IOException e) {
58            return SshKeys.generate();
59         }
60      }
61   };
62   private final Supplier<String> passwordGenerator = PasswordGenerator.INSTANCE;
63   private final Function<String, String> cryptFunction = Sha512Crypt.function();
64 
65   @Override
66   public Supplier<String> defaultAdminUsername() {
67      return defaultAdminUsername;
68   }
69 
70   @Override
71   public Supplier<Map<String, String>> defaultAdminSshKeys() {
72      return defaultAdminSshKeys;
73   }
74 
75   @Override
76   public Supplier<String> passwordGenerator() {
77      return passwordGenerator;
78   }
79 
80   @Override
81   public Function<String, String> cryptFunction() {
82      return cryptFunction;
83   }
84}

[all classes][org.jclouds.scriptbuilder.statements.login]
EMMA 2.0.5312 (C) Vladimir Roubtsov