Java Code Examples for org.codehaus.jettison.json.JSONObject#getLong()

The following examples show how to use org.codehaus.jettison.json.JSONObject#getLong() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hadoop   File: TestAMWebServicesTasks.java    License: Apache License 2.0 6 votes vote down vote up
public void verifyAMJobTaskCounters(JSONObject info, Task task)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(task.getID()),
      info.getString("id"));
  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("taskCounterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("name not set",
          (counterName != null && !counterName.isEmpty()));
      long value = counter.getLong("value");
      assertTrue("value  >= 0", value >= 0);
    }
  }
}
 
Example 2
public void verifyAMJobTaskAttemptCounters(JSONObject info, TaskAttempt att)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(att.getID()),
      info.getString("id"));

  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("taskAttemptCounterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("name not set",
          (counterName != null && !counterName.isEmpty()));
      long value = counter.getLong("value");
      assertTrue("value  >= 0", value >= 0);
    }
  }
}
 
Example 3
public void verifyHsJobTaskAttemptCounters(JSONObject info, TaskAttempt att)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(att.getID()),
      info.getString("id"));

  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("taskAttemptCounterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("name not set",
          (counterName != null && !counterName.isEmpty()));
      long value = counter.getLong("value");
      assertTrue("value  >= 0", value >= 0);
    }
  }
}
 
Example 4
Source Project: hadoop   File: TestHsWebServicesTasks.java    License: Apache License 2.0 6 votes vote down vote up
public void verifyHsJobTaskCounters(JSONObject info, Task task)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(task.getID()),
      info.getString("id"));
  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("taskCounterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("name not set",
          (counterName != null && !counterName.isEmpty()));
      long value = counter.getLong("value");
      assertTrue("value  >= 0", value >= 0);
    }
  }
}
 
Example 5
Source Project: ezScrum   File: StoryInfo.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void loadJSON(String jsonString) throws JSONException {
	JSONObject story = new JSONObject(jsonString);
	try {
		id = story.getLong("id");
	} catch (JSONException e) {
		id = -1;
	}
	name = story.getString("name");
	notes = story.getString("notes");
	howToDemo = story.getString("how_to_demo");
	importance = story.getInt("importance");
	value = story.getInt("value");
	estimate = story.getInt("estimate");
	status = story.getInt("status");
	sprintId = story.getLong("sprint_id");
	tags = story.getString("tags");
}
 
Example 6
Source Project: big-c   File: TestAMWebServicesAttempts.java    License: Apache License 2.0 6 votes vote down vote up
public void verifyAMJobTaskAttemptCounters(JSONObject info, TaskAttempt att)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(att.getID()),
      info.getString("id"));

  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("taskAttemptCounterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("name not set",
          (counterName != null && !counterName.isEmpty()));
      long value = counter.getLong("value");
      assertTrue("value  >= 0", value >= 0);
    }
  }
}
 
Example 7
Source Project: big-c   File: TestHsWebServicesAttempts.java    License: Apache License 2.0 6 votes vote down vote up
public void verifyHsJobTaskAttemptCounters(JSONObject info, TaskAttempt att)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(att.getID()),
      info.getString("id"));

  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("taskAttemptCounterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("name not set",
          (counterName != null && !counterName.isEmpty()));
      long value = counter.getLong("value");
      assertTrue("value  >= 0", value >= 0);
    }
  }
}
 
Example 8
Source Project: big-c   File: TestHsWebServicesTasks.java    License: Apache License 2.0 6 votes vote down vote up
public void verifyHsJobTaskCounters(JSONObject info, Task task)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(task.getID()),
      info.getString("id"));
  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("taskCounterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("name not set",
          (counterName != null && !counterName.isEmpty()));
      long value = counter.getLong("value");
      assertTrue("value  >= 0", value >= 0);
    }
  }
}
 
Example 9
/**
 * Returns the azkaban flow log
 * @param offset The offset from which logs should be found
 * @param maximumlLogLengthLimit The maximum log length limit
 * @return The azkaban flow logs
 */
public String getAzkabanFlowLog(String offset, String maximumlLogLengthLimit) {
  List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
  urlParameters.add(new BasicNameValuePair("session.id", _sessionId));
  urlParameters.add(new BasicNameValuePair("ajax", "fetchExecFlowLogs"));
  urlParameters.add(new BasicNameValuePair("execid", _executionId));
  urlParameters.add(new BasicNameValuePair("offset", offset));
  urlParameters.add(new BasicNameValuePair("length", maximumlLogLengthLimit));

  try {
    JSONObject jsonObject = fetchJson(urlParameters, _workflowExecutionUrl);
    if (jsonObject.getLong("length") == 0) {
      throw new RuntimeException("No log found for given execution url!.");
    }
    return jsonObject.get("data").toString();
  } catch (JSONException e) {
    e.printStackTrace();
  }
  return null;
}
 
