private static void prepareFile(
      TsFileResource tsFileResource,
      long timeOffset,
      long ptNum,
      long valueOffset,
      List<IMeasurementSchema> measurementSchemas,
      List<String> deviceIds)
      throws IOException, WriteProcessException {
    File file = tsFileResource.getTsFile();
    if (!file.getParentFile().exists()) {
      Assert.assertTrue(file.getParentFile().mkdirs());
    }
    TsFileWriter fileWriter = new TsFileWriter(file);
    Map<String, IMeasurementSchema> template = new HashMap<>();
    for (IMeasurementSchema measurementSchema : measurementSchemas) {
      template.put(measurementSchema.getMeasurementName(), measurementSchema);
    }
    fileWriter.registerSchemaTemplate("template0", template, false);
    for (String deviceId : deviceIds) {
      fileWriter.registerDevice(deviceId, "template0");
    }
    for (long i = timeOffset; i < timeOffset + ptNum; i++) {
      for (String deviceId : deviceIds) {
        TSRecord record = new TSRecord(deviceId, i);
        for (IMeasurementSchema measurementSchema : measurementSchemas) {
          record.addTuple(
              DataPoint.getDataPoint(
                  measurementSchema.getType(),
                  measurementSchema.getMeasurementName(),
                  String.valueOf(i + valueOffset)));
        }
        fileWriter.writeRecord(record);
        tsFileResource.updateStartTime(IDeviceID.Factory.DEFAULT_FACTORY.create(deviceId), i);
        tsFileResource.updateEndTime(IDeviceID.Factory.DEFAULT_FACTORY.create(deviceId), i);
      }
      if ((i + 1) % flushInterval == 0) {
        fileWriter.flush();
      }
    }
    fileWriter.close();
  }
This util contains 5 seqFiles and 5 unseqFiles in default.

<p>Sequence time range of data: [0, 99], [100, 199], [200, 299], [300, 399], [400, 499]

<p>UnSequence time range of data: [0, 19], [100, 139], [200, 259], [300, 379], [400, 499], [0,
199]

<p>The time series generated by this util are:

<p>time value

<p>0-99 20000-20099

<p>100-199 20100-20199

<p>200-259 10200-10259

<p>260-299 260-299

<p>300-379 10300-10379

<p>380-399 380-399

<p>400-499 10400-10499
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/series/SeriesReaderTestUtil.java