Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadOnly Constraint not enforced on OrientElements #7144

Closed
shooit opened this issue Feb 2, 2017 · 2 comments
Closed

ReadOnly Constraint not enforced on OrientElements #7144

shooit opened this issue Feb 2, 2017 · 2 comments
Assignees
Labels

Comments

@shooit
Copy link

shooit commented Feb 2, 2017

OrientDB Version: 2.2.16

Java Version: 1.8

OS: Ubuntu

Expected behavior

ReadOnly properties should throw an exception if you try to update them

Actual behavior

No exception is thrown and the update is committed to the graph

Steps to reproduce

@Test(expected=OValidationException.class)
public void testPropertyReadOnly() {
    String location = "memory:test_readOnly";
    OrientGraphNoTx graphNoTx = new OrientGraphNoTx(location);
    OrientVertexType testType = graphNoTx.createVertexType("Test");
    OProperty prop = testType.createProperty("name", OType.STRING).setReadonly(true);
    graphNoTx.shutdown();

    Assert.assertTrue(prop.isReadonly()); //this one passes

    OrientGraph graph = new OrientGraph(location);
    try {
        OrientVertex vert1 = graph.addVertex("class:Test", "name", "Sam");
        graph.commit();

        vert1.setProperty("name", "Ben"); //should throw an exception
        graph.commit();

        Assert.assertEquals(vert1.getProperty("name"), "Sam");  //fails
    } finally {
        graph.drop();
    }
}
@tglman
Copy link
Member

tglman commented Feb 13, 2017

hi @shooit,

Reproduced this and fixed, added the relative test case, it will be released in 2.2.17.

Regards

@shooit
Copy link
Author

shooit commented Feb 20, 2017

@tglman looks good to me. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants