use of i5.las2peer.p2p.PastryNodeImpl in project Distributed-Noracle-Backend by Distributed-Noracle.
the class NoracleServiceTest method beforeTest.
/**
* Called before a test starts.
*
* Sets up the node, initializes connector and adds user agent that can be used throughout the test.
*
* @throws Exception
*/
@Before
public void beforeTest() {
try {
nodes = TestSuite.launchNetwork(networkSize);
connector = new WebConnector(null);
connector.start(nodes.get(0));
// don't follow redirects, some tests want to test for correct redirect
// responses
webClient = ClientBuilder.newBuilder().register(MultiPartFeature.class).property(ClientProperties.FOLLOW_REDIRECTS, Boolean.FALSE).build();
startService(nodes.get(0), "i5.las2peer.services.noracleService.NoracleService", NoracleService.API_VERSION);
startService(nodes.get(0), "i5.las2peer.services.noracleService.NoracleAgentService", NoracleService.API_VERSION);
startService(nodes.get(0), "i5.las2peer.services.noracleService.NoracleSpaceService", NoracleService.API_VERSION);
startService(nodes.get(0), "i5.las2peer.services.noracleService.NoracleQuestionService", NoracleService.API_VERSION);
startService(nodes.get(0), "i5.las2peer.services.noracleService.NoracleQuestionRelationService", NoracleService.API_VERSION);
startService(nodes.get(0), "i5.las2peer.services.noracleService.NoracleVoteSe" + "rvice", NoracleService.API_VERSION);
testAgent = MockAgentFactory.getAdam();
testAgent.unlock("adamspass");
PastryNodeImpl activeNode = nodes.get(0);
activeNode.storeAgent(testAgent);
basicAuthHeader = "basic " + Base64.getEncoder().encodeToString((testAgent.getLoginName() + ":" + "adamspass").getBytes(StandardCharsets.UTF_8));
testAgent2 = MockAgentFactory.getEve();
testAgent2.unlock("evespass");
activeNode.storeAgent(testAgent2);
basicAuthHeader2 = "basic " + Base64.getEncoder().encodeToString((testAgent2.getLoginName() + ":" + "evespass").getBytes(StandardCharsets.UTF_8));
baseUrl = connector.getHttpEndpoint() + "/" + NoracleService.RESOURCE_NAME + "/v" + NoracleService.API_VERSION;
} catch (Exception e) {
e.printStackTrace();
Assert.fail(e.toString());
}
}
Aggregations