Exemple #1
0
void SessionEntry::doubleClickAction()
{
    Group* parent = getGroup();
    if ( parent == NULL )
    {
        gravUtil::logWarning( "SessionEntry::doubleClick: entry not grouped? "
                "(invalid session setup)\n" );
        return;
    }

    Group* gParent = parent->getGroup();
    if ( gParent == NULL )
    {
        gravUtil::logWarning( "SessionEntry::doubleClick: parent not grouped? "
                "(invalid session setup)\n" );
        return;
    }

    SessionManager* manager = dynamic_cast<SessionManager*>( gParent );
    if ( manager == NULL )
    {
        gravUtil::logWarning( "SessionEntry::doubleClick: not member of one of "
                "session manager's groups? (invalid session setup)\n" );
        return;
    }

    manager->sessionEntryAction( this );
}
TEST_F(SessionManagerTest, CDFFailureTest)
{
  LocalStore* memstore = new LocalStore();
  SessionStore* store = new SessionStore(memstore);
  DummyErrorPeerMessageSenderFactory* factory = new DummyErrorPeerMessageSenderFactory(BILLING_REALM);
  MockChronosConnection* fake_chronos = new MockChronosConnection("http://localhost:1234");
  SessionManager* mgr = new SessionManager(store, _dict, factory, fake_chronos, _diameter_stack);
  SessionStore::Session* sess = NULL;

  Message* start_msg = new Message("CALL_ID_FOUR", ORIGINATING, SCSCF, NULL, Rf::AccountingRecordType(2), 300, FAKE_TRAIL_ID);
  Message* interim_msg = new Message("CALL_ID_FOUR", ORIGINATING, SCSCF, NULL, Rf::AccountingRecordType(3), 300, FAKE_TRAIL_ID);

  // When a START message fails, we should not store the session or handle any subsequent messages
  mgr->handle(start_msg);
  sess = store->get_session_data("CALL_ID_FOUR", ORIGINATING, SCSCF, FAKE_TRAIL_ID);
  ASSERT_EQ(NULL, sess);

  mgr->handle(interim_msg);
  sess = store->get_session_data("CALL_ID_FOUR", ORIGINATING, SCSCF, FAKE_TRAIL_ID);
  ASSERT_EQ(NULL, sess);

  delete mgr;
  delete factory;
  delete fake_chronos;
  delete store;
  delete memstore;
}
TEST_F(SessionManagerTest, CDFInterimUnknownTest)
{
  LocalStore* memstore = new LocalStore();
  SessionStore* store = new SessionStore(memstore);
  DummyPeerMessageSenderFactory* factory = new DummyPeerMessageSenderFactory(BILLING_REALM);
  MockChronosConnection* fake_chronos = new MockChronosConnection("http://localhost:1234");
  SessionManager* mgr = new SessionManager(store, _dict, factory, fake_chronos, _diameter_stack);
  DummyUnknownErrorPeerMessageSenderFactory* fail_factory = new DummyUnknownErrorPeerMessageSenderFactory(BILLING_REALM);
  SessionManager* fail_mgr = new SessionManager(store, _dict, fail_factory, fake_chronos, _diameter_stack);
  SessionStore::Session* sess = NULL;

  Message* start_msg = new Message("CALL_ID_FOUR", ORIGINATING, SCSCF, NULL, Rf::AccountingRecordType(2), 300, FAKE_TRAIL_ID);
  Message* interim_msg = new Message("CALL_ID_FOUR", ORIGINATING, SCSCF, NULL, Rf::AccountingRecordType(3), 300, FAKE_TRAIL_ID);

  mgr->handle(start_msg);
  sess = store->get_session_data("CALL_ID_FOUR", ORIGINATING, SCSCF, FAKE_TRAIL_ID);
  ASSERT_NE((SessionStore::Session*)NULL, sess);
  EXPECT_EQ(1u, sess->acct_record_number);
  delete sess;
  sess = NULL;

  // When an INTERIM message fails with a 5002 "Session unknown" error, we should delete the session
  fail_mgr->handle(interim_msg);
  sess = store->get_session_data("CALL_ID_FOUR", ORIGINATING, SCSCF, FAKE_TRAIL_ID);
  ASSERT_EQ(NULL, sess);

  delete mgr;
  delete factory;
  delete fail_mgr;
  delete fail_factory;
  delete fake_chronos;
  delete store;
  delete memstore;
}
Exemple #4
0
extern "C" void Disconnect(int worldId)
{
  SessionManager* pMgr = g_SessionManagers.Get(worldId);
  if (NULL != pMgr) {
    pMgr->SetSession(NULL);
  }
}
void ProfileList::favoriteChanged(Profile::Ptr info,bool isFavorite)
{
    SessionManager* manager = SessionManager::instance();

    if ( isFavorite )
    {
        QAction* action = new QAction(_group);
        action->setData( QVariant::fromValue(info) );

        if ( _addShortcuts )
        {
            action->setShortcut(manager->shortcut(info));
        }

        updateAction(action,info);

        foreach(QWidget* widget,_registeredWidgets)
            widget->addAction(action);
        emit actionsChanged(_group->actions());
    }
    else
    {
        QAction* action = actionForKey(info);

        if ( action )
        {
            _group->removeAction(action);
            foreach(QWidget* widget,_registeredWidgets)
                widget->removeAction(action);
            emit actionsChanged(_group->actions());
        }
    }

    updateEmptyAction();
}
ProfileList::ProfileList(bool addShortcuts , QObject* parent)
    : QObject(parent)
    , _addShortcuts(addShortcuts)
    , _emptyListAction(0)
{
    // construct the list of favorite profiles
    _group = new QActionGroup(this);

    // Even when there are no favorite profiles, allow user to
    // create new tabs using the default profile from the menu
    _emptyListAction = new QAction(i18n("Default profile"),_group);

    // TODO - Handle re-sorts when user changes profile names
    SessionManager* manager = SessionManager::instance();
    QList<Profile::Ptr> list = manager->sortedFavorites();

    QListIterator<Profile::Ptr> iter(list);

    while (iter.hasNext())
    {
        favoriteChanged(iter.next(), true);
    }

    connect( _group , SIGNAL(triggered(QAction*)) , this , SLOT(triggered(QAction*)) );


    // listen for future changes to the profiles
    connect( manager , SIGNAL(favoriteStatusChanged(Profile::Ptr,bool)) , this ,
             SLOT(favoriteChanged(Profile::Ptr,bool)) );
    connect( manager , SIGNAL(shortcutChanged(Profile::Ptr,QKeySequence)) , this , 
             SLOT(shortcutChanged(Profile::Ptr,QKeySequence)) );
    connect( manager , SIGNAL(profileChanged(Profile::Ptr)) , this , 
             SLOT(profileChanged(Profile::Ptr)) );
}
Exemple #7
0
bool ObjectHost::connect(
    HostedObjectPtr ho,
    const SpaceObjectReference& sporef, const SpaceID& space,
    const TimedMotionVector3f& loc,
    const TimedMotionQuaternion& orient,
    const BoundingSphere3f& bnds,
    const String& mesh,
    const String& phy,
    const String& query,
    const String& zernike,
    ConnectedCallback connected_cb,
    MigratedCallback migrated_cb,
    StreamCreatedCallback stream_created_cb,
    DisconnectedCallback disconnected_cb
)
{
    Sirikata::SerializationCheck::Scoped sc(&mSessionSerialization);
    if (mHostedObjects.find(sporef)!=mHostedObjects.end())
        return false;
    SessionManager *sm = mSessionManagers[space];

    String filtered_query = mQueryProcessor->connectRequest(ho, sporef, query);
    return sm->connect(
        sporef, loc, orient, bnds, mesh, phy, filtered_query, zernike,
        std::tr1::bind(&ObjectHost::wrappedConnectedCallback, this, HostedObjectWPtr(ho), _1, _2, _3, connected_cb),
        migrated_cb,
        std::tr1::bind(&ObjectHost::wrappedStreamCreatedCallback, this, HostedObjectWPtr(ho), _1, _2, stream_created_cb),
        std::tr1::bind(&ObjectHost::wrappedDisconnectedCallback, this, HostedObjectWPtr(ho), _1, _2, disconnected_cb)
    );
}
Exemple #8
0
int closeTxns(const int& start, const int& end) {

	int first=start;
	int last=end;
	int totalClosed=0;

	for (int idx=first; idx<last ; idx++)
	{
		try
		{
			SessionManager::TxnID tmp = manager->getTxnID(idx+1000);
			if (tmp.valid == true)
			{
				manager->committed(tmp);
				CPPUNIT_ASSERT(tmp.valid==false);
				totalClosed++;
			}
			
		}
		catch (exception& e)
		{
			cerr << e.what() << endl;
			continue;
		}
	}
	return totalClosed;

} //closeTxns
TEST_F(SessionManagerTest, NewCallTest)
{
  LocalStore* memstore = new LocalStore();
  SessionStore* store = new SessionStore(memstore);
  DummyPeerMessageSenderFactory* factory = new DummyPeerMessageSenderFactory(BILLING_REALM);
  MockChronosConnection* fake_chronos = new MockChronosConnection("http://localhost:1234");
  SessionManager* mgr = new SessionManager(store, _dict, factory, fake_chronos, _diameter_stack);
  SessionStore::Session* sess = NULL;

  Message* start_msg = new Message("CALL_ID_TWO", ORIGINATING, SCSCF, NULL, Rf::AccountingRecordType(2), 300, FAKE_TRAIL_ID);
  Message* stop_msg = new Message("CALL_ID_TWO", ORIGINATING, SCSCF, NULL, Rf::AccountingRecordType(4), 300, FAKE_TRAIL_ID);
  Message* start_msg_2 = new Message("CALL_ID_TWO", ORIGINATING, SCSCF, NULL, Rf::AccountingRecordType(2), 300, FAKE_TRAIL_ID);

  mgr->handle(start_msg);

  sess = store->get_session_data("CALL_ID_TWO", ORIGINATING, SCSCF, FAKE_TRAIL_ID);
  delete sess;
  mgr->handle(stop_msg);
  sess = store->get_session_data("CALL_ID_TWO", ORIGINATING, SCSCF, FAKE_TRAIL_ID);
  ASSERT_EQ(NULL, sess);

  mgr->handle(start_msg_2);

  // Re-using call-IDs should just work
  sess = store->get_session_data("CALL_ID_TWO", ORIGINATING, SCSCF, FAKE_TRAIL_ID);
  ASSERT_EQ(1u, sess->acct_record_number);
  delete sess;
  sess = NULL;

  delete mgr;
  delete factory;
  delete fake_chronos;
  delete store;
  delete memstore;
}
Exemple #10
0
	Sender(const unsigned char* data, string ia, tpport_t port, uint32 tstamp,
			uint16 count) :

		packetsPerSecond(10) {

		Facade* facade = Facade::getInstance();
		SessionManager* session = facade->createClientSession(ia, port,
				new RecordDevice, new PlaybackDevice,
				"/home/ivocalado/workspace/streamadapt/policies/instance1.xml",
				0);

		TransportSession* sender = session->getTSession();
		uint32 timestamp = tstamp ? tstamp : 0;
		//
		//
		//
		string s = sender->getSession()->retrievePluginInformation(
				"CurrentRTPClockRate");
		istringstream s1(s);
		uint16 tstampInc = 0;
		s1 >> tstampInc;
		tstampInc /= packetsPerSecond;
		uint32 period = 1000 / packetsPerSecond;
		TimerPort::setTimer(period);
		for (int i = 0; i < count; i++) {
			uint32 tmp = timestamp + i * tstampInc;
			sender->getSession()->sendData(tmp, data,
					strlen((char *) data) + 1, &b);
			Thread::sleep(TimerPort::getTimer());
			TimerPort::incTimer(period);
		}
		session->endSession();
	}
