Code example for InputStreamReader

0
 
	// test to see that we read and convert config correctly 
	@Test 
	public void testPhysicalSourceConfig() throws IOException { 
		ObjectMapper mapper = new ObjectMapper();
		InputStreamReader isr = new InputStreamReader(IOUtils.toInputStream(_configSource));
 
		//PhysicalSourceConfig physicalSourceConfig = mapper.readValue(sourcesJson, PhysicalSourceConfig.class); 
		PhysicalSourceConfig physicalSourceConfig = mapper.readValue(isr, PhysicalSourceConfig.class);
		PhysicalSourceStaticConfig pStatic=null;
		try { 
		  physicalSourceConfig.checkForNulls();
		  pStatic = physicalSourceConfig.build();
		} catch (InvalidConfigException e) {
		  fail("PhysicalSourceConfig.checkForNulls failed.", e);
		} 
 
		// also assert basic stuff 
		assertNotNull("Uri is null.", pStatic.getUri());
		assertNotNull("Name is null.", pStatic.getName());
		assertEquals(100, pStatic.getId(),"physical source id mismatch:");