public static void main(String[] args) throws Exception {
        Arguments arguments = new Arguments();
        CommandLine commander = new CommandLine(arguments);
        try {
            commander.parseArgs(args);
            if (arguments.help) {
                commander.usage(commander.getOut());
                return;
            }
            if (arguments.generateDocs) {
                CmdGenerateDocs cmd = new CmdGenerateDocs("pulsar");
                cmd.addCommand("initialize-transaction-coordinator-metadata", commander);
                cmd.run(null);
                return;
            }
        } catch (Exception e) {
            commander.usage(commander.getOut());
            throw e;
        }

        if (arguments.configurationStore == null) {
            System.err.println("Configuration store address argument is required (--configuration-store)");
            commander.usage(commander.getOut());
            System.exit(1);
        }

        if (arguments.numTransactionCoordinators <= 0) {
            System.err.println("Number of transaction coordinators must greater than 0");
            System.exit(1);
        }

        try (MetadataStoreExtended configStore = PulsarClusterMetadataSetup
                .initConfigMetadataStore(arguments.configurationStore, arguments.zkSessionTimeoutMillis)) {
            PulsarResources pulsarResources = new PulsarResources(null, configStore);
            // Create system tenant
            PulsarClusterMetadataSetup
                    .createTenantIfAbsent(pulsarResources, NamespaceName.SYSTEM_NAMESPACE.getTenant(),
                            arguments.cluster);

            // Create system namespace
            PulsarClusterMetadataSetup.createNamespaceIfAbsent(pulsarResources, NamespaceName.SYSTEM_NAMESPACE,
                    arguments.cluster);

            // Create transaction coordinator assign partitioned topic
            PulsarClusterMetadataSetup.createPartitionedTopic(configStore,
                    SystemTopicNames.TRANSACTION_COORDINATOR_ASSIGN,
                    arguments.numTransactionCoordinators);
        }

        System.out.println("Transaction coordinator metadata setup success");
    }
@Test
    public void testMainGenerateDocs() throws Exception {
        PrintStream oldStream = System.out;
        try {
            ByteArrayOutputStream baoStream = new ByteArrayOutputStream();
            System.setOut(new PrintStream(baoStream));

            Class argumentsClass =
                    Class.forName("org.apache.pulsar.PulsarTransactionCoordinatorMetadataSetup$Arguments");

            PulsarTransactionCoordinatorMetadataSetup.main(new String[]{"-cs", "cs", "-c", "c", "-g"});

            String message = baoStream.toString();

            Field[] fields = argumentsClass.getDeclaredFields();
            for (Field field : fields) {
                boolean fieldHasAnno = field.isAnnotationPresent(Option.class);
                if (fieldHasAnno) {
                    Option fieldAnno = field.getAnnotation(Option.class);
                    String[] names = fieldAnno.names();
                    if (names.length == 0) {
                        continue;
                    }
                    String nameStr = Arrays.asList(names).toString();
                    nameStr = nameStr.substring(1, nameStr.length() - 1);
                    assertTrue(message.indexOf(nameStr) > 0);
                }
            }
        } finally {
            System.setOut(oldStream);
        }
    }