summaryrefslogtreecommitdiff
path: root/content/xdocs/OSVC.html
blob: 11986b7480dfc94b953ea006148ecb46cf6af2c4 (plain)
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<html>
    <head>
        <title>Apache Qpid : OSVC</title>
	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
    </head>

    <body>
	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
		    <tr>
			    <td valign="top" class="pagebody">
				    <div class="pageheader">
					    <span class="pagetitle">
                            Apache Qpid : OSVC
                                                    </span>
				    </div>
				    <div class="pagesubheading">
					    This page last changed on Apr 11, 2008 by <font color="#0050B2">cctrieloff</font>.
				    </div>

				    <h3><a name="OSVC-ARHEL4Grimoire"></a>A RHEL4 Grimoire</h3>

<p>by Michael Goulish on this 11th day of April, 2008</p>

<h2><a name="OSVC-Introduction"></a>Introduction</h2>

<p>Programmer&#33; Turn back now, if you can, to the daylit world&#33;</p>

<p>But if you must walk this road - take with you this map&#33; Do not stray into the mires and pits where I have wandered and despaired.</p>

<p>Herein I will describe what I can of the perils I have encountered in the antique land of RHEL4.</p>

<h2><a name="OSVC-Iteratorsandthe%22%3E%22operator."></a>Iterators and the "-&gt;" operator.</h2>

<p>I believe this is a compiler problem with the &#45;&gt; operator, in the neighborhood of any kind of iterators.</p>

<p>Code like this will not compile:</p>
<div class="code"><div class="codeContent">
<pre class="code-java">ConsumerImplMap::iterator i = consumers.find(delivery.getTag());

<span class="code-keyword">if</span> (i != consumers.end())
{  get_pointer(i)-&gt;acknowledged(delivery); <span class="code-comment">// &lt;--- Bad!  }</span></pre>
</div></div>

<p>Do this instead:</p>
<div class="code"><div class="codeContent">
<pre class="code-java">ConsumerImplMap::iterator i = consumers.find(delivery.getTag());

<span class="code-keyword">if</span> (i != consumers.end())
{  (*i).second-&gt;complete(delivery); <span class="code-comment">// &lt;--- Good!  }</span></pre>
</div></div>

<p>( Thanks, Kim&#33; )</p>

<h2><a name="OSVC-Don%27tuseBOOSTFIXTURETESTCASE"></a>Don't use BOOST_FIXTURE_TEST_CASE</h2>

<p>Because it Doesn't Exist.</p>

<p>All it does is allow you to use a class (or struct) declaration in many test cases without declaring it in every one.</p>

<p>So what? Big deal&#33; Just declare your structure in each test case, and use the QPID_AUTO_TEST_CASE macro instead&#33;</p>

<p>If you have this struct:</p>
<div class="code"><div class="codeContent">
<pre class="code-java">struct ClientSessionFixture : <span class="code-keyword">public</span> Foo
{  <span class="code-object">int</span> bar;  }</pre>
</div></div>

<p>Don't do this:</p>
<div class="code"><div class="codeContent">
<pre class="code-java">BOOST_FIXTURE_TEST_CASE(testQueueQuery, ClientSessionFixture)
{  bar = 666;  BOOST_CHECK_EQUAL ( bar, 666 );  }</pre>
</div></div>

<p>Do do this:</p>
<div class="code"><div class="codeContent">
<pre class="code-java">QPID_AUTO_TEST_CASE(testQueueQuery)
{  ClientSessionFixture fix;  fix.bar = 666;  BOOST_CHECK_EQUAL ( fix.bar, 666 );  }</pre>
</div></div>

<p>(Thanks, Alan&#33;)</p>

<h2><a name="OSVC-Don%27tusetheBOOST%5C%7B%7DTEST%7B%7Dmacros%5C%21"></a>Don't use the BOOST&#95;<b><em>TEST</em></b> macros &#33;</h2>

<p>If you are tempted to use</p>
<div class="code"><div class="codeContent">
<pre class="code-java">BOOST_AUTO_TEST_SUITE, or

BOOST_AUTO_TEST_CASE, or

BOOST_AUTO_TEST_SUITE_END,</pre>
</div></div>
<p>dont&#33;</p>

<p>Use instead:</p>
<div class="code"><div class="codeContent">
<pre class="code-java">QPID_AUTO_TEST_SUITE, or

QPID_AUTO_TEST_CASE, or

QPID_AUTO_TEST_SUITE_END !</pre>
</div></div>
<p>They turn into Appropriate Things depending on the version of Boost you are using.</p>

<p>Sometimes the Appropriate Thing is whitespace...</p>

<p>(Thanks, Alan and Kim &#33;)</p>

<h2><a name="OSVC-Don%27tuseboost%3A%3Aiostreams."></a>Don't use boost::iostreams.</h2>

<p>They don't exist.</p>
<div class="code"><div class="codeContent">
<pre class="code-java">/usr/include/boost/iostreams/: No such file or directory</pre>
</div></div>
<p>Instead, use low-level Unix IO, from the Dawn of Time.</p>
<div class="code"><div class="codeContent">
<pre class="code-java">open()

read()

write()</pre>
</div></div>

				    
                    			    </td>
		    </tr>
	    </table>
	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr>
				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
			</tr>
		    <tr>
			    <td align="center"><font color="grey">Document generated by Confluence on Apr 22, 2008 02:47</font></td>
		    </tr>
	    </table>
    </body>
</html>