예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnReadOnlyStatusWhenCreatingNodes() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReturnReadOnlyStatusWhenCreatingNodes()
        {
            // Given
            HTTP.Response response = _http.POST("db/data/transaction/commit", quotedJson("{ 'statements': [ { 'statement': 'CREATE (node)' } ] }"));

            // Then
            JsonNode error   = response.Get("errors").get(0);
            string   code    = error.get("code").asText();
            string   message = error.get("message").asText();

            assertEquals("Neo.ClientError.General.ForbiddenOnReadOnlyDatabase", code);
            assertThat(message, containsString("This is a read only Neo4j instance"));
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            // begin
            HTTP.Response begin = _http.POST("db/data/transaction");

            assertThat(begin.Status(), equalTo(201));
            AssertHasTxLocation(begin);
            try
            {
                _commitResource = begin.StringFromContent("commit");
            }
            catch (JsonParseException e)
            {
                fail("Exception caught when setting up test: " + e.Message);
            }
            assertThat(_commitResource, equalTo(begin.Location() + "/commit"));
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void periodicCommitTest() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PeriodicCommitTest()
        {
            ServerTestUtils.withCSVFile(2, url =>
            {
                // begin
                HTTP.Response begin = _http.POST("db/data/cypher", quotedJson("{ 'query': 'USING PERIODIC COMMIT 100 LOAD CSV FROM \\\"" + url + "\\\" AS line CREATE ();' }"));
                assertThat(begin.status(), equalTo(200));
            });
        }
예제 #4
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));
        }