Esempio n. 1
0
void ArrayAuditEntryTest::testproperty_UserName()
{
    ArrayAuditEntry entry;
    wstring user = L"user_name";
    entry.UserName() = user;
    CPPUNIT_ASSERT( entry.UserName() == user);
}
Esempio n. 2
0
void ArrayAuditEntryTest::testproperty_ActionType()
{
    ArrayAuditEntry entry;
    string actionType = "some_action";
    entry.ActionType() = actionType;
    CPPUNIT_ASSERT( entry.ActionType() == actionType );
}
Esempio n. 3
0
void ArrayAuditEntryTest::testproperty_DateTime()
{
    ArrayAuditEntry entry;
    DateTime dt = DateTime::GetCurrentDateTime();
    entry.DateTime() = dt;
    CPPUNIT_ASSERT( entry.DateTime().Date() == dt.Date());
    CPPUNIT_ASSERT( entry.DateTime().Time() == dt.Time());
}
Esempio n. 4
0
void ArrayAuditEntryTest::testproperty_ActionParameters()
{
    ArrayAuditEntry entry;
    ParameterNameValuePair param;
    ParameterNameValuePairList::iterator it;

    param.Name = L"name1";
    param.Value = L"value1";
    entry.ActionParameters().push_back(param);
    param.Name = L"name2";
    param.Value = L"value2";
    entry.ActionParameters().push_back(param);

    CPPUNIT_ASSERT( entry.ActionParameters().size() == 2 );
    it = entry.ActionParameters().begin();
    param = *it;
    CPPUNIT_ASSERT( param.Name == L"name1" );
    CPPUNIT_ASSERT( param.Value == L"value1" );
    ++it;
    param = *it;
    CPPUNIT_ASSERT( param.Name == L"name2" );
    CPPUNIT_ASSERT( param.Value == L"value2" );
    ++it;
    CPPUNIT_ASSERT( it == entry.ActionParameters().end() );
}
Esempio n. 5
0
void ArrayAuditEntryTest::testproperty_OutputFileGuids()
{
    ArrayAuditEntry entry;
    AffymetrixGuidType guid;
    AffymetrixGuidTypeList::iterator it;

    guid = "guid1";
    entry.OutputFileGuids().push_back(guid);
    guid = "guid2";
    entry.OutputFileGuids().push_back(guid);

    CPPUNIT_ASSERT( entry.OutputFileGuids().size() == 2 );
    it = entry.OutputFileGuids().begin();
    guid = *it;
    CPPUNIT_ASSERT( guid == AffymetrixGuidType("guid1") );
    ++it;
    guid = *it;
    CPPUNIT_ASSERT( guid == AffymetrixGuidType("guid2") );
    ++it;
    CPPUNIT_ASSERT( it == entry.OutputFileGuids().end() );
}
void AuditFileWriterTest::testmethod_WriteFile()
{
    AuditFileWriter writer;
    ArrayAuditEntry entry;
    ParameterNameValuePair param;
    string file = "./audit.log";

    remove(file.c_str());

    entry.UserName() = L"ljevon";
    entry.DateTime().Date(L"10-10-2005");
    entry.DateTime().Time(L"12:00:00Z");
    entry.ActionType() = "test.id";
    entry.ArrayGuid() = "123-123-123-123";
    entry.InputFileGuids().push_back("321-321-321-321");
    entry.InputFileGuids().push_back("345-345-345-345");
    entry.OutputFileGuids().push_back("999-999-999-999");
    param.Name = L"Test";
    param.Value = L"true";
    entry.ActionParameters().push_back(param);
    param.Name = L"PixelSize";
    param.Value = L"3";
    entry.ActionParameters().push_back(param);
    CPPUNIT_ASSERT(writer.Write(file, entry) == true);

    entry.Clear();
    entry.UserName() = L"ljevon1";
    entry.DateTime().Date( L"10-11-2005");
    entry.DateTime().Time( L"12:01:00Z");
    entry.ActionType() = "test2.id";
    entry.ArrayGuid() = "1123-123-123-123";
    entry.InputFileGuids().push_back("1321-321-321-321");
    entry.InputFileGuids().push_back("1345-345-345-345");
    entry.OutputFileGuids().push_back("1999-999-999-999");
    param.Name = L"Test";
    param.Value = L"false";
    entry.ActionParameters().push_back(param);
    param.Name = L"PixelSize";
    param.Value = L"1";
    entry.ActionParameters().push_back(param);
    param.Name = L"Temp";
    param.Value = L"200";
    entry.ActionParameters().push_back(param);
    CPPUNIT_ASSERT(writer.Write(file, entry) == true);





    AuditFileReader reader;
    ArrayAuditEntryList audit;
    ArrayAuditEntryList::iterator it;
    AffymetrixGuidTypeList::iterator guidIt;
    ParameterNameValuePairList::iterator paramIt;

    CPPUNIT_ASSERT(reader.Read(file, audit) == true);
    CPPUNIT_ASSERT(audit.size() == 2);
    it = audit.begin();
    entry = *it;
    CPPUNIT_ASSERT(entry.UserName() == L"ljevon");
    CPPUNIT_ASSERT(entry.DateTime().Date() == L"10-10-2005");
    CPPUNIT_ASSERT(entry.DateTime().Time() == L"12:00:00Z");
    CPPUNIT_ASSERT(entry.ActionType() == "test.id");
    CPPUNIT_ASSERT(entry.ArrayGuid() == "123-123-123-123");

    guidIt = entry.InputFileGuids().begin();
    CPPUNIT_ASSERT( (*guidIt) == "321-321-321-321" );
    ++guidIt;
    CPPUNIT_ASSERT( (*guidIt) == "345-345-345-345" );
    ++guidIt;
    CPPUNIT_ASSERT( guidIt ==  entry.InputFileGuids().end() );

    guidIt = entry.OutputFileGuids().begin();
    CPPUNIT_ASSERT( (*guidIt) == "999-999-999-999" );
    ++guidIt;
    CPPUNIT_ASSERT( guidIt ==  entry.OutputFileGuids().end() );

    paramIt = entry.ActionParameters().begin();
    param = *paramIt;
    CPPUNIT_ASSERT(param.Name == L"Test");
    CPPUNIT_ASSERT(param.Value == L"true");
    ++paramIt;
    param = *paramIt;
    CPPUNIT_ASSERT(param.Name == L"PixelSize");
    CPPUNIT_ASSERT(param.Value == L"3");
    ++paramIt;
    CPPUNIT_ASSERT(paramIt == entry.ActionParameters().end());


    ++it;
    entry = *it;
    CPPUNIT_ASSERT(entry.UserName() == L"ljevon1");
    CPPUNIT_ASSERT(entry.DateTime().Date() == L"10-11-2005");
    CPPUNIT_ASSERT(entry.DateTime().Time() == L"12:01:00Z");
    CPPUNIT_ASSERT(entry.ActionType() == "test2.id");
    CPPUNIT_ASSERT(entry.ArrayGuid() == "1123-123-123-123");

    guidIt = entry.InputFileGuids().begin();
    CPPUNIT_ASSERT( (*guidIt) == "1321-321-321-321" );
    ++guidIt;
    CPPUNIT_ASSERT( (*guidIt) == "1345-345-345-345" );
    ++guidIt;
    CPPUNIT_ASSERT( guidIt ==  entry.InputFileGuids().end() );

    guidIt = entry.OutputFileGuids().begin();
    CPPUNIT_ASSERT( (*guidIt) == "1999-999-999-999" );
    ++guidIt;
    CPPUNIT_ASSERT( guidIt ==  entry.OutputFileGuids().end() );

    paramIt = entry.ActionParameters().begin();
    param = *paramIt;
    CPPUNIT_ASSERT(param.Name == L"Test");
    CPPUNIT_ASSERT(param.Value == L"false");
    ++paramIt;
    param = *paramIt;
    CPPUNIT_ASSERT(param.Name == L"PixelSize");
    CPPUNIT_ASSERT(param.Value == L"1");
    ++paramIt;
    param = *paramIt;
    CPPUNIT_ASSERT(param.Name == L"Temp");
    CPPUNIT_ASSERT(param.Value == L"200");
    ++paramIt;
    CPPUNIT_ASSERT(paramIt == entry.ActionParameters().end());
}
Esempio n. 7
0
void ArrayAuditEntryTest::testmethod_Clear()
{
    ArrayAuditEntry entry;
    AffymetrixGuidType guid;

    entry.ArrayGuid() = "guid";

    guid = "guid1";
    entry.InputFileGuids().push_back(guid);
    guid = "guid2";
    entry.InputFileGuids().push_back(guid);

    wstring user = L"user_name";
    entry.UserName() = user;

    DateTime dt = DateTime::GetCurrentDateTime();
    entry.DateTime() = dt;

    guid = "guid1";
    entry.OutputFileGuids().push_back(guid);
    guid = "guid2";
    entry.OutputFileGuids().push_back(guid);

    int32_t actionType = 123;
    entry.ActionType() = actionType;

    ParameterNameValuePair param;
    ParameterNameValuePairList::iterator it;

    param.Name = L"name1";
    param.Value = L"value1";
    entry.ActionParameters().push_back(param);
    param.Name = L"name2";
    param.Value = L"value2";
    entry.ActionParameters().push_back(param);

    entry.Clear();

    CPPUNIT_ASSERT( entry.UserName() == L"" );
    CPPUNIT_ASSERT( entry.ArrayGuid() == "" );
    CPPUNIT_ASSERT( entry.DateTime().Date() == L"" );
    CPPUNIT_ASSERT( entry.DateTime().Time() == L"" );
    CPPUNIT_ASSERT( entry.InputFileGuids().size() == 0 );
    CPPUNIT_ASSERT( entry.OutputFileGuids().size() == 0 );
    CPPUNIT_ASSERT( entry.ActionParameters().size() == 0 );
    CPPUNIT_ASSERT( entry.ActionType() == "" );
}
Esempio n. 8
0
void ArrayAuditEntryTest::testproperty_ArrayGuid()
{
    ArrayAuditEntry entry;
    entry.ArrayGuid() = "guid";
    CPPUNIT_ASSERT( entry.ArrayGuid() == "guid");
}