File: yuma-op-policies.cpp

package info (click to toggle)
yuma123 2.13-1
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 22,364 kB
  • sloc: ansic: 185,010; cpp: 10,966; python: 7,902; sh: 2,631; makefile: 1,179; xml: 807; exp: 759; perl: 70
file content (89 lines) | stat: -rw-r--r-- 3,072 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// ---------------------------------------------------------------------------|
// Yuma Test Harness includes
// ---------------------------------------------------------------------------|
#include "test/support/nc-query-util/yuma-op-policies.h"
#include "test/support/nc-query-util/nc-query-utils.h"

// ---------------------------------------------------------------------------|
// STD Includes 
// ---------------------------------------------------------------------------|
#include <sstream>
#include <iomanip>

// ---------------------------------------------------------------------------|
// Boost Test Framework
// ---------------------------------------------------------------------------|
#include <boost/test/unit_test.hpp>

// ---------------------------------------------------------------------------|
// Global namespace usage
// ---------------------------------------------------------------------------|
using namespace std;

// ---------------------------------------------------------------------------|
namespace YumaTest
{

// ---------------------------------------------------------------------------|
AbstractYumaOpLogPolicy:: AbstractYumaOpLogPolicy( const string& baseDir )
   : baseDir_( baseDir )
{
}

// ---------------------------------------------------------------------------|
AbstractYumaOpLogPolicy::~AbstractYumaOpLogPolicy()
{
}

// ---------------------------------------------------------------------------|
std::string AbstractYumaOpLogPolicy::generateSessionLog( uint16_t sessionId )
{
    ostringstream oss;
    using boost::unit_test::framework::current_test_case;

    oss << baseDir_ << "/" 
        << "Ses" << setw(4) << setfill('0') << sessionId << "-"
        << current_test_case().p_name 
        << ".xml";
    return oss.str();
}

// ---------------------------------------------------------------------------|
MessageIdLogFilenamePolicy::MessageIdLogFilenamePolicy( 
      const string& baseDir )
   : AbstractYumaOpLogPolicy( baseDir )
{
}

// ---------------------------------------------------------------------------|
MessageIdLogFilenamePolicy::~MessageIdLogFilenamePolicy()
{
}

// ---------------------------------------------------------------------------|
string MessageIdLogFilenamePolicy::generate( const string& queryStr,
       uint16_t sessionId ) 
{
    ostringstream oss;
    using boost::unit_test::framework::current_test_case;

    oss << baseDir_ << "/" << current_test_case().p_name 
        << "-Ses" << setw(4) << setfill('0') << sessionId << "-" 
        << setw(4) << setfill('0') << extractMessageIdStr( queryStr) << ".xml";
    
    return oss.str();
}

// ---------------------------------------------------------------------------|
string MessageIdLogFilenamePolicy::generateHelloLog( const uint16_t sessionId ) 
{
    ostringstream oss;
    using boost::unit_test::framework::current_test_case;

    oss << baseDir_ << "/" << current_test_case().p_name 
        << "-Ses" << setw(4) << setfill('0') << sessionId << "-hello.xml";
    
    return oss.str();
}

} // namespace YumaTest