本文整理汇总了Java中i5.las2peer.webConnector.client.MiniClient类的典型用法代码示例。如果您正苦于以下问题:Java MiniClient类的具体用法?Java MiniClient怎么用?Java MiniClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MiniClient类属于i5.las2peer.webConnector.client包,在下文中一共展示了MiniClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 );
}
}
开发者ID:rwth-acis,项目名称:LAS2peer-AnnotationService,代码行数:28,代码来源:ServiceTest.java
示例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);
}
}
开发者ID:learning-layers,项目名称:Expert-Identification-Service,代码行数:20,代码来源:ServiceTest.java
示例3: 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);
}
}
开发者ID:rwth-acis,项目名称:las2peer-WebConnector,代码行数:19,代码来源:WebConnectorTest.java
示例4: 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");
}
}
开发者ID:rwth-acis,项目名称:las2peer-WebConnector,代码行数:17,代码来源:WebConnectorTest.java
示例5: testPath
import i5.las2peer.webConnector.client.MiniClient; //导入依赖的package包/类
@Test
public void testPath() {
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try {
c.setLogin(Long.toString(testAgent.getId()), testPass);
ClientResponse result = c.sendRequest("GET", "version/path", "");
assertTrue(result.getResponse().trim().endsWith("version/"));
result = c.sendRequest("GET", "version/v1/path", "");
assertTrue(result.getResponse().trim().endsWith("version/v1/"));
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
开发者ID:rwth-acis,项目名称:las2peer-WebConnector,代码行数:19,代码来源:WebConnectorTest.java
示例6: 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);
}
}
开发者ID:rwth-acis,项目名称:las2peer-WebConnector,代码行数:17,代码来源:WebConnectorTest.java
示例7: 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);
}
}
开发者ID:rwth-acis,项目名称:las2peer-WebConnector,代码行数:20,代码来源:WebConnectorTest.java
示例8: 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);
}
}
开发者ID:rwth-acis,项目名称:las2peer-WebConnector,代码行数:17,代码来源:WebConnectorTest.java
示例9: testUploadLimit
import i5.las2peer.webConnector.client.MiniClient; //导入依赖的package包/类
@Test
public void testUploadLimit() {
MiniClient c = new MiniClient();
c.setAddressPort(HTTP_ADDRESS, HTTP_PORT);
try {
c.setLogin(Long.toString(testAgent.getId()), testPass);
byte[] testContent = new byte[WebConnector.DEFAULT_MAX_REQUEST_BODY_SIZE];
new Random().nextBytes(testContent);
String base64 = Base64.getEncoder().encodeToString(testContent);
ClientResponse result = c.sendRequest("POST", "test", base64);
assertEquals(HttpURLConnection.HTTP_ENTITY_TOO_LARGE, result.getHttpCode());
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
开发者ID:rwth-acis,项目名称:las2peer-WebConnector,代码行数:18,代码来源:WebConnectorTest.java
示例10: 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);
}
}
开发者ID:rwth-acis,项目名称:las2peer-WebConnector,代码行数:27,代码来源:WebConnectorTest.java
示例11: 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);
}
}
开发者ID:rwth-acis,项目名称:Expert-Recommender-Service,代码行数:31,代码来源:ServiceTest.java
示例12: testIndexerCSV
import i5.las2peer.webConnector.client.MiniClient; //导入依赖的package包/类
@Ignore
@Test
public void testIndexerCSV() {
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=csv", "nature");
assertEquals(200, result.getHttpCode());
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
开发者ID:rwth-acis,项目名称:Expert-Recommender-Service,代码行数:17,代码来源:ServiceTest.java
示例13: 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);
}
}
开发者ID:rwth-acis,项目名称:Expert-Recommender-Service,代码行数:17,代码来源:ServiceTest.java
示例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);
}
}
开发者ID:rwth-acis,项目名称:Expert-Recommender-Service,代码行数:22,代码来源:ServiceTest.java
示例15: testSemantics
import i5.las2peer.webConnector.client.MiniClient; //导入依赖的package包/类
@Ignore
@Test
public void testSemantics() {
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/5/semantics", "");
assertEquals(200, result.getHttpCode());
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
开发者ID:rwth-acis,项目名称:Expert-Recommender-Service,代码行数:17,代码来源:ServiceTest.java
示例16: validateLogin
import i5.las2peer.webConnector.client.MiniClient; //导入依赖的package包/类
/**
*
* Tests the validate method.
*
*/
@Test
public void validateLogin() {
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(200, result.getHttpCode());
System.out.println("Result of 'testValidateLogin': " + result.getResponse().trim());
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
开发者ID:rwth-acis,项目名称:REST-OCD-Services,代码行数:22,代码来源:ServiceTest.java
示例17: getGraphMetaXMLFormat
import i5.las2peer.webConnector.client.MiniClient; //导入依赖的package包/类
@Test
public void getGraphMetaXMLFormat() 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/" + SawmillGraphId + "?outputFormat=META_XML", "");
System.out.println("Result of 'testGetGraphs' on Sawmill: " + result.getResponse().trim());
assertEquals(200, result.getHttpCode());
result = c.sendRequest("GET", mainPath + "graphs/" + DolphinsGraphId + "?outputFormat=META_XML", "");
System.out.println("Result of 'testGetGraphs' on Dolphins: " + result.getResponse().trim());
assertEquals(200, result.getHttpCode());
result = c.sendRequest("GET",
mainPath + "graphs/" + AperiodicTwoCommunitiesGraphId + "?outputFormat=META_XML", "");
System.out.println("Result of 'testGetGraphs' on AperiodicTwoCommunities: " + result.getResponse().trim());
assertEquals(200, result.getHttpCode());
} catch (Exception e) {
e.printStackTrace();
fail("Exception: " + e);
}
}
开发者ID:rwth-acis,项目名称:REST-OCD-Services,代码行数:26,代码来源:ServiceTest.java
示例18: 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);
}
}
开发者ID:rwth-acis,项目名称:REST-OCD-Services,代码行数:18,代码来源:ServiceTest.java
示例19: 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);
}
}
开发者ID:rwth-acis,项目名称:REST-OCD-Services,代码行数:21,代码来源:ServiceTest.java
示例20: 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);
}
}
开发者ID:rwth-acis,项目名称:REST-OCD-Services,代码行数:25,代码来源:ServiceTest.java
注:本文中的i5.las2peer.webConnector.client.MiniClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论