[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-server-cvs
Subject:    [Server-cvs] tools/unittest/services ut_fsmanager.cpp,NONE,1.1
From:       srao () helixcommunity ! org
Date:       2008-08-01 22:02:48
Message-ID: 200808012205.m71M5aiP015064 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/server/tools/unittest/services
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv2926

Added Files:
	ut_fsmanager.cpp 
Log Message:
Synopsis
========
PhaseII: Implement Unit Test frame work for PlaylistManager and test the phase-1 \
functionality using frame work

Branches: SERVER_12_1_RN, SERVER_CURRENT_RN Suggested Reviewer: Jamie, JJ

Description
===========
1. Added new target server-restricted_dataype_playlist_unittest to build system to \
down load PlaylistManager unit test code and related modules. (attached \
build_diff.txt)

2. Modified frame work to (ut_fw_diff.txt, playlist_piids.h)
	1. Support Playlist Manager objects 
	2. xalan helper to support empty strings.
	3. smil is only working with expat parser, so modified UT class factory to generate \
expat parser instead old XML parser.   4. Added Mock classes for fs-manager and \
server-request.

3. Fixed bugs found while doing unit testing and added couple of methods to process \
other parameters (plmgr_diff.txt) 4. PlaylistManager unit test frame work files added \
(which includes new source code and test cases in xml format) 5. Modified smil parser \
header file to make parseClockValue() method public. This method is needed in \
Playlist Manager to parse src-duration.


Files Affected
==============
/server-restricted/build/BIF/SERVER_12_1_COMMON_restricted.bif
/home/source/build/BIF/SERVER_12_1-internal.bif

/server/tools/unittest/framework/ut_testdriver.h

/server/tools/unittest/services/Umakefil
/server/tools/unittest/services/pub/ut_fsmanager.h [new file] \
/server/tools/unittest/services/pub/ut_server_request.h [new file] \
/server/tools/unittest/services/ut_fsmanager.cpp [new file] \
/server/tools/unittest/services/ut_server_request.cpp [new file]

/server/tools/unittest/services/ut_clfact.cpp
/server/tools/unittest/services/ut_context.cpp
/server/tools/unittest/services/pub/ut_clfact.h

/server/tools/unittest/utils/Umakefil
/server/tools/unittest/utils/iids.cpp
/server/tools/unittest/xalanhelper/ut_xalanhelper.cpp
/server/tools/unittest/utils/pub/playlist_piids.h [new file]

/server-restricted/datatype/playlist/unittest/plmgr_test_driver.cpp [new file] \
/server-restricted/datatype/playlist/unittest/plmgr_test_driver.h [new file] \
/server-restricted/datatype/playlist/unittest/ut_main.cpp [new file] \
/server-restricted/datatype/playlist/unittest/Umakefil [new file] \
/server-restricted/datatype/playlist/unittest/UnitTestConfig.xsd [new file] \
/server-restricted/datatype/playlist/unittest/ut_plmgr.xml [new file] \
/server-restricted/datatype/playlist/plmgr.cpp \
/server-restricted/datatype/playlist/pub/plmgr.h

/server/include/hxplaylist.h

/datatype/smil/renderer/smil2/pub/smlparse.h


Testing Performed
=================
Executed 23 test cases (written in file ut_plmgr.xml) and found all tests are passing

Build verified: win32-i386-vc7

Platforms tested: win32-i386-vc7

QA Hints
===============
None

--- NEW FILE: ut_fsmanager.cpp ---
/* ***** BEGIN LICENSE BLOCK *****
 *
 * Portions Copyright (c) 1995-2008 RealNetworks, Inc. All Rights Reserved.
 *
 * The contents of this file, and the files included with this file,
 * are subject to the current version of the RealNetworks Public
 * Source License (the "RPSL") available at
 * http://www.helixcommunity.org/content/rpsl unless you have licensed
 * the file under the current version of the RealNetworks Community
 * Source License (the "RCSL") available at
 * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
 * will apply. You may also obtain the license terms directly from
 * RealNetworks.  You may not use this file except in compliance with
 * the RPSL or, if you have a valid RCSL with RealNetworks applicable
 * to this file, the RCSL.  Please see the applicable RPSL or RCSL for
 * the rights, obligations and limitations governing use of the
 * contents of the file.
 *
 * This file is part of the Helix DNA Technology. RealNetworks is the
 * developer of the Original Code and owns the copyrights in the
 * portions it created.
 *
 * This file, and the files included with this file, is distributed
 * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
 * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
 * ENJOYMENT OR NON-INFRINGEMENT.
 *
 * Technology Compatibility Kit Test Suite(s) Location:
 *    http://www.helixcommunity.org/content/tck
 *
 * Contributor(s):
 *
 * ***** END LICENSE BLOCK ***** */

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>

#include "hxtypes.h"
#include "hxcom.h"

#include "hxstring.h"
#include "hxmap.h"

#include "ut_fsmanager.h"
#include "ut_fileobject.h"
#include "url.h"
#include "ut_context.h"
#include "hxmap.h"
#include "hxrquest.h"
#include "chxpckts.h"
#include "timeval.h"
#include "hxmon.h"
#include "errmsg_macros.h"
#include "urlparser.h"

#include <signal.h>


CUTFSManager::CUTFSManager(IHXCommonClassFactory *pCommonClassFactory)
                        :m_pCommonClassFactory(pCommonClassFactory)
{
    m_pCommonClassFactory->AddRef();

    m_ulRefCount = 0;
    m_pool     = NULL;
    m_pRequest = NULL;
    m_bHandleRedirect = FALSE;
    m_bCheckingCache  = FALSE;
    m_pResponse = NULL;
    m_url       = NULL;
    m_file_object = NULL;
    m_file_exists = NULL;
    m_last_options = NULL;
    m_first_options = NULL;
    m_ulHandlingPlusUrl = 0;
    m_bIsCDistEligible = FALSE;
    m_bCollectReadStats = FALSE;
    m_bEnableAMPDebug = FALSE;
}

CUTFSManager::~CUTFSManager()
{
    HX_RELEASE(m_pool);
    HX_RELEASE(m_file_object);
    HX_RELEASE(m_file_exists);
    HX_RELEASE(m_pRequest);
    HX_RELEASE(m_pResponse);
    HX_RELEASE(m_last_options);
    HX_RELEASE(m_first_options);
    HX_RELEASE(m_url);
}

STDMETHODIMP CUTFSManager::QueryInterface(REFIID riid, void** ppvObj)
{
    if (IsEqualIID(riid, IID_IUnknown))
    {
        AddRef();
        *ppvObj = (IUnknown*)(IHXFileSystemManager*)this;
        return HXR_OK;
    }
    else if (IsEqualIID(riid, IID_IHXFileSystemManager))
    {
        AddRef();
        *ppvObj = (IHXFileSystemManager*)this;
        return HXR_OK;
    }
    else if (IsEqualIID(riid, IID_IHXFileExistsResponse))
    {
        AddRef();
        *ppvObj = (IHXFileExistsResponse*)this;
        return HXR_OK;
    }
    else if (IsEqualIID(riid, IID_IHXGetFileFromSamePoolResponse))
    {
        AddRef();
        *ppvObj = (IHXGetFileFromSamePoolResponse*)this;
        return HXR_OK;
    }
    else if (IsEqualIID(riid, IID_IHXHTTPRedirect))
    {
        AddRef();
        *ppvObj = (IHXHTTPRedirect*)this;
        return HXR_OK;
    }
    else if (IsEqualIID(riid, IID_IHXHTTPRedirectResponse))
    {
        AddRef();
        *ppvObj = (IHXHTTPRedirectResponse*)this;
        return HXR_OK;
    }
    else if (IsEqualIID(riid, IID_IHXContentDistributionAdviseResponse))
    {
        AddRef();
        *ppvObj = (IHXContentDistributionAdviseResponse*)this;
        return HXR_OK;
    }


    *ppvObj = NULL;
    return HXR_NOINTERFACE;
}

STDMETHODIMP_(ULONG32) CUTFSManager::AddRef()
{
    return InterlockedIncrement(&m_ulRefCount);
}

STDMETHODIMP_(ULONG32) CUTFSManager::Release()
{
    if (InterlockedDecrement(&m_ulRefCount) > 0)
    {
        return m_ulRefCount;
    }

    delete this;
    return 0;
}

STDMETHODIMP
CUTFSManager::Init(IHXFileSystemManagerResponse* /*IN*/  pFileManagerResponse)
{
    if(m_pResponse)
    {
        m_pResponse->Release();
    }
    m_pResponse = pFileManagerResponse;
    m_pResponse->AddRef();
    m_pResponse->InitDone(HXR_OK);

    return HXR_OK;
}

STDMETHODIMP
CUTFSManager::GetFileObject(IHXRequest* pRequest,
                         IHXAuthenticator* pAuth)
{
    UINT32                      mount_point_len = 0;
    UINT32                      uLen = 0;
    const char*                 pURL = NULL;
    IHXFileObject *pFileObject;

    if (!pRequest)
    {
        return HXR_FAIL;
    }
    HX_RELEASE(m_pRequest);
    m_pRequest = pRequest;
    m_pRequest->AddRef();

    const char* temp = NULL;
    IHXURLParser* pURLParser = NULL;
    IHXURL* pHXURL = NULL;


    m_pRequest->QueryInterface(IID_IHXURLParser,(void**)&pURLParser);
    if (pURLParser)
    {
        pURLParser->GetHXURL(pHXURL);
        if (pHXURL)
        {
            uLen = pHXURL->GetEncodedUrl(temp);
        }
        HX_RELEASE(pURLParser);
    }
    else
    {
        m_pRequest->GetURL(temp);
        uLen = strlen(temp);
    }

    if (!temp)
    {
        HX_RELEASE(pHXURL);
        m_pResponse->FileObjectReady(HXR_FAILED, NULL);
        return HXR_FAIL;
    }

    HX_RELEASE(m_url);

    pFileObject = new  CMyExampleFileObject(m_pCommonClassFactory,"", (char*)temp);
    m_pResponse->FileObjectReady(HXR_OK, pFileObject);

}



STDMETHODIMP
CUTFSManager::FileObjectReady(HX_RESULT status,
                           IUnknown* pUnknown)
{
    IHXRequestHandler* pRequestHandler = NULL;

    if (m_pool)
    {
        m_pool->Release();
        m_pool = NULL;
    }

    if (HXR_OK == status)
    {
        pUnknown->AddRef();

        if (HXR_OK == pUnknown->QueryInterface(IID_IHXRequestHandler,
                                            (void**)&pRequestHandler))
        {
            pRequestHandler->SetRequest(m_pRequest);
        }
        // did original object collect read stats for cdist?

        IHXMIIReadStatCollection* pMSC;
        if (m_bCollectReadStats &&
            HXR_OK == pUnknown->QueryInterface(IID_IHXMIIReadStatCollection,
                                               (void**)&pMSC))
        {
            pMSC->SetMIIReadStatsEnabled(TRUE, NULL);
            pMSC->Release();
        }
    }

    m_pResponse->FileObjectReady(status,
                                 pUnknown);
    if (pRequestHandler)
    {
        pRequestHandler->Release();
    }

    if ((HXR_OK == status) && pUnknown)
    {
        pUnknown->Release();
    }

    /*
     * The IHXRequest object belongs to the IHXFileObject
     */
    HX_RELEASE(m_pRequest);

    return HXR_OK;
}



STDMETHODIMP
CUTFSManager::DoesExistDone(BOOL bExists)
{
   return HXR_OK;
}
HX_RESULT
CUTFSManager::FileReadyHook(HX_RESULT result, IUnknown* pFileObject)
{
 
    return HXR_OK;
}
STDMETHODIMP
CUTFSManager::GetNewFileObject(IHXRequest* pRequest,
                            IHXAuthenticator* pAuth)
{
    return HXR_OK;
}

STDMETHODIMP
CUTFSManager::GetRelativeFileObject(IUnknown* pOriginalObject,
                                 const char* pPath)
{
    return HXR_OK;
}

STDMETHODIMP
CUTFSManager::GetDirObjectFromURL(const char* pURL)
{
    return HXR_NOTIMPL;
}


_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic