var Thrift = require('./thrift-node');
var TestNext = require('./TestNextNode');

function TestComponent() {
}

TestComponent.prototype.testVoid = function (callback) {
    console.log('component:testVoid()');
    callback();
};

TestComponent.prototype.testString = function (thing, callback) {
    console.log('component:testString(' + thing + ')');
    callback(thing);
};

TestComponent.prototype.testException = function (arg, callback) {
    console.log('component:testException(' + arg + ')');
    if (arg == 'Xception') {
        throw new TestNext.Xception({
            errorCode: 1001,
            message: arg
        });
    } else if (arg == 'ApplicationException') {
        throw new Thrift.TApplicationException(arg);
    } else {
        callback({ string_thing: arg });
    }
};

exports.TestComponent = TestComponent;

