This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from __future__ import print_function | |
from threading import Thread | |
from twisted.internet.defer import Deferred | |
from twisted.trial.unittest import TestCase | |
from paho.mqtt.client import Client |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from threading import Thread | |
from time import sleep | |
from twisted.trial.unittest import TestCase | |
from twisted.internet.defer import Deferred | |
from twisted.internet import reactor | |
class ThreadTestCase(TestCase): | |
def setUp(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Bacon = require("baconjs"), | |
assert = require("assert"); | |
require('promise.prototype.finally'); | |
describe("Testing stream equality logic", function(){ | |
it( "can match Bacon streams backed by the same array.", function(){ | |
var targetSequence = [ | |
["oldmacdonald/farm", "['sheep','pig','cow','duck']" ] , //n.b. JSON.stringify of array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Bacon = require("baconjs"), | |
assert = require("assert"); | |
require('promise.prototype.finally'); | |
describe("Testing stream equality logic", function(){ | |
it( "can match Bacon streams backed by the same array.", function(){ | |
var targetSequence = [ | |
["oldmacdonald/farm", "['sheep','pig','cow','duck']" ] , //n.b. JSON.stringify of array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Verifies that the over-the-wire MQTT messages arising from IdeaTree operations are as expected. */ | |
describe("Tree Protocol", function(){ | |
it("Sends branch keys then leaf values", function(){ | |
var sniffer = mqtt.connect(conf.mqttWsAddr); | |
var subscribeAndSendPromise = util.createSubscriptionPromise(sniffer, '#') | |
.then(function(){ | |
writer.setItem('oldmacdonald/farm', { | |
sheep:"Baa", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Verifies that the over-the-wire MQTT messages arising from IdeaTree operations are as expected. */ | |
describe("Tree Protocol", function(){ | |
it("Sends branch keys then leaf values", function(){ | |
var sniffer = mqtt.connect(conf.mqttWsAddr); | |
var subscribeAndSendPromise = util.createSubscriptionPromise(sniffer, '#') | |
.then(function(){ | |
writer.setItem('oldmacdonald/farm', { | |
sheep:"Baa", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var _ = require("lodash"), | |
Kefir = require("kefir"), | |
events = require("events"); | |
/** This Gist is intended to emulate an eventing framework in which Javascript objects | |
* containing topic:value pairs are kept in synchrony across a network. | |
* | |
* There is a mysterious problem, in which a flatMap actually triggered by a Property event | |
* creates a stream which is also based on the same Property, but which doesn't seem to generate events. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var Kefir = require("kefir"), | |
events = require('events'); | |
var empty = void(0); | |
var localEmitter = new events.EventEmitter(); //used to notify local updates to values against new or old topics | |
var remoteEmitter = new events.EventEmitter(); //used to notify local updates to values against new or old topics | |
var localProperty = Kefir.fromEvents(localEmitter, "Hello").toProperty(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Q = require("q"); | |
var persistence = require("persistence"); | |
var mosca = require("mosca"); | |
var mqtt = require("mqtt"); | |
var chai = require("chai"); | |
var should = chai.should(); | |
var Promise = Q.Promise; | |
function promiseServer(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Q = require("q"); | |
var persistence = require("persistence"); | |
var mosca = require("mosca"); | |
var mqtt = require("mqtt"); | |
var chai = require("chai"); | |
var should = chai.should(); | |
var Promise = Q.Promise; | |
function promiseServer(){ |
OlderNewer