Skip to content
Browse files

Augmented test server to for API change.

  • Loading branch information...
1 parent 26aba97 commit 531a42ed05ec16fc655cfa621e1ad1220e502475 @jbeard4 committed Mar 29, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/util/test-server.js
View
9 lib/util/test-server.js
@@ -15,6 +15,8 @@ function loadScxml(scxmlStr,cb){
throw err;
}
+ //console.log(JSON.stringify(scxmlJson,4,4));
+
var annotatedScxmlJson = scion.annotator.transform(scxmlJson,true,true,true,true);
var model = scion.json2model(annotatedScxmlJson);
var interpreter = new scion.scxml.NodeInterpreter(model);
@@ -47,15 +49,16 @@ http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'application/json'});
res.end(JSON.stringify({
sessionToken : sessionToken,
- nextConfiguration : interpreter.getConfiguration().iter()
+ nextConfiguration : interpreter.getConfiguration()
}));
timeouts[sessionToken] = setTimeout(function(){cleanUp(sessionToken);},timeoutMs);
});
}else if(reqJson.event && (typeof reqJson.sessionToken === "number")){
console.log("sending event to statechart",reqJson.event);
var sessionToken = reqJson.sessionToken;
- var nextConfiguration = sessions[sessionToken].gen(reqJson.event).iter();
+ var nextConfiguration = sessions[sessionToken].gen(reqJson.event);
+ console.log('nextConfiguration',nextConfiguration);
res.writeHead(200, {'Content-Type': 'application/json'});
res.end(JSON.stringify({
nextConfiguration : nextConfiguration
@@ -69,6 +72,8 @@ http.createServer(function (req, res) {
res.end("Unrecognized request.\n");
}
}catch(e){
+ console.error(e);
+ console.error(e.stack);
res.writeHead(500, {'Content-Type': 'text/plain'});
res.end(e.message);
}

0 comments on commit 531a42e

Please sign in to comment.
Something went wrong with that request. Please try again.