Search in sources :

Example 1 with TransactionInfoEvent

use of org.neo4j.server.http.cypher.format.api.TransactionInfoEvent in project neo4j by neo4j.

the class AbstractEventSourceJoltSerializerTest method writeTransactionInfo.

protected static void writeTransactionInfo(LineDelimitedEventSourceJoltSerializer serializer) {
    serializer.writeErrorWrapper();
    serializer.writeTransactionInfo(new TransactionInfoEvent(TransactionNotificationState.NO_TRANSACTION, null, -1));
}
Also used : TransactionInfoEvent(org.neo4j.server.http.cypher.format.api.TransactionInfoEvent)

Example 2 with TransactionInfoEvent

use of org.neo4j.server.http.cypher.format.api.TransactionInfoEvent in project neo4j by neo4j.

the class LineDelimitedEventSourceJoltSerializerTest method shouldSerializeResponseWithCommitUriOnly.

@Test
void shouldSerializeResponseWithCommitUriOnly() {
    // when
    serializer.writeTransactionInfo(new TransactionInfoEvent(TransactionNotificationState.NO_TRANSACTION, URI.create("commit/uri/1"), -1));
    // then
    String result = output.toString(UTF_8);
    assertEquals("{\"info\":{\"commit\":\"commit/uri/1\"}}\n", result);
}
Also used : TransactionInfoEvent(org.neo4j.server.http.cypher.format.api.TransactionInfoEvent) Test(org.junit.jupiter.api.Test)

Example 3 with TransactionInfoEvent

use of org.neo4j.server.http.cypher.format.api.TransactionInfoEvent in project neo4j by neo4j.

the class LineDelimitedEventSourceJoltSerializerTest method shouldSerializeTemporalAsListOfMapsOfProperties.

@Test
void shouldSerializeTemporalAsListOfMapsOfProperties() {
    // given
    var row1 = Map.of("temporal", LocalDate.of(2018, 3, 12));
    var row2 = Map.of("temporal", ZonedDateTime.of(2018, 3, 12, 13, 2, 10, 10, ZoneId.of("UTC+1")));
    var row3 = Map.of("temporal", OffsetTime.of(12, 2, 4, 71, ZoneOffset.UTC));
    var row4 = Map.of("temporal", LocalDateTime.of(2018, 3, 12, 13, 2, 10, 10));
    var row5 = Map.of("temporal", LocalTime.of(13, 2, 10, 10));
    var row6 = Map.of("temporal", DurationValue.duration(Duration.of(12, ChronoUnit.HOURS)));
    // when
    writeStatementStart(serializer, "temporal");
    writeRecord(serializer, row1, "temporal");
    writeRecord(serializer, row2, "temporal");
    writeRecord(serializer, row3, "temporal");
    writeRecord(serializer, row4, "temporal");
    writeRecord(serializer, row5, "temporal");
    writeRecord(serializer, row6, "temporal");
    writeStatementEnd(serializer);
    serializer.writeTransactionInfo(new TransactionInfoEvent(TransactionNotificationState.NO_TRANSACTION, null, -1));
    // then
    String result = output.toString(UTF_8);
    assertEquals("{\"header\":{\"fields\":[\"temporal\"]}}\n" + "{\"data\":[{\"T\":\"2018-03-12\"}]}\n" + "{\"data\":[{\"T\":\"2018-03-12T13:02:10.00000001+01:00[UTC+01:00]\"}]}\n" + "{\"data\":[{\"T\":\"12:02:04.000000071Z\"}]}\n" + "{\"data\":[{\"T\":\"2018-03-12T13:02:10.00000001\"}]}\n" + "{\"data\":[{\"T\":\"13:02:10.00000001\"}]}\n" + "{\"data\":[{\"T\":\"PT12H\"}]}\n" + "{\"summary\":{}}\n" + "{\"info\":{}}\n", result);
}
Also used : TransactionInfoEvent(org.neo4j.server.http.cypher.format.api.TransactionInfoEvent) Test(org.junit.jupiter.api.Test)

