本文整理汇总了Java中org.neo4j.server.NeoServer.baseUri方法的典型用法代码示例。如果您正苦于以下问题:Java NeoServer.baseUri方法的具体用法?Java NeoServer.baseUri怎么用?Java NeoServer.baseUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.neo4j.server.NeoServer
的用法示例。
在下文中一共展示了NeoServer.baseUri方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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();
}