本文整理汇总了Java中org.neo4j.test.server.HTTP类的典型用法代码示例。如果您正苦于以下问题:Java HTTP类的具体用法?Java HTTP怎么用?Java HTTP使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HTTP类属于org.neo4j.test.server包,在下文中一共展示了HTTP类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testOrderTasks
import org.neo4j.test.server.HTTP; //导入依赖的package包/类
@Test
public void testOrderTasks() throws Exception {
HTTP.Response response = HTTP.POST(neo4j.httpURI().resolve("/db/data/transaction/commit").toString(), QUERY1);
int count = response.get("results").get(0).get("data").size();
assertEquals(3, count);
Map task3 = mapper.convertValue(response.get("results").get(0).get("data").get(0).get("row").get(0), Map.class);
assertEquals("Provider Two", task3.get("provider"));
assertEquals("t3", task3.get("id"));
Map task2 = mapper.convertValue(response.get("results").get(0).get("data").get(1).get("row").get(0), Map.class);
assertEquals("Provider Two", task3.get("provider"));
assertEquals("t2", task2.get("id"));
Map task1 = mapper.convertValue(response.get("results").get(0).get("data").get(2).get("row").get(0), Map.class);
assertEquals("Provider One", task1.get("provider"));
assertEquals("t1", task1.get("id"));
ArrayList<Map<String, Object>> dependencies = ((ArrayList)task1.get("dependencies"));
assertEquals(2, dependencies.size());
assertEquals(new ArrayList<String>() {{add("e2");}}, dependencies.get(0).get("missing"));
assertEquals(new ArrayList<String>() {{add("e4");}}, dependencies.get(1).get("remove"));
}
示例2: shouldCreateMention
import org.neo4j.test.server.HTTP; //导入依赖的package包/类
@Test
public void shouldCreateMention() throws InterruptedException {
HTTP.POST(neo4j.httpURI().resolve("/v1/schema/create").toString());
HTTP.Response response = HTTP.POST(neo4j.httpURI().resolve("/v1/users/maxdemarzi/posts").toString(), input);
HashMap actual = response.content();
Assert.assertEquals(expected.get(STATUS), actual.get(STATUS));
Assert.assertTrue(actual.containsKey(TIME));
sleep(1000); // Needed due to artifact in testing
response = HTTP.GET(neo4j.httpURI().resolve("/v1/users/jexp/mentions").toString());
ArrayList<HashMap> actual2 = response.content();
expected2.get(0).put(TIME, actual2.get(0).get(TIME));
Assert.assertEquals(expected2, actual2);
Assert.assertEquals("maxdemarzi", actual2.get(0).get(USERNAME));
Assert.assertEquals("Max De Marzi", actual2.get(0).get(NAME));
Assert.assertEquals("Hello @jexp", actual2.get(0).get(STATUS));
}
示例3: shouldCreateTag
import org.neo4j.test.server.HTTP; //导入依赖的package包/类
@Test
public void shouldCreateTag() throws InterruptedException {
HTTP.POST(neo4j.httpURI().resolve("/v1/schema/create").toString());
HTTP.Response response = HTTP.POST(neo4j.httpURI().resolve("/v1/users/maxdemarzi/posts").toString(), input);
HashMap actual = response.content();
Assert.assertEquals(expected.get(STATUS), actual.get(STATUS));
Assert.assertTrue(actual.containsKey(TIME));
sleep(1000); // Needed due to artifact in testing
response = HTTP.GET(neo4j.httpURI().resolve("/v1/tags/neo4j").toString());
ArrayList<HashMap> actual2 = response.content();
expected2.get(0).put(TIME, actual2.get(0).get(TIME));
Assert.assertEquals(expected2, actual2);
Assert.assertEquals("maxdemarzi", actual2.get(0).get(USERNAME));
Assert.assertEquals("Max De Marzi", actual2.get(0).get(NAME));
Assert.assertEquals(expected.get(STATUS), actual2.get(0).get(STATUS));
}
示例4: measureHTTPRequest
import org.neo4j.test.server.HTTP; //导入依赖的package包/类
@Benchmark
@Warmup(iterations = 10)
@Measurement(iterations = 50)
@Fork(2)
@Threads(4)
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.SECONDS)
public void measureHTTPRequest() throws Exception {
HTTP.Response response = HTTP.withHeaders(HttpHeaders.AUTHORIZATION, "Basic bmVvNGo6c3dvcmRmaXNo").POST("http://localhost:7474/db/data/transaction/commit", HTTPQUERY);
Assert.assertEquals("\"max\"", response.get("results").get(0).get("data").get(0).get("row").get(0).toString());
}
示例5: shouldGetLatest
import org.neo4j.test.server.HTTP; //导入依赖的package包/类
@Test
public void shouldGetLatest() throws InterruptedException {
HTTP.POST(neo4j.httpURI().resolve("/v1/schema/create").toString());
sleep(1000);
HTTP.Response response = HTTP.GET(neo4j.httpURI().resolve("/v1/search/latest").toString());
ArrayList<HashMap> actual = response.content();
Assert.assertEquals(expected, actual);
}
示例6: shouldGetLatestWithUser
import org.neo4j.test.server.HTTP; //导入依赖的package包/类
@Test
public void shouldGetLatestWithUser() throws InterruptedException {
HTTP.POST(neo4j.httpURI().resolve("/v1/schema/create").toString());
sleep(1000);
HTTP.Response response = HTTP.GET(neo4j.httpURI().resolve("/v1/search/latest?username=jexp").toString());
ArrayList<HashMap> actual = response.content();
Assert.assertEquals(expected2, actual);
}
示例7: shouldGetLatestLimited
import org.neo4j.test.server.HTTP; //导入依赖的package包/类
@Test
public void shouldGetLatestLimited() throws InterruptedException {
HTTP.POST(neo4j.httpURI().resolve("/v1/schema/create").toString());
sleep(1000);
HTTP.Response response = HTTP.GET(neo4j.httpURI().resolve("/v1/search/latest?limit=1").toString());
ArrayList<HashMap> actual = response.content();
Assert.assertTrue(actual.size() == 1);
Assert.assertEquals(expected.get(0), actual.get(0));
}
示例8: shouldGetLatestSince
import org.neo4j.test.server.HTTP; //导入依赖的package包/类
@Test
public void shouldGetLatestSince() throws InterruptedException {
HTTP.POST(neo4j.httpURI().resolve("/v1/schema/create").toString());
sleep(1000);
HTTP.Response response = HTTP.GET(neo4j.httpURI().resolve("/v1/search/latest?since=1490140300").toString());
ArrayList<HashMap> actual = response.content();
Assert.assertTrue(actual.size() == 1);
Assert.assertEquals(expected.get(1), actual.get(0));
}
示例9: shouldGetSearch
import org.neo4j.test.server.HTTP; //导入依赖的package包/类
@Test
public void shouldGetSearch() throws InterruptedException {
HTTP.POST(neo4j.httpURI().resolve("/v1/schema/create").toString());
sleep(1000);
HTTP.Response response = HTTP.GET(neo4j.httpURI().resolve("/v1/search?q=Hello").toString());
ArrayList<HashMap> actual = response.content();
Assert.assertEquals(expected, actual);
}
示例10: shouldGetSearchWithUser
import org.neo4j.test.server.HTTP; //导入依赖的package包/类
@Test
public void shouldGetSearchWithUser() throws InterruptedException {
HTTP.POST(neo4j.httpURI().resolve("/v1/schema/create").toString());
sleep(1000);
HTTP.Response response = HTTP.GET(neo4j.httpURI().resolve("/v1/search?q=Hello&username=jexp").toString());
ArrayList<HashMap> actual = response.content();
Assert.assertEquals(expected2, actual);
}
示例11: shouldGetSearchLimited
import org.neo4j.test.server.HTTP; //导入依赖的package包/类
@Test
public void shouldGetSearchLimited() throws InterruptedException {
HTTP.POST(neo4j.httpURI().resolve("/v1/schema/create").toString());
sleep(1000);
HTTP.Response response = HTTP.GET(neo4j.httpURI().resolve("/v1/search?q=Hello&limit=1").toString());
ArrayList<HashMap> actual = response.content();
Assert.assertTrue(actual.size() == 1);
Assert.assertEquals(expected.get(0), actual.get(0));
}
示例12: shouldGetSearchSince
import org.neo4j.test.server.HTTP; //导入依赖的package包/类
@Test
public void shouldGetSearchSince() throws InterruptedException {
HTTP.POST(neo4j.httpURI().resolve("/v1/schema/create").toString());
sleep(1000);
HTTP.Response response = HTTP.GET(neo4j.httpURI().resolve("/v1/search?q=Hello&since=1490140300").toString());
ArrayList<HashMap> actual = response.content();
Assert.assertTrue(actual.size() == 1);
Assert.assertEquals(expected.get(1), actual.get(0));
}
示例13: shouldNotRemoveBlockUserNotFound
import org.neo4j.test.server.HTTP; //导入依赖的package包/类
@Test
public void shouldNotRemoveBlockUserNotFound() {
HTTP.POST(neo4j.httpURI().resolve("/v1/schema/create").toString());
HTTP.Response response = HTTP.request("DELETE", neo4j.httpURI().resolve("/v1/users/max/blocks/jexp").toString(), null);
HashMap actual = response.content();
Assert.assertEquals(400, response.status());
Assert.assertEquals("User not Found.", actual.get("error"));
}
示例14: shouldNotRemoveBlockUser2NotFound
import org.neo4j.test.server.HTTP; //导入依赖的package包/类
@Test
public void shouldNotRemoveBlockUser2NotFound() {
HTTP.POST(neo4j.httpURI().resolve("/v1/schema/create").toString());
HTTP.Response response = HTTP.request("DELETE", neo4j.httpURI().resolve("/v1/users/maxdemarzi/blocks/pxej").toString(), null);
HashMap actual = response.content();
Assert.assertEquals(400, response.status());
Assert.assertEquals("User not Found.", actual.get("error"));
}
示例15: shouldNotRemoveLikeBlockNotFound
import org.neo4j.test.server.HTTP; //导入依赖的package包/类
@Test
public void shouldNotRemoveLikeBlockNotFound() {
HTTP.POST(neo4j.httpURI().resolve("/v1/schema/create").toString());
HTTP.Response response = HTTP.request("DELETE", neo4j.httpURI().resolve("/v1/users/maxdemarzi/blocks/laexample").toString(), null);
HashMap actual = response.content();
Assert.assertEquals(400, response.status());
Assert.assertEquals("Not blocking User.", actual.get("error"));
}