disconnect() { const promises = []; const keys = Object.keys(this.adapters); for (let i = 0; i < keys.length; i += 1) { const promise = this.adapters[keys[i]].disconnect(); if (promise && promise.then) { promises.push(promise); } } return Promise.all(promises); }
/** * @api {post} /api/v1/service/zwave/disconnect Disconnect * @apiName disconnect * @apiGroup Zwave */ async function disconnect(req, res) { zwaveManager.disconnect(); res.json({ success: true, }); }
/** * @public * @description This function stops the service * @example * gladys.services.mqtt.stop(); */ async function stop() { logger.log('stopping MQTT service'); mqttHandler.disconnect(); }
describe('gateway.disconnect', () => { it('should disconnect Gateway', async () => { const variable = { getValue: fake.resolves('key'), setValue: fake.resolves(null), destroy: fake.resolves(null), }; const gateway = new Gateway(variable, event, system, sequelize, config); await gateway.login('tony.stark@gladysassistant.com', 'warmachine123'); await gateway.disconnect(); }); });
lab.after((done) => { Session.deleteMany({}, (err, count) => { Session.disconnect(); done(err); }); });
it("check disconnect", () => { let p = transporter.connect().catch(protectReject).then(() => { let cb = transporter.client.close; transporter.disconnect(); expect(transporter.client).toBeNull(); expect(cb).toHaveBeenCalledTimes(1); }); transporter._client.callbacks.connect(); // Trigger the `resolve` return p; });
done(kill) { if (!ctx.db) { throw new Error(npm.text.looseQuery); } ctx.disconnect(kill); }
describe('TasmotaHandler - disconnect', () => { const tasmotaHandler = new TasmotaHandler({}, 'service-uuid-random'); tasmotaHandler.mqttService = mqttService; beforeEach(() => { sinon.reset(); }); it('disconnect with unsubscription', () => { tasmotaHandler.disconnect(); assert.calledWith(mqttService.device.unsubscribe, 'stat/+/+'); assert.calledWith(mqttService.device.unsubscribe, 'tele/+/+'); }); });
describe('Disconnect', () => { test('Should initialize the collections', async () => { const adapter = new MemorydbAdapter(); adapter.collections = { something: 1 }; await adapter.disconnect(); expect(adapter.collections).toEqual({}); }); });
/** * @api {post} /api/v1/gateway/logout * @apiName Logout * @apiGroup Gateway */ async function logout(req, res) { await gladys.gateway.disconnect(); res.json({ success: true, }); }
afterEach(async () => { consumer && (await consumer.disconnect()) consumer2 && (await consumer2.disconnect()) producer && (await producer.disconnect()) })
/** * @public * @returns {Promise<null>} */ async disconnect() { await this.brokerPool.disconnect() }
/** * @public * @description This function stops the TelegramService * @example * gladys.services.telegram.stop(); */ async function stop() { logger.log('stopping telegram service'); await messageHandler.disconnect(); }
describe('gateway.disconnect', () => { it('should disconnect Gateway', async () => { const variable = { getValue: fake.resolves('key'), setValue: fake.resolves(null), destroy: fake.resolves(null), }; const gateway = new Gateway(variable, event, system, sequelize, config); await gateway.login('tony.stark@gladysassistant.com', 'warmachine123'); await gateway.disconnect(); }); });
/** * @api {post} /api/v1/service/zwave/disconnect Disconnect * @apiName disconnect * @apiGroup Zwave */ async function disconnect(req, res) { zwaveManager.disconnect(); res.json({ success: true, }); }