Пример #1
0
/*
 * Sets the name of a universe
 */
void OlaServerServiceImpl::SetUniverseName(
    RpcController* controller,
    const UniverseNameRequest* request,
    Ack*,
    google::protobuf::Closure* done) {
  ClosureRunner runner(done);
  Universe *universe = m_universe_store->GetUniverse(request->universe());
  if (!universe)
    return MissingUniverseError(controller);

  universe->SetName(request->name());
}
Пример #2
0
/*
 * Sets the name of a universe
 */
void OlaServerServiceImpl::SetUniverseName(
    RpcController* controller,
    const UniverseNameRequest* request,
    Ack*,
    ola::rpc::RpcService::CompletionCallback* done) {
  ClosureRunner runner(done);
  Universe *universe = m_universe_store->GetUniverse(request->universe());
  if (!universe)
    return MissingUniverseError(controller);

  universe->SetName(request->name());
}
Пример #3
0
/*
 * Test that we can create universes and save their settings
 */
void UniverseTest::testLifecycle() {
  Universe *universe = m_store->GetUniverse(TEST_UNIVERSE);
  OLA_ASSERT_FALSE(universe);

  universe = m_store->GetUniverseOrCreate(TEST_UNIVERSE);
  OLA_ASSERT(universe);
  OLA_ASSERT_EQ(TEST_UNIVERSE, universe->UniverseId());
  OLA_ASSERT_EQ((unsigned int) 1, m_store->UniverseCount());
  OLA_ASSERT_EQ(Universe::MERGE_LTP, universe->MergeMode());
  OLA_ASSERT_FALSE(universe->IsActive());

  string universe_name = "New Name";
  universe->SetName(universe_name);
  universe->SetMergeMode(Universe::MERGE_HTP);

  OLA_ASSERT_EQ(universe_name, universe->Name());
  OLA_ASSERT_EQ(Universe::MERGE_HTP, universe->MergeMode());

  // delete it
  m_store->AddUniverseGarbageCollection(universe);
  m_store->GarbageCollectUniverses();
  OLA_ASSERT_EQ((unsigned int) 0, m_store->UniverseCount());
  universe = m_store->GetUniverse(TEST_UNIVERSE);
  OLA_ASSERT_FALSE(universe);

  // now re-create it
  universe = m_store->GetUniverseOrCreate(TEST_UNIVERSE);
  OLA_ASSERT(universe);
  OLA_ASSERT_EQ((unsigned int) 1, m_store->UniverseCount());
  OLA_ASSERT_EQ(TEST_UNIVERSE, universe->UniverseId());
  OLA_ASSERT_EQ(universe_name, universe->Name());
  OLA_ASSERT_EQ(Universe::MERGE_HTP, universe->MergeMode());

  m_store->DeleteAll();
  OLA_ASSERT_EQ((unsigned int) 0, m_store->UniverseCount());
}