Esempio n. 1
0
int main() {


	cout << "Simple test server" << endl;



	// Register Intermediaries
	//--------------------------------
	HeaderInjectTimestampFactory * f = new HeaderInjectTimestampFactory();
	IntermediariesFactory::provideIntermediary("HeaderInjectTimestamp",f);


	// Prepare Engine
	//-------------------------
	EUVNI::WSB::WSEngine * engine = new EUVNI::WSB::WSEngine();


	// Network
	//-------------------------

	//-- Create Loopback connector for SOAP
    LoopbackConnector * connector = new LoopbackConnector();
    connector->setMessageType("soap");

    //---- Add A broker tree
    EUVNI::WSB::BrokeringTree * connectorBTree = new EUVNI::WSB::BrokeringTree();
    connectorBTree->readInFromString(readFile("messages/empty_connector_tree.xml"));
    connector->setBrokeringTree(connectorBTree);

	//-- Add  loopback connector to Network
	engine->getNetwork().addConnector(static_cast<AbstractConnector*>(connector));

	// Start
	//-------------------------
	engine->start();

	// Test Message interface
	//---------------------------------------

	//-- Inject messages
	connector->loopMessage(readFile("messages/empty.xml"));
	//connector->loopMessage(readFile("messages/wrong_syntax_empty.xml"));



	cout << "*I: Press any key to exit" << endl;
	char c;
	cin >> c;

	engine->stop();

	return 0;

}
Esempio n. 2
0
        virtual void SetUp() {



            //-- Register Loopback Connector with SOAP Support
            connector = new LoopbackConnector();
            this->network.addConnector(connector);
            connector->setMessageType("soap");

            //-- Start
            this->init();
            this->start();

        }
Esempio n. 3
0
/**
 * This test to have a loopback server, that executes scripts passed in wsa:Action
 * @return
 */
int main() {


	cout << "TCL Invoker Loopback tester" << endl;



	// Register Intermediaries
	//--------------------------------
	HeaderInjectTimestampFactory * f = new HeaderInjectTimestampFactory();
	IntermediariesFactory::provideIntermediary("HeaderInjectTimestamp",f);

	TCLInvokeFactory * tclInvokeF = new TCLInvokeFactory();
	tclInvokeF->setBasePath("tests/tcl");
	IntermediariesFactory::provideIntermediary("TCLInvoke",tclInvokeF);




	// Prepare Engine
	//-------------------------
	EUVNI::WSB::WSEngine * engine = new EUVNI::WSB::WSEngine();
	engine->init();

	// Prepare Loopback Connector
	//-------------------------------------

	//-- Create Loopback connector for SOAP
	LoopbackConnector * connector = new LoopbackConnector();
	connector->setMessageType("soap");
	engine->getNetwork().addConnector(static_cast<AbstractConnector*>(connector));

	// Brokering Tree for TCL
	//-------------------------
	engine->getBroker().readInFromString(readFile("tests/broker/tcl_broker.xml"));

	// Start
	//-------------------------

	engine->start();

	// Test Message interface
	//---------------------------------------
	while(1) {

		string input;
		cout << "*I: Enter a TCL script name, or 'q' to stop" << endl;
		cin >> input;

		//-- Quit ?
		if (input=="q")
			break;

		//-- Prepare SOAP Message
		//---------------

		SOAPMessage * soap = new SOAPMessage();
		// <wsbtcl:InvokeTCL xmlns:wsbtcl="euvni:wsb:tcl" script="scriptname.tcl" />
		DOMElement * elt = soap->addHeader("euvni:wsb:tcl","InvokeTCL");
		elt->setAttribute(X("script"),X(input.c_str()));

		//-- Add Action

		//-- Inject
		connector->loopMessage(soap->toString());

		delete soap;

	}

	//-- Inject messages
	//connector->loopMessage(readFile("messages/empty.xml"));
	//connector->loopMessage(readFile("messages/wrong_syntax_empty.xml"));

	engine->stop();
	engine->finish();

	return 0;

}