// Path: test/io/pathfinder/BaseAppTest.java
// public class BaseAppTest {
//     public FakeApplication app;
//     public final Cluster cluster = new Cluster();
//     public final Application PATHFINDER_APPLICATION = new Application();
//     public static final String APPLICATION_ID = "001e7047-ee14-40d6-898a-5acf3a1cfd8a";
//     public static final String CLUSTER_ID = APPLICATION_ID;
//     public static final String ROOT = "/root";
// 
//     public Cluster baseCluster() {
//         return Cluster.finder().byId(CLUSTER_ID);
//     }
// 
//     @Before
//     public void startApp() {
//     	Map<String,String> conf = new HashMap<>(Helpers.inMemoryDatabase());
//     	conf.put("Authenticate", "false");
//         app = Helpers.fakeApplication(conf);
//         Helpers.start(app);
//         PATHFINDER_APPLICATION.id_$eq(APPLICATION_ID);
//         PATHFINDER_APPLICATION.name_$eq("MY COOL APP");
//         cluster.id_$eq(CLUSTER_ID);
//         cluster.insert();
//         cluster.id_$eq(CLUSTER_ID);
//         PATHFINDER_APPLICATION.insert();
//         cluster.save();
//     }
// 
//     @After
//     public void stopApp() {
//         Helpers.stop(app);
//     }
// }
// 
// Path: app/io/pathfinder/models/TransportStatus.java
// public enum TransportStatus {
//     @EnumValue("0")
//     Offline,
//     @EnumValue("1")
//     Online;
// 
//     public static final Format<TransportStatus> format = new JavaEnumFormat<>(TransportStatus.class);
// }


