/* persona-store-tests.c generated by valac 0.13.1.106-1068, the Vala compiler
 * generated from persona-store-tests.vala, do not modify */

/*
 * Copyright (C) 2011 Collabora Ltd.
 *
 * This library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This library 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authors: Raul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk>
 *
 */

#include <glib.h>
#include <glib-object.h>
#include <folks-test.h>
#include <eds-test.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <folks/folks.h>
#include <folks/folks-eds.h>
#include <gio/gio.h>


#define TYPE_PERSONA_STORE_TESTS (persona_store_tests_get_type ())
#define PERSONA_STORE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PERSONA_STORE_TESTS, PersonaStoreTests))
#define PERSONA_STORE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PERSONA_STORE_TESTS, PersonaStoreTestsClass))
#define IS_PERSONA_STORE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PERSONA_STORE_TESTS))
#define IS_PERSONA_STORE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PERSONA_STORE_TESTS))
#define PERSONA_STORE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PERSONA_STORE_TESTS, PersonaStoreTestsClass))

typedef struct _PersonaStoreTests PersonaStoreTests;
typedef struct _PersonaStoreTestsClass PersonaStoreTestsClass;
typedef struct _PersonaStoreTestsPrivate PersonaStoreTestsPrivate;
#define _eds_test_backend_unref0(var) ((var == NULL) ? NULL : (var = (eds_test_backend_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block1Data Block1Data;
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
typedef struct _Block2Data Block2Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _PersonaStoreTests {
	FolksTestCase parent_instance;
	PersonaStoreTestsPrivate * priv;
};

struct _PersonaStoreTestsClass {
	FolksTestCaseClass parent_class;
};

struct _PersonaStoreTestsPrivate {
	EdsTestBackend* eds_backend;
	GeeHashSet* group_flags_received;
};

struct _Block1Data {
	int _ref_count_;
	PersonaStoreTests * self;
	GMainLoop* main_loop;
	FolksBackendStore* backend_store;
};

struct _Block2Data {
	int _ref_count_;
	PersonaStoreTests * self;
	FolksPersonaStore* store;
};


static gpointer persona_store_tests_parent_class = NULL;

GType persona_store_tests_get_type (void) G_GNUC_CONST;
#define PERSONA_STORE_TESTS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_PERSONA_STORE_TESTS, PersonaStoreTestsPrivate))
enum  {
	PERSONA_STORE_TESTS_DUMMY_PROPERTY
};
PersonaStoreTests* persona_store_tests_new (void);
PersonaStoreTests* persona_store_tests_construct (GType object_type);
void persona_store_tests_test_persona_store (PersonaStoreTests* self);
static void _persona_store_tests_test_persona_store_folks_test_case_test_method (gpointer self);
static void persona_store_tests_real_set_up (FolksTestCase* base);
static void persona_store_tests_real_tear_down (FolksTestCase* base);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (Block1Data* _data1_);
static GValue* _g_value_dup (GValue* self);
static void _vala_GValue_free (GValue* self);
static void _lambda0_ (GObject* o, GAsyncResult* r, Block1Data* _data1_);
static void __lambda0__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
static void _lambda1_ (FolksBackend* b, PersonaStoreTests* self);
static void _lambda2_ (FolksPersonaStore* ps, PersonaStoreTests* self);
static void persona_store_tests_set_up_persona_store (PersonaStoreTests* self, FolksPersonaStore* store);
static void __lambda2__folks_backend_persona_store_added (FolksBackend* _sender, FolksPersonaStore* store, gpointer self);
static void __lambda1__folks_backend_store_backend_available (FolksBackendStore* _sender, FolksBackend* backend, gpointer self);
static gboolean _lambda4_ (Block1Data* _data1_);
static gboolean __lambda4__gsource_func (gpointer self);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (Block2Data* _data2_);
static void _lambda3_ (GObject* obj, GAsyncResult* _result_, Block2Data* _data2_);
static void persona_store_tests_can_add_personas_cb (PersonaStoreTests* self, GObject* s, GParamSpec* p);
static void _persona_store_tests_can_add_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void persona_store_tests_can_remove_personas_cb (PersonaStoreTests* self, GObject* s, GParamSpec* p);
static void _persona_store_tests_can_remove_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void persona_store_tests_can_alias_personas_cb (PersonaStoreTests* self, GObject* s, GParamSpec* p);
static void _persona_store_tests_can_alias_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void persona_store_tests_can_group_personas_cb (PersonaStoreTests* self, GObject* s, GParamSpec* p);
static void _persona_store_tests_can_group_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void __lambda3__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
static void persona_store_tests_finalize (GObject* obj);
gint _vala_main (gchar** args, int args_length1);


