ADD: Update Library
This commit is contained in:
Submodule libs/nlohmann_json updated: bc889afb4c...9cca280a4d
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "kubecontrol/KubePod.hpp"
|
#include "kubecontrol/KubePod.hpp"
|
||||||
#include "nlohmann/json_fwd.hpp"
|
#include "nlohmann/json_fwd.hpp"
|
||||||
|
#include <thread>
|
||||||
#define CATCH_CONFIG_MAIN
|
#define CATCH_CONFIG_MAIN
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
@@ -12,26 +13,49 @@
|
|||||||
|
|
||||||
SCENARIO("Testing the SimCore Sensor")
|
SCENARIO("Testing the SimCore Sensor")
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
kubecontrol::PodController podc("docs/config");
|
kubecontrol::PodController podc("docs/config");
|
||||||
|
std::string name = "hamburg";
|
||||||
|
|
||||||
|
std::string uuid = name;
|
||||||
|
kubecontrol::KubePod ShipPod1("controller",uuid,"ship","ship:latest","simulator");
|
||||||
|
|
||||||
|
nlohmann::json vars;
|
||||||
|
vars["ENTITY_ID"] = uuid;
|
||||||
|
vars["ENTITY_NAME"] = "FGS Hamburg";
|
||||||
|
vars["ENTITY_SIDE"] = "Neutral";
|
||||||
|
vars["POSITION"]["LAT"] = "55";
|
||||||
|
vars["POSITION"]["LON"] = "8";
|
||||||
|
vars["POSITION"]["Height"] = "0";
|
||||||
|
vars["COURSE"] = "0";
|
||||||
|
vars["SPEED"] = "0";
|
||||||
|
vars["GROUNDTRUTH_PORT"] = std::to_string(10000);
|
||||||
|
vars["GROUNDTRUTH_ADDR"] = "239.0.0.1";
|
||||||
|
vars["COMMAND_PORT"] = "5555";
|
||||||
|
vars["ENTITY_RCS"] = std::to_string(850);
|
||||||
|
|
||||||
|
vars["ENTITY_SENSORS"].push_back("radar:latest");
|
||||||
|
ShipPod1.setEnvironmentVar("CONFIG", vars.dump());
|
||||||
|
|
||||||
|
// kubecontrol::KubePod pod1("Pod1",xg::newGuid().str(),"ship:latest");
|
||||||
|
|
||||||
|
// kubecontrol::KubePod pod2("Pod2",xg::newGuid().str(),"debugdebianhenry:0.1.3");
|
||||||
|
|
||||||
|
// pod1.setArgs("-c");
|
||||||
|
// pod1.setArgs("while true; do echo hello; sleep 5;done");
|
||||||
|
|
||||||
|
// pod1.setCommand("/bin/sh");
|
||||||
|
|
||||||
|
|
||||||
kubecontrol::KubePod pod1("Pod1",xg::newGuid().str(),"debugdebianhenry:0.1.3");
|
podc.startPod(ShipPod1);
|
||||||
|
// podc.startPod(pod2);
|
||||||
kubecontrol::KubePod pod2("Pod2",xg::newGuid().str(),"debugdebianhenry:0.1.3");
|
|
||||||
|
|
||||||
pod1.setArgs("-c");
|
|
||||||
pod1.setArgs("while true; do echo hello; sleep 5;done");
|
|
||||||
|
|
||||||
pod1.setCommand("/bin/sh");
|
|
||||||
|
|
||||||
|
|
||||||
podc.startPod(pod1);
|
|
||||||
podc.startPod(pod2);
|
|
||||||
std::string info1 = "";
|
std::string info1 = "";
|
||||||
info1 = podc.getInfoForPod("pod1");
|
info1 = podc.getInfoForPod("hamburg");
|
||||||
nlohmann::json j1 = nlohmann::json::parse(info1);
|
nlohmann::json j1 = nlohmann::json::parse(info1);
|
||||||
|
|
||||||
nlohmann::json jall = nlohmann::json::parse(podc.getPodsInfo());
|
nlohmann::json jall = nlohmann::json::parse(podc.getPodsInfo());
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
||||||
|
|
||||||
podc.stopAllPods();
|
podc.stopAllPods();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user