<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Development</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<meta name="keywords" content="">
<meta name="generator" content"JBake">
<!-- Le styles -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/asciidoctor.css" rel="stylesheet">
<link href="css/base.css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<![endif]-->
<!-- Fav and touch icons -->
<!--<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">-->
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<div id="wrap">
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<ul class="nav navbar-nav">
<li><a href=".">p4oauth</a></li>
<li><a href="overview.html">Overview</a></li>
<li><a href="configuration.html">Configuration</a></li>
<li><a href="api.html">API</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="../javadoc">Javadoc</a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<h1>P4OAuth Development</h1><p>Most of the build tasks are run using <a href="http://www.gradle.org">gradle</a>, which is generally what your IDE should be able to import for doing development. This has only been imported with IDEA, which works, so YMMV if you use anything else like Eclipse.</p><h2>Testing</h2><p>The only tests right now are system tests developed in the <code>functional_tests</code> subproject. To run, you'll need:</p>
<ol>
<li>A running p4d</li>
<li>A running p4oauth server</li>
<li>An example "Test server" of a test client integration</li>
</ol><p>The tests themselves use <a href="http://testng.org/doc/index.html">TestNG</a>, but assume the above services are running.</p><p>You <em>can</em> use the following gradle tasks to set up your environment. These gradle commands should set up a keystore for you using the <code>keytool</code> command. They also set up temporary working configurations which you might find useful.</p><h4>Setup p4d</h4><p>This command really only needs to be run once:</p>
<pre><code> % cd functional_tests
% ./gradlew initPerforce
</code></pre><p>From there, a p4d should be running at <code>localhost:1666</code>.</p><p>You can restart the p4d instance via:</p>
<pre><code> % cd functional_tests
% ./gradlew startPerforce
</code></pre><p>In general though, the other services will do this automatically.</p><h5>Start/Stop p4oauth</h5><p>If you want, you can execute a p4oauth service in the background:</p>
<pre><code> % ./gradlew assemble
% cd functional_tests
% ./gradlew startP4Oauth
</code></pre><p>This runs P4OAuth using the <code>p4oauth.jar</code> that should be built in the <code>build/libs</code> folder of the project.</p><h4>Start/Stop Test Server</h4><p>A test client server is used by tests that access the local p4d and list files (to just ensure we can in fact do something with the login token). Like p4oauth, you'll have to first assemble the test server.</p>
<pre><code>% cd functional_tests
% ./gradlew :test_server:assemble
% ./gradlew startTestServer
</code></pre><h1>To Do List</h1>
<ol>
<li>Define and document kinds of error situations when the user may have a bad set of p4d tokens</li>
</ol>
</div>
</div><!-- #wrap -->
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>