Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

robotremote

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

robotremote - npm Package Compare versions

Comparing version 0.9.2 to 0.9.3

bin/botclient.js

11

example/examplelibrary.js
'use strict';
var fs = require('promised-io/fs'),
robot = require('../lib/robotremote'),
assert = require('assert');

@@ -41,2 +42,7 @@

*
* Each keyword also have the output writer, which enables logging at various levels.
* Here warn level is showed as an example.
* All robot levels are supported including messages with timestamp through timestamp`Level` function.
* See http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.html?r=2.8.5#logging-information
*
* @param str1

@@ -46,3 +52,3 @@ * @param str2

lib.stringsShouldBeEqual = function (str1, str2) {
console.log('Comparing \'%s\' to \'%s\'', str1, str2);
this.output.warn('Comparing \'%s\' to \'%s\'', str1, str2);
assert.equal(str1, str2, 'Given strings are not equal');

@@ -54,4 +60,3 @@ };

if (!module.parent) {
var robot = require('../lib/robotremote');
var server = new robot.Server([lib], { host: 'localhost', port: 8270, allowStop: true });
var server = new robot.Server([lib], { host: 'localhost', port: 8270 });
}
'use strict';
var xmlrpc = require('xmlrpc'),
util = require('util'),
isPromise = require('is-promise');

@@ -9,2 +10,3 @@

this.port = options.port;
this.allowStop = options.allowStop === true || false;
this.timeout = parseInt(options.timeout, 10) || 10000;

@@ -33,7 +35,12 @@

this.allowStop = options.allowStop === true || false;
this.server = xmlrpc.createServer(options);
// TODO trovare modo migliore per fargliele riferire e anche illog dentro con va col ctrl C
this.stopRemoteServer.host = this.host;
this.stopRemoteServer.port = this.port;
this.stopRemoteServer.allowStop = this.allowStop;
this.stopRemoteServer.server = this.server;
// Register functions
var that = this;
var that = this;// TODO rpcWrappare anche stopremoteserver
var rpcWrap = function (keyword) {

@@ -78,11 +85,11 @@ return function (method, params, response) {

var that = this;
that.server.close(function () {
process.nextTick(function () {
that.server.close(function () {
});
});
setTimeout(function () {
process.kill(process.pid);// Still want to stop if we have open connections.
}, 2000);
return true;
} else {
console.log(prefix + ' does not allow stopping');
return false;
var message = prefix + ' does not allow stopping';
console.log(message);
return new Error(message);
}

@@ -96,2 +103,3 @@ };

var timeout = null;
var output = '';
var keywordReturn = function (val) {

@@ -103,3 +111,3 @@ if (timeout === null) {

timeout = null;
var result = {status: 'PASS', output: '', traceback: '', return: '', error: ''};
var result = { output: output };
if (val instanceof Error) {

@@ -109,3 +117,6 @@ result.traceback = val.stack.toString();

result.error = val.toString();
result.contibuable = val.continuable === true || false;
result.fatal = val.fatal === true || false;
} else {
result.status = 'PASS';
result.return = val;

@@ -118,5 +129,10 @@ }

}, this.timeout);
keyword.output = new KeywordLogger(function (line) {
output = output.concat(line);
});
var result;
try {
result = keyword.apply(this, params);
result = keyword.apply(keyword, params);
} catch (e) {

@@ -139,4 +155,35 @@ // Got sync keyword failure.

function KeywordLogger(writeOutput) {
function outputWriter(level) {
return function () {
writeOutput('*' + level + '* ' + util.format.apply(null, arguments) + '\n');
};
}
function Client(options) {
this.trace = outputWriter('TRACE');
this.info = outputWriter('INFO');
this.debug = outputWriter('DEBUG');
this.warn = outputWriter('WARN');
this.html = outputWriter('HTML');
function timestampOutputWriter(level) {
return function () {
writeOutput('*' + level + ':' + new Date().getTime() + '* ' + util.format.apply(null, arguments) + '\n');
};
}
this.timestampTrace = timestampOutputWriter('TRACE');
this.timestampInfo = timestampOutputWriter('INFO');
this.timestampDebug = timestampOutputWriter('DEBUG');
this.timestampWarn = timestampOutputWriter('WARN');
this.timestampHtml = timestampOutputWriter('HTML');
}
/**
* Create a new client with given options
* @param options a dictionary with xmlrpc options. Also path is supported.
* @param ready callback to call when the client is ready.
* @constructor
*/
function Client(options, ready) {
options.path = '/';

@@ -161,5 +208,8 @@ var client = xmlrpc.createClient(options);

});
if (ready !== undefined) {
ready(that);
}
});
}
module.exports.Client = Client;
module.exports.Client = Client;

@@ -17,3 +17,3 @@ {

],
"version": "0.9.2",
"version": "0.9.3",
"preferGlobal": false,

@@ -57,4 +57,3 @@ "homepage": "https://github.com/comick/node-robotremoteserver",

}
],
"optionalDependencies": {}
]
}

@@ -25,2 +25,3 @@ # robotremote

var fs = require('promised-io/fs'),
robot = require('../lib/robotremote'),
assert = require('assert');

@@ -63,2 +64,7 @@

*
* Each keyword also have the output writer, which enables logging at various levels.
* Here warn level is showed as an example.
* All robot levels are supported including messages with timestamp through timestamp`Level` function.
* See http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.html?r=2.8.5#logging-information
*
* @param str1

@@ -68,3 +74,3 @@ * @param str2

lib.stringsShouldBeEqual = function (str1, str2) {
console.log('Comparing \'%s\' to \'%s\'', str1, str2);
this.output.warn('Comparing \'%s\' to \'%s\'', str1, str2);
assert.equal(str1, str2, 'Given strings are not equal');

@@ -76,4 +82,3 @@ };

if (!module.parent) {
var robot = require('../lib/robotremote');
var server = new robot.Server([lib], { host: 'localhost', port: 8270, allowStop: true });
var server = new robot.Server([lib], { host: 'localhost', port: 8270 });
}

@@ -101,3 +106,3 @@ ```

Strings Should Be Equal Hello Hello
Strings Should Be Equal not equal*** Settings ***
Strings Should Be Equal not equal
```

@@ -104,0 +109,0 @@

@@ -15,2 +15,3 @@ *** Settings ***

${remote}= Start Process node ./test/testlibrary.js ${HOST} ${PORT}
Sleep 1s
Process Should Be Running ${remote}

@@ -32,5 +33,3 @@ Import Library Remote http://${HOST}:${PORT}

Stop Remote Server
Wait For Process timeout=10secs
Process Should Be Stopped

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc