@Test public void testDecodeZooKeeperEntry() throws Exception { byte[] zpathFileName = makeZPathFileName(TABLE_ID, ProblemType.FILE_READ, RESOURCE); String node = Encoding.encodeAsBase64FileName(new Text(zpathFileName)); long now = System.currentTimeMillis(); byte[] encoded = encodeReportData(now, SERVER, "excmsg"); expect(zoorw.getData(ZooUtil.getRoot("instance") + Constants.ZPROBLEMS + "/" + node, null)) .andReturn(encoded); replay(zoorw); r = ProblemReport.decodeZooKeeperEntry(context, node); assertEquals(TABLE_ID, r.getTableId()); assertSame(ProblemType.FILE_READ, r.getProblemType()); assertEquals(RESOURCE, r.getResource()); assertEquals(SERVER, r.getServer()); assertEquals(now, r.getTime()); assertEquals("excmsg", r.getException()); }
static ProblemReport decodeZooKeeperEntry(ServerContext context, String node) throws IOException, KeeperException, InterruptedException { byte[] bytes = Encoding.decodeBase64FileName(node); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); DataInputStream dis = new DataInputStream(bais); TableId tableId = TableId.of(dis.readUTF()); String problemType = dis.readUTF(); String resource = dis.readUTF(); String zpath = context.getZooKeeperRoot() + Constants.ZPROBLEMS + "/" + node; byte[] enc = context.getZooReaderWriter().getData(zpath, null); return new ProblemReport(tableId, ProblemType.valueOf(problemType), resource, enc); }
ProblemReport { static ProblemReport decodeZooKeeperEntry(ServerContext context, String node) throws IOException, KeeperException, InterruptedException { byte[] bytes = Encoding.decodeBase64FileName(node); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); DataInputStream dis = new DataInputStream(bais); TableId tableId = TableId.of(dis.readUTF()); String problemType = dis.readUTF(); String resource = dis.readUTF(); String zpath = context.getZooKeeperRoot() + Constants.ZPROBLEMS + "/" + node; byte[] enc = context.getZooReaderWriter().getData(zpath, null); return new ProblemReport(tableId, ProblemType.valueOf(problemType), resource, enc); } }
ProblemReport { static ProblemReport decodeZooKeeperEntry(ServerContext context, String node) throws IOException, KeeperException, InterruptedException { byte[] bytes = Encoding.decodeBase64FileName(node); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); DataInputStream dis = new DataInputStream(bais); TableId tableId = TableId.of(dis.readUTF()); String problemType = dis.readUTF(); String resource = dis.readUTF(); String zpath = context.getZooKeeperRoot() + Constants.ZPROBLEMS + "/" + node; byte[] enc = context.getZooReaderWriter().getData(zpath, null); return new ProblemReport(tableId, ProblemType.valueOf(problemType), resource, enc); } ProblemReport(TableId tableId, ProblemType problemType, String resource, String server,
      Throwable e, long creationTime);  ProblemReport(TableId tableId, ProblemType problemType, String resource, String server,
      Throwable e);  ProblemReport(TableId tableId, ProblemType problemType, String resource, Throwable e); private  ProblemReport(TableId table, ProblemType problemType, String resource, byte[] enc); }
ProblemReport { static ProblemReport decodeZooKeeperEntry(ServerContext context, String node) throws IOException, KeeperException, InterruptedException { byte[] bytes = Encoding.decodeBase64FileName(node); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); DataInputStream dis = new DataInputStream(bais); TableId tableId = TableId.of(dis.readUTF()); String problemType = dis.readUTF(); String resource = dis.readUTF(); String zpath = context.getZooKeeperRoot() + Constants.ZPROBLEMS + "/" + node; byte[] enc = context.getZooReaderWriter().getData(zpath, null); return new ProblemReport(tableId, ProblemType.valueOf(problemType), resource, enc); } ProblemReport(TableId tableId, ProblemType problemType, String resource, String server,
      Throwable e, long creationTime);  ProblemReport(TableId tableId, ProblemType problemType, String resource, String server,
      Throwable e);  ProblemReport(TableId tableId, ProblemType problemType, String resource, Throwable e); private  ProblemReport(TableId table, ProblemType problemType, String resource, byte[] enc); static ProblemReport decodeMetadataEntry(Entry<Key,Value> entry); TableId getTableId(); ProblemType getProblemType(); String getResource(); String getException(); String getServer(); long getTime(); @Override int hashCode(); @Override boolean equals(Object o); }
ProblemReport { static ProblemReport decodeZooKeeperEntry(ServerContext context, String node) throws IOException, KeeperException, InterruptedException { byte[] bytes = Encoding.decodeBase64FileName(node); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); DataInputStream dis = new DataInputStream(bais); TableId tableId = TableId.of(dis.readUTF()); String problemType = dis.readUTF(); String resource = dis.readUTF(); String zpath = context.getZooKeeperRoot() + Constants.ZPROBLEMS + "/" + node; byte[] enc = context.getZooReaderWriter().getData(zpath, null); return new ProblemReport(tableId, ProblemType.valueOf(problemType), resource, enc); } ProblemReport(TableId tableId, ProblemType problemType, String resource, String server,
      Throwable e, long creationTime);  ProblemReport(TableId tableId, ProblemType problemType, String resource, String server,
      Throwable e);  ProblemReport(TableId tableId, ProblemType problemType, String resource, Throwable e); private  ProblemReport(TableId table, ProblemType problemType, String resource, byte[] enc); static ProblemReport decodeMetadataEntry(Entry<Key,Value> entry); TableId getTableId(); ProblemType getProblemType(); String getResource(); String getException(); String getServer(); long getTime(); @Override int hashCode(); @Override boolean equals(Object o);  }