testexecmgmt/ucc/Source/Uccs.v2/ServiceStubs/Test/CTestStub.cpp
changeset 0 3da2a79470a7
equal deleted inserted replaced
-1:000000000000 0:3da2a79470a7
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 * Filename: CTestStub.cpp
       
    16 * ServiceStub for unit testing the Usecase Controller. 
       
    17 * System Includes
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 #include <assert.h>
       
    24 #include <winsock2.h>
       
    25 #include <windows.h>
       
    26 
       
    27 /*******************************************************************************
       
    28  *
       
    29  * Local Includes
       
    30  *
       
    31  ******************************************************************************/
       
    32 #include "../../Core/UCCS_ServiceValues.h"
       
    33 #include "../../Core/UCCS_ErrorCodes.h"
       
    34 #include "CTestStub.h"
       
    35 #include "../../../include/penstd.h"
       
    36 
       
    37 /*******************************************************************************
       
    38  *
       
    39  * Definitions
       
    40  *
       
    41  ******************************************************************************/
       
    42 
       
    43 /*******************************************************************************
       
    44  *
       
    45  * Macro Functions
       
    46  *
       
    47  ******************************************************************************/
       
    48 																		
       
    49 /*******************************************************************************
       
    50  *
       
    51  * Constructor / Destructor
       
    52  *
       
    53  ******************************************************************************/
       
    54 CTestStub::CTestStub()
       
    55 {
       
    56 }
       
    57 
       
    58 
       
    59 CTestStub::~CTestStub()
       
    60 {
       
    61 }
       
    62 
       
    63 
       
    64 /*******************************************************************************
       
    65  *
       
    66  * Startup / Shutdown
       
    67  *
       
    68  ******************************************************************************/
       
    69 int CTestStub::StartUccsService( char *aHostName, int *aErrorDetail, int *aUnused )
       
    70 {
       
    71 	*aErrorDetail = *aUnused = 0;
       
    72 	return 0;
       
    73 }
       
    74 
       
    75 
       
    76 int CTestStub::StopUccsService( int *aErrorDetail, int *aUnused )
       
    77 {
       
    78 	*aErrorDetail = *aUnused = 0;
       
    79 	return 0;
       
    80 }
       
    81 
       
    82 
       
    83 /*******************************************************************************
       
    84  *
       
    85  * IssueCommand
       
    86  *
       
    87  ******************************************************************************/
       
    88 CDataRecord* CTestStub::IssueCommand( CDataRecord* aRequest )
       
    89 {
       
    90 	int err = 0;
       
    91 	int method_id = -1;
       
    92 	CDataRecord* request_reply = NULL;
       
    93 
       
    94 	// check params
       
    95 	assert( aRequest != NULL );
       
    96 
       
    97 	// create a standard reply 
       
    98 	request_reply = CreateBaseReply( aRequest );
       
    99 	assert( request_reply != NULL );
       
   100 
       
   101 	// get and check the method_id
       
   102 	err = request_reply->GetFieldAsInt( "METHODID", &method_id );
       
   103 	if( method_id == -1 ) {
       
   104 		UpdateCompletionCode( request_reply, ERR_INVALID_METHOD );
       
   105 		return request_reply;
       
   106 	}
       
   107 
       
   108 	// now dispatch and call the appropriate method
       
   109 	switch( method_id ) {
       
   110 	
       
   111 	// create result field
       
   112 	case 2:		
       
   113 		err = request_reply->NewField( "TEST_RESULT_FIELD", "TEST_RESULT_VALUE" );
       
   114 		assert( err == UCCS_OK );
       
   115 		UpdateCompletionCode( request_reply, ERR_NONE );			
       
   116 		break;
       
   117 
       
   118 	// Any other method id results in an invalid method id result
       
   119 	case 1:
       
   120 	default:
       
   121 		UpdateCompletionCode( request_reply, ERR_INVALID_METHOD );
       
   122 		break;
       
   123 	}
       
   124 
       
   125 	// everything should be handled above 
       
   126 	return request_reply;
       
   127 }
       
   128 
       
   129 
       
   130 /*******************************************************************************
       
   131  *
       
   132  * GetStatus()
       
   133  *
       
   134  ******************************************************************************/
       
   135 int CTestStub::GetStatus()
       
   136 {
       
   137 	assert( !"GetStatus() - is not implemented" );
       
   138 	return -1;
       
   139 }
       
   140 
       
   141 
       
   142 /*******************************************************************************
       
   143  *
       
   144  * GetLastRPCError()
       
   145  *
       
   146  ******************************************************************************/
       
   147 char *CTestStub::GetLastRPCError( int *aIntError )
       
   148 {
       
   149 	assert( !"GetLastRPCError() - is not implemented" );
       
   150 	return NULL;
       
   151 }