static void _persona_store_tests_test_persona_store_folks_test_case_test_method (gpointer self) {
	persona_store_tests_test_persona_store (self);
}


PersonaStoreTests* persona_store_tests_construct (GType object_type) {
	PersonaStoreTests * self = NULL;
	EdsTestBackend* _tmp0_;
	self = (PersonaStoreTests*) folks_test_case_construct (object_type, "PersonaStoreTests");
	_tmp0_ = eds_test_backend_new ();
	_eds_test_backend_unref0 (self->priv->eds_backend);
	self->priv->eds_backend = _tmp0_;
	folks_test_case_add_test ((FolksTestCase*) self, "persona store tests", _persona_store_tests_test_persona_store_folks_test_case_test_method, self);
	return self;
}


PersonaStoreTests* persona_store_tests_new (void) {
	return persona_store_tests_construct (TYPE_PERSONA_STORE_TESTS);
}


static void persona_store_tests_real_set_up (FolksTestCase* base) {
	PersonaStoreTests * self;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GeeHashSet* _tmp2_;
	EdsTestBackend* _tmp3_;
	self = (PersonaStoreTests*) base;
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, _tmp0_, _tmp1_);
	_g_object_unref0 (self->priv->group_flags_received);
	self->priv->group_flags_received = _tmp2_;
	_tmp3_ = self->priv->eds_backend;
	eds_test_backend_set_up (_tmp3_);
}


static void persona_store_tests_real_tear_down (FolksTestCase* base) {
	PersonaStoreTests * self;
	self = (PersonaStoreTests*) base;
}


static Block1Data* block1_data_ref (Block1Data* _data1_) {
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}


static void block1_data_unref (Block1Data* _data1_) {
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		_g_object_unref0 (_data1_->self);
		_g_object_unref0 (_data1_->backend_store);
		_g_main_loop_unref0 (_data1_->main_loop);
		g_slice_free (Block1Data, _data1_);
	}
}


static GValue* _g_value_dup (GValue* self) {
	return g_boxed_copy (G_TYPE_VALUE, self);
}


static void _vala_GValue_free (GValue* self) {
	g_value_unset (self);
	g_free (self);
}


static gpointer __g_value_dup0 (gpointer self) {
	return self ? _g_value_dup (self) : NULL;
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static void _lambda0_ (GObject* o, GAsyncResult* r, Block1Data* _data1_) {
	PersonaStoreTests * self;
	FolksBackendStore* _tmp0_;
	GAsyncResult* _tmp1_;
	self = _data1_->self;
	g_return_if_fail (r != NULL);
	_tmp0_ = _data1_->backend_store;
	_tmp1_ = r;
	folks_backend_store_prepare_finish (_tmp0_, _tmp1_);
}


static void __lambda0__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	_lambda0_ (source_object, res, self);
	block1_data_unref (self);
}


static void _lambda2_ (FolksPersonaStore* ps, PersonaStoreTests* self) {
	FolksPersonaStore* _tmp0_;
	g_return_if_fail (ps != NULL);
	_tmp0_ = ps;
	persona_store_tests_set_up_persona_store (self, _tmp0_);
}


static void __lambda2__folks_backend_persona_store_added (FolksBackend* _sender, FolksPersonaStore* store, gpointer self) {
	_lambda2_ (store, self);
}


static void _lambda1_ (FolksBackend* b, PersonaStoreTests* self) {
	FolksBackend* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (b != NULL);
	_tmp0_ = b;
	_tmp1_ = folks_backend_get_name (_tmp0_);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (_tmp2_, "eds") == 0) {
		FolksBackend* _tmp3_;
		_tmp3_ = b;
		g_signal_connect_object (_tmp3_, "persona-store-added", (GCallback) __lambda2__folks_backend_persona_store_added, self, 0);
		{
			FolksBackend* _tmp4_;
			GeeMap* _tmp5_;
			GeeMap* _tmp6_;
			GeeCollection* _tmp7_;
			GeeCollection* _tmp8_;
			GeeCollection* _tmp9_;
			GeeIterator* _tmp10_ = NULL;
			GeeIterator* _tmp11_;
			GeeIterator* _store_it;
			_tmp4_ = b;
			_tmp5_ = folks_backend_get_persona_stores (_tmp4_);
			_tmp6_ = _tmp5_;
			_tmp7_ = gee_map_get_values (_tmp6_);
			_tmp8_ = _tmp7_;
			_tmp9_ = _tmp8_;
			_tmp10_ = gee_iterable_iterator ((GeeIterable*) _tmp9_);
			_tmp11_ = _tmp10_;
			_g_object_unref0 (_tmp9_);
			_store_it = _tmp11_;
			while (TRUE) {
				GeeIterator* _tmp12_;
				gboolean _tmp13_ = FALSE;
				GeeIterator* _tmp14_;
				gpointer _tmp15_ = NULL;
				FolksPersonaStore* store;
				FolksPersonaStore* _tmp16_;
				_tmp12_ = _store_it;
				_tmp13_ = gee_iterator_next (_tmp12_);
				if (!_tmp13_) {
					break;
				}
				_tmp14_ = _store_it;
				_tmp15_ = gee_iterator_get (_tmp14_);
				store = (FolksPersonaStore*) _tmp15_;
				_tmp16_ = store;
				persona_store_tests_set_up_persona_store (self, _tmp16_);
				_g_object_unref0 (store);
			}
			_g_object_unref0 (_store_it);
		}
	}
}


static void __lambda1__folks_backend_store_backend_available (FolksBackendStore* _sender, FolksBackend* backend, gpointer self) {
	_lambda1_ (backend, self);
}


static gboolean _lambda4_ (Block1Data* _data1_) {
	PersonaStoreTests * self;
	gboolean result = FALSE;
	GMainLoop* _tmp0_;
	self = _data1_->self;
	_tmp0_ = _data1_->main_loop;
	g_main_loop_quit (_tmp0_);
	result = FALSE;
	return result;
}


static gboolean __lambda4__gsource_func (gpointer self) {
	gboolean result;
	result = _lambda4_ (self);
	return result;
}


