Example usage for org.apache.commons.io.input ReaderInputStream toString

List of usage examples for org.apache.commons.io.input ReaderInputStream toString

Introduction

In this page you can find the example usage for org.apache.commons.io.input ReaderInputStream toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:co.cask.cdap.gateway.handlers.ConfigServiceTest.java

@Test
public void testConfig() {

    // cConf/*w w  w. j  ava2 s.c o m*/
    CConfiguration cConf = CConfiguration.create();
    cConf.clear();

    String cConfResourceString = "<configuration>\n" + "\n" + "  <property>\n"
            + "    <name>stream.zz.threshold</name>\n" + "    <value>1</value>\n"
            + "    <description>Some description</description>\n" + "  </property>\n" + "\n"
            + "</configuration>";
    ReaderInputStream cConfResource = new ReaderInputStream(new StringReader(cConfResourceString));
    cConf.addResource(cConfResource);

    ConfigEntry cConfEntry = new ConfigEntry("stream.zz.threshold", "1", cConfResource.toString());

    // hConf
    Configuration hConf = new Configuration();
    String hConfResourceString = "<configuration>\n" + "\n" + "  <property>\n"
            + "    <name>stream.notification.threshold</name>\n" + "    <value>3</value>\n"
            + "    <description>Some description</description>\n" + "  </property>\n" + "\n"
            + "</configuration>";
    ReaderInputStream hConfResource = new ReaderInputStream(new StringReader(hConfResourceString));
    hConf.addResource(hConfResource);

    ConfigEntry hConfEntry = new ConfigEntry("stream.notification.threshold", "3", hConfResource.toString());

    // test
    ConfigService configService = new ConfigService(cConf, hConf);
    List<ConfigEntry> cConfEntries = configService.getCConf();
    Assert.assertTrue(cConfEntries.contains(cConfEntry));

    List<ConfigEntry> hConfEntries = configService.getHConf();
    Assert.assertTrue(hConfEntries.contains(hConfEntry));
}