EMMA Coverage Report (generated Tue Jun 21 05:51:52 EDT 2011)
[all classes][org.jclouds.compute.callables]

COVERAGE SUMMARY FOR SOURCE FILE [RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilComplete.java]

nameclass, %method, %block, %line, %
RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilComplete.java0%   (0/1)0%   (0/2)0%   (0/138)0%   (0/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilComplete0%   (0/1)0%   (0/2)0%   (0/138)0%   (0/10)
RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilComplete (Predicate, Function... 0%   (0/1)0%   (0/13)0%   (0/3)
doCall (): ExecResponse 0%   (0/1)0%   (0/125)0%   (0/7)

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.compute.callables;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import javax.inject.Inject;
24import javax.inject.Named;
25 
26import org.jclouds.compute.domain.ExecResponse;
27import org.jclouds.compute.domain.NodeMetadata;
28import org.jclouds.compute.options.RunScriptOptions;
29import org.jclouds.compute.predicates.ScriptStatusReturnsZero.CommandUsingClient;
30import org.jclouds.scriptbuilder.domain.Statement;
31import org.jclouds.ssh.SshClient;
32 
33import com.google.common.base.Function;
34import com.google.common.base.Predicate;
35import com.google.inject.assistedinject.Assisted;
36 
37/**
38 * 
39 * @author Adrian Cole
40 */
41public class RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilComplete extends RunScriptOnNodeAsInitScriptUsingSsh {
42   protected final Predicate<CommandUsingClient> runScriptNotRunning;
43 
44   @Inject
45   public RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilComplete(
46            @Named("SCRIPT_COMPLETE") Predicate<CommandUsingClient> runScriptNotRunning,
47            Function<NodeMetadata, SshClient> sshFactory, @Assisted NodeMetadata node, @Assisted Statement script,
48            @Assisted RunScriptOptions options) {
49      super(sshFactory, node, script, options);
50      this.runScriptNotRunning = checkNotNull(runScriptNotRunning, "runScriptNotRunning");
51   }
52 
53   @Override
54   public ExecResponse doCall() {
55      ExecResponse returnVal = super.doCall();
56      boolean complete = runScriptNotRunning.apply(new CommandUsingClient("./" + name + " status", ssh));
57      logger.debug("<< complete(%s)", complete);
58      if (logger.isDebugEnabled() || returnVal.getExitCode() != 0) {
59         logger.debug("<< stdout from %s as %s@%s\n%s", name, ssh.getUsername(), ssh.getHostAddress(), ssh.exec(
60                  "./" + name + " tail").getOutput());
61         logger.debug("<< stderr from %s as %s@%s\n%s", name, ssh.getUsername(), ssh.getHostAddress(), ssh.exec(
62                  "./" + name + " tailerr").getOutput());
63      }
64      return returnVal;
65   }
66}

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