<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>This is the net result of how the AbstractMMQueryTestCase would end up, because these are directly dependent on using the DriverManager:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(127, 0, 85); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>static<span style="color: #000000"> {</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #7f0055">new</span> TeiidDriver();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; <span style="color: #7f0055">private</span> Stack&lt;com.metamatrix.jdbc.api.Connection&gt; <span style="color: #0000c0">contexts</span> = <span style="color: #7f0055">new</span> Stack&lt;Connection&gt;();</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; <span style="color: #7f0055">public</span> <span style="color: #7f0055">void</span> pushConnection() {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(0, 0, 192); "><span style="color: #000000">&nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #7f0055">this</span><span style="color: #000000">.</span>contexts<span style="color: #000000">.push(</span><span style="color: #7f0055">this</span><span style="color: #000000">.</span>internalConnection<span style="color: #000000">);</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(0, 0, 192); "><span style="color: #000000">&nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #7f0055">this</span><span style="color: #000000">.</span>internalConnection<span style="color: #000000"> = </span><span style="color: #7f0055">null</span><span style="color: #000000">;</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; }</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; <span style="color: #7f0055">public</span> <span style="color: #7f0055">void</span> popConnection() {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(0, 0, 192); "><span style="color: #000000">&nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #7f0055">this</span><span style="color: #000000">.</span>internalConnection<span style="color: #000000"> = </span><span style="color: #7f0055">this</span><span style="color: #000000">.</span>contexts<span style="color: #000000">.pop();</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; }</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp;&nbsp; &nbsp; <span style="color: #7f0055">public</span> com.metamatrix.jdbc.api.Connection getConnection(String vdb, String propsFile){</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7f0055">return</span> getConnection(vdb, propsFile, <span style="color: #2a00ff">""</span>);&nbsp; <span style="color: #3f7f5f">//$NON-NLS-1$</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; }</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; <span style="color: #7f0055">public</span> com.metamatrix.jdbc.api.Connection getConnection(String vdb, String propsFile, String addtionalStuff){</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>closeResultSet();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>closeStatement();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>closeConnection();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7f0055">try</span> {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                        </span><span style="color: #7f0055">this</span>.<span style="color: #0000c0">internalConnection</span> = createConnection(vdb, propsFile, addtionalStuff);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>} <span style="color: #7f0055">catch</span> (SQLException e) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                        </span><span style="color: #7f0055">throw</span> <span style="color: #7f0055">new</span> RuntimeException(e);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>}&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(0, 0, 192); "><span style="color: #000000">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #7f0055">return</span><span style="color: #000000"> </span><span style="color: #7f0055">this</span><span style="color: #000000">.</span>internalConnection<span style="color: #000000">;</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; }</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; <span style="color: #7f0055">public</span> <span style="color: #7f0055">static</span> com.metamatrix.jdbc.api.Connection createConnection(String vdb, String propsFile, String addtionalStuff) <span style="color: #7f0055">throws</span> SQLException {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; String url = <span style="color: #2a00ff">"jdbc:metamatrix:"</span>+vdb+<span style="color: #2a00ff">"@"</span> + propsFile+addtionalStuff; <span style="color: #3f7f5f">//$NON-NLS-1$ //$NON-NLS-2$</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7f0055">return</span> (com.metamatrix.jdbc.api.Connection)DriverManager.getConnection(url);&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; } &nbsp; &nbsp;</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<br class="webkit-block-placeholder"></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px">&nbsp;&nbsp; &nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; <span style="color: #7f0055">protected</span> <span style="color: #7f0055">void</span> helpTest(String query, String[] expected, String vdb, String props, String urlProperties) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; getConnection(vdb, props, urlProperties);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; executeAndAssertResults(query, expected);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; closeConnection();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">With these changes, tt would enable the extender to control how the connection is created (i.e., from the MMDataSource).</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">Van</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br></div></div><br><div><div>On Aug 27, 2009, at 10:23 AM, Ramesh Reddy wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Van,<br><br>This class is utility class, in most situations it is extended by a<br>another class to write the test.<br><br>If you are looking to to provide abstractions for connections you can<br>certainly/override the "getConnection" calls or add others. You can<br>refactor to suit the needs, I just wondering if that requires pushing<br>the functionality to a base class (as this is already functionally a<br>abstract class)?<br><br>Thanks<br><br>Ramesh..<br><br>On Thu, 2009-08-27 at 09:59 -0500, Van Halbert wrote:<br><blockquote type="cite">I would like to refactor AbstractMMQueryTestCase by pushing its core &nbsp;<br></blockquote><blockquote type="cite">logic further down (new base class) for executing queries, comparing &nbsp;<br></blockquote><blockquote type="cite">results, and common actions on the connection, etc. so that it can &nbsp;<br></blockquote><blockquote type="cite">reused (extended) for any manner of tests that, in the end, use a &nbsp;<br></blockquote><blockquote type="cite">Connection. &nbsp;&nbsp;&nbsp;Also, this core logic is basic to jdbc testing and &nbsp;<br></blockquote><blockquote type="cite">therefore would like to reuse this in the, soon to becoming, &nbsp;<br></blockquote><blockquote type="cite">integration test project for testing transactions and running the ctc &nbsp;<br></blockquote><blockquote type="cite">tests. &nbsp;&nbsp;&nbsp;&nbsp;There was already a similar class, from whence it came &nbsp;<br></blockquote><blockquote type="cite">from, in the JBEDSP integration test project. &nbsp;&nbsp;So I would to &nbsp;<br></blockquote><blockquote type="cite">consolidate this logic.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Any comments, complaints, suggestions, please speak up. &nbsp;&nbsp;&nbsp;Otherwise I &nbsp;<br></blockquote><blockquote type="cite">will commence with refactoring tomorrow.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Van Halbert<br></blockquote><blockquote type="cite">Principal Software Eng.<br></blockquote><blockquote type="cite">Red Hat, Inc.<br></blockquote><blockquote type="cite">------<br></blockquote><blockquote type="cite"><a href="mailto:vhalbert@redhat.com">vhalbert@redhat.com</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">teiid-dev mailing list<br></blockquote><blockquote type="cite"><a href="mailto:teiid-dev@lists.jboss.org">teiid-dev@lists.jboss.org</a><br></blockquote><blockquote type="cite"><a href="https://lists.jboss.org/mailman/listinfo/teiid-dev">https://lists.jboss.org/mailman/listinfo/teiid-dev</a><br></blockquote><br></div></blockquote></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="font-size: 12px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Van Halbert</div><div>Principal Software Eng.</div><div>Red Hat, Inc.</div><div>------</div><div><a href="mailto:vhalbert@redhat.com">vhalbert@redhat.com</a></div><div><br></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"> </div><br></body></html>