use of org.neo4j.kernel.api.query.ExecutingQuery in project neo4j by neo4j.
the class QueryLoggerTest method shouldLogQueryParameters.
@Test
public void shouldLogQueryParameters() throws Exception {
// given
final AssertableLogProvider logProvider = new AssertableLogProvider();
Map<String, Object> params = new HashMap<>();
params.put("ages", Arrays.asList(41, 42, 43));
ExecutingQuery query = query(0, SESSION_1, "TestUser", QUERY_4, params, emptyMap());
FakeClock clock = Clocks.fakeClock();
QueryLogger queryLogger = queryLoggerWithParams(logProvider, clock);
// when
queryLogger.startQueryExecution(query);
clock.forward(11, TimeUnit.MILLISECONDS);
queryLogger.endSuccess(query);
// then
String expectedSessionString = sessionConnectionDetails(SESSION_1, "TestUser");
logProvider.assertExactly(inLog(getClass()).info(format("%d ms: %s - %s - %s - {}", 11L, expectedSessionString, QUERY_4, "{ages: " + "[41, 42, 43]}")));
}
use of org.neo4j.kernel.api.query.ExecutingQuery in project neo4j by neo4j.
the class ExecutingQueryListTest method removingTheLastQueryReturnsAnEmptyList.
@Test
public void removingTheLastQueryReturnsAnEmptyList() {
// Given
ExecutingQuery aQuery = createExecutingQuery(1, "query");
ExecutingQueryList list = ExecutingQueryList.EMPTY.push(aQuery);
// When
ExecutingQueryList result = list.remove(aQuery);
// Then
assertThat(result, equalTo(ExecutingQueryList.EMPTY));
}
use of org.neo4j.kernel.api.query.ExecutingQuery in project neo4j by neo4j.
the class ExecutingQueryListTest method addingQueriesKeepsInsertOrder.
@Test
public void addingQueriesKeepsInsertOrder() {
// Given
ExecutingQuery query1 = createExecutingQuery(1, "query1");
ExecutingQuery query2 = createExecutingQuery(2, "query2");
ExecutingQuery query3 = createExecutingQuery(3, "query3");
ExecutingQuery query4 = createExecutingQuery(4, "query4");
ExecutingQuery query5 = createExecutingQuery(5, "query5");
ExecutingQueryList list = ExecutingQueryList.EMPTY.push(query1).push(query2).push(query3).push(query4).push(query5);
// When
List<ExecutingQuery> result = list.queries().collect(Collectors.toList());
// Then
assertThat(result, equalTo(asList(query5, query4, query3, query2, query1)));
}
Aggregations