~ubuntu-branches/ubuntu/gutsy/soprano/gutsy

« back to all changes in this revision

Viewing changes to test/RedlandPersistentModelTest.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-10-12 14:43:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071012144348-yajzi51v4k23ahxf
Tags: 1.95.0~beta2-1ubuntu1
* Sync with Debian
* Add versioned build-dep on raptor

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include <soprano/soprano.h>
25
25
 
 
26
#include <QtCore/QFile>
 
27
 
26
28
using namespace Soprano;
27
29
 
28
 
void RedlandPersistentModelTest::initTestCase()
 
30
static int modelCnt = 0;
 
31
 
 
32
Soprano::Model* RedlandPersistentModelTest::createModel()
29
33
{
30
 
  Soprano::setUsedBackend( Soprano::discoverBackendByName( "redland" ) );
31
 
  m_model = Soprano::createModel( "persistent-model-test" );
32
 
  QVERIFY( m_model != 0 );
 
34
    const Backend* b = Soprano::discoverBackendByName( "redland" );
 
35
    if ( !b ) {
 
36
        return 0;
 
37
    }
 
38
 
 
39
 
 
40
    QList<BackendSetting> settings;
 
41
    settings.append( BackendSetting( "hash-type", "bdb" ) );
 
42
    settings.append( BackendSetting( "name", QString( "test%1" ).arg( ++modelCnt ) ) );
 
43
 
 
44
    Model* m = b->createModel( settings );
 
45
    if ( m ) {
 
46
        m_nameMap[m] = QString( "test%1" ).arg( modelCnt );
 
47
    }
 
48
    return m;
33
49
}
34
50
 
35
 
void RedlandPersistentModelTest::cleanupTestCase()
 
51
 
 
52
void RedlandPersistentModelTest::deleteModel( Soprano::Model* m )
36
53
{
37
 
  delete m_model;
 
54
    QString name = m_nameMap[m];
 
55
    delete m;
 
56
    QFile::remove( QString( "%1-po2s.db" ).arg( name ) );
 
57
    QFile::remove( QString( "%1-so2p.db" ).arg( name ) );
 
58
    QFile::remove( QString( "%1-sp2o.db" ).arg( name ) );
 
59
    QFile::remove( QString( "%1-contexts.db" ).arg( name ) );
38
60
}
39
61
 
40
62
QTEST_MAIN(RedlandPersistentModelTest)