Exemple #11
0
void sessionmanager_5()
{
	SessionManager sm;
	int tmp = -1;

	tmp = sm.verID();
	// there's no "correct" value b/c it's monotonically increasing.
}
Exemple #12
0
extern "C" int IsConnected(int worldId)
{
  int ret = 0;
  SessionManager* pMgr = g_SessionManagers.Get(worldId);
  if (NULL != pMgr) {
    ret = (NULL != pMgr->GetSession() ? 1 : 0);
  }
  return ret;
}
Exemple #13
0
void SessionEntry::doubleClickAction()
{
    SessionManager* manager = getParentManager();

    if ( manager != NULL )
    {
        manager->sessionEntryAction( this );
    }
}
Exemple #14
0
extern "C" int TargetHandle(int worldId, const char* name)
{
  int handle = 0;
  if (NULL != name) {
    SessionManager* pMgr = g_SessionManagers.Get(worldId);
    if (NULL != pMgr) {
      handle = pMgr->TargetHandle(name);
    }
  }
  return handle;
}
Exemple #15
0
// Space API - Provide info for ObjectHost to communicate with spaces
void ObjectHost::addServerIDMap(const SpaceID& space_id, ServerIDMap* sidmap) {
    SessionManager* smgr = new SessionManager(
        mContext, space_id, sidmap,
        std::tr1::bind(&ObjectHost::handleObjectConnected, this, _1, _2),
        std::tr1::bind(&ObjectHost::handleObjectMigrated, this, _1, _2, _3),
        std::tr1::bind(&ObjectHost::handleObjectMessage, this, _1, space_id, _2),
        std::tr1::bind(&ObjectHost::handleObjectDisconnected, this, _1, _2)
    );
    mSessionManagers[space_id] = smgr;
    smgr->start();
}
Exemple #16
0
void ObjectHost::stop() {
    for(SpaceSessionManagerMap::iterator it = mSessionManagers.begin(); it != mSessionManagers.end(); it++) {
        SessionManager* sm = it->second;
        sm->stop();
    }

    for(InternalIDHostedObjectMap::const_iterator it = mHostedObjectsByID.begin(); it != mHostedObjectsByID.end(); it++) {
        HostedObjectPtr ho = it->second.lock();
        if (ho) ho->stop();
    }
}
Exemple #17
0
	void sessionManager_4()
	{
		char *buf;
		int len;
		SessionManager sm;

		buf = sm.getShmContents(len);
		CPPUNIT_ASSERT(len > 0);
		CPPUNIT_ASSERT(buf != NULL);
		delete [] buf;
	}
