public static void init()

in computer-test/src/main/java/org/apache/hugegraph/computer/suite/unit/UnitTestBase.java [79:139]


    public static void init() throws ClassNotFoundException {
        Runtime.getRuntime().addShutdownHook(new Thread(LogManager::shutdown));

        LOG.info("Setup for UnitTestSuite of hugegraph-computer");

        String etcdUrl = System.getenv("BSP_ETCD_URL");
        if (StringUtils.isNotBlank(etcdUrl)) {
            Whitebox.setInternalState(ComputerOptions.BSP_ETCD_ENDPOINTS,
                                      "defaultValue", etcdUrl);
        }

        Whitebox.setInternalState(ComputerOptions.HUGEGRAPH_URL,
                "defaultValue",
                "http://127.0.0.1:8080");
        Whitebox.setInternalState(ComputerOptions.HUGEGRAPH_GRAPH_NAME,
                "defaultValue",
                "hugegraph");
        Whitebox.setInternalState(ComputerOptions.OUTPUT_HDFS_URL,
                "defaultValue",
                "hdfs://127.0.0.1:9000");
        Whitebox.setInternalState(ComputerOptions.OUTPUT_HDFS_USER,
                "defaultValue",
                System.getProperty("user.name"));
        Whitebox.setInternalState(ComputerOptions.OUTPUT_HDFS_KERBEROS_ENABLE,
                "defaultValue",
                false);
        Whitebox.setInternalState(ComputerOptions.OUTPUT_HDFS_KRB5_CONF,
                "defaultValue",
                "/etc/krb5.conf");
        Whitebox.setInternalState(ComputerOptions.OUTPUT_HDFS_KERBEROS_KEYTAB,
                "defaultValue",
                "");
        Whitebox.setInternalState(
                ComputerOptions.OUTPUT_HDFS_KERBEROS_PRINCIPAL,
                "defaultValue",
                "");
        Whitebox.setInternalState(
                ComputerOptions.INPUT_LOADER_SCHEMA_PATH,
                "defaultValue",
                "src/main/resources/hdfs_input_test/schema.json");
        Whitebox.setInternalState(
                ComputerOptions.INPUT_LOADER_STRUCT_PATH,
                "defaultValue",
                "src/main/resources/hdfs_input_test/struct.json");

        URL = ComputerOptions.HUGEGRAPH_URL
                .defaultValue();

        GRAPH = ComputerOptions.HUGEGRAPH_GRAPH_NAME
                .defaultValue();

        Class.forName(IdType.class.getName());
        // Don't forget to register options
        OptionSpace.register("computer",
                             "org.apache.hugegraph.computer.core.config.ComputerOptions");
        OptionSpace.register("computer-rpc", "org.apache.hugegraph.config.RpcOptions");

        UnitTestBase.updateOptions(
                ComputerOptions.ALGORITHM_RESULT_CLASS, LongValue.class.getName()
        );
    }