Example 10
@Test
public void simpleCountdownTest() throws Exception
{
  List<GPOMutable> dataValues = createValues();
  DataQuerySnapshot gQuery = new DataQuerySnapshot("1", new Fields(Sets.newHashSet("a", "b")));

  DataResultSnapshot result = new DataResultSnapshot(gQuery, dataValues, 2);

  DataResultSnapshotSerializer serializer = new DataResultSnapshotSerializer();
  String resultJSON = serializer.serialize(result, new ResultFormatter());

  JSONObject rjo = new JSONObject(resultJSON);

  long countdown = rjo.getLong(Result.FIELD_COUNTDOWN);

  Assert.assertEquals(2, countdown);
}
 
Example 11
protected String validateGetNewApplicationJsonResponse(JSONObject json)
    throws JSONException {
  String appId = json.getString("application-id");
  assertTrue(!appId.isEmpty());
  JSONObject maxResources = json.getJSONObject("maximum-resource-capability");
  long memory = maxResources.getLong("memory");
  long vCores = maxResources.getLong("vCores");
  assertTrue(memory != 0);
  assertTrue(vCores != 0);
  return appId;
}
 
Example 12
Source Project: hadoop   File: TestAMWebServicesJobs.java    License: Apache License 2.0 5 votes vote down vote up
public void verifyAMJobCounters(JSONObject info, Job job)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(job.getID()),
      info.getString("id"));
  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("counterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("counter name not set",
          (counterName != null && !counterName.isEmpty()));

      long mapValue = counter.getLong("mapCounterValue");
      assertTrue("mapCounterValue  >= 0", mapValue >= 0);

      long reduceValue = counter.getLong("reduceCounterValue");
      assertTrue("reduceCounterValue  >= 0", reduceValue >= 0);

      long totalValue = counter.getLong("totalCounterValue");
      assertTrue("totalCounterValue  >= 0", totalValue >= 0);

    }
  }
}
 
Example 13
Source Project: tez   File: DAGClientTimelineImpl.java    License: Apache License 2.0 5 votes vote down vote up
private TezCounterGroupProto.Builder parseCounterGroup(JSONObject counterGroupNode)
    throws JSONException {

  if (counterGroupNode == null) {
    return null;
  }

  TezCounterGroupProto.Builder counterGroup = TezCounterGroupProto.newBuilder();

  final String groupName = counterGroupNode.optString(ATSConstants.COUNTER_GROUP_NAME);
  final String groupDisplayName = counterGroupNode.optString(
      ATSConstants.COUNTER_GROUP_DISPLAY_NAME, groupName);
  final JSONArray counterNodes = counterGroupNode.optJSONArray(ATSConstants.COUNTERS);
  final int numCounters = counterNodes.length();

  List<TezCounterProto> counters = new ArrayList<TezCounterProto>(numCounters);

  for (int i = 0; i < numCounters; i++) {
    final JSONObject counterNode = counterNodes.getJSONObject(i);
    final String counterName = counterNode.getString(ATSConstants.COUNTER_NAME);
    final String counterDisplayName = counterNode.optString(ATSConstants.COUNTER_DISPLAY_NAME,
        counterName);
    final long counterValue = counterNode.getLong(ATSConstants.COUNTER_VALUE);

    counters.add(
        TezCounterProto.newBuilder()
            .setName(counterName)
            .setDisplayName(counterDisplayName)
            .setValue(counterValue)
            .build());
  }

  return counterGroup.setName(groupName)
      .setDisplayName(groupDisplayName)
      .addAllCounters(counters);
}
 
Example 14
private void loadJSON(String jsonString) throws JSONException {
	JSONObject release = new JSONObject(jsonString);
	try {
		id = release.getLong("id");
	} catch (JSONException e) {
		id = -1;
	}
	name = release.getString(ReleaseEnum.NAME);
	description = release.getString(ReleaseEnum.DESCRIPTION);
	startDate = release.getString(SprintEnum.START_DATE);
	dueDate = release.getString(SprintEnum.DUE_DATE);
}
 
