X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-data-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fdata%2Fimpl%2Fschema%2Ftree%2FErrorReportingTest.java;h=771cdfbf3af39d80d23bee91b642d1aeddac135c;hb=a7c0733bc9201f67b73196d93792dee582f931fd;hp=03a086fd0afc70e8057725e323454eb2c7bec962;hpb=5115ed3ea7f633d0ab4959575d3d60b18f1feb6e;p=yangtools.git diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ErrorReportingTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ErrorReportingTest.java index 03a086fd0a..771cdfbf3a 100644 --- a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ErrorReportingTest.java +++ b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ErrorReportingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -9,28 +9,32 @@ package org.opendaylight.yangtools.yang.data.impl.schema.tree; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; + import org.junit.Before; import org.junit.Test; import org.opendaylight.yangtools.yang.data.api.schema.tree.ConflictingModificationAppliedException; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException; import org.opendaylight.yangtools.yang.data.api.schema.tree.ModifiedNodeDoesNotExistException; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; -public class ErrorReportingTest { +public class ErrorReportingTest extends AbstractTestModelTest { - private InMemoryDataTree tree; + private DataTree tree; @Before public void setup() { - tree = (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(); - tree.setSchemaContext(TestModel.createTestContext()); + tree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_OPERATIONAL, SCHEMA_CONTEXT); } @Test public void writeWithoutParentExisting() { - InMemoryDataTreeModification modification = tree.takeSnapshot().newModification(); + DataTreeModification modification = tree.takeSnapshot().newModification(); // We write node without creating parent - modification.write(TestModel.OUTER_LIST_PATH, ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build()); + modification.write(TestModel.OUTER_LIST_PATH, ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME) + .build()); modification.ready(); try { tree.validate(modification); @@ -43,16 +47,16 @@ public class ErrorReportingTest { } @Test - public void parentConcurrentlyDeletedExisting() { - InMemoryDataTreeModification initial = tree.takeSnapshot().newModification(); + public void parentConcurrentlyDeletedExisting() throws DataValidationFailedException { + DataTreeModification initial = tree.takeSnapshot().newModification(); // We write node without creating parent initial.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME)); initial.ready(); // We commit transaction tree.commit(tree.prepare(initial)); - InMemoryDataTreeModification writeTx = tree.takeSnapshot().newModification(); - InMemoryDataTreeModification deleteTx = tree.takeSnapshot().newModification(); + final DataTreeModification writeTx = tree.takeSnapshot().newModification(); + final DataTreeModification deleteTx = tree.takeSnapshot().newModification(); deleteTx.delete(TestModel.TEST_PATH); deleteTx.ready(); // We commit delete modification @@ -68,7 +72,5 @@ public class ErrorReportingTest { } catch (DataValidationFailedException e) { fail("ConflictingModificationAppliedException expected"); } - } - }