Skip to content
This repository has been archived by the owner on Sep 25, 2018. It is now read-only.

Commit

Permalink
Modified multi-process testing harness to allow distributed testing. …
Browse files Browse the repository at this point in the history
…Seems to work with one client; next step will be to test on multiple clients.
  • Loading branch information
jbeard4 committed Sep 5, 2011
1 parent 5f87767 commit 576716e
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 184 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,37 @@ require ["scxml/SCXML","scxml/test/multi-process-browser/initialize-json-test-de
clearTimeout = (cb,time) -> window.clearTimeout cb,time

interpreter = null
currentTestId = null
p = null
buffer = ""

initializeStatechart = ->
$.getJSON "test",(testJson) ->
initializeJsonTest testJson,([m,model,optimizations]) ->
if testJson.done #server says we're out of tests
$(document.documentElement).unbind() #unbind event listeners
else
currentTestId = testJson.id

dfd = new jQuery.Deferred()
p = dfd.promise()
initializeJsonTest testJson,([m,model,optimizations]) ->

interpreter = new scxml.SimpleInterpreter model,setTimeout,clearTimeout,optimizations
interpreter.start()
initialConfiguration = interpreter.getConfiguration()
console.log "initialConfiguration",initialConfiguration.iter()
$.post "/statechart-initialized",(l) ->
console.log l
$.post "/check-configuration",JSON.stringify(initialConfiguration.iter()),(-> dfd.resolve())
dfd = new jQuery.Deferred()
p = dfd.promise()

interpreter = new scxml.SimpleInterpreter model,setTimeout,clearTimeout,optimizations
interpreter.start()
initialConfiguration = interpreter.getConfiguration()
console.log "initialConfiguration",initialConfiguration.iter()

data = JSON.stringify {id : currentTestId}

$.post "/statechart-initialized",data,(l) ->
console.log l

data = JSON.stringify
id : currentTestId
configuration : initialConfiguration.iter()

$.post "/check-configuration",data,(-> dfd.resolve())

$(document.documentElement).keypress (e) ->
#send it to statechart instance
Expand Down Expand Up @@ -59,11 +73,14 @@ require ["scxml/SCXML","scxml/test/multi-process-browser/initialize-json-test-de
interpreter.gen new Event b
configuration = interpreter.getConfiguration()
console.log "configuration after event",scEvent,configuration.iter()
$.post "/check-configuration",JSON.stringify(configuration.iter())
data = JSON.stringify
id : currentTestId
configuration : configuration.iter()

$.post "/check-configuration",data

else
#append char to buffer
buffer += scEvent


$.post "/dom-ready"
initializeStatechart()
Loading

0 comments on commit 576716e

Please sign in to comment.