public static void main(String[] args) throws IOException
  {
    if (args.length < 2)
    {
      _log.error("Usage: AvroSchemaGenerator targetDirectoryPath [sourceFile or sourceDirectory or schemaName]+");
      System.exit(1);
    }

    String resolverPath = System.getProperty(AbstractGenerator.GENERATOR_RESOLVER_PATH);
    if (resolverPath != null && ArgumentFileProcessor.isArgFile(resolverPath))
    {
      // The resolver path is an arg file, prefixed with '@' and containing the actual resolverPath
      String[] argFileContents = ArgumentFileProcessor.getContentsAsArray(resolverPath);
      resolverPath = argFileContents.length > 0 ? argFileContents[0] : null;
    }
    run(resolverPath,
        System.getProperty(GENERATOR_AVRO_TRANSLATE_OPTIONAL_DEFAULT),
        System.getProperty(GENERATOR_AVRO_TYPEREF_PROPERTY_EXCLUDE),
        Boolean.parseBoolean(System.getProperty(GENERATOR_AVRO_NAMESPACE_OVERRIDE)),
        args[0],
        Arrays.copyOfRange(args, 1, args.length));
  }
@Test(dataProvider = "toAvroSchemaDataBeforeReferree")
  public void testReferrerBeforeReferreeInArgs(Map<String, String> testSchemas, String testPath, boolean override) throws IOException
  {
    Map<File, Map.Entry<String,String>> files = TestUtil.createSchemaFiles(_testDir, testSchemas, _debug);
    Collection<String> testPaths = computePathFromRelativePaths(_testDir, Arrays.asList(testPath));
    Map.Entry<File, Map.Entry<String,String>> referrer2 = findEntryForPdsc(buildSystemIndependentPath("a3", "b", "c", "referrer2.pdsc"), files);
    Map.Entry<File, Map.Entry<String,String>> referree2 = findEntryForPdsc(buildSystemIndependentPath("a3", "b", "c", "referree2.pdsc"), files);

    File targetDir = setup(testPaths, override);
    String targetPath = targetDir.getCanonicalPath() + (override ? ("/" + AVRO_PREFIX) : "");

    File[] expectedOutputFiles =
    {
      schemaOutputFile(targetPath, referrer2.getValue().getValue()),
      schemaOutputFile(targetPath, referree2.getValue().getValue())
    };

    // make sure files do not exists
    for (File f : expectedOutputFiles)
    {
      assertFalse(f.exists());
    }

    // referrer before referree in arg list
    String args[] =
    {
      targetDir.getAbsolutePath(),
      referrer2.getKey().getCanonicalPath(),
      referree2.getKey().getCanonicalPath(),
    };
    Exception exc = null;
    try
    {
      AvroSchemaGenerator.main(args);
    }
    catch (Exception e)
    {
      exc = e;
    }
    assertNull(exc);

    // make sure expected file is generated
    for (File f : expectedOutputFiles)
    {
      assertTrue(f.exists(), f + " expected to exist");
      f.delete();
    }
  }