EMMA Coverage Report (generated Mon Oct 17 05:41:20 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 * 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.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