TestApplicationIdentity.cpp 741 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "Test.h"
#include "../include/Strings.h"
#include "../include/JSON.h"
#include "../src/message/Message.h"
#include <iostream>

using namespace std;
using namespace cameo;

int main(int argc, char *argv[]) {

	Endpoint endpoint("gamma75", 9999);

	ApplicationIdentity identity("my-app", 31, endpoint);

	string jsonString = identity.toJSONString();

	json::Object jsonIdentity;
	json::parse(jsonIdentity, jsonString);

	CAMEO_ASSERT_TRUE(string("my-app") == jsonIdentity[message::ApplicationIdentity::NAME].GetString());
	CAMEO_ASSERT_EQUAL(31, jsonIdentity[message::ApplicationIdentity::ID].GetInt());
	CAMEO_ASSERT_TRUE(string("tcp://gamma75:9999") == jsonIdentity[message::ApplicationIdentity::SERVER].GetString());

	return 0;
}