use of co.cask.cdap.proto.RunRecord in project cdap by caskdata.
the class LogHandlerTestRun method testLogsRunId.
private void testLogsRunId(String appId, String entityType, String entityId, String namespace, String format, List<String> suppress) throws Exception {
ProgramId programId = new NamespaceId(namespace).app(appId).program(ProgramType.valueOfCategoryName(entityType), entityId);
RunRecord runRecord = mockLogReader.getRunRecord(programId);
int expectedEvents = 20;
if (runRecord.getStatus() == ProgramRunStatus.RUNNING || runRecord.getStatus() == ProgramRunStatus.SUSPENDED) {
expectedEvents = 30;
}
long startTime = MockLogReader.getMockTimeSecs(0);
long stopTime = MockLogReader.getMockTimeSecs(100);
String nextNoFromUrl;
if (suppress.isEmpty()) {
nextNoFromUrl = String.format("apps/%s/%s/%s/runs/%s/logs?format=%s&start=%s&stop=%s", appId, entityType, entityId, runRecord.getPid(), format, startTime, stopTime);
} else {
String fieldsToSuppress = getSuppressStr(suppress);
nextNoFromUrl = String.format("apps/%s/%s/%s/runs/%s/logs?format=%s&start=%s&stop=%s&suppress=%s", appId, entityType, entityId, runRecord.getPid(), format, startTime, stopTime, fieldsToSuppress);
}
HttpResponse response = doGet(getVersionedAPIPath(nextNoFromUrl, namespace));
verifyLogs(response, entityId, format, true, true, true, expectedEvents, 20, suppress);
}
Aggregations