use of org.neo4j.values.virtual.MapValue in project neo4j by neo4j.
the class RoutingResultFormat method parseRows.
private static Map<Role, List<SocketAddress>> parseRows(ListValue rows) {
Map<Role, List<SocketAddress>> endpoints = new HashMap<>();
for (AnyValue single : rows) {
MapValue row = (MapValue) single;
Role role = Role.valueOf(((TextValue) row.get("role")).stringValue());
List<SocketAddress> addresses = parseEndpoints((ListValue) row.get("addresses"));
endpoints.put(role, addresses);
}
Arrays.stream(Role.values()).forEach(r -> endpoints.putIfAbsent(r, Collections.emptyList()));
return endpoints;
}
use of org.neo4j.values.virtual.MapValue in project neo4j by neo4j.
the class BoltConnectionIT method createLocalIrisData.
private String createLocalIrisData(BoltStateMachine machine) throws Exception {
for (String className : IRIS_CLASS_NAMES) {
MapValue params = map("className", className);
runAndPull(machine, "CREATE (c:Class {name: $className}) RETURN c", params);
}
return env.putTmpFile("iris", ".csv", IRIS_DATA).toExternalForm();
}
use of org.neo4j.values.virtual.MapValue in project neo4j by neo4j.
the class BoltV3TransportIT method shouldSetTxMetadata.
@ParameterizedTest(name = "{0}")
@MethodSource("argumentsProvider")
public void shouldSetTxMetadata(Class<? extends TransportConnection> connectionClass) throws Exception {
init(connectionClass);
// Given
negotiateBoltV3();
Map<String, Object> txMetadata = map("who-is-your-boss", "Molly-mostly-white");
Map<String, Object> msgMetadata = map("tx_metadata", txMetadata);
MapValue meta = asMapValue(msgMetadata);
connection.send(util.chunk(new BeginMessage(meta, List.of(), null, AccessMode.WRITE, txMetadata), new RunMessage("RETURN 1"), PullAllMessage.INSTANCE));
// When
assertThat(connection).satisfies(util.eventuallyReceives(msgSuccess(), msgSuccess(), msgRecord(eqRecord(longEquals(1L))), msgSuccess()));
// Then
GraphDatabaseAPI gdb = (GraphDatabaseAPI) server.graphDatabaseService();
Set<KernelTransactionHandle> txHandles = gdb.getDependencyResolver().resolveDependency(KernelTransactions.class).activeTransactions();
assertThat(txHandles.size()).isEqualTo(1);
for (KernelTransactionHandle txHandle : txHandles) {
assertThat(txHandle.getMetaData()).isEqualTo(txMetadata);
}
connection.send(util.chunk(ROLLBACK_MESSAGE));
}
Aggregations