void
test_use_syslog (void)
{
    cut_assert_equal_boolean(
        TRUE,
        milter_manager_configuration_get_use_syslog(config));
    milter_manager_configuration_set_use_syslog(config, FALSE);
    cut_assert_equal_boolean(
        FALSE,
        milter_manager_configuration_get_use_syslog(config));
}
예제 #2
0
void
test_uint64_to_bool(gconstpointer data)
{
  grn_obj_reinit(&context, &dest, GRN_DB_BOOL, 0);
  cast_uint64(gcut_data_get_uint(data, "number"));
  cut_assert_equal_boolean(gcut_data_get_uint(data, "expected"),
                           GRN_BOOL_VALUE(&dest));
}
static void
milter_assert_default_configuration_helper (MilterManagerConfiguration *config)
{
    cut_assert_false(milter_manager_configuration_is_privilege_mode(config));

    cut_assert_equal_string(
        MILTER_MANAGER_DEFAULT_CONNECTION_SPEC,
        milter_manager_configuration_get_manager_connection_spec(config));
    cut_assert_equal_string(
        NULL,
        milter_manager_configuration_get_controller_connection_spec(config));
    cut_assert_equal_string(
        MILTER_MANAGER_DEFAULT_EFFECTIVE_USER,
        milter_manager_configuration_get_effective_user(config));
    cut_assert_equal_string(
        MILTER_MANAGER_DEFAULT_EFFECTIVE_GROUP,
        milter_manager_configuration_get_effective_group(config));
    cut_assert_equal_string(
        MILTER_MANAGER_DEFAULT_PID_FILE,
        milter_manager_configuration_get_pid_file(config));
    cut_assert_equal_string(
        NULL,
        milter_manager_configuration_get_custom_configuration_directory(config));

    cut_assert_equal_uint(
        0660,
        milter_manager_configuration_get_manager_unix_socket_mode(config));
    cut_assert_equal_string(
        MILTER_MANAGER_DEFAULT_SOCKET_GROUP,
        milter_manager_configuration_get_manager_unix_socket_group(config));
    cut_assert_equal_uint(
        0660,
        milter_manager_configuration_get_controller_unix_socket_mode(config));
    cut_assert_equal_string(
        NULL,
        milter_manager_configuration_get_controller_unix_socket_group(config));

    cut_assert_true(milter_manager_configuration_is_remove_manager_unix_socket_on_close(config));
    cut_assert_true(milter_manager_configuration_is_remove_controller_unix_socket_on_close(config));
    cut_assert_true(milter_manager_configuration_is_remove_manager_unix_socket_on_create(config));
    cut_assert_true(milter_manager_configuration_is_remove_controller_unix_socket_on_create(config));
    cut_assert_false(milter_manager_configuration_is_daemon(config));

    cut_assert_equal_uint(
        10,
        milter_manager_configuration_get_maintenance_interval(config));
    cut_assert_equal_uint(
        MILTER_CLIENT_DEFAULT_SUSPEND_TIME_ON_UNACCEPTABLE,
        milter_manager_configuration_get_suspend_time_on_unacceptable(config));
    cut_assert_equal_uint(
        MILTER_CLIENT_DEFAULT_MAX_CONNECTIONS,
        milter_manager_configuration_get_max_connections(config));
    cut_assert_equal_uint(
        0,
        milter_manager_configuration_get_max_file_descriptors(config));

    gcut_assert_equal_enum(
        MILTER_TYPE_STATUS,
        MILTER_STATUS_ACCEPT,
        milter_manager_configuration_get_fallback_status(config));

    cut_assert_equal_string(
        MILTER_MANAGER_PACKAGE_PLATFORM,
        milter_manager_configuration_get_package_platform(config));
    cut_assert_equal_string(
        MILTER_MANAGER_PACKAGE_OPTIONS,
        milter_manager_configuration_get_package_options(config));

    cut_assert_equal_uint(
        0,
        milter_manager_configuration_get_connection_check_interval(config));

    gcut_assert_equal_enum(
        MILTER_TYPE_CLIENT_EVENT_LOOP_BACKEND,
        MILTER_CLIENT_EVENT_LOOP_BACKEND_GLIB,
        milter_manager_configuration_get_event_loop_backend(config));
    cut_assert_equal_uint(
        0,
        milter_manager_configuration_get_n_workers(config));

    cut_assert_equal_uint(
        0,
        milter_manager_configuration_get_default_packet_buffer_size(config));

    cut_assert_equal_boolean(
        TRUE,
        milter_manager_configuration_get_use_syslog(config));
    cut_assert_equal_string(
        NULL,
        milter_manager_configuration_get_syslog_facility(config));

    cut_assert_equal_uint(
        MILTER_CHUNK_SIZE,
        milter_manager_configuration_get_chunk_size(config));

    cut_assert_equal_uint(
        0,
        milter_manager_configuration_get_max_pending_finished_sessions(config));

    if (expected_children)
        g_object_unref(expected_children);
    expected_children = milter_manager_children_new(config, loop);
    if (actual_children)
        g_object_unref(actual_children);
    actual_children = milter_manager_children_new(config, loop);
    milter_manager_configuration_setup_children(config, actual_children, NULL);
    milter_assert_equal_children(expected_children, actual_children);
    g_object_unref(actual_children);
    actual_children = NULL;
}