void persona_store_tests_test_persona_store (PersonaStoreTests* self) {
	Block1Data* _data1_;
	GeeHashMap* _tmp0_;
	GeeHashMap* c1;
	GeeHashMap* _tmp1_;
	GeeHashMap* c2;
	GMainLoop* _tmp2_;
	GValue* v = NULL;
	EdsTestBackend* _tmp3_;
	GValue _tmp4_ = {0};
	GValue _tmp5_;
	GValue _tmp6_;
	GValue* _tmp7_;
	GValue* _tmp8_;
	GeeHashMap* _tmp9_;
	GValue* _tmp10_;
	GValue* _tmp11_;
	GValue _tmp12_ = {0};
	GValue _tmp13_;
	GValue _tmp14_;
	GValue* _tmp15_;
	GValue* _tmp16_;
	GeeHashMap* _tmp17_;
	const gchar* _tmp18_;
	GValue* _tmp19_;
	GValue* _tmp20_;
	EdsTestBackend* _tmp21_;
	GeeHashMap* _tmp22_;
	GeeHashMap* _tmp23_;
	GValue _tmp24_ = {0};
	GValue _tmp25_;
	GValue _tmp26_;
	GValue* _tmp27_;
	GValue* _tmp28_;
	GeeHashMap* _tmp29_;
	GValue* _tmp30_;
	GValue* _tmp31_;
	GValue _tmp32_ = {0};
	GValue _tmp33_;
	GValue _tmp34_;
	GValue* _tmp35_;
	GValue* _tmp36_;
	GeeHashMap* _tmp37_;
	const gchar* _tmp38_;
	GValue* _tmp39_;
	GValue* _tmp40_;
	EdsTestBackend* _tmp41_;
	GeeHashMap* _tmp42_;
	GeeHashMap* _tmp43_;
	FolksBackendStore* _tmp44_ = NULL;
	FolksBackendStore* _tmp45_;
	FolksBackendStore* _tmp46_;
	FolksBackendStore* _tmp47_;
	GMainLoop* _tmp48_;
	EdsTestBackend* _tmp49_;
	g_return_if_fail (self != NULL);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_data1_->self = g_object_ref (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_VALUE, (GBoxedCopyFunc) _g_value_dup, _vala_GValue_free, NULL, NULL, NULL);
	c1 = _tmp0_;
	_tmp1_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_VALUE, (GBoxedCopyFunc) _g_value_dup, _vala_GValue_free, NULL, NULL, NULL);
	c2 = _tmp1_;
	_tmp2_ = g_main_loop_new (NULL, FALSE);
	_data1_->main_loop = _tmp2_;
	_tmp3_ = self->priv->eds_backend;
	eds_test_backend_reset (_tmp3_);
	g_value_init (&_tmp4_, G_TYPE_STRING);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_;
	_tmp7_ = __g_value_dup0 (&_tmp6_);
	__vala_GValue_free0 (v);
	v = _tmp7_;
	G_IS_VALUE (&_tmp6_) ? (g_value_unset (&_tmp6_), NULL) : NULL;
	_tmp8_ = v;
	g_value_set_string (_tmp8_, "bernie h. innocenti");
	_tmp9_ = c1;
	_tmp10_ = v;
	v = NULL;
	_tmp11_ = _tmp10_;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp9_, "full_name", _tmp11_);
	__vala_GValue_free0 (_tmp11_);
	g_value_init (&_tmp12_, G_TYPE_STRING);
	_tmp13_ = _tmp12_;
	_tmp14_ = _tmp13_;
	_tmp15_ = __g_value_dup0 (&_tmp14_);
	__vala_GValue_free0 (v);
	v = _tmp15_;
	G_IS_VALUE (&_tmp14_) ? (g_value_unset (&_tmp14_), NULL) : NULL;
	_tmp16_ = v;
	g_value_set_string (_tmp16_, "bernie@example.org");
	_tmp17_ = c1;
	_tmp18_ = EDSF_PERSONA_email_fields[0];
	_tmp19_ = v;
	v = NULL;
	_tmp20_ = _tmp19_;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp17_, _tmp18_, _tmp20_);
	__vala_GValue_free0 (_tmp20_);
	_tmp21_ = self->priv->eds_backend;
	_tmp22_ = c1;
	_tmp23_ = _g_object_ref0 (_tmp22_);
	eds_test_backend_add_contact (_tmp21_, _tmp23_);
	g_value_init (&_tmp24_, G_TYPE_STRING);
	_tmp25_ = _tmp24_;
	_tmp26_ = _tmp25_;
	_tmp27_ = __g_value_dup0 (&_tmp26_);
	__vala_GValue_free0 (v);
	v = _tmp27_;
	G_IS_VALUE (&_tmp26_) ? (g_value_unset (&_tmp26_), NULL) : NULL;
	_tmp28_ = v;
	g_value_set_string (_tmp28_, "richard m. stallman");
	_tmp29_ = c2;
	_tmp30_ = v;
	v = NULL;
	_tmp31_ = _tmp30_;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp29_, "full_name", _tmp31_);
	__vala_GValue_free0 (_tmp31_);
	g_value_init (&_tmp32_, G_TYPE_STRING);
	_tmp33_ = _tmp32_;
	_tmp34_ = _tmp33_;
	_tmp35_ = __g_value_dup0 (&_tmp34_);
	__vala_GValue_free0 (v);
	v = _tmp35_;
	G_IS_VALUE (&_tmp34_) ? (g_value_unset (&_tmp34_), NULL) : NULL;
	_tmp36_ = v;
	g_value_set_string (_tmp36_, "rms@example.org");
	_tmp37_ = c2;
	_tmp38_ = EDSF_PERSONA_email_fields[0];
	_tmp39_ = v;
	v = NULL;
	_tmp40_ = _tmp39_;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp37_, _tmp38_, _tmp40_);
	__vala_GValue_free0 (_tmp40_);
	_tmp41_ = self->priv->eds_backend;
	_tmp42_ = c2;
	_tmp43_ = _g_object_ref0 (_tmp42_);
	eds_test_backend_add_contact (_tmp41_, _tmp43_);
	_tmp44_ = folks_backend_store_dup ();
	_data1_->backend_store = _tmp44_;
	_tmp45_ = _data1_->backend_store;
	folks_backend_store_prepare (_tmp45_, __lambda0__gasync_ready_callback, block1_data_ref (_data1_));
	_tmp46_ = _data1_->backend_store;
	g_signal_connect_object (_tmp46_, "backend-available", (GCallback) __lambda1__folks_backend_store_backend_available, self, 0);
	_tmp47_ = _data1_->backend_store;
	folks_backend_store_load_backends (_tmp47_, NULL, NULL);
	g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 3, __lambda4__gsource_func, block1_data_ref (_data1_), block1_data_unref);
	_tmp48_ = _data1_->main_loop;
	g_main_loop_run (_tmp48_);
	_tmp49_ = self->priv->eds_backend;
	eds_test_backend_tear_down (_tmp49_);
	__vala_GValue_free0 (v);
	_g_object_unref0 (c2);
	_g_object_unref0 (c1);
	block1_data_unref (_data1_);
	_data1_ = NULL;
}


