Example #1
0
static
void test_collection(const char *name, col_schema_node_cptr coll)
{
    bt_key key;
    key.setnew(" ");
    bt_cursor cursor = bt_find_gt(coll->metadata, key);

    if (cursor.is_null()) return;

    do
    {
        key = cursor.get_key();
        try
        {
            test_document((char*)key.data(), indirectionDereferenceCP(cursor.bt_next_obj()), true);
            fprintf(logfile, "Checked collection: %s, document: %s\n", name, (char*)key.data());
        }
        catch(SednaException &e)
        {
            elog(EL_ERROR, ("Recovery failed on collection: %s, document: %s, error: %s\n", name, (char*)key.data(), e.what()));
            fprintf(logfile, "Recovery failed on collection: %s, document: %s, error: %s\n", name, (char*)key.data(), e.what());
            isRcvOK = false;
        }
    }
    while(cursor.bt_next_key());

    test_indexes(coll->full_index_list->first);
}
Example #2
0
int
main( int argc, char **argv )
{
    course_of_action = course_of_action | DO_TELL;
    whoami = argv[0];
    printf( "robodoc unittest\n" );
    test_file(  );
    test_directory(  );
    test_document(  );
    return EXIT_SUCCESS;
}
Example #3
0
int
main(int argc,
     const char *const argv[])
{
  GNUNET_log_setup ("test-jsonapi",
                    "WARNING",
                    NULL);
  if (0 != test_spec_jsonapi ())
    return 1;
  if (0 != test_serialize ())
    return 1;
  if (0 != test_document ())
    return 1;
  if (0 != test_document_error ())
    return 1;
  return 0;
}
Example #4
0
void test_db_after_rcv()
{
    std::string rcv_fname = std::string(SEDNA_DATA) + std::string("/data/") + std::string(tr_globals::db_name) + std::string("_files/rcv_test_result.log");
    metadata_cell_cptr mdc = XNULL;

    logfile = fopen(rcv_fname.c_str(), "at");
    fprintf(logfile, "---------------------------------------------------------------------\n");

    bt_cursor cursor = bt_lm(catalog_get_names(catobj_metadata));
    if (!cursor.is_null()) do
    {
        mdc = cursor.bt_next_obj();

        if (!mdc->is_document())
            test_collection(mdc->get_name(), mdc->get_schema_node());
        else
        {
            xptr blk = mdc->get_schema_node()->bblk;
            CHECKP(blk);
            xptr doc_dsc = getFirstBlockNode(blk);
            test_document(mdc->get_name(), doc_dsc, false);
            test_indexes(doc_schema_node_cptr(mdc->get_schema_node())->full_index_list->first);
        }
    }
    while(cursor.bt_next_key());

    fclose(logfile);

#ifdef RCV_TEST_CRASH
    rcv_fname = std::string(SEDNA_DATA) + std::string("/data/") + std::string(tr_globals::db_name) + std::string("_files");

    if (isRcvOK)
        rcv_fname += std::string("/rcv_ok");
    else
        rcv_fname += std::string("/rcv_failed");

    r_fh = uCreateFile(rcv_fname.c_str(), U_SHARE_READ | U_SHARE_WRITE, U_READ_WRITE, U_NO_BUFFERING, NULL, NULL);
    if (r_fh == U_INVALID_FD)
        fprintf(stderr, "Cannot create rcv result file\n");
    uCloseFile(r_fh, NULL);
#endif
}