import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.pattern.Patterns;
import akka.testkit.TestActorRef;
import akka.testkit.TestProbe;
import io.pathfinder.BaseAppTest;
import io.pathfinder.models.Cluster;
import io.pathfinder.models.Commodity;
import io.pathfinder.models.Transport;
import io.pathfinder.models.TransportStatus;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import play.api.libs.json.JsNumber;
import play.api.libs.json.JsObject;
import play.api.libs.json.JsValue;
import play.api.libs.json.Json;
import scala.collection.mutable.HashMap;
import scala.collection.mutable.Map;
import scala.math.BigDecimal;
    }

    @Test
    public void testCreateTransport() {
        final int NEXT_UNUSED_ID = 1;
        Patterns.ask(socket, WebSocketMessage.format().reads(JSON_CREATE_TRANSPORT).get(), TIMEOUT);
        Transport createdTransport = new Transport();
        createdTransport.id_$eq(NEXT_UNUSED_ID);
        createdTransport.latitude_$eq(0.1);
        createdTransport.longitude_$eq(-12.3);
        Map<String,JsValue> meta = new HashMap<>();
        meta.put("capacity", new JsNumber(BigDecimal.valueOf(99)));
        createdTransport.metadata_$eq(new JsObject(meta));
        createdTransport.status_$eq(TransportStatus.Online);
        createdTransport.cluster_$eq(baseCluster());
        client.expectMsg(new WebSocketMessage.Created(
                ModelTypes.Transport(), Transport.format().writes(createdTransport)));
    }

    @Test
    public void testCreateCommodity() {
        final int NEXT_UNUSED_ID = 1;
        Patterns.ask(socket, WebSocketMessage.format().reads(JSON_CREATE_COMMODITY).get(), TIMEOUT);
        Commodity createdCommodity = new Commodity();
        createdCommodity.id_$eq(NEXT_UNUSED_ID);
        createdCommodity.startLatitude_$eq(0.1);
        createdCommodity.startLongitude_$eq(-12.3);
        createdCommodity.endLatitude_$eq(99.4);
        createdCommodity.endLongitude_$eq(-3.5);
        createdCommodity.cluster_$eq(baseCluster());
// Path: test/io/pathfinder/BaseAppTest.java
// public class BaseAppTest {
//     public FakeApplication app;
//     public final Cluster cluster = new Cluster();
//     public final Application PATHFINDER_APPLICATION = new Application();
//     public static final String APPLICATION_ID = "001e7047-ee14-40d6-898a-5acf3a1cfd8a";
//     public static final String CLUSTER_ID = APPLICATION_ID;
//     public static final String ROOT = "/root";
// 
//     public Cluster baseCluster() {
//         return Cluster.finder().byId(CLUSTER_ID);
//     }
// 
//     @Before
//     public void startApp() {
//     	Map<String,String> conf = new HashMap<>(Helpers.inMemoryDatabase());
//     	conf.put("Authenticate", "false");
//         app = Helpers.fakeApplication(conf);
//         Helpers.start(app);
//         PATHFINDER_APPLICATION.id_$eq(APPLICATION_ID);
//         PATHFINDER_APPLICATION.name_$eq("MY COOL APP");
//         cluster.id_$eq(CLUSTER_ID);
//         cluster.insert();
//         cluster.id_$eq(CLUSTER_ID);
//         PATHFINDER_APPLICATION.insert();
//         cluster.save();
//     }
// 
//     @After
//     public void stopApp() {
//         Helpers.stop(app);
//     }
// }
// 
// Path: app/io/pathfinder/models/TransportStatus.java
// public enum TransportStatus {
//     @EnumValue("0")
//     Offline,
//     @EnumValue("1")
//     Online;
// 
//     public static final Format<TransportStatus> format = new JavaEnumFormat<>(TransportStatus.class);
// }


// Path: test/io/pathfinder/websockets/WebSocketActorTest.java
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.pattern.Patterns;
import akka.testkit.TestActorRef;
import akka.testkit.TestProbe;
import io.pathfinder.BaseAppTest;
import io.pathfinder.models.Cluster;
import io.pathfinder.models.Commodity;
import io.pathfinder.models.Transport;
import io.pathfinder.models.TransportStatus;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import play.api.libs.json.JsNumber;
import play.api.libs.json.JsObject;
import play.api.libs.json.JsValue;
import play.api.libs.json.Json;
import scala.collection.mutable.HashMap;
import scala.collection.mutable.Map;
import scala.math.BigDecimal;

    }

    @Test
    public void testCreateTransport() {
        final int NEXT_UNUSED_ID = 1;
        Patterns.ask(socket, WebSocketMessage.format().reads(JSON_CREATE_TRANSPORT).get(), TIMEOUT);
        Transport createdTransport = new Transport();
        createdTransport.id_$eq(NEXT_UNUSED_ID);
        createdTransport.latitude_$eq(0.1);
        createdTransport.longitude_$eq(-12.3);
        Map<String,JsValue> meta = new HashMap<>();
        meta.put("capacity", new JsNumber(BigDecimal.valueOf(99)));
        createdTransport.metadata_$eq(new JsObject(meta));
        createdTransport.status_$eq(TransportStatus.Online);
        createdTransport.cluster_$eq(baseCluster());
        client.expectMsg(new WebSocketMessage.Created(
                ModelTypes.Transport(), Transport.format().writes(createdTransport)));
    }

    @Test
    public void testCreateCommodity() {
        final int NEXT_UNUSED_ID = 1;
        Patterns.ask(socket, WebSocketMessage.format().reads(JSON_CREATE_COMMODITY).get(), TIMEOUT);
        Commodity createdCommodity = new Commodity();
        createdCommodity.id_$eq(NEXT_UNUSED_ID);
        createdCommodity.startLatitude_$eq(0.1);
        createdCommodity.startLongitude_$eq(-12.3);
        createdCommodity.endLatitude_$eq(99.4);
        createdCommodity.endLongitude_$eq(-3.5);
        createdCommodity.cluster_$eq(baseCluster());
        Map<String,JsValue> meta = new HashMap<>();