--- /dev/null
+/*
+ * This file is a part of fauld.
+ *
+ * Copyright © 2017 Samsung Electronics
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "test_dbadapter.h"
+#include "database.h"
+
+struct testdb_adapter {
+ struct faultd_database_adapter database_adapter;
+};
+
+#define to_testdb_adapter(MOD) \
+ container_of(MOD, struct testdb_adapter, database_adapter)
+
+static int init_testdb_adapter(struct faultd_module *module,
+ struct faultd_config *config,
+ sd_event *event_loop)
+{
+ return 0;
+}
+
+static void cleanup_testdb_adapter(struct faultd_module *module)
+{
+}
+
+static int testdb_store(struct faultd_database_adapter *adapter,
+ struct faultd_object *obj, faultd_oid_t *oid)
+{
+ return 0;
+}
+
+static int testdb_get_by_oid(struct faultd_database_adapter *adapter,
+ faultd_oid_t *oid, struct faultd_object *result)
+{
+ return 0;
+}
+
+static int testdb_load(struct faultd_database_adapter *adapter,
+ struct faultd_object *query,
+ struct faultd_object *result, uint32_t *nr)
+{
+ *nr = 0;
+ return 0;
+}
+
+static int testdb_new_oid(faultd_oid_t *oid)
+{
+ return 0;
+}
+
+static struct testdb_adapter testdb_adapter = {
+ .database_adapter = {
+ .module = {
+ .name = "testdb_dbadapter",
+ .type = FAULTD_MODULE_TYPE_DBADAPTER,
+ .init = init_testdb_adapter,
+ .cleanup = cleanup_testdb_adapter,
+ .node = LIST_HEAD_INIT(testdb_adapter.database_adapter.module.node),
+ },
+ .id_key = "testdb_id",
+ .store = testdb_store,
+ .get_by_oid = testdb_get_by_oid,
+ .load = testdb_load,
+ .new_oid = testdb_new_oid,
+ }
+};
+
+void testdb_init()
+{
+ faultd_set_database_adapter(&testdb_adapter.database_adapter);
+}
--- /dev/null
+/*
+ * This file is a part of fauld.
+ *
+ * Copyright © 2017 Samsung Electronics
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FAULTD_TEST_DBADAPTER
+#define FAULTD_TEST_DBADAPTER
+
+void testdb_init();
+
+#endif