Changeset View
Changeset View
Standalone View
Standalone View
tests/core-impl/collections/db/sql/TestSqlCollectionLocation.cpp
Show All 13 Lines | |||||
14 | * this program. If not, see <http://www.gnu.org/licenses/>. * | 14 | * this program. If not, see <http://www.gnu.org/licenses/>. * | ||
15 | ****************************************************************************************/ | 15 | ****************************************************************************************/ | ||
16 | 16 | | |||
17 | #include "TestSqlCollectionLocation.h" | 17 | #include "TestSqlCollectionLocation.h" | ||
18 | 18 | | |||
19 | #include "DatabaseUpdater.h" | 19 | #include "DatabaseUpdater.h" | ||
20 | #include "core/support/Debug.h" | 20 | #include "core/support/Debug.h" | ||
21 | #include "core/support/Components.h" | 21 | #include "core/support/Components.h" | ||
22 | #include "core-impl/logger/ProxyLogger.h" | | |||
23 | #include "DefaultSqlQueryMakerFactory.h" | 22 | #include "DefaultSqlQueryMakerFactory.h" | ||
24 | #include "core/meta/Meta.h" | 23 | #include "core/meta/Meta.h" | ||
25 | #include "core-impl/storage/sql/mysqlestorage/MySqlEmbeddedStorage.h" | 24 | #include "core-impl/storage/sql/mysqlestorage/MySqlEmbeddedStorage.h" | ||
26 | #include "SqlCollection.h" | 25 | #include "SqlCollection.h" | ||
27 | #include "SqlCollectionLocation.h" | 26 | #include "SqlCollectionLocation.h" | ||
28 | #include "SqlRegistry.h" | 27 | #include "SqlRegistry.h" | ||
29 | #include "SqlMountPointManagerMock.h" | 28 | #include "SqlMountPointManagerMock.h" | ||
30 | #include "core/collections/MockCollectionLocationDelegate.h" | 29 | #include "core/collections/MockCollectionLocationDelegate.h" | ||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 103 | { | |||
106 | char **argv = (char **) malloc(sizeof(char *)); | 105 | char **argv = (char **) malloc(sizeof(char *)); | ||
107 | argv[0] = strdup( QCoreApplication::applicationName().toLocal8Bit().data() ); | 106 | argv[0] = strdup( QCoreApplication::applicationName().toLocal8Bit().data() ); | ||
108 | ::testing::InitGoogleMock( &argc, argv ); | 107 | ::testing::InitGoogleMock( &argc, argv ); | ||
109 | } | 108 | } | ||
110 | 109 | | |||
111 | void | 110 | void | ||
112 | TestSqlCollectionLocation::initTestCase() | 111 | TestSqlCollectionLocation::initTestCase() | ||
113 | { | 112 | { | ||
114 | Amarok::Components::setLogger( new ProxyLogger() ); | | |||
115 | m_tmpDir = new QTemporaryDir(); | 113 | m_tmpDir = new QTemporaryDir(); | ||
116 | m_storage = QSharedPointer<MySqlEmbeddedStorage>( new MySqlEmbeddedStorage() ); | 114 | m_storage = QSharedPointer<MySqlEmbeddedStorage>( new MySqlEmbeddedStorage() ); | ||
117 | QVERIFY( m_storage->init( m_tmpDir->path() ) ); | 115 | QVERIFY( m_storage->init( m_tmpDir->path() ) ); | ||
118 | m_collection = new Collections::SqlCollection( m_storage ); | 116 | m_collection = new Collections::SqlCollection( m_storage ); | ||
119 | SqlMountPointManagerMock *mock = new SqlMountPointManagerMock( this, m_storage ); | 117 | SqlMountPointManagerMock *mock = new SqlMountPointManagerMock( this, m_storage ); | ||
120 | mock->setCollectionFolders( QStringList() << m_tmpDir->path() ); // the target folder needs to have enough space and be writable | 118 | mock->setCollectionFolders( QStringList() << m_tmpDir->path() ); // the target folder needs to have enough space and be writable | ||
121 | m_collection->setMountPointManager( mock ); | 119 | m_collection->setMountPointManager( mock ); | ||
122 | 120 | | |||
Show All 9 Lines | 122 | m_storage->query( QString( "CREATE TABLE playlist_tracks (" | |||
132 | ", length INTEGER " | 130 | ", length INTEGER " | ||
133 | ", uniqueid " + m_storage->textColumnType(128) + ") ENGINE = MyISAM;" ) ); | 131 | ", uniqueid " + m_storage->textColumnType(128) + ") ENGINE = MyISAM;" ) ); | ||
134 | } | 132 | } | ||
135 | 133 | | |||
136 | void | 134 | void | ||
137 | TestSqlCollectionLocation::cleanupTestCase() | 135 | TestSqlCollectionLocation::cleanupTestCase() | ||
138 | { | 136 | { | ||
139 | delete m_collection; | 137 | delete m_collection; | ||
140 | delete Amarok::Components::setLogger( 0 ); | | |||
141 | //m_storage is deleted by SqlCollection | 138 | //m_storage is deleted by SqlCollection | ||
142 | delete m_tmpDir; | 139 | delete m_tmpDir; | ||
143 | } | 140 | } | ||
144 | 141 | | |||
145 | void | 142 | void | ||
146 | TestSqlCollectionLocation::init() | 143 | TestSqlCollectionLocation::init() | ||
147 | { | 144 | { | ||
148 | //setup base data | 145 | //setup base data | ||
▲ Show 20 Lines • Show All 132 Lines • Show Last 20 Lines |