本文整理汇总了Java中org.neo4j.server.rest.RestRequest类的典型用法代码示例。如果您正苦于以下问题:Java RestRequest类的具体用法?Java RestRequest怎么用?Java RestRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RestRequest类属于org.neo4j.server.rest包,在下文中一共展示了RestRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldGetValidInfo
import org.neo4j.server.rest.RestRequest; //导入依赖的package包/类
@Test
public void shouldGetValidInfo() throws IOException {
NeoServer server = CommunityServerBuilder.server().onPort(7577)
.withThirdPartyJaxRsPackage("org.amanzi.neo4j.csvtreeloader", MOUNT_POINT).build();
server.start();
RestRequest restRequest = new RestRequest(server.baseUri().resolve(MOUNT_POINT), CLIENT);
String query = "service/csvtree";
JaxRsResponse response = restRequest.get(query);
assertEquals(200, response.getStatus());
System.out.println("Got Import response: " + response.getEntity());
JsonNode tree = objectMapper.readTree(response.getEntity().toString());
String version = tree.get("version").asText();
assertTrue("Version should be valid string", version.length() >= 5);
server.stop();
}
示例2: shouldImportFromConfigCSV
import org.neo4j.server.rest.RestRequest; //导入依赖的package包/类
@Test
public void shouldImportFromConfigCSV() throws IOException {
NeoServer server = CommunityServerBuilder.server().onPort(7577)
.withThirdPartyJaxRsPackage("org.amanzi.neo4j.csvtreeloader", MOUNT_POINT).build();
server.start();
String[] columnHeaders = new String[] { "Device.deviceid",
"Version.version_name.GeoptimaVersion.Version%20Props", "Day..EventDay",
"Date.time.ConfigCheck" };
String[] leafProperties = new String[] { "Date.time", "UTC" };
String leafPropertiesColumn = "Params";
String treeSpec = "Device-versions->GeoptimaVersion-days->EventDay-checks->ConfigCheck";
RestRequest restRequest = new RestRequest(server.baseUri().resolve(MOUNT_POINT), CLIENT);
importFromCSV(restRequest, "samples/short_config.csv", columnHeaders, leafProperties, leafPropertiesColumn, treeSpec, 200, 5, true);
server.stop();
}
示例3: setUp
import org.neo4j.server.rest.RestRequest; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
server = CommunityServerBuilder.server()
.withThirdPartyJaxRsPackage("pe.archety", "/v1")
.build();
server.start();
request = new RestRequest(server.baseUri().resolve("/v1"), CLIENT);
populate(server.getDatabase().getGraph());
}
示例4: setUp
import org.neo4j.server.rest.RestRequest; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
server = CommunityServerBuilder.server()
.withThirdPartyJaxRsPackage("pe.archety", "/v1")
.build();
server.start();
request = new RestRequest(server.baseUri().resolve("/v1"), CLIENT);
}
示例5: setUp
import org.neo4j.server.rest.RestRequest; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
server = CommunityServerBuilder.server()
.withThirdPartyJaxRsPackage("pe.archety", "/v1")
.build();
server.start();
request = new RestRequest(server.baseUri().resolve("/v1"), CLIENT);
request.get("service/migrate");
populate(server.getDatabase().getGraph());
}
示例6: setUp
import org.neo4j.server.rest.RestRequest; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
server = CommunityServerBuilder.server()
.withThirdPartyJaxRsPackage("com.hpce", "/v1")
.onPort(8484)
.build();
server.start();
request = new RestRequest(server.baseUri().resolve("/v1"), CLIENT);
populate(server.getDatabase().getGraph());
}
示例7: setUp
import org.neo4j.server.rest.RestRequest; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
server = CommunityServerBuilder.server()
.withThirdPartyJaxRsPackage("com.hpce", "/v1")
.onPort(8484)
.build();
server.start();
request = new RestRequest(server.baseUri().resolve("/v1"), CLIENT);
}
示例8: shouldImportFromCSV
import org.neo4j.server.rest.RestRequest; //导入依赖的package包/类
@Test
public void shouldImportFromCSV() throws IOException {
NeoServer server = CommunityServerBuilder.server().onPort(7577)
.withThirdPartyJaxRsPackage("org.amanzi.neo4j.csvtreeloader", MOUNT_POINT).build();
server.start();
String[] columnHeaders = new String[] { "DeviceID", "Day..EventDay", "Date.time.Event" };
String[] leafProperties = new String[] { "Date", "Path", "UTC" };
String leafPropertiesColumn = "Params";
RestRequest restRequest = new RestRequest(server.baseUri().resolve(MOUNT_POINT), CLIENT);
importFromCSV(restRequest, "non-existant.csv", columnHeaders, leafProperties, leafPropertiesColumn, null, 404, 0, true);
importFromCSV(restRequest, "samples/353333333333333.csv", columnHeaders, leafProperties, leafPropertiesColumn, null, 200, 122, false);
//importFromCSV(restRequest, "samples/load_config_access.csv", columnHeaders, leafProperties, leafPropertiesColumn, 200, 1000, false);
server.stop();
}
示例9: shouldManageInvalidRequests
import org.neo4j.server.rest.RestRequest; //导入依赖的package包/类
@Test
public void shouldManageInvalidRequests() throws IOException {
NeoServer server = CommunityServerBuilder.server().onPort(7577)
.withThirdPartyJaxRsPackage("org.amanzi.neo4j.csvtreeloader", MOUNT_POINT).build();
server.start();
RestRequest restRequest = new RestRequest(server.baseUri().resolve(MOUNT_POINT), CLIENT);
importFromCSV(restRequest, null, null, null, null, null, 404, 0, false);
importFromCSV(restRequest, "samples/353333333333333.csv", null, null, null, null, 200, 122, false);
server.stop();
}
示例10: importFromCSV
import org.neo4j.server.rest.RestRequest; //导入依赖的package包/类
private void importFromCSV(RestRequest restRequest, String path, String[] columnHeaders, String[] leafProperties,
String leafPropertiesColumn, String treeSpec, int rc, int records, boolean debug) throws JsonProcessingException, IOException {
System.out.println("Running CSV Import from: " + path);
String query = "service/loadcsvtree?skip=0&limit=1000";
if (path != null) {
query += "&path=" + path;
}
if (columnHeaders != null) {
query += "&header=" + ACollections.join(columnHeaders, "&header=");
}
if (leafProperties != null) {
query += "&leafProperty=" + ACollections.join(leafProperties, "&leafProperty=");
}
if (leafPropertiesColumn != null) {
query += "&leafProperties=" + leafPropertiesColumn;
}
if (treeSpec != null) {
query += "&tree=" + java.net.URLEncoder.encode(treeSpec, "US-ASCII");
}
if (debug) {
query += "&debug=true";
}
JaxRsResponse response = restRequest.get(query);
assertEquals(rc, response.getStatus());
if (rc == 200) {
System.out.println("Got Import response: " + response.getEntity());
JsonNode tree = objectMapper.readTree(response.getEntity().toString());
int count = tree.get("count").asInt();
assertEquals(records, count);
}
}
示例11: shouldReturnFriends
import org.neo4j.server.rest.RestRequest; //导入依赖的package包/类
@Test
public void shouldReturnFriends() throws IOException {
NeoServer server = ServerBuilder.server()
.withThirdPartyJaxRsPackage("org.neo4j.example.unmanagedextension", MOUNT_POINT)
.build();
server.start();
populateDb(server.getDatabase().getGraph());
RestRequest restRequest = new RestRequest(server.baseUri().resolve(MOUNT_POINT), CLIENT);
JaxRsResponse response = restRequest.get("service/friends/B");
System.out.println(response.getEntity());
List list = objectMapper.readValue(response.getEntity(), List.class);
assertEquals(new HashSet<String>(Arrays.asList("A", "C")), new HashSet<String>(list));
server.stop();
}
示例12: shouldReturnConnectedComponentCount
import org.neo4j.server.rest.RestRequest; //导入依赖的package包/类
@Test
public void shouldReturnConnectedComponentCount() throws IOException {
NeoServer server = ServerBuilder.server()
.withThirdPartyJaxRsPackage("org.neo4j.hwp", MOUNT_POINT)
.build();
server.start();
populateDb(server.getDatabase().getGraph());
RestRequest restRequest = new RestRequest(server.baseUri().resolve(MOUNT_POINT), CLIENT);
JaxRsResponse response = restRequest.get("service/hwp/A");
System.out.println(response.getEntity());
assertEquals("{\"weight\":8,\"nodes\":[{\"id\":1,\"weight\":1,\"name\":\"A\"},{\"id\":6,\"weight\":4,\"name\":\"AB\"},{\"id\":7,\"weight\":3,\"name\":\"AAA\"}]}", response.getEntity());
server.stop();
}
示例13: shouldReturnConnectedComponentCount
import org.neo4j.server.rest.RestRequest; //导入依赖的package包/类
@Test
public void shouldReturnConnectedComponentCount() throws IOException {
NeoServer server = ServerBuilder.server()
.withThirdPartyJaxRsPackage("org.neo4j.max_flow", MOUNT_POINT)
.build();
server.start();
populateDb(server.getDatabase().getGraph());
RestRequest restRequest = new RestRequest(server.baseUri().resolve(MOUNT_POINT), CLIENT);
JaxRsResponse response = restRequest.get("service/max_flow/1/7");
assertEquals("5", response.getEntity());
server.stop();
}
示例14: shouldReturnConnectedComponentCount
import org.neo4j.server.rest.RestRequest; //导入依赖的package包/类
@Test
public void shouldReturnConnectedComponentCount() throws IOException {
NeoServer server = ServerBuilder.server()
.withThirdPartyJaxRsPackage("org.neo4j.cc", MOUNT_POINT)
.build();
server.start();
populateDb(server.getDatabase().getGraph());
RestRequest restRequest = new RestRequest(server.baseUri().resolve(MOUNT_POINT), CLIENT);
JaxRsResponse response = restRequest.get("service/cc/KNOWS");
assertEquals("2", response.getEntity());
server.stop();
}
示例15: should401WithBasicChallengeWhenASecurityRuleFails
import org.neo4j.server.rest.RestRequest; //导入依赖的package包/类
@Test
public void should401WithBasicChallengeWhenASecurityRuleFails()
throws Exception
{
NeoServer server = ServerBuilder.server()
.withSecurityRules(LockDownSecurityRule.class.getCanonicalName() ).build();
server.start();
RestRequest restRequest = new RestRequest(server.baseUri());
String dummyText = "";
JaxRsResponse response = restRequest.post("db/data/node/0/traverse/node", dummyText);
assertTrue(response.getStatus() == 401);
assertTrue(response.getHeaders().getFirst( "WWW-Authenticate" ).contains("Basic realm=\"WallyWorld\""));
server.stop();
}