void AllProjectsFilter::refreshInternally()
{
    m_files.clear();
    SessionManager *session = m_projectExplorer->session();
    if (!session)
        return;
    foreach (Project *project, session->projects())
        m_files += project->files(Project::AllFiles);
    qSort(m_files);
    generateFileNames();
}
TEST_F(SessionManagerTest, TimerIDTest)
{
  LocalStore* memstore = new LocalStore();
  SessionStore* store = new SessionStore(memstore);
  DummyPeerMessageSenderFactory* factory = new DummyPeerMessageSenderFactory(BILLING_REALM);
  MockChronosConnection* fake_chronos = new MockChronosConnection("http://localhost:1234");
  SessionManager* mgr = new SessionManager(store, _dict, factory, fake_chronos, _diameter_stack);
  SessionStore::Session* sess = NULL;

  Message* start_msg = new Message("CALL_ID_ONE", ORIGINATING, SCSCF, NULL, Rf::AccountingRecordType(2), 300, FAKE_TRAIL_ID);
  start_msg->ccfs.push_back("10.0.0.1");
  Message* interim_msg = new Message("CALL_ID_ONE", ORIGINATING, SCSCF, NULL, Rf::AccountingRecordType(3), 0, FAKE_TRAIL_ID);
  Message* stop_msg = new Message("CALL_ID_ONE", ORIGINATING, SCSCF, NULL, Rf::AccountingRecordType(4), 0, FAKE_TRAIL_ID);

  // START should put a session in the store
  mgr->handle(start_msg);

  sess = store->get_session_data("CALL_ID_ONE", ORIGINATING, SCSCF, FAKE_TRAIL_ID);
  ASSERT_NE((SessionStore::Session*)NULL, sess);
  EXPECT_EQ(1u, sess->acct_record_number);

  // Change the stored timer - this means that the chronos PUT will return a
  // clashing timer, triggering the session manager to update the stored timer ID
  sess->timer_id = "NEW_TIMER";
  store->set_session_data("CALL_ID_ONE", ORIGINATING, SCSCF, sess, FAKE_TRAIL_ID);

  delete sess;
  sess = NULL;

  // INTERIM should keep that session in the store
  mgr->handle(interim_msg);

  sess = store->get_session_data("CALL_ID_ONE", ORIGINATING, SCSCF, FAKE_TRAIL_ID);
  ASSERT_NE((SessionStore::Session*)NULL, sess);
  EXPECT_EQ(2u, sess->acct_record_number);

  // The timer id should have been updated to match the id returned from the PUT.
  EXPECT_EQ("TIMER_ID", sess->timer_id);

  delete sess;
  sess = NULL;

  // STOP should remove the session from the store
  mgr->handle(stop_msg);

  sess = store->get_session_data("CALL_ID_ONE", ORIGINATING, SCSCF, FAKE_TRAIL_ID);
  ASSERT_EQ(NULL, sess);

  delete mgr;
  delete factory;
  delete fake_chronos;
  delete store;
  delete memstore;
}
Exemple #20
0
extern "C" int SendCommandByName(int worldId, const char* name, const char* command)
{
  int ret = 0;
  if (NULL != name && NULL != command) {
    SessionManager* pMgr = g_SessionManagers.Get(worldId);
    if (NULL != pMgr) {
      int dest = pMgr->TargetHandle(name);
      ret = SendCommandByHandle(worldId, dest, command);
    }
  }
  return ret;
}
Exemple #21
0
void ChatTests::init()
{
    /* User #1. */

    SessionManager *sessionManager = SessionManager::getInstance();
    QSignalSpy spy(sessionManager,
                   SIGNAL(loginCompleted(QSharedPointer<Session>, bool, QString)));
    QVERIFY(spy.isValid());
    QVERIFY(spy.isEmpty());

    QSharedPointer<const LoginUser> u(new LoginUser(TEMP_SESSION_USER3,
                                      WORKING_DIR "public.pem", WORKING_DIR "private.pem"));
    sessionManager->login(SERVER_URL, CA_CERT, u, "password");

    waitForResult(spy);
    QCOMPARE(spy.count(), 1);
    QList<QVariant> arguments = spy.takeFirst();
    QVERIFY2(arguments.at(1) == true, arguments.at(2).toString().toStdString().c_str());

    session = arguments.at(0).value<QSharedPointer<Session> >();

    QSignalSpy spy2(session.data(), SIGNAL(initChatCompleted(QSharedPointer<Chat>, bool,
                                           QString)));
    QVERIFY(spy2.isValid());
    QVERIFY(spy2.isEmpty());

    session->initChat();
    waitForResult(spy2);

    QCOMPARE(spy2.count(), 1);
    QList<QVariant> arguments2 = spy2.takeFirst();
    QVERIFY2(arguments2.at(1) == true, arguments2.at(2).toString().toStdString().c_str());

    chat = arguments2.at(0).value<QSharedPointer<Chat> >();

    /* User #2. */

    QSignalSpy spy3(sessionManager,
                    SIGNAL(loginCompleted(QSharedPointer<Session>, bool, QString)));
    QVERIFY(spy3.isValid());
    QVERIFY(spy3.isEmpty());

    QSharedPointer<const LoginUser> u2(new LoginUser(TEMP_SESSION_USER2,
                                       WORKING_DIR "public.pem", WORKING_DIR "private.pem"));
    sessionManager->login(SERVER_URL, CA_CERT, u2, "password");

    waitForResult(spy3);
    QCOMPARE(spy3.count(), 1);
    QList<QVariant> arguments3 = spy3.takeFirst();
    QVERIFY2(arguments3.at(1) == true, arguments3.at(2).toString().toStdString().c_str());

    session2 = arguments3.at(0).value<QSharedPointer<Session> >();
}
Exemple #22
0
extern "C" int SendByName(int worldId, const char* name, const void* data, int len)
{
  int ret = 0;
  if (NULL != name && NULL != data) {
    SessionManager* pMgr = g_SessionManagers.Get(worldId);
    if (NULL != pMgr) {
      int dest = pMgr->TargetHandle(name);
      ret = SendByHandle(worldId, dest, data, len);
    }
  }
  return ret;
}
Exemple #23
0
extern "C" void Tick(void)
{
  if (NULL != g_pNetIoService && NULL != g_EventBase) {
    g_pNetIoService->Poll();
    for (SessionManagers::Iterator it = g_SessionManagers.First(); !it.IsNull(); ++it) {
      SessionManager* pMgr = it->GetValue();
      if (NULL != pMgr) {
        pMgr->Tick();
      }
    }
  }
}
Exemple #24
0
CalpontSelectExecutionPlan* parseQuery(const string& query, const uint32_t sid)
{
	//We're going to make parsing the query single-threaded for now. This makes it a lot
	// easier to interface with the parser and doesn;t materially affect overall query
	// performance (I think)
	mutex::scoped_lock lk(ParserMutex);

	boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sid);
	CalpontSelectExecutionPlan* csep=0;
	csep = new CalpontSelectExecutionPlan();
	//we use an auto_ptr here with some trepidation. We only want auto delete on an execption.
	//If the parseing and plan build succeed, we want the ptr to stay around. boost::scoped_ptr<>
	//doesn't have an API to release ownership, so we use auto_ptr...
	auto_ptr<CalpontSelectExecutionPlan> scsep(csep);

	yy_buffer_state* ybs=0;
	ybs = qfe_scan_string(query.c_str());
	if (ybs != 0)
	{
		ParserCSEP = csep;
		ParserCSC = csc;
		if (qfeparse() != 0)
			throw runtime_error("syntax error");
		qfe_delete_buffer(ybs);
	}
	else
		throw runtime_error("Internal parser memory error");

	csep->data(query);

        SessionManager sm;
        TxnID txnID;
        txnID = sm.getTxnID(sid);
        if (!txnID.valid)
        {
            txnID.id = 0;
            txnID.valid = true;
        }
        QueryContext verID;
        verID = sm.verID();

	csep->txnID(txnID.id);
	csep->verID(verID);
	csep->sessionID(sid);

	//cout << *csep << endl;
	scsep.release();
	return csep;
}
Exemple #25
0
// Space API - Provide info for ObjectHost to communicate with spaces
void ObjectHost::addServerIDMap(const SpaceID& space_id, ServerIDMap* sidmap) {
    SessionManager* smgr = new SessionManager(
        mContext, space_id, sidmap,
        std::tr1::bind(&ObjectHost::handleObjectConnected, this, _1, _2),
        std::tr1::bind(&ObjectHost::handleObjectMigrated, this, _1, _2, _3),
        std::tr1::bind(&ObjectHost::handleObjectMessage, this, _1, space_id, _2),
        std::tr1::bind(&ObjectHost::handleObjectDisconnected, this, _1, _2)
    );
    smgr->registerDefaultOHDPHandler(
        std::tr1::bind(&ObjectHost::handleDefaultOHDPMessageHandler, this, _1, _2, _3)
    );
    smgr->addListener(static_cast<SpaceNodeSessionListener*>(this));
    mSessionManagers[space_id] = smgr;
    smgr->start();
}
Exemple #26
0
extern "C" int TargetName(int worldId, int handle, char* buf, int len)
{
  int ret = 0;
  if (NULL != buf) {
    SessionManager* pMgr = g_SessionManagers.Get(worldId);
    if (NULL != pMgr) {
      const char* name = pMgr->TargetName(handle);
      if (NULL != name) {
        tsnprintf(buf, len, "%s", name);
        ret = 1;
      }
    }
  }
  return ret;
}
TEST_F(SessionManagerTest, CDFInterimFailureWithTimerIdChangeTest)
{
  LocalStore* memstore = new LocalStore();
  SessionStore* store = new SessionStore(memstore);
  DummyPeerMessageSenderFactory* factory = new DummyPeerMessageSenderFactory(BILLING_REALM);
  MockChronosConnection* fake_chronos = new MockChronosConnection("http://localhost:1234");
  SessionManager* mgr = new SessionManager(store, _dict, factory, fake_chronos, _diameter_stack);
  DummyErrorPeerMessageSenderFactory* fail_factory = new DummyErrorPeerMessageSenderFactory(BILLING_REALM);
  SessionManager* fail_mgr = new SessionManager(store, _dict, fail_factory, fake_chronos, _diameter_stack);
  SessionStore::Session* sess = NULL;

  Message* start_msg = new Message("CALL_ID_FOUR", ORIGINATING, SCSCF, NULL, Rf::AccountingRecordType(2), 300, FAKE_TRAIL_ID);
  Message* interim_msg = new Message("CALL_ID_FOUR", ORIGINATING, SCSCF, NULL, Rf::AccountingRecordType(3), 300, FAKE_TRAIL_ID);

  mgr->handle(start_msg);
  sess = store->get_session_data("CALL_ID_FOUR", ORIGINATING, SCSCF, FAKE_TRAIL_ID);

  ASSERT_NE((SessionStore::Session*)NULL, sess);
  EXPECT_EQ(1u, sess->acct_record_number);

  // Change the stored timer - this means that the chronos PUT will return a
  // clashing timer, triggering the session manager to update the stored timer ID
  sess->timer_id = "NEW_TIMER";
  store->set_session_data("CALL_ID_FOUR", ORIGINATING, SCSCF, sess, FAKE_TRAIL_ID);

  delete sess;
  sess = NULL;

  // When an INTERIM message fails with an error other than 5002 "Session unknown", we should still keep the session
  fail_mgr->handle(interim_msg);
  sess = store->get_session_data("CALL_ID_FOUR", ORIGINATING, SCSCF, FAKE_TRAIL_ID);
  ASSERT_NE((SessionStore::Session*)NULL, sess);
  EXPECT_EQ(2u, sess->acct_record_number);

  // The timer id should have been updated to match the id returned from the PUT.
  EXPECT_EQ("TIMER_ID", sess->timer_id);

  delete sess;
  sess = NULL;

  delete mgr;
  delete factory;
  delete fail_mgr;
  delete fail_factory;
  delete fake_chronos;
  delete store;
  delete memstore;
}
Core::IFile *ProjectFileFactory::open(const QString &fileName)
{
    Core::IFile *fIFace = 0;

    ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
    if (!pe->openProject(fileName)) {
        Core::ICore::instance()->messageManager()->printToOutputPane(tr("Could not open the following project: '%1'").arg(fileName));
    } else if (pe->session()) {
        SessionManager *session = pe->session();
        if (session->projects().count() == 1)
            fIFace = session->projects().first()->file();
        else if (session->projects().count() > 1)
            fIFace = session->file();  // TODO: Why return session file interface here ???
    }
    return fIFace;
}
Exemple #29
0
static void registerUser(const QString &user)
{
    SessionManager *sessionManager = SessionManager::getInstance();
    QSignalSpy spy(sessionManager, SIGNAL(registerCompleted(bool, const QString &)));
    QVERIFY(spy.isValid());
    QVERIFY(spy.isEmpty());

    QSharedPointer<const User> u(new User(user, WORKING_DIR "public.pem"));
    sessionManager->registerUser(SERVER_URL, CA_CERT, u, "password");

    waitForResult(spy);

    QCOMPARE(spy.count(), 1);

    /* Don't check results - we don't delete this user, so it will fail. */
}
Exemple #30
0
void VideoSource::doubleClickAction()
{
    if ( altAddress.compare( "" ) != 0 )
    {
        SessionManager* manager = session->getParentManager();
        if ( manager )
        {
            manager->rotateTo( altAddress, false );
        }
    }
    else
    {
        gravUtil::logVerbose( "VideoSource::doubleClickAction(): no alternate "
                              "address to connect to\n" );
    }
}