本文整理汇总了Java中i5.las2peer.webConnector.client.MiniClient.setLogin方法的典型用法代码示例。如果您正苦于以下问题:Java MiniClient.setLogin方法的具体用法?Java MiniClient.setLogin怎么用?Java MiniClient.setLogin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类i5.las2peer.webConnector.client.MiniClient
的用法示例。
在下文中一共展示了MiniClient.setLogin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetCollections
import i5.las2peer.webConnector.client.MiniClient; //导入方法依赖的package包/类
/**
* Tests the AnnotationService for getting all collections
*/
@Test
public void testGetCollections()
{
//AnnotationsClass cl = new AnnotationsClass();
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try
{
c.setLogin(Long.toString(testAgent.getId()), testPass);
//retrieve the collection information
ClientResponse select=c.sendRequest("GET", mainPath +"collections", "");
assertEquals(200, select.getHttpCode());
assertTrue(select.getResponse().trim().contains(objectCollection));
System.out.println("Result of select in 'testGetCollections': " + select.getResponse().trim());
}
catch(Exception e)
{
e.printStackTrace();
fail ( "Exception: " + e );
}
}
示例2: testDuringDevelopment
import i5.las2peer.webConnector.client.MiniClient; //导入方法依赖的package包/类
@Ignore
@Test
public void testDuringDevelopment() {
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try {
c.setLogin(Long.toString(testAgent.getId()), testPass);
ClientResponse result=c.sendRequest("POST", mainPath+"datasets/1/parse?format=xml", "C:\\Users\\gulyabani\\Downloads\\fitness.stackexchange.com\\Posts.xml,C:\\Users\\gulyabani\\Downloads\\fitness.stackexchange.com\\Users.xml");
System.out.println("Result of 'testExampleMethod': " +result.getResponse().trim());
assertEquals(200, result.getHttpCode());
assertTrue(result.getResponse().trim().contains("testInput"));
//"testInput" name is part of response
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
示例3: getGraphInvalidID
import i5.las2peer.webConnector.client.MiniClient; //导入方法依赖的package包/类
@Test
public void getGraphInvalidID() throws AdapterException, FileNotFoundException {
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try {
c.setLogin(Long.toString(testAgent.getId()), testPass);
ClientResponse result = c.sendRequest("GET", mainPath + "graphs/" + 999 + "?outputFormat=META_XML", "");
System.out.println("Result of 'testGetGraphs' on Sawmill: " + result.getResponse().trim());
assertEquals(400, result.getHttpCode());
result = c.sendRequest("GET", mainPath + "graphs/" + -4 + "?outputFormat=META_XML", "");
System.out.println("Result of 'testGetGraphs' on Sawmill: " + result.getResponse().trim());
assertEquals(400, result.getHttpCode());
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
示例4: testExceptions
import i5.las2peer.webConnector.client.MiniClient; //导入方法依赖的package包/类
@Test
public void testExceptions() {
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try {
// unknown service
c.setLogin(Long.toString(testAgent.getId()), testPass);
ClientResponse result = c.sendRequest("GET", "doesNotExist", "");
assertEquals(404, result.getHttpCode());
// exception in invocation
result = c.sendRequest("GET", "test/exception", "");
assertEquals(500, result.getHttpCode());
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
示例5: testCrossOriginHeader
import i5.las2peer.webConnector.client.MiniClient; //导入方法依赖的package包/类
@Test
public void testCrossOriginHeader() {
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try {
c.setLogin(Long.toString(testAgent.getId()), testPass);
// this test should work for an unknown function, too
ClientResponse response = c.sendRequest("GET", "asdag", "");
assertEquals(connector.crossOriginResourceDomain, response.getHeader("Access-Control-Allow-Origin"));
assertEquals(String.valueOf(connector.crossOriginResourceMaxAge),
response.getHeader("Access-Control-Max-Age"));
} catch (Exception e) {
fail("Not existing service caused wrong exception");
}
}
示例6: startSimulation
import i5.las2peer.webConnector.client.MiniClient; //导入方法依赖的package包/类
@Test
public void startSimulation() throws AdapterException, FileNotFoundException {
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try {
c.setLogin(Long.toString(testAgent.getId()), testPass);
ClientResponse result = c.sendRequest("POST",
mainPath + "simulation" , "{\"graphId\":2,\"dynamic\":\"Moran\",\"dynamicValues\":[],\"payoffCC\":1.0,\"payoffCD\":1.0,\"payoffDC\":1.0,\"payoffDD\":1.0,\"iterations\":20}", "application/json", "", new HashMap<>());
System.out.println("Result of 'startSimulation' " + result.getResponse().trim());
assertEquals(400, result.getHttpCode());
c.setLogin(Long.toString(testAgent.getId()), testPass);
result = c.sendRequest("POST",
mainPath + "simulation" , "{\"graphId\":2,\"dynamic\":\"Moran\",\"dynamicValues\":[],\"payoffValues\":[1.0,2.0,3.1,0.0],\"iterations\":20}", "application/json", "", new HashMap<>());
System.out.println("Result of 'startSimulation' " + result.getResponse().trim());
assertEquals(400, result.getHttpCode());
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
示例7: testSwagger
import i5.las2peer.webConnector.client.MiniClient; //导入方法依赖的package包/类
@Test
public void testSwagger() {
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try {
c.setLogin(Long.toString(testAgent.getId()), testPass);
ClientResponse result = c.sendRequest("GET", "swaggertest/swagger.json", "");
assertTrue(result.getResponse().trim().contains("createSomething"));
assertTrue(result.getResponse().trim().contains("subresource/content"));
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
示例8: testResponseCode
import i5.las2peer.webConnector.client.MiniClient; //导入方法依赖的package包/类
@Test
public void testResponseCode() {
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try {
c.setLogin(Long.toString(testAgent.getId()), testPass);
ClientResponse result = c.sendRequest("PUT", "swaggertest/create/notfound", "");
assertEquals(404, result.getHttpCode());
result = c.sendRequest("PUT", "swaggertest/create/asdf", "");
assertEquals(200, result.getHttpCode());
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
示例9: testSubresource
import i5.las2peer.webConnector.client.MiniClient; //导入方法依赖的package包/类
@Test
public void testSubresource() {
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try {
c.setLogin(Long.toString(testAgent.getId()), testPass);
ClientResponse result = c.sendRequest("GET", "swaggertest/subresource/content", "");
assertEquals(200, result.getHttpCode());
assertEquals("test", result.getResponse().trim());
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
示例10: testIndexerXML
import i5.las2peer.webConnector.client.MiniClient; //导入方法依赖的package包/类
@Ignore
@Test
public void testIndexerXML() {
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try {
c.setLogin(Long.toString(testAgent.getId()), testPass);
ClientResponse result = c.sendRequest("POST", mainPath + "indexer?inputFormat=xml", "reqbazaar");
assertEquals(200, result.getHttpCode());
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
示例11: testValidateLogin
import i5.las2peer.webConnector.client.MiniClient; //导入方法依赖的package包/类
@Test
public void testValidateLogin()
{
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try
{
c.setLogin(Long.toString(testAgent.getId()), testPass);
// ClientResponse result=c.sendRequest("GET", mainPath +"validate", "");
// assertEquals(HttpURLConnection.HTTP_OK, result.getHttpCode());
} catch (Exception e)
{
e.printStackTrace();
fail("Exception: " + e);
}
}
示例12: testAuthParamSanitization
import i5.las2peer.webConnector.client.MiniClient; //导入方法依赖的package包/类
@Test
public void testAuthParamSanitization() {
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try {
c.setLogin(Long.toString(testAgent.getId()), testPass);
// test auth params in GET
ClientResponse result = c.sendRequest("GET", "test/requesturi?param1=sadf&access_token=secret", "");
assertEquals(200, result.getHttpCode());
assertTrue(result.getResponse().contains("param1"));
assertFalse(result.getResponse().contains("secret"));
assertFalse(result.getResponse().contains("access_token"));
// test auth params in header
HashMap<String, String> headers = new HashMap<>();
headers.put("param1", "asdf");
result = c.sendRequest("GET", "test/headers", "", headers);
assertEquals(200, result.getHttpCode());
assertTrue(result.getResponse().toLowerCase().contains("param1"));
assertFalse(result.getResponse().toLowerCase().contains("authorization"));
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
示例13: testExampleMethod
import i5.las2peer.webConnector.client.MiniClient; //导入方法依赖的package包/类
/**
*
* Test the example method that consumes one path parameter
* which we give the value "testInput" in this test.
*
*/
@Test
public void testExampleMethod() {
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try {
c.setLogin(Long.toString(testAgent.getId()), testPass);
// ClientResponse result=c.sendRequest("POST", mainPath
// +"myResourcePath/testInput", ""); //testInput is the pathParam
// ClientResponse result=c.sendRequest("POST", mainPath
// +"recommender", "Who is the expert in compiler?"); //testInput is
// the pathParam
// System.out.println("Result of 'testExampleMethod': " +
// result.getResponse().trim());
// assertEquals(200, result.getHttpCode());
// assertTrue(result.getResponse().trim().contains("testInput"));
// //"testInput" name is part of response
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
示例14: testStemmerMethod
import i5.las2peer.webConnector.client.MiniClient; //导入方法依赖的package包/类
@Ignore
@Test
public void testStemmerMethod() {
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try {
c.setLogin(Long.toString(testAgent.getId()), testPass);
ClientResponse result = c.sendRequest("POST", mainPath + "stemmer", "Who is the expert in compiler catty?"); // testInput
// is
// the
// pathParam
System.out.println("Result of 'testExampleMethod': " + result.getResponse().trim());
assertEquals(200, result.getHttpCode());
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
示例15: getGraphPropertiesXMLFormat
import i5.las2peer.webConnector.client.MiniClient; //导入方法依赖的package包/类
@Test
public void getGraphPropertiesXMLFormat() throws AdapterException, FileNotFoundException {
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try {
c.setLogin(Long.toString(testAgent.getId()), testPass);
ClientResponse result = c.sendRequest("GET",
mainPath + "graphs/" + DolphinsGraphId + "?outputFormat=PROPERTIES_XML", "");
System.out.println("Result of 'testGetGraphs' on Dolphins: " + result.getResponse().trim());
assertEquals(200, result.getHttpCode());
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}