예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void unavailableCsvResourceShouldRollbackTransaction() throws org.neo4j.server.rest.domain.JsonParseException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void UnavailableCsvResourceShouldRollbackTransaction()
        {
            // Given
            HTTP.Response first = POST(TxUri(), quotedJson("{'statements': [{'statement': 'CREATE ()'}]}"));
            assertThat(first.Status(), @is(201));
            assertThat(first, containsNoErrors());

            long txId = ExtractTxId(first);

            // When
            HTTP.Response second = POST(TxUri(txId), quotedJson("{'statements': [{'statement': 'LOAD CSV FROM \\\"http://127.0.0.1/null/\\\" AS line " + "CREATE (a {name:line[0]})'}]}"));

            // Then

            // request fails because specified CSV resource is invalid
            assertThat(second.Status(), @is(200));
            assertThat(second, hasErrors(Org.Neo4j.Kernel.Api.Exceptions.Status_Statement.ExternalResourceFailed));

            // transaction was rolled back on the previous step and we can't commit it
            HTTP.Response commit = POST(second.StringFromContent("commit"));
            assertThat(commit.Status(), @is(404));
        }