mdk_runtime.FakeWebSockets Maven / Gradle / Ivy
/* Quark 1.0.452 run at 2016-11-11 16:09:46.008093 */
package mdk_runtime;
/**
* WebSocket implementation for testing purposes.
*
*/
public class FakeWebSockets implements WebSockets, io.datawire.quark.runtime.QObject {
public static quark.reflect.Class quark_List_mdk_runtime_FakeWSActor__ref = datawire_mdk_md.Root.quark_List_mdk_runtime_FakeWSActor__md;
public static quark.reflect.Class mdk_runtime_FakeWebSockets_ref = datawire_mdk_md.Root.mdk_runtime_FakeWebSockets_md;
public mdk_runtime.actors.MessageDispatcher dispatcher;
public java.util.ArrayList fakeActors = new java.util.ArrayList(java.util.Arrays.asList(new Object[]{}));
public FakeWebSockets() {}
public mdk_runtime.promise.Promise connect(String url, mdk_runtime.actors.Actor originator) {
mdk_runtime.promise.PromiseResolver factory = new mdk_runtime.promise.PromiseResolver((this).dispatcher);
FakeWSActor actor = new FakeWSActor(originator, factory, url);
((this).dispatcher).startActor(actor);
((this).fakeActors).add(actor);
return (factory).promise;
}
public FakeWSActor lastConnection() {
return ((this).fakeActors).get((((this).fakeActors).size()) - (1));
}
public void onStart(mdk_runtime.actors.MessageDispatcher dispatcher) {
(this).dispatcher = dispatcher;
}
public void onMessage(mdk_runtime.actors.Actor origin, Object message) {}
public String _getClass() {
return "mdk_runtime.FakeWebSockets";
}
public Object _getField(String name) {
if ((name)==("dispatcher") || ((Object)(name) != null && ((Object) (name)).equals("dispatcher"))) {
return (this).dispatcher;
}
if ((name)==("fakeActors") || ((Object)(name) != null && ((Object) (name)).equals("fakeActors"))) {
return (this).fakeActors;
}
return null;
}
public void _setField(String name, Object value) {
if ((name)==("dispatcher") || ((Object)(name) != null && ((Object) (name)).equals("dispatcher"))) {
(this).dispatcher = (mdk_runtime.actors.MessageDispatcher) (value);
}
if ((name)==("fakeActors") || ((Object)(name) != null && ((Object) (name)).equals("fakeActors"))) {
(this).fakeActors = (java.util.ArrayList) (value);
}
}
/**
* The Actor should begin shutting down.
*/
public void onStop() {}
}