本文整理汇总了Java中org.neo4j.server.NeoServer类的典型用法代码示例。如果您正苦于以下问题:Java NeoServer类的具体用法?Java NeoServer怎么用?Java NeoServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NeoServer类属于org.neo4j.server包,在下文中一共展示了NeoServer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: graphDatabaseService
import org.neo4j.server.NeoServer; //导入依赖的package包/类
/**
* Neo4j Server bean.
* Runs Neo4j server for integration tests and returns {@link GraphDatabaseService} instance.
*
* @return {@link GraphDatabaseService}
*/
@Bean(destroyMethod = "shutdown")
public GraphDatabaseService graphDatabaseService() {
String homeDir = "./target";
String configFile = "./src/test/resources/neo4j.conf";
ServerBootstrapper serverBootstrapper = new CommunityBootstrapper();
int i = serverBootstrapper.start(new File(homeDir), Optional.of(new File(configFile)));
switch (i) {
case ServerBootstrapper.OK:
logger.debug("Server started");
break;
case ServerBootstrapper.GRAPH_DATABASE_STARTUP_ERROR_CODE:
logger.error("Server failed to start: graph database startup error");
break;
case ServerBootstrapper.WEB_SERVER_STARTUP_ERROR_CODE:
logger.error("Server failed to start: web server startup error");
break;
default:
logger.error("Server failed to start: unknown error");
break;
}
NeoServer neoServer = serverBootstrapper.getServer();
return neoServer.getDatabase().getGraph();
}
开发者ID:telstra,项目名称:open-kilda,代码行数:30,代码来源:TestConfig.java
示例2: start
import org.neo4j.server.NeoServer; //导入依赖的package包/类
@Override
public Collection<Injectable<?>> start(final NeoServer neoServer) {
webServer = getWebServer(neoServer);
// mutablizeRequestParameterMapFitler = new MutablizeRequestParameterMapFitler();
// convertKafYaInParametersFilter = new ConvertKafYaInParametersFilter();
beginTransactionFilter = new BeginTransactionFilter(neoServer.getDatabase().getGraph());
//
// for (String path : mappings.get(MutablizeRequestParameterMapFitler.class)) {
// webServer.addFilter(mutablizeRequestParameterMapFitler, path);
// }
//
// for (String path : mappings.get(ConvertKafYaInParametersFilter.class)) {
// webServer.addFilter(convertKafYaInParametersFilter, path);
// }
for (String path : mappings.get(BeginTransactionFilter.class)) {
webServer.addFilter(beginTransactionFilter, path);
}
return Collections.emptyList();
}
开发者ID:vahidooo,项目名称:quranic-graph,代码行数:23,代码来源:FiltersInitializer.java
示例3: shouldGetValidInfo
import org.neo4j.server.NeoServer; //导入依赖的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();
}
开发者ID:craigtaverner,项目名称:csvtreeloader,代码行数:18,代码来源:CSVTreeLoaderServiceFunctionalTest.java
示例4: shouldImportFromConfigCSV
import org.neo4j.server.NeoServer; //导入依赖的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();
}
开发者ID:craigtaverner,项目名称:csvtreeloader,代码行数:17,代码来源:CSVTreeLoaderServiceFunctionalTest.java
示例5: main
import org.neo4j.server.NeoServer; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
PropertiesConfiguration config = PropertiesHolder.getInstance();
String outputFolderPath = config.getString("output.folder");
File storeDir = new File(outputFolderPath + File.separator + "graph-db");
ServerBootstrapper serverBootstrapper = new CommunityBootstrapper();
serverBootstrapper.start(
storeDir,
Optional.empty(), // omit configfile, properties follow
Pair.of("dbms.connector.http.address","127.0.0.1:7474"),
Pair.of("dbms.connector.http.enabled", "true"),
Pair.of("dbms.connector.bolt.enabled", "true"),
// allow the shell connections via port 1337 (default)
Pair.of("dbms.shell.enabled", "true"),
Pair.of("dbms.shell.host", "127.0.0.1"),
Pair.of("dbms.shell.port", "1337"),
Pair.of("dbms.security.auth_enabled", "false")
);
// ^^ serverBootstrapper.start() also registered shutdown hook!
NeoServer neoServer = serverBootstrapper.getServer();
System.out.println("Press ENTER to quit.");
System.in.read();
neoServer.stop();
}
开发者ID:phenopolis,项目名称:pheno4j,代码行数:30,代码来源:Neo4jRunner.java
示例6: shouldImportFromCSV
import org.neo4j.server.NeoServer; //导入依赖的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();
}
开发者ID:craigtaverner,项目名称:csvtreeloader,代码行数:16,代码来源:CSVTreeLoaderServiceFunctionalTest.java
示例7: shouldManageInvalidRequests
import org.neo4j.server.NeoServer; //导入依赖的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();
}
开发者ID:craigtaverner,项目名称:csvtreeloader,代码行数:12,代码来源:CSVTreeLoaderServiceFunctionalTest.java
示例8: shouldReturnFriends
import org.neo4j.server.NeoServer; //导入依赖的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();
}
开发者ID:maxdemarzi,项目名称:dense,代码行数:15,代码来源:DenseNodeFunctionalTest.java
示例9: shouldReturnConnectedComponentCount
import org.neo4j.server.NeoServer; //导入依赖的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();
}
开发者ID:maxdemarzi,项目名称:neo_hwp,代码行数:16,代码来源:MyServiceFunctionalTest.java
示例10: shouldReturnConnectedComponentCount
import org.neo4j.server.NeoServer; //导入依赖的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();
}
开发者ID:maxdemarzi,项目名称:neo_max_flow,代码行数:14,代码来源:MyServiceFunctionalTest.java
示例11: shouldReturnConnectedComponentCount
import org.neo4j.server.NeoServer; //导入依赖的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();
}
开发者ID:maxdemarzi,项目名称:neo_cc,代码行数:14,代码来源:MyServiceFunctionalTest.java
示例12: should401WithBasicChallengeWhenASecurityRuleFails
import org.neo4j.server.NeoServer; //导入依赖的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();
}
开发者ID:neo4j-contrib,项目名称:neo_lock_down,代码行数:16,代码来源:LockDownSecurityRuleFunctionalTest.java
示例13: should401WithBasicChallengeWhenASecurityRuleFailswithBatch
import org.neo4j.server.NeoServer; //导入依赖的package包/类
@Test
public void should401WithBasicChallengeWhenASecurityRuleFailswithBatch()
throws Exception
{
NeoServer server = ServerBuilder.server()
.withSecurityRules(LockDownSecurityRule.class.getCanonicalName() ).build();
server.start();
RestRequest restRequest = new RestRequest(server.baseUri());
String dummyText = "[ {\n" +
" \"method\" : \"POST\",\n" +
" \"to\" : \"/node/0/traverse\",\n" +
" \"body\" : {\n" +
" \"return_filter\" : {\n" +
" \"body\" : \"position.length()<3;\",\n" +
" \"language\" : \"javascript\" },\n" +
" \"prune_evaluator\" : {\n" +
" \"name\" : \"none\",\n" +
" \"language\" : \"builtin\" }\n" +
" },\n" +
" \"id\" : 0 }]";
JaxRsResponse response = restRequest.post("db/data/batch", dummyText);
// We don't get a nice 200 with an error on the batch request
// instead we get a 500 actual exception
//System.out.println(response.getStatus());
//System.out.println(response.getEntity().toString());
//assertTrue(response.getStatus() == 401);
//assertTrue(response.getHeaders().getFirst( "WWW-Authenticate" ).contains("Basic realm=\"WallyWorld\""));
assertTrue(response.getStatus() == 500);
server.stop();
}
开发者ID:neo4j-contrib,项目名称:neo_lock_down,代码行数:35,代码来源:LockDownSecurityRuleFunctionalTest.java
示例14: should200WithBasicChallengeWhenASecurityRuleSucceeds
import org.neo4j.server.NeoServer; //导入依赖的package包/类
@Test
public void should200WithBasicChallengeWhenASecurityRuleSucceeds()
throws Exception
{
NeoServer server = ServerBuilder.server()
.withSecurityRules(LockDownSecurityRule.class.getCanonicalName() ).build();
server.start();
RestRequest restRequest = new RestRequest(server.baseUri());
JaxRsResponse response = restRequest.get("db/data/node/0");
assertTrue(response.getStatus() == 200);
server.stop();
}
开发者ID:neo4j-contrib,项目名称:neo_lock_down,代码行数:15,代码来源:LockDownSecurityRuleFunctionalTest.java
示例15: getWebServer
import org.neo4j.server.NeoServer; //导入依赖的package包/类
private WebServer getWebServer(final NeoServer neoServer) {
if (neoServer instanceof AbstractNeoServer) {
return ((AbstractNeoServer) neoServer).getWebServer();
}
throw new IllegalArgumentException("expected AbstractNeoServer");
}
开发者ID:vahidooo,项目名称:quranic-graph,代码行数:7,代码来源:FiltersInitializer.java
注:本文中的org.neo4j.server.NeoServer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论