@Override
          public String apply(@Nullable Command cmd) {
            StringBuilder sb = new StringBuilder();
            String serializedCmd = null;
            try {
              serializedCmd = ReplicationUtils.serializeCommand(cmd);
            } catch (IOException e) {
              e.printStackTrace();
              throw new RuntimeException(e);
            }
            sb.append("SERIALIZED:"+serializedCmd+"\n");
            Command command = null;
            try {
              command = ReplicationUtils.deserializeCommand(serializedCmd);
            } catch (IOException e) {
              e.printStackTrace();
              throw new RuntimeException(e);
            }
            sb.append("CMD:[" + command.getClass().getName() + "]\n");
            sb.append("EVENTID:[" +command.getEventId()+"]\n");
            for (String s : command.get()) {
              sb.append("CMD:" + s);
              sb.append("\n");
            }
            sb.append("Retriable:" + command.isRetriable() + "\n");
            sb.append("Undoable:" + command.isUndoable() + "\n");
            if (command.isUndoable()) {
              for (String s : command.getUndo()) {
                sb.append("UNDO:" + s);
                sb.append("\n");
              }
            }
            List<String> locns = command.cleanupLocationsPerRetry();
            sb.append("cleanupLocationsPerRetry entries :" + locns.size());
            for (String s : locns){
              sb.append("RETRY_CLEANUP:"+s);
              sb.append("\n");
            }
            locns = command.cleanupLocationsAfterEvent();
            sb.append("cleanupLocationsAfterEvent entries :" + locns.size());
            for (String s : locns){
              sb.append("AFTER_EVENT_CLEANUP:"+s);
              sb.append("\n");
            }
            return sb.toString();
          }
Test for event-based replication scenario

Does not test if replication actually happened, merely tests if we're able to consume a repl task
iter appropriately, calling all the functions expected of the interface, without errors.
hcatalog/webhcat/java-client/src/test/java/org/apache/hive/hcatalog/api/TestHCatClient.java