コード例 #1
0
/**
@SYMTestCaseID          SYSLIB-STORE-CT-1197
@SYMTestCaseDesc	    Reading from a file buffer test
@SYMTestPriority 	    High
@SYMTestActions  	    Tests for reading from root and temporary store.
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void testReadL()
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1197 Opening host file "));
	TParsePtrC parse(KFileLocationSpec);
	
	CFileStore* file=CFileStore::OpenLC(TheFs,parse.NameAndExt(),EFileRead);
//
	test.Next(_L("Reading from root store"));
	TStreamId root=file->Root();
	
	RStoreReadStream stream;
	stream.OpenLC(*file,root);
	TBuf8<5> b;
	stream.ReadL(b);
	test(b==_L8(" root"));
	CleanupStack::Pop(&stream);
	CEmbeddedStore* store=CEmbeddedStore::FromL(stream);
	CleanupStack::PushL(store);
	testReadL(*store);
	CleanupStack::PopAndDestroy(store);
	
	stream.OpenLC(*file,root);
	stream.ReadL(b);
	test(b==_L8(" root"));
	CleanupStack::Pop(&stream);
	store=CEmbeddedStore::FromLC(stream);
	testReadL(*store);
	CleanupStack::PopAndDestroy();
//
	test.Next(_L("Reading from temp store"));
	stream.OpenLC(*file,TheTempId);
	stream.ReadL(b);
	test(b==_L8(" temp"));
	CleanupStack::Pop();
	store=CEmbeddedStore::FromLC(stream);
	testReadL(*store);
//
	CleanupStack::PopAndDestroy(2);
	}
コード例 #2
0
/**
@SYMTestCaseID          SYSLIB-STORE-CT-1151
@SYMTestCaseDesc	    Copying to a single file store test.
@SYMTestPriority 	    High
@SYMTestActions  	    Test for copying using different buffer sizes
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void testCopyL()
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1151 Copying using small transfers "));
	TParsePtrC parse(KFileLocationSpec);
	
	CFileStore* store=CFileStore::OpenLC(TheFs,parse.NameAndExt(),EFileRead|EFileWrite);
	RStoreReadStream in;
	in.OpenLC(*store,store->Root());
	in>>TheBuf;
	TStreamId copyId;
	in>>copyId;
	in.Close();
	in.OpenL(*store,copyId);
	RStoreWriteStream out;
	TStreamId id=out.CreateLC(*store);
	testCopyL(out,in);
	out.CommitL();
	out.Close();
	in.Close();
	in.OpenL(*store,id);
	testReadL(in);
	in.Close();
//
	test.Next(_L("Copying using a single big transfer"));
	in.OpenL(*store,copyId);
	id=out.CreateL(*store);
	in.ReadL(out,KTestTotal);
	out.CommitL();
	out.Close();
	in.Close();
	in.OpenL(*store,id);
	testReadL(in);
	in.Close();
	in.OpenL(*store,copyId);
	id=out.CreateL(*store);
	out.WriteL(in,KTestTotal);
	out.CommitL();
	out.Close();
	in.Close();
	in.OpenL(*store,id);
	testReadL(in);
//
	CleanupStack::PopAndDestroy(3);
	}
コード例 #3
0
/**
@SYMTestCaseID          SYSLIB-STORE-CT-1130
@SYMTestCaseDesc	    Tests copying from one stream to another stream
@SYMTestPriority 	    High
@SYMTestActions  	    Attempt for copying using different transfer sizes
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void testCopyL()
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1130 Opening host file "));
	
	TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive()));	
	TParse parse;
	parse.Set(drive.Name(), &KFileLocationSpec, NULL);
	
	CFileStore* file=CFileStore::OpenLC(TheFs,parse.NameAndExt(),EFileRead|EFileWrite);
//
	test.Next(_L("Opening source (root) store"));
	TStreamId root=file->Root();
	RStoreReadStream src;
	src.OpenLC(*file,root);
	RDecryptStream decrypt;
	decrypt.OpenLC(src,*thePBEKey);

	TBuf8<5> b;
	TStreamId embed;
	decrypt>>b>>embed;
	test(b==_L8(" root"));
	CleanupStack::PopAndDestroy(2); // src, decrypt
	src.OpenL(*file,embed);
	CEmbeddedStore* source=CEmbeddedStore::FromLC(src);
	CSecureStore* ssource=NULL;
	ssource=CSecureStore::NewLC(*source,*thePBEKey);

	test.Next(_L("Creating target store"));
	RStoreWriteStream trg;
	trg.CreateL(*file);
	CEmbeddedStore* target=CEmbeddedStore::NewLC(trg);
	CSecureStore* starget=NULL;
	starget=CSecureStore::NewLC(*target,*thePBEKey);

	test.Next(_L("Copying using small transfers"));
	RStoreReadStream in;
	in.OpenL(*ssource,source->Root());
	in>>TheBuf;
	TStreamId copyId;
	in>>copyId;
	in.Close();
	in.OpenL(*ssource,copyId);
	RStoreWriteStream out;
	TStreamId id=out.CreateL(*starget);
	testCopyL(out,in);
	out.CommitL();
	out.Close();
	in.Close();
	in.OpenL(*starget,id);
	testReadL(in);
	in.Close();
//
	test.Next(_L("Copying using a single big transfer"));
	in.OpenL(*ssource,copyId);
	id=out.CreateL(*starget);
	in.ReadL(out,KTestTotal);
	out.CommitL();
	out.Close();
	in.Close();
	in.OpenL(*starget,id);
	testReadL(in);
	in.Close();
	in.OpenL(*ssource,copyId);
	id=out.CreateL(*starget);
	out.WriteL(in,KTestTotal);
	out.CommitL();
	out.Close();
	in.Close();
	in.OpenL(*starget,id);
	testReadL(in);
	in.Close();
//
	CleanupStack::PopAndDestroy(5);
	}
コード例 #4
0
/**
@SYMTestCaseID          SYSLIB-STORE-CT-1198
@SYMTestCaseDesc	    Copying in a single file store test.
@SYMTestPriority 	    High
@SYMTestActions  	    Tests for copying using different buffer sizes
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void testCopyL()
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1198 Opening host file "));
	TParsePtrC parse(KFileLocationSpec);
	
	CFileStore* file=CFileStore::OpenLC(TheFs,parse.NameAndExt(),EFileRead|EFileWrite);
//
	test.Next(_L("Opening source (root) store"));
	TStreamId root=file->Root();
	RStoreReadStream src;
	src.OpenLC(*file,root);
	TBuf8<5> b;
	src.ReadL(b);
	test(b==_L8(" root"));
	CleanupStack::Pop();
	CEmbeddedStore* source=CEmbeddedStore::FromLC(src);
//
	test.Next(_L("Duplicating source store"));
	RStoreWriteStream trg;
	trg.CreateLC(*file);
	MStreamBuf* host=source->Host();
	TStreamPos pos=CEmbeddedStore::Position(source->Root());
	host->SeekL(host->ERead,EStreamBeginning);
	RReadStream stream(host);
	trg.WriteL(stream,pos.Offset());
	stream>>TheBuf;
	TStreamId id;
	stream>>id;
	test(host->TellL(host->ERead).Offset()==host->SizeL());
	trg<<TheBuf;
	trg<<id;
	trg.CommitL();
	source->Detach();
	host->Release();
	source->Reattach(trg.Sink());
	CleanupStack::Pop();
	testReadL(*source);
//
	test.Next(_L("Creating target store"));
	trg.CreateLC(*file);
	trg.WriteL(_L8(" target"));
	CleanupStack::Pop();
	CEmbeddedStore* target=CEmbeddedStore::NewLC(trg);
//
	test.Next(_L("Copying using small transfers"));
	RStoreReadStream in;
	in.OpenL(*source,source->Root());
	in>>TheBuf;
	TStreamId copyId;
	in>>copyId;
	in.Close();
	in.OpenL(*source,copyId);
	RStoreWriteStream out;
	id=out.CreateL(*target);
	testCopyL(out,in);
	out.CommitL();
	out.Close();
	in.Close();
	in.OpenL(*target,id);
	testReadL(in);
	in.Close();
//
	test.Next(_L("Copying using a single big transfer"));
	in.OpenL(*source,copyId);
	id=out.CreateL(*target);
	in.ReadL(out,KTestTotal);
	out.CommitL();
	out.Close();
	in.Close();
	in.OpenL(*target,id);
	testReadL(in);
	in.Close();
	in.OpenL(*source,copyId);
	id=out.CreateL(*target);
	out.WriteL(in,KTestTotal);
	out.CommitL();
	out.Close();
	in.Close();
	in.OpenL(*target,id);
	testReadL(in);
	in.Close();
//
	CleanupStack::PopAndDestroy(3);
	}