Example 15
Source Project: big-c   File: TestAMWebServicesJobs.java    License: Apache License 2.0 5 votes vote down vote up
public void verifyAMJobCounters(JSONObject info, Job job)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(job.getID()),
      info.getString("id"));
  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("counterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("counter name not set",
          (counterName != null && !counterName.isEmpty()));

      long mapValue = counter.getLong("mapCounterValue");
      assertTrue("mapCounterValue  >= 0", mapValue >= 0);

      long reduceValue = counter.getLong("reduceCounterValue");
      assertTrue("reduceCounterValue  >= 0", reduceValue >= 0);

      long totalValue = counter.getLong("totalCounterValue");
      assertTrue("totalCounterValue  >= 0", totalValue >= 0);

    }
  }
}
 
Example 16
Source Project: big-c   File: TestHsWebServicesJobs.java    License: Apache License 2.0 5 votes vote down vote up
public void verifyHsJobCounters(JSONObject info, Job job)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(job.getID()),
      info.getString("id"));
  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("counterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("counter name not set",
          (counterName != null && !counterName.isEmpty()));

      long mapValue = counter.getLong("mapCounterValue");
      assertTrue("mapCounterValue  >= 0", mapValue >= 0);

      long reduceValue = counter.getLong("reduceCounterValue");
      assertTrue("reduceCounterValue  >= 0", reduceValue >= 0);

      long totalValue = counter.getLong("totalCounterValue");
      assertTrue("totalCounterValue  >= 0", totalValue >= 0);

    }
  }
}
 
Example 17
/**
 * This is a helper method extracts and validates the information contained in the schema stub for this schema.
 *
 * @param schemaStub The schema stub to extract information from and validate.
 * @throws JSONException This exception is thrown if there is an error processing the provided JSON schemaStub.
 */
private void setSchemaStub(String schemaStub) throws JSONException
{
  JSONObject jo = new JSONObject(schemaStub);
  SchemaUtils.checkValidKeysEx(jo, VALID_KEYS);

  JSONObject tempTime = jo.getJSONObject(FIELD_TIME);
  SchemaUtils.checkValidKeys(jo, VALID_TIME_KEYS);

  this.from = tempTime.getLong(FIELD_TIME_FROM);
  this.to = tempTime.getLong(FIELD_TIME_TO);
}
 
Example 18
Source Project: tez   File: Utils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Parse tez counters from json
 *
 * @param jsonObject
 * @return TezCounters
 * @throws JSONException
 */
public static TezCounters parseTezCountersFromJSON(JSONObject jsonObject)
    throws JSONException {
  TezCounters counters = new TezCounters();

  if (jsonObject == null) {
    return counters; //empty counters.
  }

  final JSONArray counterGroupNodes = jsonObject.optJSONArray(Constants.COUNTER_GROUPS);
  if (counterGroupNodes != null) {
    for (int i = 0; i < counterGroupNodes.length(); i++) {
      JSONObject counterGroupNode = counterGroupNodes.optJSONObject(i);
      final String groupName = counterGroupNode.optString(Constants.COUNTER_GROUP_NAME);
      final String groupDisplayName = counterGroupNode.optString(
          Constants.COUNTER_GROUP_DISPLAY_NAME, groupName);

      CounterGroup group = counters.addGroup(groupName, groupDisplayName);

      final JSONArray counterNodes = counterGroupNode.optJSONArray(Constants.COUNTERS);

      //Parse counter nodes
      for (int j = 0; j < counterNodes.length(); j++) {
        JSONObject counterNode = counterNodes.optJSONObject(j);
        final String counterName = counterNode.getString(Constants.COUNTER_NAME);
        final String counterDisplayName =
            counterNode.optString(Constants.COUNTER_DISPLAY_NAME, counterName);
        final long counterValue = counterNode.getLong(Constants.COUNTER_VALUE);
        addCounter(group, counterName, counterDisplayName, counterValue);
      }
    }
  }
  return counters;
}
 
