use of org.neo4j.graphdb.schema.IndexDefinition in project neo4j by neo4j.
the class AppsIT method canListIndexes.
@Test
public void canListIndexes() throws Exception {
// GIVEN
Label label = label("Person");
beginTx();
IndexDefinition index = db.schema().indexFor(label).on("name").create();
finishTx();
waitForIndex(db, index);
// WHEN / THEN
executeCommand("schema ls", ":Person", IndexState.ONLINE.name());
}
use of org.neo4j.graphdb.schema.IndexDefinition in project neo4j by neo4j.
the class AppsIT method failSamplingWhenProvidingBadProperty.
@Test
public void failSamplingWhenProvidingBadProperty() throws Exception {
// GIVEN
Label label = label("Person");
String property = "name";
beginTx();
IndexDefinition index = db.schema().indexFor(label).on(property).create();
finishTx();
waitForIndex(db, index);
// WHEN / THEN
try {
executeCommand("schema sample -l Person -p namn");
fail("This should fail");
} catch (ShellException e) {
assertThat(e.getMessage(), containsString("No property associated with 'namn' was found"));
}
}
use of org.neo4j.graphdb.schema.IndexDefinition in project neo4j by neo4j.
the class AppsIT method canSampleAllIndexes.
@Test
public void canSampleAllIndexes() throws Exception {
// GIVEN
Label label = label("Person");
String property = "name";
beginTx();
IndexDefinition index = db.schema().indexFor(label).on(property).create();
finishTx();
waitForIndex(db, index);
// WHEN / THEN
executeCommand("schema sample -a");
}
use of org.neo4j.graphdb.schema.IndexDefinition in project neo4j by neo4j.
the class AppsIT method failSampleWhenNoOptionGiven.
@Test
public void failSampleWhenNoOptionGiven() throws Exception {
// GIVEN
Label label = label("Person");
String property = "name";
beginTx();
IndexDefinition index = db.schema().indexFor(label).on(property).create();
finishTx();
waitForIndex(db, index);
// WHEN / THEN
try {
executeCommand("schema sample");
fail("This should fail");
} catch (ShellException e) {
assertThat(e.getMessage(), containsString("Invalid usage of sample"));
}
}
use of org.neo4j.graphdb.schema.IndexDefinition in project neo4j by neo4j.
the class AppsIT method canListIndexesForGivenLabel.
@Test
public void canListIndexesForGivenLabel() throws Exception {
// GIVEN
Label label1 = label("Person");
Label label2 = label("Building");
beginTx();
IndexDefinition index1 = db.schema().indexFor(label1).on("name").create();
IndexDefinition index2 = db.schema().indexFor(label2).on("name").create();
finishTx();
waitForIndex(db, index1);
waitForIndex(db, index2);
// WHEN / THEN
executeCommand("schema ls -l " + label2.name(), ":" + label2.name(), IndexState.ONLINE.name(), "!:" + label1.name());
}
Aggregations