public LogAggregationFileControllerFactory(Configuration conf) {
    this.conf = conf;
    Collection<String> fileControllers = conf.getStringCollection(
        YarnConfiguration.LOG_AGGREGATION_FILE_FORMATS);
    Map<String, String> controllerChecker = new HashMap<>();

    for (String controllerName : fileControllers) {
      validateAggregatedFileControllerName(controllerName);

      validateConflictingControllers(conf, controllerChecker, controllerName);
      DeterminedControllerClassName className =
          new DeterminedControllerClassName(conf, controllerName);
      LogAggregationFileController controller = createFileControllerInstance(conf,
          controllerName, className);
      controller.initialize(conf, controllerName);
      controllers.add(controller);
    }
  }
@Test
  void testLogAggregationFileControllerFactory() throws Exception {
    enableFileControllers(getConf(), ALL_FILE_CONTROLLERS, ALL_FILE_CONTROLLER_NAMES);
    LogAggregationFileControllerFactory factory =
        new LogAggregationFileControllerFactory(getConf());
    List<LogAggregationFileController> list =
        factory.getConfiguredLogAggregationFileControllerList();

    assertEquals(3, list.size(), "The expected number of LogAggregationFileController " +
        "is not 3!");
    assertTrue(list.get(0) instanceof
        TestLogAggregationFileController, "Test format is expected to be the first " +
        "LogAggregationFileController!");
    assertTrue(list.get(1) instanceof
        LogAggregationIndexedFileController, "IFile format is expected to be the second " +
        "LogAggregationFileController!");
    assertTrue(list.get(2) instanceof
        LogAggregationTFileController, "TFile format is expected to be the first " +
        "LogAggregationFileController!");
    assertTrue(factory.getFileControllerForWrite() instanceof
            TestLogAggregationFileController,
        "Test format is expected to be used for writing!");

    verifyFileControllerInstance(factory,
        TestLogAggregationFileController.class);
  }