/fbus/service_manager_test.c
http://ftk.googlecode.com/ · C · 65 lines · 29 code · 7 blank · 29 comment · 8 complexity · 180ca3d6ce0355edea3de2674b00250e MD5 · raw file
- /*
- * File:
- * Author: Li XianJing <xianjimli@hotmail.com>
- * Brief:
- *
- * Copyright (c) 2009 - 2010 Li XianJing <xianjimli@hotmail.com>
- *
- * Licensed under the Academic Free License version 2.1
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
- /*
- * History:
- * ================================================================
- * 2010-07-25 Li XianJing <xianjimli@hotmail.com> created
- *
- */
- #include "ftk_globals.h"
- #include "ftk_allocator_default.h"
- #include "fbus_service_manager.h"
- int main(int argc, char* argv[])
- {
- int j = 0;
- int i = 0;
- int nr = 0;
- FBusServiceInfo info = {0};
- FBusServiceManager* thiz = NULL;
-
- #ifndef USE_STD_MALLOC
- ftk_set_allocator((ftk_allocator_default_create()));
- #endif
-
- for(j = 0; j < 1000; j++)
- {
- thiz = fbus_service_manager_create();
-
- assert(fbus_service_manager_get_nr(thiz, &nr) == RET_OK);
- for(i = 0; i < nr; i++)
- {
- assert(fbus_service_manager_get(thiz, i, &info) == RET_OK);
- assert(fbus_service_manager_start(thiz, info.name) == RET_OK);
- assert(fbus_service_manager_query(thiz, info.name, &info) == RET_OK);
- assert(fbus_service_manager_start(thiz, info.name) == RET_OK);
- assert(fbus_service_manager_stop(thiz, info.name) == RET_OK);
- }
- fbus_service_manager_destroy(thiz);
- }
- return 0;
- }