X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2Ftest%2FTestUtils.java;h=5ef66c3b257da4af2811a9e40b7c5d1908b4f474;hb=306f95ccf8d699e2eed111f193b2fc388fa03e70;hp=4295c29a22cea2f538d0006d94c70957163fabf9;hpb=86b407a7355a4931a59a9fa462c9c06248456727;p=controller.git diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java index 4295c29a22..5ef66c3b25 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java @@ -6,9 +6,11 @@ import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileNotFoundException; +import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; @@ -149,7 +151,7 @@ public final class TestUtils { ControllerContext.getInstance().setSchemas(TestUtils.loadSchemaContext(modules)); prepareMocksForRestconf(modules, restconf); - restconf.createConfigurationData(schemaNodePath, compositeNode); + restconf.updateConfigurationData(schemaNodePath, compositeNode); } /** @@ -276,4 +278,18 @@ public final class TestUtils { return byteArrayOS.toString(); } + + public static String loadTextFile(String filePath) throws IOException { + FileReader fileReader = new FileReader(filePath); + BufferedReader bufReader = new BufferedReader(fileReader); + + String line = null; + StringBuilder result = new StringBuilder(); + while ((line = bufReader.readLine()) != null) { + result.append(line); + } + bufReader.close(); + return result.toString(); + + } }