Add simple test for service selection
authorAlberto Ruiz <aruiz@gnome.org>
Wed, 20 Jul 2011 12:47:56 +0000 (13:47 +0100)
committerAlberto Ruiz <aruiz@gnome.org>
Wed, 20 Jul 2011 12:47:56 +0000 (13:47 +0100)
Makefile.am
examples/service-selection.c [new file with mode: 0644]
webprovisioning/complex-test.msht

index 9fe8cc3..a8f83eb 100644 (file)
@@ -48,7 +48,7 @@ src_moonshot_webp_SOURCES = \
         src/moonshot-webp-parser.vala \
         src/moonshot-id.vala
 
-src_moonshot_VALAFLAGS = --pkg gdk-2.0 gtk+-2.0 $(AM_VALAFLAGS)
+src_moonshot_VALAFLAGS = --pkg gdk-2.0 --pkg gtk+-2.0 $(AM_VALAFLAGS)
 src_moonshot_CPPFLAGS = $(moonshot_CFLAGS) $(AM_CPPFLAGS)
 src_moonshot_LDADD = $(moonshot_LIBS)
 
@@ -143,8 +143,13 @@ EXTRA_DIST = webprovisioning/moonshot.xml $(dbusservice_in_files)
 
 noinst_PROGRAMS = \
         examples/client \
+        examples/service-selection \
         tests/basic
 
+examples_service_selection_SOURCES = examples/service-selection.c
+examples_service_selection_CPPFLAGS = $(libmoonshot_CFLAGS) $(AM_CPPFLAGS)
+examples_service_selection_LDADD = ${top_builddir}/libmoonshot/libmoonshot.la
+
 examples_client_SOURCES = examples/client.c
 examples_client_CPPFLAGS = $(libmoonshot_CFLAGS) $(AM_CPPFLAGS)
 examples_client_LDADD = ${top_builddir}/libmoonshot/libmoonshot.la
diff --git a/examples/service-selection.c b/examples/service-selection.c
new file mode 100644 (file)
index 0000000..1a08cfc
--- /dev/null
@@ -0,0 +1,36 @@
+#include <glib.h>
+#include "libmoonshot.h"
+
+int main (int argc, char *argv[])
+{
+    MoonshotError *error;
+    gboolean        success;
+
+    char *nai,
+         *password,
+         *server_certificate_hash,
+         *ca_certificate,
+         *subject_name_constraint,
+         *subject_alt_name_constraint;
+
+    success = moonshot_get_identity ("user1@foo.baz",
+                                     "",
+                                     "",
+                                     &nai,
+                                     &password,
+                                     &server_certificate_hash,
+                                     &ca_certificate,
+                                     &subject_name_constraint,
+                                     &subject_alt_name_constraint,
+                                     &error);
+
+    if (success)
+        g_debug ("Got id: %s %s\n", nai, password);
+
+    moonshot_free (nai);
+    moonshot_free (password);
+    moonshot_free (server_certificate_hash);
+    moonshot_free (ca_certificate);
+    moonshot_free (subject_name_constraint);
+    moonshot_free (subject_alt_name_constraint);
+}
index 3fe1ce8..32d03ea 100644 (file)
@@ -5,6 +5,7 @@
     <password></password>
     <realm>foo.baz</realm>
     <services>
+      <service>irc@jabber.project-moonshot.org</service>
       <service>xmpp@jabber.project-moonshot.org</service>
     </services>
     <selection-rules>
@@ -33,6 +34,7 @@
     <password></password>
     <realm>foo.bar</realm>
     <services>
+      <service>irc@jabber.project-moonshot.org</service>
       <service>email@project-moonshot.org</service>
     </services>
     <selection-rules>
@@ -55,6 +57,7 @@
     <password></password>
     <realm>foo.com</realm>
     <services>
+      <service>irc@jabber.project-moonshot.org</service>
       <service>email@project-moonshot.org</service>
     </services>
     <trust-anchor>