int test_deinit(void)
{
    kaa_bootstrap_manager_destroy(bootstrap_manager);
    kaa_channel_manager_destroy(channel_manager);
    kaa_log_destroy(logger);
    ext_log_upload_strategy_destroy(strategy);

    return 0;
}
Пример #2
0
KAA_TEST_CASE_EX(log_setters, set_storage_valid_parameters)
{
    (void)state;
    kaa_error_t rc;

    /* First storage will be internally deleted */
    rc = kaa_logging_set_storage(log_collector, test_storage2);
    ASSERT_EQUAL(KAA_ERR_NONE, rc);

    ext_log_upload_strategy_destroy(&test_strategy2);

    /* Second storage will be deleted on test teardown */
}
Пример #3
0
KAA_TEST_CASE_EX(log_setters, set_storage_invalid_parameters)
{
    (void)state;
    kaa_error_t rc;

    rc = kaa_logging_set_storage(log_collector, NULL);
    ASSERT_EQUAL(KAA_ERR_BADPARAM, rc);

    rc = kaa_logging_set_storage(NULL, test_storage2);
    ASSERT_EQUAL(KAA_ERR_BADPARAM, rc);

    ext_log_storage_destroy(test_storage2);
    ext_log_upload_strategy_destroy(&test_strategy2);
}
void test_create_strategy(void **state)
{
    (void)state;
    (void)state;

    void *tmp_strategy = NULL;

    kaa_error_t error_code = ext_log_upload_strategy_create(&kaa_context, NULL,
            KAA_LOG_UPLOAD_VOLUME_STRATEGY);
    ASSERT_NOT_EQUAL(error_code, KAA_ERR_NONE);

    error_code = ext_log_upload_strategy_create(NULL, &tmp_strategy, KAA_LOG_UPLOAD_VOLUME_STRATEGY);
    ASSERT_NOT_EQUAL(error_code, KAA_ERR_NONE);

    error_code = ext_log_upload_strategy_create(&kaa_context, &tmp_strategy, 0);
    ASSERT_NOT_EQUAL(error_code, KAA_ERR_NONE);

    error_code = ext_log_upload_strategy_create(&kaa_context, &tmp_strategy, KAA_LOG_UPLOAD_VOLUME_STRATEGY);
    ASSERT_EQUAL(error_code, KAA_ERR_NONE);
    ASSERT_NOT_NULL(tmp_strategy);

    ext_log_upload_strategy_destroy(tmp_strategy);
}
void test_create_strategy(void)
{
    KAA_TRACE_IN(logger);

    kaa_error_t error_code = KAA_ERR_NONE;
    void *tmp_strategy = NULL;

    error_code = ext_log_upload_strategy_create(&kaa_context, NULL, KAA_LOG_UPLOAD_VOLUME_STRATEGY);
    ASSERT_NOT_EQUAL(error_code, KAA_ERR_NONE);

    error_code = ext_log_upload_strategy_create(NULL, &tmp_strategy, KAA_LOG_UPLOAD_VOLUME_STRATEGY);
    ASSERT_NOT_EQUAL(error_code, KAA_ERR_NONE);

    error_code = ext_log_upload_strategy_create(&kaa_context, &tmp_strategy, 0);
    ASSERT_NOT_EQUAL(error_code, KAA_ERR_NONE);

    error_code = ext_log_upload_strategy_create(&kaa_context, &tmp_strategy, KAA_LOG_UPLOAD_VOLUME_STRATEGY);
    ASSERT_EQUAL(error_code, KAA_ERR_NONE);
    ASSERT_NOT_NULL(tmp_strategy);

    ext_log_upload_strategy_destroy(tmp_strategy);

    KAA_TRACE_OUT(logger);
}