blob: 91995f1961db811fab094383cf9f30358db38258 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.3">
<link rel="apple-touch-icon" sizes="180x180" href="/img/favicon/apple-touch-icon-04cb17e028.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon/favicon-32x32-12431ee8eb.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon/favicon-16x16-4f316e4d55.png">
<link rel="manifest" href="/img/favicon/manifest-65e6aaa49e.json">
<link rel="mask-icon" href="/img/favicon/safari-pinned-tab-558c1991b1.svg" color="#dc5656">
<link rel="shortcut icon" href="/img/favicon/favicon-6cef91375b.ico">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/img/favicon/mstile-144x144-34e7696278.png">
<meta name="msapplication-config" content="/img/favicon/browserconfig-82ff158058.xml">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="https://cayenne.apache.org/css/styles-9ee2e6e330.css"/>
<script src="https://cayenne.apache.org/js/bundle-c0e6356367.js"></script>
<script src="https://www.apachecon.com/event-images/snippet.js"></script>
<title>Legacy Ant Unit Tests &middot; Apache Cayenne</title>
</head>
<body>
<header class="page-header">
<nav id="topbar" class="bg-dark" aria-label="breadcrumb" role="navigation">
<ul class="breadcrumb breadcrumb-sm breadcrumb-dark container mb-0">
<li class="breadcrumb-item dropdown">
<a class="dropdown-toggle text-nowrap pr-1" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img class="mw-15px mr-1" src="/img/feather-641aa69d09.svg" />Apache Software Foundation</a>
<div class="dropdown-menu rounded-0" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="https://www.apache.org">Apache Homepage</a>
<a class="dropdown-item" href="https://www.apache.org/licenses/">License</a>
<a class="dropdown-item" href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a>
<a class="dropdown-item" href="https://www.apache.org/foundation/thanks.html">Thanks</a>
<a class="dropdown-item" href="https://www.apache.org/security/">Security</a>
<a class="dropdown-item" href="https://privacy.apache.org/policies/privacy-policy-public.html">Privacy</a>
<a class="ml-1 mt-1 acevent" data-format="wide" data-mode="dark" data-width="120"></a>
</div>
</li>
</ul>
</nav>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="https://cayenne.apache.org/">
<img src="/img/logo_mono_full-d7a19eef61.svg" alt="Apache Cayenne" />
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#mainMenu" aria-controls="mainMenu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="mainMenu">
<ul class="navbar-nav mt-3 mt-lg-0 mr-auto">
<li class="nav-item">
<a class="nav-link" href="/download/">DOWNLOAD</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/docs/4.2/getting-started-guide/">DOCUMENTATION</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about/support/">SUPPORT</a>
</li>
</ul>
<ul class="navbar-nav flex-row justify-content-center mt-2 mt-lg-0 mb-2 mb-lg-0 " id="social-links-menu">
<li class="nav-item d-flex">
<a class="nav-link d-flex justify-content-center align-items-center" href="https://github.com/apache/cayenne">
<img src="/img/icon_octocat_stars-c24dac94b8.svg" alt="GitHub" />
</a>
</li>
<li class="nav-item d-flex">
<a class="nav-link d-flex justify-content-center align-items-center" href="https://twitter.com/ApacheCayenne">
<img src="/img/icon_twitter-220a129d14.svg" alt="Twitter" />
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<main class="container py-5">
<section>
<article>
<h1 class="text-center">Legacy Ant Unit Tests</h1>
<p>Cayenne provides a comprehensive suite of unit tests. To execute unit tests
you must first <a href="/dev/code-repository.html">get Cayenne from SVN</a>
, install JDK 1.5 and obtain the latest Ant.</p>
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
<h2 id="summary-of-build-properties">Summary of Build Properties</h2>
<p>These properties can be passed to ant build via <em>-DpropName=value</em>.</p>
<p>{.table .table-bordered}
Property | Description
&mdash;&mdash;&mdash;|&mdash;&mdash;&mdash;&mdash;
<em>cayenne.test.connection</em> | Named connection source (see below)
<em>test.filter</em> | Running a subset of tests (see below)
<em>cayenne.test.schema.skip</em> | If &ldquo;true&rdquo;, won&rsquo;t attempt to recreate the test database, i.e. the database must already be present.</p>
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
<h2 id="running-against-embedded-hsqldb">Running Against Embedded HSQLDB</h2>
<p>No extra setup is required. Just run Ant:</p>
<pre><code># cd cayenne/cayenne-ant
# ant test
</code></pre>
<p>Optionally you may run JDK 1.4 tests only (e.g. if you don&rsquo;t have JDK 1.5
on your machine):</p>
<pre><code># cd cayenne/cayenne-ant
# ant test-1_4
</code></pre>
<p>This will use an embedded HSQLDB. Running tests against your own database
requires a few extra steps described below.</p>
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
<h2 id="running-against-a-specific-database">Running Against a Specific Database</h2>
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
<h4 id="step-1-configure-one-or-more-data-sources">Step 1: Configure One or More Data Sources</h4>
<p>Create a directory <em>$HOME/.cayenne/</em> and place a file called
<em>connection.properties</em> in this directory. File contents should be
similar to this example:</p>
<pre><code>example1.cayenne.adapter = org.apache.cayenne.dba.mysql.MySQLAdapter
example1.jdbc.username = someuser
example1.jdbc.password = somepasswd
example1.jdbc.url = jdbc:someurl1
example1.jdbc.driver = com.xyz.MyDriverClass
example2.cayenne.adapter = org.apache.cayenne.dba.oracle.OracleAdapter
example2.jdbc.username = someuser
example2.jdbc.password = somepasswd
example2.jdbc.url = jdbc:someurl2
example2.jdbc.driver = com.xyz.MyDriverClass
</code></pre>
<p>Each key starts with an identifier for a datasource. In the file above,
&ldquo;example1&rdquo; and &ldquo;example2&rdquo; are such identifiers. They can be arbitrary
strings without &ldquo;.&rdquo; (dot) symbols.</p>
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
<h4 id="step-2-run-tests-against-configured-data-source">Step 2. Run Tests Against Configured Data Source</h4>
<pre><code># cd cayenne/cayenne-ant
# ant test -Dcayenne.test.connection=example1
</code></pre>
<p>Substitute &ldquo;example1&rdquo; with a name of your data source configured in the
previous step. In case of total success, one of the last messages Ant
prints on console is BUILD SUCCESSFUL. If build fails, failure report is
generated in HTML format under
<em>cayenne/cayenne-ant/build/tests-report-example1/index.html</em> and can be
viewed using a web browser (again, substitute &ldquo;example1&rdquo; in this path with
the name of data source used).</p>
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
<h2 id="filtering-tests">Filtering Tests</h2>
<p>To run only a subset of test cases, Ant-style pattern matching can be used.
A property called <em>test.filter</em> defines a set of class files to be run.
For instance to run only tests from the &ldquo;tools&rdquo; package, the following
startup parameters can be used:</p>
<pre><code># cd cayenne/cayenne-ant
# ant test -Dcayenne.test.connection=example1 -Dtest.filter=&quot;**/tools/*Tst.class&quot;
</code></pre>
</article>
</section>
</main>
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=5c836e39-be6b-4a21-a946-a97b5b69f172" />
<footer class="bg-dark">
<div class="footer-nav container text-center text-lg-left pb-3">
<div class="row pt-5 pb-3">
<div class="col-sm-6 col-lg-3">
<h4>About</h4>
<ul class="list-unstyled">
<li>
<a href="/why-cayenne.html">Why Cayenne?</a>
</li>
<li>
<a href="/download/">Download</a>
</li>
<li>
<a href="/success-stories.html">Success Stories</a>
</li>
<li>
<a href="/about/support/">Support</a>
</li>
</ul>
</div>
<div class="col-sm-6 col-lg-3">
<h4>Documentation</h4>
<ul class="list-unstyled">
<li>
<a href="/docs/4.0/getting-started-guide/">Getting Started (4.0)</a>
</li>
<li>
<a href="/docs/4.1/getting-started-guide/">Getting Started (4.1)</a>
</li>
<li>
<a href="/docs/4.2/getting-started-guide/">Getting Started (4.2)</a>
</li>
<li>
<a href="/docs/4.0/cayenne-guide/">Cayenne Guide (4.0)</a>
</li>
<li>
<a href="/docs/4.1/cayenne-guide/">Cayenne Guide (4.1)</a>
</li>
<li>
<a href="/docs/4.2/cayenne-guide/">Cayenne Guide (4.2)</a>
</li>
<li>
<a href="/docs/4.1/getting-started-db-first/">Database First tutorial (4.1)</a>
</li>
<li>
<a href="/docs/4.2/getting-started-db-first/">Database First tutorial (4.2)</a>
</li>
<li>
<a href="/legacy/legacy-docs/">Legacy Documentation</a>
</li>
</ul>
</div>
<div class="col-sm-6 col-lg-3">
<h4>Collaboration</h4>
<ul class="list-unstyled">
<li>
<a href="https://issues.apache.org/jira/browse/CAY">Bug/Feature Tracker</a>
</li>
<li>
<a href="/mailing-lists.html">Mailing Lists</a>
</li>
<li>
<a href="/dev/code-repository.html">Code Repository</a>
</li>
<li>
<a href="/dev/">Developer Guide</a>
</li>
<li>
<a href="/how-can-i-help.html">How can I help?</a>
</li>
<li>
<a href="/contributors.html">Contributors</a>
</li>
<li>
<a href="/thanks.html">Thanks</a>
</li>
</ul>
</div>
<div class="col-sm-6 col-lg-3">
<h4>News</h4>
<ul class="list-multiline-items list-unstyled mb-0">
<li>
<time datetime="2023-05-25 18:00:00 &#43;0300 &#43;0300" class="xsmall d-block">May 25, 2023</time>
<a href="/2023/05/cayenne-42-final-released/">Cayenne 4.2 Final Released</a>
</li>
<li>
<time datetime="2023-03-02 12:00:00 &#43;0300 &#43;0300" class="xsmall d-block">Mar 02, 2023</time>
<a href="/2023/03/cayenne-403-released/">Cayenne 4.0.3 Released</a>
</li>
<li>
<time datetime="2022-12-05 12:00:00 &#43;0300 &#43;0300" class="xsmall d-block">Dec 05, 2022</time>
<a href="/2022/12/cayenne-42rc2-released/">Cayenne 4.2 Release Candidate 2 Released</a>
</li>
</ul>
<a class="btn-link text-uppercase xsmall" href="https://cayenne.apache.org/news">
More news
<i class="fa fa-lg fa-long-arrow-right" aria-hidden="true"></i>
</a>
</div>
</div>
<hr class="mt-0 mb-3" />
<p class="copy xsmall text-center mw-75 mx-auto mb-0">
Copyright © 2001-2024 Apache Software Foundation. Apache Cayenne, Cayenne, Apache, the Apache feather logo, and the Apache Cayenne project logo are trademarks of The Apache Software Foundation.
<a href="https://privacy.apache.org/policies/privacy-policy-public.html">Privacy policy</a>.
<img class="d-block mx-auto mt-2" src="/img/logo_mono-3302daa3cf.svg" alt="Apache Cayenne" />
</p>
</div>
</footer>
</body>
</html>