|
1 /* |
|
2 * Copyright (c) 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: hostconn header declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #ifndef __TESTHOSTLET_H__ |
|
26 #define __TESTHOSTLET_H__ |
|
27 |
|
28 // EXTERNAL INCLUDES |
|
29 #include <senhostletconnectionbctest.h> |
|
30 |
|
31 #include <MSenProperties.h> |
|
32 |
|
33 // INTERNAL INCLUDES |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class CHostletConnectionBCTest; |
|
37 |
|
38 class CTestHostlet : public CBase, public MSenHostlet, public MSenHostletRequest |
|
39 { |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Two phase construction |
|
44 */ |
|
45 static CTestHostlet* NewL(CSenHostletConnectionBCTest* aTestSuite, |
|
46 TInt (*ap2ServiceL) (CSenHostletConnectionBCTest*, MSenHostletRequest&, MSenHostletResponse&) = NULL, |
|
47 TInt (*ap2OnServiceCompleteL) (CSenHostletConnectionBCTest*, const TInt, TInt, const TDesC8&) = NULL, |
|
48 void (*ap2DescribeServiceL) (CSenXmlServiceDescription&) = NULL); |
|
49 |
|
50 static CTestHostlet* NewLC(CSenHostletConnectionBCTest* aTestSuite, |
|
51 TInt (*ap2ServiceL) (CSenHostletConnectionBCTest*, MSenHostletRequest&, MSenHostletResponse&) = NULL, |
|
52 TInt (*ap2OnServiceCompleteL) (CSenHostletConnectionBCTest*, const TInt, TInt, const TDesC8&) = NULL, |
|
53 void (*ap2DescribeServiceL) (CSenXmlServiceDescription&) = NULL); |
|
54 |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 ~CTestHostlet(); |
|
59 virtual void DescribeServiceL(CSenXmlServiceDescription& aSD); |
|
60 |
|
61 virtual TPtrC8 Contract() const; |
|
62 |
|
63 virtual TPtrC8 Endpoint() const; |
|
64 |
|
65 virtual TInt ServiceL(MSenHostletRequest& aRequest, MSenHostletResponse& aResponse); |
|
66 virtual void OnServiceCompleteL(const TInt aTxnId, TInt aCompletionCode, const TDesC8& aDesc); |
|
67 |
|
68 public: // Public data => OK in testers, no benefit gained from getters => in real apps, these should be private: |
|
69 CSenXmlServiceDescription* ipHostletDescription; |
|
70 RPointerArray<HBufC8> iRequests; |
|
71 RPointerArray<HBufC8> iResponses; |
|
72 RPointerArray<HBufC8> iRequestProps; |
|
73 RArray<MSenProperties::TSenPropertiesClassType> iRequestPropTypes; |
|
74 RPointerArray<CSenTransportProperties> iResponseProps; |
|
75 RArray<TInt> iResponseCodes; |
|
76 TInt iRespondRetCode; // direct retCode from RespondL (async) |
|
77 RArray<TInt> iCompletionCodes; // from OnServiceCompleteL => indicates how Respond operation was delivered |
|
78 RArray<TInt> iTxnIds; |
|
79 |
|
80 inline virtual TPtrC8 FrameworkId() const |
|
81 { |
|
82 return KDefaultRestServicesFrameworkID(); |
|
83 } |
|
84 //MSenHostletRequest |
|
85 inline virtual TPtrC8 RequestUtf8() const |
|
86 { |
|
87 return _L8(""); |
|
88 } |
|
89 inline virtual TPtrC ThreadId() const |
|
90 { |
|
91 return _L(""); |
|
92 } |
|
93 inline virtual TPtrC8 ConsumerId() const |
|
94 { |
|
95 return _L8(""); |
|
96 } |
|
97 inline virtual TInt RequestId() const |
|
98 { |
|
99 return KErrNone; |
|
100 } |
|
101 inline virtual TPtrC8 Properties(MSenProperties::TSenPropertiesClassType& aType) const |
|
102 { |
|
103 return _L8(""); |
|
104 } |
|
105 private: // Constructor |
|
106 CTestHostlet(CSenHostletConnectionBCTest* aTestSuite, |
|
107 TInt (*ap2ServiceL) (CSenHostletConnectionBCTest*, MSenHostletRequest&, MSenHostletResponse&), |
|
108 TInt (*ap2OnServiceCompleteL) (CSenHostletConnectionBCTest*, const TInt, TInt, const TDesC8&), |
|
109 void (*ap2DescribeServiceL) (CSenXmlServiceDescription&)); |
|
110 void ConstructL(); |
|
111 |
|
112 private: // Data |
|
113 CSenHostletConnectionBCTest* ipTestSuite; |
|
114 |
|
115 private: // Function pointers |
|
116 TInt (*ip2ServiceL) (CSenHostletConnectionBCTest*, MSenHostletRequest&, MSenHostletResponse&); |
|
117 TInt (*ip2OnServiceCompleteL) (CSenHostletConnectionBCTest*, const TInt, TInt, const TDesC8&); |
|
118 void (*ip2DescribeServiceL)(CSenXmlServiceDescription&); |
|
119 }; |
|
120 |
|
121 #endif // __TESTHOSTLET_H__ |
|
122 |
|
123 // End of file |