VistaSystemInfoResponseExtractor implements RpcResponseExtractor<VistaSystemInfo> { @Override public VistaSystemInfo extractData(RpcResponse response) throws RpcResponseExtractionException { String[] lines = linesFromExtractor.extractData(response); VistaSystemInfo info = new VistaSystemInfo(); info.setServer(lines[0]); info.setVolume(lines[1]); info.setUCI(lines[2]); info.setDevice(lines[3]); if (lines.length > 7) { info.setDomainName(lines[6]); if ("1".equals(lines[7])) info.setProductionAccount(true); } return info; }  @Override VistaSystemInfo extractData(RpcResponse response);  }
@Test public void extractVistaSystemInfo() throws Exception { VistaSystemInfoResponseExtractor e = new VistaSystemInfoResponseExtractor(); VistaSystemInfo systemInfo = e.extractData(new RpcResponse("serverserv.vha.domain.ext\r\nDEV\r\nDEV\r\n/dev/null:26294\r\n5\r\n0\r\nserverserver-02.DOMAIN.EXT\r\n0\r\n")); assertEquals("serverserv.vha.domain.ext", systemInfo.getServer()); assertEquals("DEV", systemInfo.getVolume()); assertEquals("DEV", systemInfo.getUCI()); assertEquals("/dev/null:26294", systemInfo.getDevice()); assertEquals("serverserver-02.DOMAIN.EXT", systemInfo.getDomainName()); assertFalse(systemInfo.isProductionAccount()); assertEquals(VistaStringUtils.crc16Hex("serverserver-02.DOMAIN.EXT"), systemInfo.getVistaId()); assertNull(systemInfo.getIntroText()); }