}
@Test
public void shouldDropMultipleUniqueConstraint() {
this.g.tx().readWrite();
final Schema schema = this.g.getBaseGraph().schema();
schema.constraintFor(DynamicLabel.label("Person")).assertPropertyIsUnique("name").create();
schema.constraintFor(DynamicLabel.label("Person")).assertPropertyIsUnique("surname").create();
this.g.tx().commit();
this.g.addVertex(T.label, "Person", "name", "marko");
this.g.addVertex(T.label, "Person", "surname", "aaaa");
this.g.tx().commit();
boolean failSurname = false;
try {
this.g.addVertex(T.label, "Person", "surname", "aaaa");
} catch (ConstraintViolationException e) {
failSurname = true;
}
assertTrue(failSurname);
boolean failName = false;
try {
this.g.addVertex(T.label, "Person", "name", "marko");
} catch (ConstraintViolationException e) {
failName = true;
}
assertTrue(failName);
this.g.tx().commit();
this.g.tx().readWrite();
for (ConstraintDefinition cd : schema.getConstraints(DynamicLabel.label("Person"))) {
cd.drop();
}
this.g.tx().commit();
assertEquals(1, this.g.V().has(T.label, "Person").<Vertex>has("name", "marko").count().next(), 0);