@Test public void testJsonKeepConfig() throws IOException { String stateStorePath = getClass().getClassLoader().getResource(TEST_STORE).getPath(); boolean keepConfig = true; JobStateToJsonConverter converter = new JobStateToJsonConverter(new Properties(), stateStorePath, keepConfig); StringWriter stringWriter = new StringWriter(); converter.convert(TEST_JOB, stringWriter); JsonObject json = new JsonParser().parse(new JsonReader(new StringReader(stringWriter.toString()))).getAsJsonObject(); Assert.assertNotNull(json.get(PROPERTIES)); for (JsonElement taskState: json.get(TASK_STATES).getAsJsonArray()) { Assert.assertNotNull(taskState.getAsJsonObject().get(PROPERTIES)); } }
public void convert(String jobName, String jobId, Writer writer) throws IOException { List<? extends JobState> jobStates = this.jobStateStore.getAll(jobName, jobId + JOB_STATE_STORE_TABLE_SUFFIX); if (jobStates.isEmpty()) { LOGGER.warn(String.format("No job state found for job with name %s and id %s", jobName, jobId)); return; } try (JsonWriter jsonWriter = new JsonWriter(writer)) { jsonWriter.setIndent("\t"); writeJobState(jsonWriter, jobStates.get(0)); } }
JobStateToJsonConverter implements CliApplication { public void convert(String jobName, String jobId, Writer writer) throws IOException { List<? extends JobState> jobStates = this.jobStateStore.getAll(jobName, jobId + JOB_STATE_STORE_TABLE_SUFFIX); if (jobStates.isEmpty()) { LOGGER.warn(String.format("No job state found for job with name %s and id %s", jobName, jobId)); return; } try (JsonWriter jsonWriter = new JsonWriter(writer)) { jsonWriter.setIndent("\t"); writeJobState(jsonWriter, jobStates.get(0)); } } }
JobStateToJsonConverter implements CliApplication { public void convert(String jobName, String jobId, Writer writer) throws IOException { List<? extends JobState> jobStates = this.jobStateStore.getAll(jobName, jobId + JOB_STATE_STORE_TABLE_SUFFIX); if (jobStates.isEmpty()) { LOGGER.warn(String.format("No job state found for job with name %s and id %s", jobName, jobId)); return; } try (JsonWriter jsonWriter = new JsonWriter(writer)) { jsonWriter.setIndent("\t"); writeJobState(jsonWriter, jobStates.get(0)); } } JobStateToJsonConverter(Properties props, String storeUrl, boolean keepConfig); }
JobStateToJsonConverter implements CliApplication { public void convert(String jobName, String jobId, Writer writer) throws IOException { List<? extends JobState> jobStates = this.jobStateStore.getAll(jobName, jobId + JOB_STATE_STORE_TABLE_SUFFIX); if (jobStates.isEmpty()) { LOGGER.warn(String.format("No job state found for job with name %s and id %s", jobName, jobId)); return; } try (JsonWriter jsonWriter = new JsonWriter(writer)) { jsonWriter.setIndent("\t"); writeJobState(jsonWriter, jobStates.get(0)); } } JobStateToJsonConverter(Properties props, String storeUrl, boolean keepConfig); void convert(String jobName, String jobId, Writer writer); void convert(String jobName, Writer writer); void convertAll(String jobName, Writer writer); @SuppressWarnings("all") @Override void run(String[] args); }
JobStateToJsonConverter implements CliApplication { public void convert(String jobName, String jobId, Writer writer) throws IOException { List<? extends JobState> jobStates = this.jobStateStore.getAll(jobName, jobId + JOB_STATE_STORE_TABLE_SUFFIX); if (jobStates.isEmpty()) { LOGGER.warn(String.format("No job state found for job with name %s and id %s", jobName, jobId)); return; } try (JsonWriter jsonWriter = new JsonWriter(writer)) { jsonWriter.setIndent("\t"); writeJobState(jsonWriter, jobStates.get(0)); } } JobStateToJsonConverter(Properties props, String storeUrl, boolean keepConfig); void convert(String jobName, String jobId, Writer writer); void convert(String jobName, Writer writer); void convertAll(String jobName, Writer writer); @SuppressWarnings("all") @Override void run(String[] args);  }