use of org.neo4j.graphdb.Notification in project neo4j by neo4j.
the class ResultSubscriber method writeAsStringTo.
@Override
public void writeAsStringTo(PrintWriter writer) {
ResultStringBuilder stringBuilder = ResultStringBuilder.apply(execution.fieldNames(), context);
try {
// paths
if (this.hasFetchedNext()) {
stringBuilder.addRow(new ResultRowImpl(this.getNextObject()));
}
accept(stringBuilder);
stringBuilder.result(writer, statistics);
for (Notification notification : getNotifications()) {
writer.println(notification.getDescription());
}
} catch (Exception e) {
close();
throw converted(e);
}
}
use of org.neo4j.graphdb.Notification in project neo4j by neo4j.
the class NotificationCodeTest method shouldConstructNotificationFor_INDEX_HINT_UNFULFILLABLE.
@Test
void shouldConstructNotificationFor_INDEX_HINT_UNFULFILLABLE() {
NotificationDetail indexDetail = NotificationDetail.Factory.index("Person", "name");
Notification notification = INDEX_HINT_UNFULFILLABLE.notification(InputPosition.empty, indexDetail);
assertThat(notification.getTitle()).isEqualTo("The request (directly or indirectly) referred to an index that does not exist.");
assertThat(notification.getSeverity()).isEqualTo(SeverityLevel.WARNING);
assertThat(notification.getCode()).isEqualTo("Neo.ClientError.Schema.IndexNotFound");
assertThat(notification.getPosition()).isEqualTo(InputPosition.empty);
assertThat(notification.getDescription()).isEqualTo("The hinted index does not exist, please check the schema (hinted index is: index on :Person(name))");
}
use of org.neo4j.graphdb.Notification in project neo4j by neo4j.
the class NotificationCodeTest method shouldConstructNotificationsFor_DEPRECATED_PROCEDURE_with_no_newName.
@Test
void shouldConstructNotificationsFor_DEPRECATED_PROCEDURE_with_no_newName() {
NotificationDetail identifierDetail = NotificationDetail.Factory.deprecatedName("oldName", "");
Notification notification = DEPRECATED_PROCEDURE.notification(InputPosition.empty, identifierDetail);
assertThat(notification.getTitle()).isEqualTo("This feature is deprecated and will be removed in future versions.");
assertThat(notification.getSeverity()).isEqualTo(SeverityLevel.WARNING);
assertThat(notification.getCode()).isEqualTo("Neo.ClientNotification.Statement.FeatureDeprecationWarning");
assertThat(notification.getPosition()).isEqualTo(InputPosition.empty);
assertThat(notification.getDescription()).isEqualTo("The query used a deprecated procedure. ('oldName' is no longer supported)");
}
use of org.neo4j.graphdb.Notification in project neo4j by neo4j.
the class NotificationCodeTest method shouldConstructNotificationsFor_DEPRECATED_PROCEDURE.
@Test
void shouldConstructNotificationsFor_DEPRECATED_PROCEDURE() {
NotificationDetail identifierDetail = NotificationDetail.Factory.deprecatedName("oldName", "newName");
Notification notification = DEPRECATED_PROCEDURE.notification(InputPosition.empty, identifierDetail);
assertThat(notification.getTitle()).isEqualTo("This feature is deprecated and will be removed in future versions.");
assertThat(notification.getSeverity()).isEqualTo(SeverityLevel.WARNING);
assertThat(notification.getCode()).isEqualTo("Neo.ClientNotification.Statement.FeatureDeprecationWarning");
assertThat(notification.getPosition()).isEqualTo(InputPosition.empty);
assertThat(notification.getDescription()).isEqualTo("The query used a deprecated procedure. ('oldName' has been replaced by 'newName')");
}
use of org.neo4j.graphdb.Notification in project neo4j by neo4j.
the class NotificationCodeTest method shouldConstructNotificationsFor_JOIN_HINT_UNFULFILLABLE.
@Test
void shouldConstructNotificationsFor_JOIN_HINT_UNFULFILLABLE() {
List<String> idents = new ArrayList<>();
idents.add("n");
idents.add("node2");
NotificationDetail identifierDetail = NotificationDetail.Factory.joinKey(idents);
Notification notification = JOIN_HINT_UNFULFILLABLE.notification(InputPosition.empty, identifierDetail);
assertThat(notification.getTitle()).isEqualTo("The database was unable to plan a hinted join.");
assertThat(notification.getSeverity()).isEqualTo(SeverityLevel.WARNING);
assertThat(notification.getCode()).isEqualTo("Neo.ClientNotification.Statement.JoinHintUnfulfillableWarning");
assertThat(notification.getPosition()).isEqualTo(InputPosition.empty);
assertThat(notification.getDescription()).isEqualTo("The hinted join was not planned. This could happen because no generated plan contained the join key, " + "please try using a different join key or restructure your query. " + "(hinted join key identifiers are: n, node2)");
}
Aggregations