Example 19
@Test
public void testGetTasksId() throws Exception {
	SprintObject sprint = new SprintObject(mProject.getId());
	sprint.save();
	StoryObject story = new StoryObject(mProject.getId());
	story.setSprintId(sprint.getId());
	story.save();
	TaskObject task1 = new TaskObject(mProject.getId());
	task1.setStoryId(story.getId()).setName("Test_Task_Name1")
			.setStatus(TaskObject.STATUS_UNCHECK).setEstimate(13)
			.setRemains(8).setActual(10).setNotes("Test_Task_Notes");
	task1.save();
	TaskObject task2 = new TaskObject(mProject.getId());
	task2.setStoryId(story.getId()).setName("Test_Task_Name2")
			.setStatus(TaskObject.STATUS_UNCHECK).setEstimate(13)
			.setRemains(8).setActual(10).setNotes("Test_Task_Notes");
	task2.save();
	TaskObject task3 = new TaskObject(mProject.getId());
	task3.setStoryId(story.getId()).setName("Test_Task_Name3")
			.setStatus(TaskObject.STATUS_UNCHECK).setEstimate(13)
			.setRemains(8).setActual(10).setNotes("Test_Task_Notes");
	task3.save();
	String sprintId = String.valueOf(sprint.getId());
	String storyId = String.valueOf(story.getId());
	// Assemble URL
	String URL = String.format(API_URL, mProjectName, sprintId + "/" + storyId + "/task-id-list", mUsername, mPassword);

	// Send Http Request
	HttpGet httpGet = new HttpGet(URL);
	String result = EntityUtils.toString(mHttpClient.execute(httpGet)
			.getEntity(), StandardCharsets.UTF_8);
	JSONObject wholeJson = new JSONObject(result);
	JSONObject storyJson = wholeJson
			.getJSONObject(SprintBacklogUtil.TAG_STORY);
	long storyIdFromResponse = storyJson.getLong(SprintBacklogUtil.TAG_ID);
	JSONArray taskIdArray = storyJson
			.getJSONArray(SprintBacklogUtil.TAG_TASKSIDL);
	assertEquals(story.getId(), storyIdFromResponse);
	assertEquals(task1.getId(), taskIdArray.get(0));
	assertEquals(task2.getId(), taskIdArray.get(1));
	assertEquals(task3.getId(), taskIdArray.get(2));
}
 
Example 20
/**
 * This is a helper deserializer method.
 * @param json The JSON to deserialize.
 * @param context The context information to use when deserializing the query.
 * @return The deserialized query. If the given json contains some invalid content this
 * method may return null.
 * @throws Exception
 */
private Message deserializeHelper(String json, Object context) throws Exception
{
  JSONObject jo = new JSONObject(json);

  //Validate fields
  if (!SchemaUtils.checkValidKeys(jo, FIRST_LEVEL_FIELD_COMBINATIONS)) {
    throw new IOException("Invalid keys");
  }

  //// Query id stuff
  String id = jo.getString(DataQuerySnapshot.FIELD_ID);
  String type = jo.getString(DataQuerySnapshot.FIELD_TYPE);

  if (!type.equals(DataQuerySnapshot.TYPE)) {
    LOG.error("Found type {} in the query json, but expected type {}.", type, DataQuerySnapshot.TYPE);
    return null;
  }

  /// Countdown
  long countdown = -1L;
  boolean hasCountdown = jo.has(DataQuerySnapshot.FIELD_COUNTDOWN);

  if (hasCountdown) {
    countdown = jo.getLong(DataQuerySnapshot.FIELD_COUNTDOWN);
  }

  ////Data
  Map<String, String> schemaKeys = null;
  Set<String> fieldsSet = Sets.newHashSet();

  if (jo.has(DataQuerySnapshot.FIELD_DATA)) {
    JSONObject data = jo.getJSONObject(DataQuerySnapshot.FIELD_DATA);

    if (!SchemaUtils.checkValidKeys(data, DATA_FIELD_COMBINATIONS)) {
      LOG.error("Error validating {} field", DataQuerySnapshot.FIELD_DATA);
      throw new IOException("Invalid keys");
    }

    if (data.has(DataQuerySnapshot.FIELD_SCHEMA_KEYS)) {
      schemaKeys = SchemaUtils.extractMap(data.getJSONObject(DataQuerySnapshot.FIELD_SCHEMA_KEYS));
    }

    if (data.has(DataQuerySnapshot.FIELD_FIELDS)) {
      //// Fields
      JSONArray jArray = data.getJSONArray(DataQuerySnapshot.FIELD_FIELDS);

      for (int index = 0; index < jArray.length(); index++) {
        String field = jArray.getString(index);

        if (!fieldsSet.add(field)) {
          LOG.error("The field {} was listed more than once, this is an invalid query.", field);
        }
      }
    }
  }

  Fields fields = new Fields(fieldsSet);

  if (!hasCountdown) {
    return new DataQuerySnapshot(id, fields, schemaKeys);
  } else {
    return new DataQuerySnapshot(id, fields, countdown, schemaKeys);
  }
}