ORCFileViewer extends HdfsFileViewer { @Override public Set<Capability> getCapabilities(FileSystem fs, Path path) { if (logger.isDebugEnabled()) { logger.debug("orc file path: " + path.toUri().getPath()); } Reader orcReader = null; RecordReader recordReader = null; try { orcReader = OrcFile.createReader(fs, path); recordReader = orcReader.rows(null); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug(path.toUri().getPath() + " is not a ORC file."); logger.debug("Error in opening ORC file: " + e.getLocalizedMessage()); } return EnumSet.noneOf(Capability.class); } finally { if (recordReader != null) { try { recordReader.close(); } catch (IOException e) { logger.error(e); } } } return EnumSet.of(Capability.READ, Capability.SCHEMA); }  @Override String getName(); @Override Set<Capability> getCapabilities(FileSystem fs, Path path); @Override void displayFile(FileSystem fs, Path path, OutputStream outStream,
        int startLine, int endLine); @Override String getSchema(FileSystem fs, Path path);  }
@Test public void orcEmptyFileCapability() throws IOException { assertEquals(this.supportedCapabilities, this.viewer.getCapabilities(this.fs, getResourcePath("TestOrcFile.emptyFile.orc"))); }
@Test public void genericORCFileCapability() throws IOException { assertEquals(this.supportedCapabilities, this.viewer.getCapabilities(this.fs, getResourcePath("TestOrcFile.testPredicatePushdown.orc"))); }
@Test public void binaryTypeORCFileCapability() throws IOException { assertEquals(this.supportedCapabilities, this.viewer.getCapabilities(this.fs, getResourcePath("TestOrcFile.testStringAndBinaryStatistics.orc"))); }
@Test public void snappyCompressedORCFileCapability() throws IOException { assertEquals(this.supportedCapabilities, this.viewer.getCapabilities(this.fs, getResourcePath("TestOrcFile.testSnappy.orc"))); }
@Test public void unionTypeORCFileCapability() throws IOException { assertEquals(this.supportedCapabilities, this.viewer.getCapabilities(this.fs, getResourcePath("TestOrcFile.testUnionAndTimestamp.orc"))); }
@Test public void noAvroCapability() throws IOException { assertEquals(this.unSupportedCapabilities, this.viewer.getCapabilities(this.fs, getResourcePath("TestAvro.avro"))); }
@Test public void noTextCapability() throws IOException { assertEquals(this.unSupportedCapabilities, this.viewer.getCapabilities(this.fs, getResourcePath("TestTextFile.txt"))); }
@Test public void noParquetCapability() throws IOException { assertEquals(this.unSupportedCapabilities, this.viewer.getCapabilities(this.fs, getResourcePath("TestParquetFile.parquet"))); }