/**
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4056
@SYMTestCaseDesc Test to confirm that keyspace files of mixed types (txt and cre) can be used
to make up a keyspace
@SYMTestPriority High
@SYMTestActions Open keyspace 0x10286555.  This keyspace is represented by one cre file and one
txt files.  The keyspace file names in the source have been mangled in a similar way to that
which would be expected on the device (eg. abcd1234.txt, abcd1234.txt[01-00], abcd1234.txt[02-00] etc.
@SYMTestExpectedResults Ensure that the final value of the setting is as specified in the final
ROFS layer that touched that setting.
@SYMREQ REQ11282
*/
LOCAL_C void MixedFileTypesL()
{
    TheTest.Next(_L( " @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4056 " ));

    CRepository* rep;
    User::LeaveIfNull(rep = CRepository::NewLC(KUidKeyspace6));
    TInt settingValueInt = 0;
    TBuf<20> settingValueStr;
    TUint32 settingMeta = 0;
    TInt rtn = 0;

    // tests that the core value is not modified
    rtn = rep->Get(KKeyOne, settingValueInt);
    TEST2(settingValueInt, KKeyspace6Setting1Value);

    // tests that the core value is modified by the ROFS layer
    rtn = rep->Get(KKeyTwo, settingValueInt);
    TEST2(settingValueInt, KKeyspace6Setting2Value);

    // tests that the core metadata value is not modified
    rep->GetMeta(KKeyThree, settingMeta);
    TEST2(settingMeta, KKeyspace6Setting3Meta);

    // tests that the core metadata value is modified by the ROFS layer
    rep->GetMeta(KKeyFour, settingMeta);
    TEST2(settingMeta, KKeyspace6Setting4Meta);

    // tests that the platsec details have not been modified
    rtn = rep->Get(KKeyFive, settingValueStr);
    TEST2(rtn, KErrNone);

    // tests that the platsec details were modified in the ROFS layer
    rtn = rep->Get(KKeySix, settingValueStr);
    TEST2(rtn, KErrPermissionDenied);

    CleanupStack::PopAndDestroy(rep);
}
/**
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4053
@SYMTestCaseDesc Test that settings information can be selectively overridden in a ROFS layer
@SYMTestPriority High
@SYMTestActions Open keyspace 0x10286550.  This keyspace is represented by two txt files.  The
keyspace file names in the source have been mangled in a similar way to that which would be
expected on the device (eg. abcd1234.txt, abcd1234.txt[01-00], abcd1234.txt[02-00] etc.
@SYMTestExpectedResults Ensure that the value of each setting specified in ROFS 1 has been
modified to the values specified in ROFS 1 and that each value not specified in ROFS 1 remains
as it was defined in the CORE layer.
@SYMREQ REQ11283
*/
LOCAL_C void REQ11283L()
{
    TheTest.Next(_L( " @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4053 " ));

    CRepository* rep;
    User::LeaveIfNull(rep = CRepository::NewLC(KUidKeyspace1));

    TInt settingValueInt = 0;
    TReal settingValueReal = 0.0;
    TBuf<20> settingValueStr;
    TUint32 settingMeta = 0;
    TInt rtn = 0;

    //check every single setting and meta and access policy
    User::LeaveIfError(rep->Get(1,settingValueInt));
    TEST(settingValueInt==1);
    User::LeaveIfError(rep->GetMeta(1,settingMeta));
    TEST(settingMeta==0);
    User::LeaveIfError(rep->Get(2,settingValueInt));
    TEST(settingValueInt==3);
    User::LeaveIfError(rep->GetMeta(2,settingMeta));
    TEST(settingMeta==0);
    User::LeaveIfError(rep->Get(3,settingValueReal));
    TEST(settingValueReal==3.1);
    User::LeaveIfError(rep->GetMeta(3,settingMeta));
    TEST(settingMeta==0);
    User::LeaveIfError(rep->Get(4,settingValueReal));
    TEST(settingValueReal==4.2);
    User::LeaveIfError(rep->GetMeta(4,settingMeta));
    TEST(settingMeta==0);
    User::LeaveIfError(rep->Get(5,settingValueStr));
    TEST(settingValueStr.Compare(_L("test 1"))==0);
    User::LeaveIfError(rep->GetMeta(5,settingMeta));
    TEST(settingMeta==0);
    User::LeaveIfError(rep->Get(6,settingValueStr));
    TEST(settingValueStr.Compare(_L("test 3"))==0);
    User::LeaveIfError(rep->GetMeta(6,settingMeta));
    TEST(settingMeta==0);

    //check value and meta combination
    User::LeaveIfError(rep->Get(7,settingValueInt));
    TEST(settingValueInt==8);
    User::LeaveIfError(rep->GetMeta(7,settingMeta));
    TEST(settingMeta==88);
    User::LeaveIfError(rep->Get(8,settingValueReal));
    TEST(settingValueReal==8.2);
    User::LeaveIfError(rep->GetMeta(8,settingMeta));
    TEST(settingMeta==888);
    User::LeaveIfError(rep->Get(9,settingValueStr));
    TEST(settingValueStr.Compare(_L("test 4"))==0);
    User::LeaveIfError(rep->GetMeta(9,settingMeta));
    TEST(settingMeta==888);

    //check value and platsec combination
    rtn=rep->Get(10,settingValueInt);
    TEST(rtn==KErrPermissionDenied);
    rtn=rep->Get(11,settingValueReal);
    TEST(rtn==KErrPermissionDenied);
    rtn=rep->Get(12,settingValueStr);
    TEST(rtn==KErrPermissionDenied);
    User::LeaveIfError(rep->Get(13,settingValueInt));
    TEST(settingValueInt==14);
    User::LeaveIfError(rep->GetMeta(13,settingMeta));
    TEST(settingMeta==0);
    User::LeaveIfError(rep->Get(14,settingValueInt));
    TEST(settingValueInt==15);
    User::LeaveIfError(rep->GetMeta(14,settingMeta));
    TEST(settingMeta==0);
    User::LeaveIfError(rep->Get(15,settingValueInt));
    TEST(settingValueInt==16);
    User::LeaveIfError(rep->GetMeta(15,settingMeta));
    TEST(settingMeta==0);
    User::LeaveIfError(rep->Set(15,150));
    User::LeaveIfError(rep->Get(16,settingValueInt));
    TEST(settingValueInt==16);
    User::LeaveIfError(rep->GetMeta(16,settingMeta));
    TEST(settingMeta==0);
    rtn=rep->Set(16,160);
    TEST(rtn==KErrPermissionDenied);


    //range meta
    User::LeaveIfError(rep->Get(0x20,settingValueInt));
    TEST(settingValueInt==16);
    User::LeaveIfError(rep->GetMeta(0x20,settingMeta));
    TEST(settingMeta==100);
    User::LeaveIfError(rep->Get(0x21,settingValueInt));
    TEST(settingValueInt==17);
    User::LeaveIfError(rep->GetMeta(0x21,settingMeta));
    TEST(settingMeta==101);

    //range platsec
    User::LeaveIfError(rep->Get(0x30,settingValueInt));
    TEST(settingValueInt==18);
    User::LeaveIfError(rep->GetMeta(0x30,settingMeta));
    TEST(settingMeta==0);
    rtn=rep->Set(0x30,0x31);
    TEST(rtn==KErrPermissionDenied);
    User::LeaveIfError(rep->Get(0x31,settingValueInt));
    TEST(settingValueInt==19);
    User::LeaveIfError(rep->GetMeta(0x31,settingMeta));
    TEST(settingMeta==0);
    User::LeaveIfError(rep->Set(0x31,0x32));

    //new settings
    User::LeaveIfError(rep->Get(0x50,settingValueInt));
    TEST(settingValueInt==50);
    User::LeaveIfError(rep->GetMeta(0x50,settingMeta));
    TEST(settingMeta==505);

    User::LeaveIfError(rep->Get(0x51,settingValueReal));
    TEST(settingValueReal==51.51);
    rtn=rep->Set(0x51,1.234);
    TEST(rtn==KErrPermissionDenied);

    User::LeaveIfError(rep->Get(0x52,settingValueStr));
    TEST(settingValueStr.Compare(_L("test 6"))==0);

    CleanupStack::PopAndDestroy(rep);
}