Example 4 with TransactionInfoEvent

use of org.neo4j.server.http.cypher.format.api.TransactionInfoEvent in project neo4j by neo4j.

the class ExecutionResultSerializerTest method shouldSerializeTemporalAsListOfMapsOfProperties.

@Test
void shouldSerializeTemporalAsListOfMapsOfProperties() {
    // given
    var row1 = Map.of("temporal", LocalDate.of(2018, 3, 12));
    var row2 = Map.of("temporal", ZonedDateTime.of(2018, 3, 12, 13, 2, 10, 10, ZoneId.of("UTC+1")));
    var row3 = Map.of("temporal", OffsetTime.of(12, 2, 4, 71, ZoneOffset.UTC));
    var row4 = Map.of("temporal", LocalDateTime.of(2018, 3, 12, 13, 2, 10, 10));
    var row5 = Map.of("temporal", LocalTime.of(13, 2, 10, 10));
    var row6 = Map.of("temporal", Duration.of(12, ChronoUnit.HOURS));
    // when
    writeStatementStart(serializer, "temporal");
    writeRecord(serializer, row1, "temporal");
    writeRecord(serializer, row2, "temporal");
    writeRecord(serializer, row3, "temporal");
    writeRecord(serializer, row4, "temporal");
    writeRecord(serializer, row5, "temporal");
    writeRecord(serializer, row6, "temporal");
    writeStatementEnd(serializer);
    serializer.writeTransactionInfo(new TransactionInfoEvent(TransactionNotificationState.NO_TRANSACTION, null, -1));
    // then
    String result = output.toString(UTF_8);
    assertEquals("{\"results\":[{\"columns\":[\"temporal\"],\"data\":[" + "{\"row\":[\"2018-03-12\"],\"meta\":[{\"type\":\"date\"}]}," + "{\"row\":[\"2018-03-12T13:02:10.000000010+01:00[UTC+01:00]\"],\"meta\":[{\"type\":\"datetime\"}]}," + "{\"row\":[\"12:02:04.000000071Z\"],\"meta\":[{\"type\":\"time\"}]}," + "{\"row\":[\"2018-03-12T13:02:10.000000010\"],\"meta\":[{\"type\":\"localdatetime\"}]}," + "{\"row\":[\"13:02:10.000000010\"],\"meta\":[{\"type\":\"localtime\"}]}," + "{\"row\":[\"PT12H\"],\"meta\":[{\"type\":\"duration\"}]}" + "]}],\"errors\":[]}", result);
}
Also used : TransactionInfoEvent(org.neo4j.server.http.cypher.format.api.TransactionInfoEvent) Test(org.junit.jupiter.api.Test)

Example 5 with TransactionInfoEvent

use of org.neo4j.server.http.cypher.format.api.TransactionInfoEvent in project neo4j by neo4j.

the class ExecutionResultSerializerTest method shouldSerializeResponseWithCommitUriOnly.

@Test
void shouldSerializeResponseWithCommitUriOnly() {
    // when
    serializer.writeTransactionInfo(new TransactionInfoEvent(TransactionNotificationState.NO_TRANSACTION, URI.create("commit/uri/1"), -1));
    // then
    String result = output.toString(UTF_8);
    assertEquals("{\"results\":[],\"errors\":[],\"commit\":\"commit/uri/1\"}", result);
}
Also used : TransactionInfoEvent(org.neo4j.server.http.cypher.format.api.TransactionInfoEvent) Test(org.junit.jupiter.api.Test)

Aggregations

TransactionInfoEvent (org.neo4j.server.http.cypher.format.api.TransactionInfoEvent)10 Test (org.junit.jupiter.api.Test)6 FailureEvent (org.neo4j.server.http.cypher.format.api.FailureEvent)2 StatementEndEvent (org.neo4j.server.http.cypher.format.api.StatementEndEvent)2 StatementStartEvent (org.neo4j.server.http.cypher.format.api.StatementStartEvent)2 InputStatement (org.neo4j.server.http.cypher.format.input.json.InputStatement)2