static Block2Data* block2_data_ref (Block2Data* _data2_) {
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}


static void block2_data_unref (Block2Data* _data2_) {
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		_g_object_unref0 (_data2_->self);
		_g_object_unref0 (_data2_->store);
		g_slice_free (Block2Data, _data2_);
	}
}


static void _persona_store_tests_can_add_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	persona_store_tests_can_add_personas_cb (self, _sender, pspec);
}


static void _persona_store_tests_can_remove_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	persona_store_tests_can_remove_personas_cb (self, _sender, pspec);
}


static void _persona_store_tests_can_alias_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	persona_store_tests_can_alias_personas_cb (self, _sender, pspec);
}


static void _persona_store_tests_can_group_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	persona_store_tests_can_group_personas_cb (self, _sender, pspec);
}


static void _lambda3_ (GObject* obj, GAsyncResult* _result_, Block2Data* _data2_) {
	PersonaStoreTests * self;
	GError * _inner_error_ = NULL;
	self = _data2_->self;
	g_return_if_fail (_result_ != NULL);
	{
		FolksPersonaStore* _tmp0_;
		GAsyncResult* _tmp1_;
		FolksPersonaStore* _tmp2_;
		FolksMaybeBool _tmp3_;
		FolksMaybeBool _tmp4_;
		FolksPersonaStore* _tmp7_;
		FolksMaybeBool _tmp8_;
		FolksMaybeBool _tmp9_;
		FolksPersonaStore* _tmp12_;
		FolksMaybeBool _tmp13_;
		FolksMaybeBool _tmp14_;
		FolksPersonaStore* _tmp17_;
		FolksMaybeBool _tmp18_;
		FolksMaybeBool _tmp19_;
		_tmp0_ = _data2_->store;
		_tmp1_ = _result_;
		folks_persona_store_prepare_finish (_tmp0_, _tmp1_, &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
		_tmp2_ = _data2_->store;
		_tmp3_ = folks_persona_store_get_can_add_personas (_tmp2_);
		_tmp4_ = _tmp3_;
		if (_tmp4_ != FOLKS_MAYBE_BOOL_UNSET) {
			FolksPersonaStore* _tmp5_;
			_tmp5_ = _data2_->store;
			persona_store_tests_can_add_personas_cb (self, (GObject*) _tmp5_, NULL);
		} else {
			FolksPersonaStore* _tmp6_;
			_tmp6_ = _data2_->store;
			g_signal_connect_object ((GObject*) _tmp6_, "notify::can-add-personas", (GCallback) _persona_store_tests_can_add_personas_cb_g_object_notify, self, 0);
		}
		_tmp7_ = _data2_->store;
		_tmp8_ = folks_persona_store_get_can_remove_personas (_tmp7_);
		_tmp9_ = _tmp8_;
		if (_tmp9_ != FOLKS_MAYBE_BOOL_UNSET) {
			FolksPersonaStore* _tmp10_;
			_tmp10_ = _data2_->store;
			persona_store_tests_can_remove_personas_cb (self, (GObject*) _tmp10_, NULL);
		} else {
			FolksPersonaStore* _tmp11_;
			_tmp11_ = _data2_->store;
			g_signal_connect_object ((GObject*) _tmp11_, "notify::can-remove-personas", (GCallback) _persona_store_tests_can_remove_personas_cb_g_object_notify, self, 0);
		}
		_tmp12_ = _data2_->store;
		_tmp13_ = folks_persona_store_get_can_alias_personas (_tmp12_);
		_tmp14_ = _tmp13_;
		if (_tmp14_ != FOLKS_MAYBE_BOOL_UNSET) {
			FolksPersonaStore* _tmp15_;
			_tmp15_ = _data2_->store;
			persona_store_tests_can_alias_personas_cb (self, (GObject*) _tmp15_, NULL);
		} else {
			FolksPersonaStore* _tmp16_;
			_tmp16_ = _data2_->store;
			g_signal_connect_object ((GObject*) _tmp16_, "notify::can-alias-personas", (GCallback) _persona_store_tests_can_alias_personas_cb_g_object_notify, self, 0);
		}
		_tmp17_ = _data2_->store;
		_tmp18_ = folks_persona_store_get_can_group_personas (_tmp17_);
		_tmp19_ = _tmp18_;
		if (_tmp19_ != FOLKS_MAYBE_BOOL_UNSET) {
			FolksPersonaStore* _tmp20_;
			_tmp20_ = _data2_->store;
			persona_store_tests_can_group_personas_cb (self, (GObject*) _tmp20_, NULL);
		} else {
			FolksPersonaStore* _tmp21_;
			_tmp21_ = _data2_->store;
			g_signal_connect_object ((GObject*) _tmp21_, "notify::can-group-personas", (GCallback) _persona_store_tests_can_group_personas_cb_g_object_notify, self, 0);
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		FolksPersonaStore* _tmp22_;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		FolksPersonaStore* _tmp25_;
		const gchar* _tmp26_;
		const gchar* _tmp27_;
		GError* _tmp28_;
		const gchar* _tmp29_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp22_ = _data2_->store;
		_tmp23_ = folks_persona_store_get_type_id (_tmp22_);
		_tmp24_ = _tmp23_;
		_tmp25_ = _data2_->store;
		_tmp26_ = folks_persona_store_get_id (_tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = e;
		_tmp29_ = _tmp28_->message;
		g_warning ("Error preparing PersonaStore type: %s, id: %s: " "'%s'", _tmp24_, _tmp27_, _tmp29_);
		_g_error_free0 (e);
	}
	__finally0:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


static void __lambda3__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	_lambda3_ (source_object, res, self);
	block2_data_unref (self);
}


static void persona_store_tests_set_up_persona_store (PersonaStoreTests* self, FolksPersonaStore* store) {
	Block2Data* _data2_;
	FolksPersonaStore* _tmp0_;
	FolksPersonaStore* _tmp1_;
	FolksPersonaStore* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (store != NULL);
	_data2_ = g_slice_new0 (Block2Data);
	_data2_->_ref_count_ = 1;
	_data2_->self = g_object_ref (self);
	_tmp0_ = store;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_data2_->store = _tmp1_;
	_tmp2_ = _data2_->store;
	folks_persona_store_prepare (_tmp2_, __lambda3__gasync_ready_callback, block2_data_ref (_data2_));
	block2_data_unref (_data2_);
	_data2_ = NULL;
}


static void persona_store_tests_can_add_personas_cb (PersonaStoreTests* self, GObject* s, GParamSpec* p) {
	GObject* _tmp0_;
	GObject* _tmp1_;
	EdsfPersonaStore* _tmp2_;
	EdsfPersonaStore* store;
	EdsfPersonaStore* _tmp3_;
	FolksMaybeBool _tmp4_;
	FolksMaybeBool _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	_tmp0_ = s;
	g_assert (EDSF_IS_PERSONA_STORE (_tmp0_));
	_tmp1_ = s;
	_tmp2_ = _g_object_ref0 (EDSF_PERSONA_STORE (_tmp1_));
	store = _tmp2_;
	_tmp3_ = store;
	_tmp4_ = folks_persona_store_get_can_add_personas ((FolksPersonaStore*) _tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ != FOLKS_MAYBE_BOOL_UNSET) {
		EdsfPersonaStore* _tmp6_;
		FolksMaybeBool _tmp7_;
		FolksMaybeBool _tmp8_;
		EdsfPersonaStore* _tmp9_;
		guint _tmp10_ = 0U;
		GQuark _tmp11_ = 0U;
		_tmp6_ = store;
		_tmp7_ = folks_persona_store_get_can_add_personas ((FolksPersonaStore*) _tmp6_);
		_tmp8_ = _tmp7_;
		g_assert (_tmp8_ == FOLKS_MAYBE_BOOL_TRUE);
		_tmp9_ = store;
		g_signal_parse_name ("notify::can-add-personas", G_TYPE_OBJECT, &_tmp10_, &_tmp11_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp9_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp10_, _tmp11_, NULL, (GCallback) _persona_store_tests_can_add_personas_cb_g_object_notify, self);
	}
	_g_object_unref0 (store);
}


static void persona_store_tests_can_remove_personas_cb (PersonaStoreTests* self, GObject* s, GParamSpec* p) {
	GObject* _tmp0_;
	GObject* _tmp1_;
	EdsfPersonaStore* _tmp2_;
	EdsfPersonaStore* store;
	EdsfPersonaStore* _tmp3_;
	FolksMaybeBool _tmp4_;
	FolksMaybeBool _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	_tmp0_ = s;
	g_assert (EDSF_IS_PERSONA_STORE (_tmp0_));
	_tmp1_ = s;
	_tmp2_ = _g_object_ref0 (EDSF_PERSONA_STORE (_tmp1_));
	store = _tmp2_;
	_tmp3_ = store;
	_tmp4_ = folks_persona_store_get_can_remove_personas ((FolksPersonaStore*) _tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ != FOLKS_MAYBE_BOOL_UNSET) {
		EdsfPersonaStore* _tmp6_;
		FolksMaybeBool _tmp7_;
		FolksMaybeBool _tmp8_;
		EdsfPersonaStore* _tmp9_;
		guint _tmp10_ = 0U;
		GQuark _tmp11_ = 0U;
		_tmp6_ = store;
		_tmp7_ = folks_persona_store_get_can_remove_personas ((FolksPersonaStore*) _tmp6_);
		_tmp8_ = _tmp7_;
		g_assert (_tmp8_ == FOLKS_MAYBE_BOOL_TRUE);
		_tmp9_ = store;
		g_signal_parse_name ("notify::can-remove-personas", G_TYPE_OBJECT, &_tmp10_, &_tmp11_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp9_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp10_, _tmp11_, NULL, (GCallback) _persona_store_tests_can_remove_personas_cb_g_object_notify, self);
	}
	_g_object_unref0 (store);
}


static void persona_store_tests_can_alias_personas_cb (PersonaStoreTests* self, GObject* s, GParamSpec* p) {
	GObject* _tmp0_;
	GObject* _tmp1_;
	EdsfPersonaStore* _tmp2_;
	EdsfPersonaStore* store;
	EdsfPersonaStore* _tmp3_;
	FolksMaybeBool _tmp4_;
	FolksMaybeBool _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	_tmp0_ = s;
	g_assert (EDSF_IS_PERSONA_STORE (_tmp0_));
	_tmp1_ = s;
	_tmp2_ = _g_object_ref0 (EDSF_PERSONA_STORE (_tmp1_));
	store = _tmp2_;
	_tmp3_ = store;
	_tmp4_ = folks_persona_store_get_can_alias_personas ((FolksPersonaStore*) _tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ != FOLKS_MAYBE_BOOL_UNSET) {
		EdsfPersonaStore* _tmp6_;
		FolksMaybeBool _tmp7_;
		FolksMaybeBool _tmp8_;
		EdsfPersonaStore* _tmp9_;
		guint _tmp10_ = 0U;
		GQuark _tmp11_ = 0U;
		_tmp6_ = store;
		_tmp7_ = folks_persona_store_get_can_alias_personas ((FolksPersonaStore*) _tmp6_);
		_tmp8_ = _tmp7_;
		g_assert (_tmp8_ == FOLKS_MAYBE_BOOL_FALSE);
		_tmp9_ = store;
		g_signal_parse_name ("notify::can-alias-personas", G_TYPE_OBJECT, &_tmp10_, &_tmp11_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp9_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp10_, _tmp11_, NULL, (GCallback) _persona_store_tests_can_alias_personas_cb_g_object_notify, self);
	}
	_g_object_unref0 (store);
}


static void persona_store_tests_can_group_personas_cb (PersonaStoreTests* self, GObject* s, GParamSpec* p) {
	GObject* _tmp0_;
	GObject* _tmp1_;
	EdsfPersonaStore* _tmp2_;
	EdsfPersonaStore* store;
	EdsfPersonaStore* _tmp3_;
	FolksMaybeBool _tmp4_;
	FolksMaybeBool _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	_tmp0_ = s;
	g_assert (EDSF_IS_PERSONA_STORE (_tmp0_));
	_tmp1_ = s;
	_tmp2_ = _g_object_ref0 (EDSF_PERSONA_STORE (_tmp1_));
	store = _tmp2_;
	_tmp3_ = store;
	_tmp4_ = folks_persona_store_get_can_group_personas ((FolksPersonaStore*) _tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ != FOLKS_MAYBE_BOOL_UNSET) {
		EdsfPersonaStore* _tmp6_;
		FolksMaybeBool _tmp7_;
		FolksMaybeBool _tmp8_;
		EdsfPersonaStore* _tmp9_;
		guint _tmp10_ = 0U;
		GQuark _tmp11_ = 0U;
		_tmp6_ = store;
		_tmp7_ = folks_persona_store_get_can_group_personas ((FolksPersonaStore*) _tmp6_);
		_tmp8_ = _tmp7_;
		g_assert (_tmp8_ == FOLKS_MAYBE_BOOL_TRUE);
		_tmp9_ = store;
		g_signal_parse_name ("notify::can-group-personas", G_TYPE_OBJECT, &_tmp10_, &_tmp11_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp9_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp10_, _tmp11_, NULL, (GCallback) _persona_store_tests_can_group_personas_cb_g_object_notify, self);
	}
	_g_object_unref0 (store);
}


static void persona_store_tests_class_init (PersonaStoreTestsClass * klass) {
	persona_store_tests_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (PersonaStoreTestsPrivate));
	FOLKS_TEST_CASE_CLASS (klass)->set_up = persona_store_tests_real_set_up;
	FOLKS_TEST_CASE_CLASS (klass)->tear_down = persona_store_tests_real_tear_down;
	G_OBJECT_CLASS (klass)->finalize = persona_store_tests_finalize;
}


static void persona_store_tests_instance_init (PersonaStoreTests * self) {
	self->priv = PERSONA_STORE_TESTS_GET_PRIVATE (self);
}


static void persona_store_tests_finalize (GObject* obj) {
	PersonaStoreTests * self;
	self = PERSONA_STORE_TESTS (obj);
	_eds_test_backend_unref0 (self->priv->eds_backend);
	_g_object_unref0 (self->priv->group_flags_received);
	G_OBJECT_CLASS (persona_store_tests_parent_class)->finalize (obj);
}


GType persona_store_tests_get_type (void) {
	static volatile gsize persona_store_tests_type_id__volatile = 0;
	if (g_once_init_enter (&persona_store_tests_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (PersonaStoreTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) persona_store_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PersonaStoreTests), 0, (GInstanceInitFunc) persona_store_tests_instance_init, NULL };
		GType persona_store_tests_type_id;
		persona_store_tests_type_id = g_type_register_static (FOLKS_TYPE_TEST_CASE, "PersonaStoreTests", &g_define_type_info, 0);
		g_once_init_leave (&persona_store_tests_type_id__volatile, persona_store_tests_type_id);
	}
	return persona_store_tests_type_id__volatile;
}


gint _vala_main (gchar** args, int args_length1) {
	gint result = 0;
	GTestSuite* _tmp0_ = NULL;
	GTestSuite* root;
	GTestSuite* _tmp1_;
	PersonaStoreTests* _tmp2_;
	PersonaStoreTests* _tmp3_;
	GTestSuite* _tmp4_ = NULL;
	g_test_init (&args_length1, &args, NULL);
	_tmp0_ = g_test_get_root ();
	root = _tmp0_;
	_tmp1_ = root;
	_tmp2_ = persona_store_tests_new ();
	_tmp3_ = _tmp2_;
	_tmp4_ = folks_test_case_get_suite ((FolksTestCase*) _tmp3_);
	g_test_suite_add_suite (_tmp1_, _tmp4_);
	_g_object_unref0 (_tmp3_);
	g_test_run ();
	result = 0;
	return result;
}


int main (int argc, char ** argv) {
	g_type_init ();
	return _vala_main (argv, argc);
}



