public static List<TargetInfo> parseOptTarget(CommandLine cmd, AlluxioConfiguration conf)
      throws IOException {
    String[] targets;
    if (cmd.hasOption(TARGET_OPTION_NAME)) {
      String argTarget = cmd.getOptionValue(TARGET_OPTION_NAME);
      if (StringUtils.isBlank(argTarget)) {
        throw new IOException("Option " + TARGET_OPTION_NAME + " can not be blank.");
      } else if (argTarget.contains(TARGET_SEPARATOR)) {
        targets = argTarget.split(TARGET_SEPARATOR);
      } else {
        targets = new String[]{argTarget};
      }
    } else {
      // By default we set on all targets (master/workers/job_master/job_workers)
      targets = new String[]{ROLE_MASTER, ROLE_JOB_MASTER, ROLE_WORKERS, ROLE_JOB_WORKERS};
    }
    return getTargetInfos(targets, conf);
  }
@Test
  public void parseEmbeddedHAJobMasterTarget() throws Exception {
    mConf.set(PropertyKey.JOB_MASTER_EMBEDDED_JOURNAL_ADDRESSES, "masters-1:19200,masters-2:19200");

    CommandLine mockCommandLine = mock(CommandLine.class);
    String[] mockArgs = new String[]{"--target", "job_master"};
    when(mockCommandLine.getArgs()).thenReturn(mockArgs);
    when(mockCommandLine.hasOption(LogLevel.TARGET_OPTION_NAME)).thenReturn(true);
    when(mockCommandLine.getOptionValue(LogLevel.TARGET_OPTION_NAME)).thenReturn(mockArgs[1]);
    try (MockedStatic<JobMasterClient.Factory> mockFactory =
        mockStatic(JobMasterClient.Factory.class)) {
      JobMasterClient mockJobClient = mock(JobMasterClient.class);
      when(mockJobClient.getRemoteSockAddress()).thenReturn(new InetSocketAddress("masters-2",
          mConf.getInt(PropertyKey.JOB_MASTER_RPC_PORT)));
      when(mockJobClient.getRemoteHostName()).thenReturn("masters-2");
      mockFactory.when(() -> JobMasterClient.Factory.create(any())).thenReturn(mockJobClient);

      List<LogLevel.TargetInfo> targets = LogLevel.parseOptTarget(mockCommandLine, mConf);
      assertEquals(1, targets.size());
      assertEquals(new LogLevel.TargetInfo("masters-2", JOB_MASTER_WEB_PORT, "job_master"),
          targets.get(0));
    }
  }