本文整理汇总了Java中i5.las2peer.connectors.webConnector.WebConnector类的典型用法代码示例。如果您正苦于以下问题:Java WebConnector类的具体用法?Java WebConnector怎么用?Java WebConnector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebConnector类属于i5.las2peer.connectors.webConnector包,在下文中一共展示了WebConnector类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startServer
import i5.las2peer.connectors.webConnector.WebConnector; //导入依赖的package包/类
/**
* Called before the tests start.
*
* Sets up the node and initializes connector and users that can be used throughout the tests.
*
* @throws Exception
*/
@Before
public void startServer() throws Exception {
// start node
node = new LocalNodeManager().newNode();
testAgent = MockAgentFactory.getAdam();
testAgent.unlock(testPass);
node.storeAgent(testAgent);
node.launch();
ServiceAgentImpl testService = ServiceAgentImpl.createServiceAgent(testServiceClass, "a pass");
testService.unlock("a pass");
node.registerReceiver(testService);
// start connector
logStream = new ByteArrayOutputStream();
connector = new WebConnector(true, 0, false, 0);
connector.setLogStream(new PrintStream(logStream));
connector.start(node);
client = new MiniClient();
client.setConnectorEndpoint(connector.getHttpEndpoint());
client.setLogin(testAgent.getIdentifier(), testPass);
}
示例2: startServer
import i5.las2peer.connectors.webConnector.WebConnector; //导入依赖的package包/类
@Before
public void startServer() throws Exception {
// start Node
node = TestSuite.launchNetwork(1).get(0);
user1 = MockAgentFactory.getAdam();
user1.unlock(adamsPass);
node.storeAgent(user1);
ServiceAgentImpl testService = ServiceAgentImpl.createServiceAgent(testServiceClass, "a pass");
testService.unlock("a pass");
node.registerReceiver(testService);
// start connector
logStream = new ByteArrayOutputStream();
connector = new WebConnector(true, HTTP_PORT, false, 1000);
connector.setLogStream(new PrintStream(logStream));
connector.start(node);
Thread.sleep(1000); // wait a second for the connector to become ready
c1 = new MiniClient();
c1.setConnectorEndpoint(connector.getHttpEndpoint());
c1.setLogin(user1.getIdentifier(), "adamspass");
}
示例3: startServer
import i5.las2peer.connectors.webConnector.WebConnector; //导入依赖的package包/类
/**
* Called before the tests start.
*
* Sets up the node and initializes connector and users that can be used throughout the tests.
*
* @throws Exception
*/
@BeforeClass
public static void startServer() throws Exception {
// start node
node = new LocalNodeManager().newNode();
user1 = MockAgentFactory.getAdam();
user2 = MockAgentFactory.getAbel();
user3 = MockAgentFactory.getEve();
user1.unlock("adamspass");
user2.unlock("abelspass");
user3.unlock("evespass");
Agent[] as;
as = new Agent[] { user1, user2 };
group1 = GroupAgentImpl.createGroupAgent(as);
group1.unlock(user1);
as = new Agent[] { user2, user3 };
group2 = GroupAgentImpl.createGroupAgent(as);
group2.unlock(user2);
node.storeAgent(user1);
node.storeAgent(user2);
node.storeAgent(user3);
node.storeAgent(group1);
node.storeAgent(group2);
node.launch();
ServiceAgentImpl testService = ServiceAgentImpl.createServiceAgent(testServiceClass, "a pass");
testService.unlock("a pass");
node.registerReceiver(testService);
// start connector
logStream = new ByteArrayOutputStream();
connector = new WebConnector(true, 0, false, 0);
connector.setLogStream(new PrintStream(logStream));
connector.start(node);
Thread.sleep(1000); // wait a second for the connector to become ready
c1 = new MiniClient();
c1.setConnectorEndpoint(connector.getHttpEndpoint());
c1.setLogin(user1.getIdentifier(), "adamspass");
c2 = new MiniClient();
c2.setConnectorEndpoint(connector.getHttpEndpoint());
c2.setLogin(user2.getIdentifier(), "abelspass");
c3 = new MiniClient();
c3.setConnectorEndpoint(connector.getHttpEndpoint());
c3.setLogin(user3.getIdentifier(), "evespass");
}
示例4: startServer
import i5.las2peer.connectors.webConnector.WebConnector; //导入依赖的package包/类
/**
* Called before the tests start.
*
* Sets up the node and initializes connector and users that can be used throughout the tests.
*
* @throws Exception
*/
@BeforeClass
public static void startServer() throws Exception {
// start node
node = new LocalNodeManager().newNode();
user = MockAgentFactory.getAdam();
node.storeAgent(user);
node.launch();
ServiceAgentImpl testService = ServiceAgentImpl.createServiceAgent(testServiceClass, "a pass");
testService.unlock("a pass");
node.registerReceiver(testService);
// start connector
logStream = new ByteArrayOutputStream();
// connector = new WebConnector(true,HTTP_PORT,false,1000,"./etc/xmlc");
connector = new WebConnector(true, 0, false, 0);
connector.setLogStream(new PrintStream(logStream));
connector.start(node);
Thread.sleep(1000); // wait a second for the connector to become ready
c1 = new MiniClient();
c1.setConnectorEndpoint(connector.getHttpEndpoint());
c1.setLogin(user.getIdentifier(), "adamspass");
// String xml=RESTMapper.mergeXMLs(new String[]{RESTMapper.getMethodsAsXML(SurveyService.class)});
// System.out.println(xml);
// first delete all surveys & questionnaires
c1.sendRequest("DELETE", "mobsos/surveys", "");
c1.sendRequest("DELETE", "mobsos/questionnaires", "");
}