Source code formating unification
[framework/web/wrt-commons.git] / tests / dpl / db / test_sql_connection.cpp
index 246e77d..0cee018 100644 (file)
@@ -35,16 +35,16 @@ RUNNER_TEST_GROUP_INIT(DPL)
 
 class AbstractSynchronizationObjectGenerator
 {
-public:
+  public:
     virtual ~AbstractSynchronizationObjectGenerator() {}
 
     virtual DPL::DB::SqlConnection::SynchronizationObject *Create() = 0;
 };
 
-class NaiveSynchronizationObjectGenerator
-    public AbstractSynchronizationObjectGenerator
+class NaiveSynchronizationObjectGenerator :
+    public AbstractSynchronizationObjectGenerator
 {
-public:
+  public:
     virtual DPL::DB::SqlConnection::SynchronizationObject *Create()
     {
         return new DPL::DB::NaiveSynchronizationObject();
@@ -53,15 +53,15 @@ public:
 
 void MassiveReadWriteTest(AbstractSynchronizationObjectGenerator *generator);
 
-class StressGenerator
-    public DPL::Thread
+class StressGenerator :
+    public DPL::Thread
 {
-private:
+  private:
     size_t m_prefix;
     std::string m_dbFileName;
     AbstractSynchronizationObjectGenerator *m_generator;
 
-protected:
+  protected:
     virtual int ThreadEntry()
     {
         DPL::DB::SqlConnection connection(
@@ -74,8 +74,7 @@ protected:
             connection.PrepareDataCommand(
                 "SELECT COUNT(*) FROM test WHERE value=?");
 
-        for (size_t i = 0; i < 10; ++i)
-        {
+        for (size_t i = 0; i < 10; ++i) {
             std::ostringstream valueStream;
 
             valueStream << "value_";
@@ -103,15 +102,14 @@ protected:
         return 0;
     }
 
-public:
+  public:
     StressGenerator(size_t prefix,
                     const std::string &dbFileName,
-                    AbstractSynchronizationObjectGenerator *generator)
-        : m_prefix(prefix),
-          m_dbFileName(dbFileName),
-          m_generator(generator)
-    {
-    }
+                    AbstractSynchronizationObjectGenerator *generator) :
+        m_prefix(prefix),
+        m_dbFileName(dbFileName),
+        m_generator(generator)
+    {}
 };
 
 typedef std::shared_ptr<DPL::Thread> ThreadPtr;
@@ -127,16 +125,16 @@ void MassiveReadWriteTest(AbstractSynchronizationObjectGenerator *generator)
     const size_t STRESS_GENERATOR_COUNT = 5;
     ThreadPtr stressGenerators[STRESS_GENERATOR_COUNT];
 
-    for (size_t i = 0; i < STRESS_GENERATOR_COUNT; ++i)
-    {
+    for (size_t i = 0; i < STRESS_GENERATOR_COUNT; ++i) {
         stressGenerators[i].reset(
             new StressGenerator(i, PATH_DB, generator));
 
         stressGenerators[i]->Run();
     }
 
-    for (size_t i = 0; i < STRESS_GENERATOR_COUNT; ++i)
+    for (size_t i = 0; i < STRESS_GENERATOR_COUNT; ++i) {
         stressGenerators[i]->Quit();
+    }
 
     connection.ExecCommand("DROP TABLE test;");
 }
@@ -149,27 +147,22 @@ RUNNER_TEST(SqlConnection_MassiveReadWrite_NaiveSynchronization)
     MassiveReadWriteTest(&m_generator);
 }
 
-
-
-
-
-
 RUNNER_TEST(SqlConnection_Not_Connected_Lucene)
 {
     Try {
-        DPL::DB::SqlConnection connection("/notexisitingdirectiory/foo",
-                                          DPL::DB::SqlConnection::Flag::UseLucene,
-                                          DPL::DB::SqlConnection::Flag::RW);
+        DPL::DB::SqlConnection connection(
+            "/notexisitingdirectiory/foo",
+            DPL::DB::SqlConnection::Flag::
+                UseLucene,
+            DPL::DB::SqlConnection::Flag::RW);
         RUNNER_ASSERT_MSG(false,
                           "connection should throw on accessing "
                           "nonexistent file as a database");
     }
-    Catch (DPL::DB::SqlConnection::Exception::ConnectionBroken)
+    Catch(DPL::DB::SqlConnection::Exception::ConnectionBroken)
     {
         RUNNER_ASSERT(true);
-    }
-    catch (DPL::Exception)
-    {
+    } catch (DPL::Exception) {
         RUNNER_ASSERT_MSG(false, "Wrong exception found");
     }
 }
@@ -184,12 +177,10 @@ RUNNER_TEST(SqlConnection_Not_Connected)
                           "connection should throw on accessing "
                           "nonexistent file as a database");
     }
-    Catch (DPL::DB::SqlConnection::Exception::ConnectionBroken)
+    Catch(DPL::DB::SqlConnection::Exception::ConnectionBroken)
     {
         RUNNER_ASSERT(true);
-    }
-    catch (DPL::Exception)
-    {
+    } catch (DPL::Exception) {
         RUNNER_ASSERT_MSG(false, "Wrong exception found");
     }
 }
@@ -205,15 +196,12 @@ RUNNER_TEST(SqlConnection_Null_Query)
         RUNNER_ASSERT_MSG(false,
                           "Null pointer should not be accepted");
     }
-    Catch (DPL::DB::SqlConnection::Exception::SyntaxError)
+    Catch(DPL::DB::SqlConnection::Exception::SyntaxError)
     {
         RUNNER_ASSERT(true);
-    }
-    catch (DPL::Exception)
-    {
+    } catch (DPL::Exception) {
         RUNNER_ASSERT_MSG(false, "Wrong exception found");
     }
-
 }
 
 RUNNER_TEST(SqlConnection_Bad_Query)
@@ -226,12 +214,10 @@ RUNNER_TEST(SqlConnection_Bad_Query)
         connection.ExecCommand("Some stupid string");
         RUNNER_ASSERT_MSG(false, "This string should not be accepted");
     }
-    Catch (DPL::DB::SqlConnection::Exception::SyntaxError)
+    Catch(DPL::DB::SqlConnection::Exception::SyntaxError)
     {
         RUNNER_ASSERT(true);
-    }
-    catch (DPL::Exception)
-    {
+    } catch (DPL::Exception) {
         RUNNER_ASSERT_MSG(false, "Wrong exception found");
     }
 }