Ejemplo n.º 1
0
void EntityEditor::operationGetGoalInfoResult(const Atlas::Objects::Operation::RootOperation& op)
{
	//What we receive here has been relayed from the mind of the entity. That means that this op
	//is potentially unsafe, as it could be of any type (Set, Logout etc.), all depending on what the
	//mind client decided to send (i.e. someone might want to try to hack). We should therefore treat it
	//very carefully.

	if (op->getClassNo() == Atlas::Objects::Operation::ROOT_OPERATION_NO) {
		//An empty root operation signals a timeout; we never got any answer from the entity.
		return;
	}

	//Since we'll just be iterating over the args we only need to do an extra check that what we got is a
	//"info" operation.
	if (op->getClassNo() != Atlas::Objects::Operation::INFO_NO) {
		S_LOG_WARNING("Got goal info operation with wrong type.");
		return;
	}

	if (!op->getArgs().empty()) {
		auto goalInfos = op->getArgsAsList();
		for (auto goalInfo : goalInfos) {
			EventGotGoalInfo(goalInfo);
		}
	} else {
		S_LOG_VERBOSE("Got goal info op without any goals.");
	}
}
Ejemplo n.º 2
0
void EntityEditor::removeGoal(const std::string& id)
{
	Eris::Account* account = EmberServices::getSingleton().getServerService().getAccount();

	Atlas::Message::MapType goalElement;
	goalElement["id"] = id;
	//By not defining anything else than the id we're telling the server to remove it.

	Atlas::Objects::Entity::Anonymous thought;
	thought->setAttr("goal", goalElement);

	Atlas::Objects::Operation::RootOperation thinkOp;
	thinkOp->setArgs1(thought);
	std::list<std::string> parents;
	parents.emplace_back("think");
	thinkOp->setParents(parents);
	thinkOp->setTo(mEntity.getId());
	//By setting it TO an entity and FROM our avatar we'll make the server deliver it as
	//if it came from the entity itself (the server rewrites the FROM to be of the entity).
	thinkOp->setFrom(mWorld.getAvatar()->getEmberEntity().getId());

	Eris::Connection* connection = account->getConnection();

	connection->send(thinkOp);
}
Ejemplo n.º 3
0
int main()
{
    ClientConnection * cc = new ClientConnection();
    delete cc;

    // Try all the method calls when not connected
    cc = new ClientConnection();

    cc->login("username", "password");
    cc->create("player", "username", "password");
    cc->wait();

    {
        Atlas::Objects::Operation::RootOperation op;
        cc->send(op);
    }

    cc->pop();
    cc->pending();
    
    delete cc;

    TestClientConnection * tcc = new TestClientConnection();

    {
        Atlas::Objects::Root obj;
        Atlas::Objects::Operation::RootOperation op;
        tcc->test_operation(op);
        tcc->test_errorArrived(op);
        tcc->test_infoArrived(op);
        tcc->test_objectArrived(op);

        Anonymous op_arg;
        op->setArgs1(op_arg);
        tcc->test_infoArrived(op);

        op->setFrom("1");
        tcc->test_infoArrived(op);

        op->setParents(std::list<std::string>());
        tcc->test_operation(op);
        tcc->test_objectArrived(op);

        Info i;
        tcc->test_objectArrived(i);

        Error e;
        tcc->test_objectArrived(e);

        tcc->test_objectArrived(obj);
        obj->setParents(std::list<std::string>());
        tcc->test_objectArrived(obj);

        
    }

    return 0;
}
Ejemplo n.º 4
0
void ConnectedAdapter::actuate(Eris::Entity* entity, const std::string& action)
{
	try {

		Atlas::Objects::Entity::Anonymous what;
		what->setId(entity->getId());
		// 	what->setObjtype("obj");

		Atlas::Objects::Operation::RootOperation actionOp;
		actionOp->setObjtype("op");
		actionOp->setArgs1(what);
		std::list<std::string> actionParents;
		actionParents.push_back(action);
		actionOp->setParents(actionParents);

		Atlas::Objects::Operation::RootOperation actuateOp;
		actuateOp->setObjtype("op");
		actuateOp->setArgs1(actionOp);
		std::list<std::string> actuateParents;
		actuateParents.push_back("actuate");
		actuateOp->setParents(actuateParents);
		actuateOp->setFrom(mAvatar.getEntity()->getId());

		S_LOG_INFO("Actuating entity with id " << entity->getId() << ", named " << entity->getName() << " with action '" << action << "'.");
		mConnection.send(actuateOp);
	} catch (const std::exception& ex) {
		S_LOG_WARNING("Got error on actuating." << ex);
	}
}
Ejemplo n.º 5
0
void Lobbytest::test_operation_account()
{
    Account * tac = new TestAccount();

    m_lobby->addAccount(tac);

    Atlas::Objects::Operation::RootOperation op;
    OpVector res;
    op->setTo("2");
    m_lobby->operation(op, res);
}
Ejemplo n.º 6
0
void Lobbytest::test_operation_connected_other()
{
    Account * tac = new TestAccount();

    tac->m_connection = new Connection(*(CommSocket*)0,
                                       *(ServerRouting*)0,
                                       "foo", "3", 3);

    m_lobby->addAccount(tac);

    Atlas::Objects::Operation::RootOperation op;
    OpVector res;
    op->setTo("2");
    m_lobby->operation(op, res);
}
Ejemplo n.º 7
0
void LocatedEntity::broadcast(const Atlas::Objects::Operation::RootOperation& op, OpVector& res, Visibility visibility) const
{
    std::set<const LocatedEntity*> receivers;
    collectObservers(receivers);

    for (auto& entity : receivers) {
        if (visibility == Visibility::PRIVATE) {
            //Only send private ops to admins
            if (!entity->hasFlags(entity_admin)) {
                continue;
            }
        } else if (visibility == Visibility::PROTECTED) {
            //Protected ops also goes to the entity itself
            if (!entity->hasFlags(entity_admin) &&
                entity->getIntId() != getIntId()) {
                continue;
            }
        }
        auto newOp = op.copy();
        newOp->setTo(entity->getId());
        newOp->setFrom(getId());
        res.push_back(newOp);
    }

}
Ejemplo n.º 8
0
	void SoundEntity::Entity_Action(const Atlas::Objects::Operation::RootOperation& act)
	{
		const std::list<std::string> &p = act->getParents();
		std::list<std::string>::const_iterator I = p.begin();

		if (I != p.end()) {
			const std::string& name = *I;
			playAction(name);
		}
	}
