示例#1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void testCorsAllowMethods(org.neo4j.server.web.HttpMethod method, String origin) throws Exception
        private void TestCorsAllowMethods(HttpMethod method, string origin)
        {
            HTTP.Builder  requestBuilder = RequestWithHeaders("authDisabled", "authDisabled").withHeaders(ACCESS_CONTROL_REQUEST_METHOD, method.ToString());
            HTTP.Response response       = RunQuery(requestBuilder);

            assertEquals(OK.StatusCode, response.Status());
            AssertCorsHeaderEquals(response, origin);
            assertEquals(method, HttpMethod.valueOf(response.Header(ACCESS_CONTROL_ALLOW_METHODS)));
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAddCorsRequestHeaders() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAddCorsRequestHeaders()
        {
            StartServer(false);

            HTTP.Builder  requestBuilder = RequestWithHeaders("authDisabled", "authDisabled").withHeaders(ACCESS_CONTROL_REQUEST_HEADERS, "Accept, X-Not-Accept");
            HTTP.Response response       = RunQuery(requestBuilder);

            assertEquals(OK.StatusCode, response.Status());
            AssertCorsHeaderPresent(response);
            assertEquals("Accept, X-Not-Accept", response.Header(ACCESS_CONTROL_ALLOW_HEADERS));
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void executeQueryWithSnapshotEngine()
        public virtual void ExecuteQueryWithSnapshotEngine()
        {
            Database            database = _server.Database;
            GraphDatabaseFacade graph    = database.Graph;

            using (Transaction transaction = graph.BeginTx())
            {
                for (int i = 0; i < 10; i++)
                {
                    Node node = graph.CreateNode();
                    node.SetProperty("a", "b");
                }
                transaction.Success();
            }

            HTTP.Builder  httpClientBuilder = HTTP.withBaseUri(_server.baseUri());
            HTTP.Response transactionStart  = httpClientBuilder.Post(TransactionURI());
            assertThat(transactionStart.Status(), equalTo(201));
            HTTP.Response response = httpClientBuilder.POST(transactionStart.Location(), quotedJson("{ 'statements': [ { 'statement': 'MATCH (n) RETURN n' } ] }"));
            assertThat(response.Status(), equalTo(200));
        }
示例#4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            ServerHelper.cleanTheDatabase(_readOnlyServer);
            _readOnlyServer = ServerHelper.createReadOnlyServer(Dir.storeDir());
            _http           = HTTP.withBaseUri(_readOnlyServer.baseUri());
        }
示例#5
0
 private HTTP.Response RunQuery(HTTP.Builder requestBuilder)
 {
     HTTP.RawPayload statements = quotedJson("{'statements': [{'statement': 'RETURN 42'}]}");
     return(requestBuilder.Post(TxCommitURL(), statements));
 }