contentstorage/castorage/tsrc/t_castorage/src/castoragetestbackup.cpp
changeset 117 c63ee96dbe5f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/castorage/tsrc/t_castorage/src/castoragetestbackup.cpp	Thu Sep 16 12:11:40 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+/*
+ * castoragetestgetparentids.cpp
+ *
+ *  Created on: 2009-09-14
+ *      Author: michal.czerwiec
+ */
+
+#include "castoragetest.h"
+#include "castoragefactory.h"
+#include "castorage.h"
+#include "cainnerentry.h"
+#include "casqlquery.h"
+#include "casqlitestorage.h"
+#include "castoragetestsqlcommands.h"
+#include "casqlcommands.h"
+
+
+
+void CCAStorageTest::testSaveRestoreDatabase()
+{
+    
+    TBool result = EFalse; 
+    TRAPD(err,
+    	    RFs fs;
+    	    User::LeaveIfError(fs.Connect());
+    	    
+    	    CCaSqLiteStorage *storage = dynamic_cast<CCaSqLiteStorage *>(mStorage);
+    		if( BaflUtils::FileExists( fs, storage->iPrivatePathCDriveDbBackup) )
+    			{
+    		    BaflUtils::DeleteFile(fs, storage->iPrivatePathCDriveDbBackup);    		    
+    			}
+    		
+    		mStorage->SaveDatabaseL();
+    		
+    		mStorage->RestoreDatabaseL();
+    		
+
+    		if( BaflUtils::FileExists( fs, storage->iPrivatePathCDriveDbBackup) )
+    			{
+    		    result = ETrue;
+    		    BaflUtils::DeleteFile(fs, storage->iPrivatePathCDriveDbBackup);    		    
+    			}
+            fs.Close();
+     );
+
+    QCOMPARE(err, KErrNone);
+    QVERIFY(result);
+}
+
+