Sponsored Content
Top Forums Shell Programming and Scripting FNG Question: Test if remote server has booted Post 302343194 by vwgtiturbo on Wednesday 12th of August 2009 01:39:32 AM
Old 08-12-2009
Thanks for that! I didn't have the [ true ] portion in my mock up (which may explain why I never got it to work...). I like reading your responses; I always learn something. Thanks again, and I'll try not to be a burden for a while!
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rsh: test $? on remote system.

Hi, a little help. I need to test the return code of a list file command on a remote system (Unix) using the rsh command. More exactly, to test is a directory exists, I try the following command: rsh $remoteHost "ls -la " $DirRemote Now, if the $DirRemote is not correct and I test... (3 Replies)
Discussion started by: gio123bg
3 Replies

2. UNIX for Advanced & Expert Users

execute a script on test server from dev server

I need to execute a script from dev server which is located on Test server.I can use ftp to connect to dev server and from there how can i execute a command on test server. Thanks (5 Replies)
Discussion started by: ukatru
5 Replies

3. Shell Programming and Scripting

preserving the timestamp of a file when copied from remote server to local server using ftp

Hi, I need to copy few files from remote server to local server. I write a shell script to connect to the remote server using ftp and go to that path. Now i need to copy those files in the remote directory to my local server with the timestamp of all those files shouldnt be changed. ... (5 Replies)
Discussion started by: arunkumarmc
5 Replies

4. Programming

SFTP from one remote server to another remote server from desktop

Hi, I have 1. lappy 2. server A 3. server B Now, what i need is to run a command from lappy that will sftp a file from server A to server B. Please guide me to achieve this. -akash (1 Reply)
Discussion started by: akash.mahakode
1 Replies

5. Shell Programming and Scripting

How to Append the output of a script running in remote server to a file in local server?

Hi guys, So i am in server1 and i have to login to server 2, 3,4 and run some script there(logging script) and output its result. What i am doing is running the script in server2 and outputting it to a file in server 2 and then Scp'ing the file to server1. Similarly i am doing this for other... (5 Replies)
Discussion started by: srkmish
5 Replies

6. Shell Programming and Scripting

Test if Remote server is up and running before SFTP'ing files (in batch mode)

Hello, In our Data Warehouse environment, before our batch SFTP jobs kick off to pull the files from remote servers, I would like to setup a pre-sftp job that would test if all the remote servers from where the files are being pulled, are up and running. If any one of the remote serer is... (2 Replies)
Discussion started by: Dippu
2 Replies

7. Shell Programming and Scripting

Sudo connect to a remote server and execute scripts in remote server

Hello Every one!! I am trying to write a shell script which will connect to a remote server and execute scripts which are at a certain path in the remote server. Before this I am using a sudo command to change the user. The place where I am stuck is, I am able to connect to the... (6 Replies)
Discussion started by: masubram
6 Replies

8. UNIX for Beginners Questions & Answers

How to test if remote dir exist?

Hello, :) I'm trying to test if a remote directory exist per ssh, I have already made a ssh key and it works : #!/bin/bash HOST="10.10.1.22" FILE_PATH="/var/wwww/html" ssh -q $HOST ] && echo "Directory exists" || echo "Directory does not exist"; Output : ... (4 Replies)
Discussion started by: Arnaudh78
4 Replies

9. Shell Programming and Scripting

Script connect to remote server, not find files and exit only from remote server, but not from scrip

I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)
Discussion started by: digioleg54
3 Replies
Test::MockObject::Extends(3)				User Contributed Perl Documentation			      Test::MockObject::Extends(3)

NAME
Test::MockObject::Extends - mock part of an object or class SYNOPSIS
use Some::Class; use Test::MockObject::Extends; # create an object to mock my $object = Some::Class->new(); # wrap that same object with a mocking wrapper $object = Test::MockObject::Extends->new( $object ); # now chain mock and control calls $object->set_true( 'parent_method' ) ->set_always( -grandparent_method => 1 ) ->clear(); DESCRIPTION
Test::MockObject::Extends lets you mock one or more methods of an existing object or class. This can be very handy when you're testing a well-factored module that does almost exactly what you want. Wouldn't it be handy to take control of a method or two to make sure you receive testable results? Now you can. METHODS
"new( $object | $class )" "new()" takes one optional argument, the object or class to mock. If you're mocking a method for an object that holds internal state, create an appropriate object, then pass it to this constructor. NOTE: this will modify the object in place. If you're mocking an object that does not need state, as in the cases where there's no internal data or you'll only be calling class methods, or where you'll be mocking all of the access to internal data, you can pass in the name of the class to mock partially. If you've not yet loaded the class, this method will try to load it for you. This may fail, so beware. If you pass no arguments, it will assume you really meant to create a normal "Test::MockObject" object and will oblige you. Note that if you pass a class, the object returned will appear to be an instance of that class; this does not mock the class itself. "mock( $methodname, $sub_ref )" See the documentation for Test::MockObject for all of the ways to mock methods and to retrieve method logging information. These methods return the invocant, so you can chain them. "unmock( $methodname )" Removes any active mocking of the named method. This means any calls to that method will hit the method of that name in the class being mocked, if it exists. This method returns the invocant, you can chain it. "isa( $class )" As you'd expect from a mocked object, this will return true for the class it's mocking. INTERNAL METHODS
To do its magic, this module uses several internal methods: o "check_class_loaded( $parent_class )" This verifies that you have the mockee defined. If not, it attempts to load the corresponding module for you. o "gen_autoload( $extended )" Returns an AUTOLOAD subroutine for the mock object that checks that the extended object (or class) can perform the requested method, that Test::MockObject can perform it, or that the parent has an appropriate AUTOLOAD of its own. (It should have its own "can()" in that case too though.) o "gen_can( $extended )" Returns a "can()" method for the mock object that respects the same execution order as "gen_autoload()". o "gen_isa( $extended )" Returns an "isa()" method for the mock object that claims to be the $extended object appropriately. o "gen_get_parents( $extended )" Returns a "__get_parents()" method for the mock object that claims to be the $extended object appropriately. o "gen_package( $extended )" Creates a new unique package for the mock object with the appropriate methods already installed. o "get_class( $invocant )" Returns the class name of the invocant, whether it's an object or a class name. CAVEATS
There may be some weird corner cases with dynamically generated methods in the mocked class. You really should use subroutine declarations though, or at least set "can()" appropriately. There are also potential name collisions with methods in this module or "Test::MockObject", though this should be rare. AUTHOR
chromatic, <chromatic at wgz dot org> Documentation bug fixed by Stevan Little. Additional AUTOLOAD approach suggested by Adam Kennedy. Other bugs reported by Paul the Nomad and Praveen Ray. Thank you all! BUGS
No known bugs. COPYRIGHT
Copyright (c) 2004 - 2011, chromatic. All rights reserved. You may use, modify, and distribute this module under the same terms as Perl 5.10 perl v5.16.3 2012-03-01 Test::MockObject::Extends(3)
All times are GMT -4. The time now is 08:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy