#include <error.h>
#include <fosa.h>
#include <forb/executor.h>
-
-int argc_g;
-char **argv_g;
+#include <wvtest.h>
+#include <forb/object.h>
void *server_thread(void *arg)
{
return NULL;
}
-void start_server()
+forb_orb start_server()
{
forb_orb orb;
- hello hobj;
+ hello hobj, hobj2;
int ret;
fosa_thread_id_t tid;
.orb_id = "hello_remote_server"
};
- orb = forb_init(&argc_g, &argv_g, &attr);
- hobj = hello_impl_initialize(orb);
+ WVPASS(orb = forb_init(0, NULL, &attr));
+ WVPASS(hobj = hello_impl_initialize(orb));
fosa_thread_create(&tid, NULL, server_thread, hobj);
- ret = forb_register_reference(hobj, "hello");
+ WVPASSEQ(ret = forb_register_reference(hobj, "hello"), 0);
if (ret != 0) {
error(1, errno, "Cannot register reference to hello");
}
+ WVPASS(hobj2 = forb_resolve_reference(orb, "hello"));
+ WVPASS(forb_object_is_local(hobj2));
+ return orb;
}
void client(void)
{
- forb_orb orb;
- hello hobj;
- struct forb_env env;
- struct forb_init_attr attr = {
- .orb_id = "hello_remote_client"
- };
+/* forb_orb orb; */
+/* hello hobj; */
+/* struct forb_env env; */
+/* struct forb_init_attr attr = { */
+/* .orb_id = "hello_remote_client" */
+/* }; */
- orb = forb_init(&argc_g, &argv_g, &attr);
-
- hobj = forb_resolve_reference(orb, "hello");
- if (!hobj) {
- error(1, errno, "Cannot resolve reference to hello server)");
- }
-
- hello_message(hobj, "Hello world!", &env);
- if (forb_exception_occurred(&env)) {
- error(1, 0, "FORB exception %d", env.major);
- }
+/* WVPASS(orb = forb_init(0, NULL, &attr)); */
+
+ /* The following is currently broken */
+
+/* hobj = forb_resolve_reference(orb, "hello"); */
+/* if (!hobj) { */
+/* error(1, errno, "Cannot resolve reference to hello server)"); */
+/* } */
+
+/* hello_message(hobj, "Hello world!", &env); */
+/* if (forb_exception_occurred(&env)) { */
+/* error(1, 0, "FORB exception %d", env.major); */
+/* } */
}
-int main(int argc, char *argv[])
+WVTEST_MAIN("Registering of references")
{
-
- argc_g = argc;
- argv_g = argv;
-
- start_server();
-
+ forb_orb orb;
+ orb = start_server();
client();
-
- return 0;
+ forb_destroy(orb);
+
}