Ejemplo n.º 9
0
void EntityEditor::addKnowledge(const std::string& predicate, const std::string& subject, const std::string& knowledge)
{
	Eris::Account* account = EmberServices::getSingleton().getServerService().getAccount();

	Atlas::Objects::Entity::Anonymous thought;
	thought->setAttr("predicate", predicate);
	thought->setAttr("subject", subject);
	thought->setAttr("object", knowledge);

	Atlas::Objects::Operation::RootOperation thinkOp;
	thinkOp->setArgs1(thought);
	std::list<std::string> parents;
	parents.emplace_back("think");
	thinkOp->setParents(parents);
	thinkOp->setTo(mEntity.getId());
	//By setting it TO an entity and FROM our avatar we'll make the server deliver it as
	//if it came from the entity itself (the server rewrites the FROM to be of the entity).
	thinkOp->setFrom(mWorld.getAvatar()->getEmberEntity().getId());

	Eris::Connection* connection = account->getConnection();

	connection->send(thinkOp);

}
Ejemplo n.º 10
0
void EmberEntity::onAction(const Atlas::Objects::Operation::RootOperation& act)
{
	const std::list<std::string> &p = act->getParents();
	std::list<std::string>::const_iterator I = p.begin();

	if (I != p.end()) {

		const std::string& name = *I;
		std::string message = getName() + " performs a " + name + ".";

		ConsoleBackend::getSingletonPtr()->pushMessage(message, "info");

		S_LOG_VERBOSE("Entity: " << this->getId() << " (" << this->getName() << ") action: " << name);
	}
	Entity::onAction(act);
}
Ejemplo n.º 11
0
void EmberEntity::onSoundAction(const Atlas::Objects::Operation::RootOperation & op)
{
	//We'll just catch the call and write something to both the log and the console, and then pass it on.
	const std::list<std::string> &p = op->getParents();
	std::list<std::string>::const_iterator I = p.begin();

	if (I != p.end()) {

		const std::string& name = *I;
		std::string message = getName() + " emits a " + name + ".";

		ConsoleBackend::getSingletonPtr()->pushMessage(message, "info");

		S_LOG_VERBOSE("Entity: " << this->getId() << " (" << this->getName() << ") sound action: " << name);
	}

	Eris::Entity::onSoundAction(op);
}
Ejemplo n.º 12
0
void EntityImporterBase::sendMinds()
{
    if (!mResolvedMindMapping.empty()) {
        S_LOG_INFO("Sending minds.");
        for (auto mind : mResolvedMindMapping) {
            Atlas::Message::MapType message;
            mind.second->addToMessage(message);

            Atlas::Message::Element thoughtsElem = message["thoughts"];
            Atlas::Message::ListType thoughtArgs;

            if (thoughtsElem.isList()) {
                Atlas::Message::ListType thoughtList = thoughtsElem.List();

                for (auto& thought : thoughtList) {
                    //If the thought is a list of things the entity owns, we should adjust it with the new entity ids.
                    if (thought.isMap()) {
                        auto& thoughtMap = thought.Map();
                        if (thoughtMap.count("things") > 0) {
                            auto& thingsElement = thoughtMap.find("things")->second;
                            if (thingsElement.isMap()) {
                                for (auto& thingI : thingsElement.asMap()) {
                                    if (thingI.second.isList()) {
                                        Atlas::Message::ListType newList;
                                        for (auto& thingId : thingI.second.asList()) {
                                            if (thingId.isString()) {
                                                const auto& entityIdLookupI = mEntityIdMap.find(thingId.asString());
                                                //Check if the owned entity has been created with a new id. If so, replace the data.
                                                if (entityIdLookupI != mEntityIdMap.end()) {
                                                    newList.emplace_back(entityIdLookupI->second);
                                                } else {
                                                    newList.push_back(thingId);
                                                }
                                            } else {
                                                newList.push_back(thingId);
                                            }
                                        }
                                        thingI.second = newList;
                                    }
                                }
                            }
                        }

                        if (thoughtMap.count("pending_things") > 0) {
                            //things that the entity owns, but haven't yet discovered are expressed as a list of entity ids
                            auto& pendingThingsElement = thoughtMap.find("pending_things")->second;
                            if (pendingThingsElement.isList()) {
                                Atlas::Message::ListType newList;
                                for (auto& thingId : pendingThingsElement.asList()) {
                                    if (thingId.isString()) {
                                        const auto& entityIdLookupI = mEntityIdMap.find(thingId.asString());
                                        //Check if the owned entity has been created with a new id. If so, replace the data.
                                        if (entityIdLookupI != mEntityIdMap.end()) {
                                            newList.emplace_back(entityIdLookupI->second);
                                        } else {
                                            newList.push_back(thingId);
                                        }
                                    } else {
                                        newList.push_back(thingId);
                                    }
                                }
                                pendingThingsElement = newList;
                            }
                        }

                        if (thoughtMap.count("object") > 0) {
                            auto& objectElement = thoughtMap.find("object")->second;
                            if (objectElement.isString()) {
                                std::string& objectString = objectElement.String();
                                //Other entities are referred to using the syntax "'$eid:...'".
                                //For example, the entity with id 2 would be "'$eid:2'".
                                auto pos = objectString.find("$eid:");
                                if (pos != std::string::npos) {
                                    auto quotePos = objectString.find('\'', pos);
                                    if (quotePos != std::string::npos) {
                                        auto id = objectString.substr(pos + 5, quotePos - pos - 5);
                                        auto I = mEntityIdMap.find(id);
                                        if (I != mEntityIdMap.end()) {
                                            objectString.replace(pos + 5, quotePos - 7, I->second);
                                        }
                                    }
                                }
                            }
                        }

                    }
                    thoughtArgs.push_back(thought);
                }
            }

            Atlas::Objects::Operation::RootOperation thinkOp;
            thinkOp->setParent("think");
            thinkOp->setTo(mind.first);
            //By setting it TO an entity and FROM our avatar we'll make the server deliver it as
            //if it came from the entity itself (the server rewrites the FROM to be of the entity).
            thinkOp->setFrom(mAvatarId);
            thinkOp->setSerialno(newSerialNumber());

            Atlas::Objects::Operation::Set setOp;
            setOp->setArgsAsList(thoughtArgs);
            thinkOp->setArgs1(setOp);


            mStats.mindsProcessedCount++;
            S_LOG_VERBOSE("Restoring mind of " << mind.first);
            mThoughtOpsInTransit++;

            sigc::slot<void, const Operation&> slot = sigc::mem_fun(*this, &EntityImporterBase::operationThinkResult);
            sendAndAwaitResponse(thinkOp, slot);
            EventProgress.emit();
        }
        mResolvedMindMapping.clear();
    } else {
        complete();
    }
}
Ejemplo n.º 13
0
int main()
{
    TestWorld world;
    CommServer server;

    {
        Peer * p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);
        delete p;
    }

    {
        Peer * p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);

        Atlas::Objects::Operation::RootOperation op;
        OpVector res;
        p->operation(op, res);

        delete p;
    }

    {
        // Test the setting of authentiaction states
        Peer * p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);

        assert(p->getAuthState() == PEER_INIT);
        p->setAuthState(PEER_AUTHENTICATED);
        assert(p->getAuthState() == PEER_AUTHENTICATED);

        delete p;
    }

    {
        Peer *p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        Atlas::Objects::Operation::Info op;
        OpVector res;
        p->operation(op, res);
    }

    // Authenticating (no args)
    {
        Peer *p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);

        p->setAuthState(PEER_AUTHENTICATING);
        
        Atlas::Objects::Operation::Info op;
        OpVector res;
        p->operation(op, res);
    }

    // Authenticating (empty arg)
    {
        Peer *p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);

        p->setAuthState(PEER_AUTHENTICATING);
        
        Atlas::Objects::Operation::Info op;
        Atlas::Objects::Root arg;
        op->setArgs1(arg);
        OpVector res;
        p->operation(op, res);
    }

    // Authenticating (full arg)
    {
        TestPeer *p = new TestPeer(*(CommSocket*)0, *(ServerRouting*)0, "addr", "1", 1);

        p->setAuthState(PEER_AUTHENTICATING);
        
        Atlas::Objects::Operation::Info op;
        Atlas::Objects::Root arg;
        arg->setId("2");
        std::list<std::string> parents;
        parents.push_back("server");
        arg->setParents(parents);
        op->setArgs1(arg);
        OpVector res;
        p->operation(op, res);
        assert(p->getAccountType() == "server");
    }

    // Authenticated (no args)
    {
        Peer *p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);

        p->setAuthState(PEER_AUTHENTICATED);
        
        Atlas::Objects::Operation::Info op;
        OpVector res;
        p->operation(op, res);
    }

    {
        Peer *p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        Atlas::Objects::Operation::Error op;
        OpVector res;
        p->operation(op, res);
    }

    // Not authenticated
    {
        Peer *p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        Entity e("3", 3);
        int ret = p->teleportEntity(&e);
        assert(ret == -1);
    }

    // Authenticated
    {
        TestCommClient client(server, "");
        Peer *p = new Peer(client, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        p->setAuthState(PEER_AUTHENTICATED);
        
        Entity e("3", 3);
        int ret = p->teleportEntity(&e);
        assert(ret == 0);
        assert(stub_CommClient_sent_op.isValid());
        assert(stub_CommClient_sent_op->getArgs().size() == 1);
    }

    // Re-teleport same entity
    {
        TestCommClient client(server, "");
        Peer *p = new Peer(client, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        p->setAuthState(PEER_AUTHENTICATED);
        
        Entity e("3", 3);
        int ret = p->teleportEntity(&e);
        assert(ret == 0);
        assert(stub_CommClient_sent_op.isValid());
        assert(stub_CommClient_sent_op->getArgs().size() == 1);

        ret = p->teleportEntity(&e);
        assert(ret != 0);
    }

    // Character (no mind)
    {
        TestCommClient client(server, "");
        Peer *p = new Peer(client, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        p->setAuthState(PEER_AUTHENTICATED);
        
        Character e("3", 3);
        int ret = p->teleportEntity(&e);
        assert(ret == 0);
        assert(stub_CommClient_sent_op.isValid());
        assert(stub_CommClient_sent_op->getArgs().size() == 1);
    }

    // Character (externl mind, unconnected)
    {
        TestCommClient client(server, "");
        Peer *p = new Peer(client, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        p->setAuthState(PEER_AUTHENTICATED);
        
        Character e("3", 3);
        e.m_externalMind = new ExternalMind(e);
        int ret = p->teleportEntity(&e);
        assert(ret == 0);
        assert(stub_CommClient_sent_op.isValid());
        assert(stub_CommClient_sent_op->getArgs().size() == 1);
    }

    // Character (externl mind, connected)
    {
        TestCommClient client(server, "");
        Peer *p = new Peer(client, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        p->setAuthState(PEER_AUTHENTICATED);
        
        Character e("3", 3);
        ExternalMind * mind = new ExternalMind(e);
        mind->linkUp((Link*)23);
        e.m_externalMind = mind;
        int ret = p->teleportEntity(&e);
        assert(ret == 0);
        assert(stub_CommClient_sent_op.isValid());
        assert(stub_CommClient_sent_op->getArgs().size() == 2);
    }

    // No arg
    {
        Peer *p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        Atlas::Objects::Operation::Info op;
        OpVector res;
         
        p->peerTeleportResponse(op, res);
    }

    // Empty arg, no refno
    {
        Peer *p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        Atlas::Objects::Operation::Info op;
        OpVector res;

        Atlas::Objects::Root arg;
        op->setArgs1(arg);
         
        p->peerTeleportResponse(op, res);
    }

    // Empty arg, made up refno, not CommPeer
    {
        TestCommClient *peerConn = new TestCommClient(*(CommServer*)0, "name");
        Peer *p = new Peer(*peerConn, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        Atlas::Objects::Operation::Info op;
        OpVector res;

        Atlas::Objects::Root arg;
        op->setArgs1(arg);
        op->setRefno(23);
         
        p->peerTeleportResponse(op, res);
    }

    // Empty arg, made up refno
    {
        CommPeer *peerConn = new CommPeer(*(CommServer*)0, "name");
        Peer *p = new Peer(*peerConn, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        Atlas::Objects::Operation::Info op;
        OpVector res;

        Atlas::Objects::Root arg;
        op->setArgs1(arg);
        op->setRefno(23);
         
        p->peerTeleportResponse(op, res);
    }

    // Empty arg, refno that matches earlier teleport, not in world
    {
        CommPeer *peerConn = new CommPeer(server, "name");
        Peer *p = new Peer(*peerConn, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        p->setAuthState(PEER_AUTHENTICATED);
        
        Entity e("23", 23);
        int ret = p->teleportEntity(&e);
        assert(ret == 0);

        Atlas::Objects::Operation::Info op;
        OpVector res;

        Atlas::Objects::Root arg;
        op->setArgs1(arg);
        op->setRefno(23);
         
        p->peerTeleportResponse(op, res);
    }

    // Empty arg, refno that matches earlier teleport, in world
    {
        CommPeer *peerConn = new CommPeer(server, "name");
        Peer *p = new Peer(*peerConn, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        p->setAuthState(PEER_AUTHENTICATED);
        
        Entity e("23", 23);
        int ret = p->teleportEntity(&e);
        assert(ret == 0);

        world.test_addEntity(&e, 23);

        Atlas::Objects::Operation::Info op;
        OpVector res;

        Atlas::Objects::Root arg;
        op->setArgs1(arg);
        op->setRefno(23);
         
        p->peerTeleportResponse(op, res);

        world.test_delEntity(23);
    }

    // Empty arg, refno that matches earlier teleport, with mind
    {
        CommPeer *peerConn = new CommPeer(server, "name");
        Peer *p = new Peer(*peerConn, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        p->setAuthState(PEER_AUTHENTICATED);
        
        Character e("23", 23);
        ExternalMind * mind = new ExternalMind(e);
        mind->linkUp((Link*)23);
        e.m_externalMind = mind;
        int ret = p->teleportEntity(&e);
        assert(ret == 0);

        world.test_addEntity(&e, 23);

        Atlas::Objects::Operation::Info op;
        OpVector res;

        Atlas::Objects::Root arg;
        op->setArgs1(arg);
        op->setRefno(23);
         
        p->peerTeleportResponse(op, res);

        world.test_delEntity(23);
    }

    // No teleports to clear
    {
        Peer *p = new Peer(*(CommSocket*)0, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        p->cleanTeleports();
    }

    // One teleport to clear
    {
        TestCommClient client(server, "");
        Peer *p = new Peer(client, *(ServerRouting*)0, "addr", 6767, "1", 1);
        
        p->setAuthState(PEER_AUTHENTICATED);
        
        Entity e("23", 23);
        int ret = p->teleportEntity(&e);
        assert(ret == 0);

        p->cleanTeleports();
    }

    return 0;
}
Ejemplo n.º 14
0
int main()
{
    CommServer comm_server;

    {
        new TestCommClient(comm_server);
    }

    {
        new TestCommClient(comm_server, 0);
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->test_setEncoder();

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->setup(0);

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->test_negotiate();

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->test_setConnection(new TestLink(*cs));

        cs->test_setNegotiateState(Atlas::Negotiate::SUCCEEDED);

        cs->test_negotiate();

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->test_setNegotiateState(Atlas::Negotiate::FAILED);

        cs->test_negotiate();

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->test_setConnectTime(0);
        cs->test_idle(0);

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->test_setConnection(new TestLink(*cs));

        cs->test_setNegotiateState(Atlas::Negotiate::SUCCEEDED);
        cs->test_negotiate();

        cs->test_setConnectTime(0);
        cs->test_idle(0);

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->test_setConnectTime(0);
        cs->test_idle(20);

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->read();

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->test_setEncoder();
        cs->read();

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        Atlas::Objects::Operation::RootOperation op;
        cs->send(op);

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->test_openSocket();

        Atlas::Objects::Operation::RootOperation op;
        cs->send(op);

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->test_openSocket();
        cs->test_setEncoder();

        Atlas::Objects::Operation::RootOperation op;
        cs->send(op);

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->test_setConnection(new TestLink(*cs));

        Atlas::Objects::Operation::RootOperation op;
        cs->test_operation(op);

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->test_setConnection(new TestLink(*cs, 1));

        Atlas::Objects::Operation::RootOperation op;
        cs->test_operation(op);

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->test_setConnection(new TestLink(*cs, 1));

        Atlas::Objects::Operation::RootOperation op;
        op->setSerialno(23);
        cs->test_operation(op);

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->test_setConnection(new TestLink(*cs, 1));

        cs->dispatch();

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        cs->test_setConnection(new TestLink(*cs, 1));

        cs->test_setupQueue();
        cs->dispatch();

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        Atlas::Objects::Entity::RootEntity ent;
        cs->test_objectArrived(ent);

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        Atlas::Objects::Entity::RootEntity ent;
        ent->setParents(std::list<std::string>());
        cs->test_objectArrived(ent);

        delete cs;
    }

    {
        TestCommClient * cs = new TestCommClient(comm_server);

        Atlas::Objects::Operation::RootOperation op;
        cs->test_objectArrived(op);

        delete cs;
    }

    return 0;
}
Ejemplo n.º 15
0
int CommClient::send(const Atlas::Objects::Operation::RootOperation & op)
{
    stub_connection_send_op = op->getClassNo();
    ++stub_connection_send_count;
    return 0;
}