X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-it%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Ftest%2Fsal%2Fbinding%2Fit%2FDataServiceTest.java;h=8a390b337e1849ae8cf2c15f7799073ace928ee2;hb=28ad802448833cad483f185cfe442497ddc5c296;hp=e1f109b88dc2e923f8580b47e57c1795cc50d947;hpb=00c17684ce6100b6896049fab6becd06325de510;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/DataServiceTest.java b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/DataServiceTest.java index e1f109b88d..8a390b337e 100644 --- a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/DataServiceTest.java +++ b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/DataServiceTest.java @@ -1,14 +1,23 @@ +/* + * Copyright (c) 2014 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, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.test.sal.binding.it; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import java.util.concurrent.Future; import org.junit.Before; import org.junit.Test; import org.opendaylight.controller.md.sal.common.api.TransactionStatus; -import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext; +import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer; import org.opendaylight.controller.sal.binding.api.data.DataBrokerService; import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction; import org.opendaylight.controller.sal.core.api.Broker; @@ -27,8 +36,8 @@ import com.google.inject.Inject; public class DataServiceTest extends AbstractTest { protected DataBrokerService consumerDataService; - - + + @Inject Broker broker2; @@ -49,59 +58,58 @@ public class DataServiceTest extends AbstractTest { assertNotNull(consumerDataService); - + DataModificationTransaction transaction = consumerDataService.beginTransaction(); assertNotNull(transaction); - + NodeRef node1 = createNodeRef("0"); DataObject node = consumerDataService.readConfigurationData(node1.getValue()); assertNull(node); Node nodeData1 = createNode("0"); - + transaction.putConfigurationData(node1.getValue(), nodeData1); Future> commitResult = transaction.commit(); assertNotNull(commitResult); - + RpcResult result = commitResult.get(); - + assertNotNull(result); assertNotNull(result.getResult()); assertEquals(TransactionStatus.COMMITED, result.getResult()); - + Node readedData = (Node) consumerDataService.readConfigurationData(node1.getValue()); assertNotNull(readedData); assertEquals(nodeData1.getKey(), readedData.getKey()); - - + + DataModificationTransaction transaction2 = consumerDataService.beginTransaction(); assertNotNull(transaction); - + transaction2.removeConfigurationData(node1.getValue()); - + Future> commitResult2 = transaction2.commit(); assertNotNull(commitResult2); - + RpcResult result2 = commitResult2.get(); - + assertNotNull(result2); assertNotNull(result2.getResult()); assertEquals(TransactionStatus.COMMITED, result2.getResult()); - + DataObject readedData2 = consumerDataService.readConfigurationData(node1.getValue()); assertNull(readedData2); - - + + } - + private static NodeRef createNodeRef(String string) { NodeKey key = new NodeKey(new NodeId(string)); - InstanceIdentifier path = InstanceIdentifier.builder().node(Nodes.class).node(Node.class, key) - .toInstance(); + InstanceIdentifier path = InstanceIdentifier.builder(Nodes.class).child(Node.class, key).build(); return new NodeRef(path); } - + private static Node createNode(String string) { NodeBuilder ret = new NodeBuilder(); NodeId id = new NodeId(string);