blob: e99aa3a93621456ae8cfb0336ac0d55939d95b45 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>PLC4X &#x2013; </title>
<script src="../js/jquery.slim.min.js" type="text/javascript"></script>
<!--script src="../js/popper.min.js" type="javascript"></script-->
<script src="../js/bootstrap.bundle.min.js" type="text/javascript"></script>
<!-- The tooling for adding images and links to Apache events -->
<script src="https://www.apachecon.com/event-images/snippet.js" type="text/javascript"></script>
<!-- FontAwesome -->
<link rel="stylesheet" href="../css/all.min.css" type="text/css"/>
<!-- Bootstrap -->
<link rel="stylesheet" href="../css/bootstrap.min.css" type="text/css"/>
<!-- Some Maven Site defaults -->
<link rel="stylesheet" href="../css/maven-base.css" type="text/css"/>
<link rel="stylesheet" href="../css/maven-theme.css" type="text/css"/>
<!-- The PLC4X version of a bootstrap theme -->
<link rel="stylesheet" href="../css/themes/plc4x.css" type="text/css" id="pagestyle"/>
<!-- A custom style for printing content -->
<link rel="stylesheet" href="../css/print.css" type="text/css" media="print"/>
<meta http-equiv="Content-Language" content="en"/>
</head>
<body class="composite">
<nav class="navbar navbar-light navbar-expand-md bg-faded justify-content-center border-bottom">
<!--a href="/" class="navbar-brand d-flex w-50 mr-auto">Navbar 3</a-->
<a href="https://plc4x.apache.org/" id="bannerLeft"><img src="../images/apache_plc4x_logo_small.png" alt="Apache PLC4X"/></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsingNavbar3">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse w-100" id="collapsingNavbar3">
<ul class="navbar-nav w-100 justify-content-center">
<li class="nav-item">
<a class="nav-link" href="../index.html">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../users/index.html">Users</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="../developers/index.html">Developers</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../apache/index.html">Apache</a>
</li>
</ul>
<ul class="nav navbar-nav ml-auto justify-content-end">
<li class="nav-item row valign-middle">
<a class="acevent" data-format="wide" data-mode="light" data-event="random" style="width:240px;height:60px;"></a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
<div class="row h-100">
<nav class="col-sm-push col-md-2 pt-3 sidebar">
<div class="sidebar-sticky">
<ul class="nav flex-column">
<li class="nav-item">
<a href="../developers/infrastructure/issues.html" class="nav-link">Bug & Issue Tracker</a>
</li>
<li class="nav-item">
<a href="../developers/index.html" class="nav-link">Section Home</a>
</li>
<li class="nav-item">
<a href="../developers/preparing/index.html" class="nav-link">Preparing your Computer</a>
<ul class="flex-column pl-4 nav">
<li class="nav-item">
<a href="../developers/preparing/linux.html" class="nav-link">Linux</a>
</li>
<li class="nav-item">
<a href="../developers/preparing/macos.html" class="nav-link">Mac OS</a>
</li>
<li class="nav-item">
<a href="../developers/preparing/windows.html" class="nav-link">Windows</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="../developers/building.html" class="nav-link">Building</a>
</li>
<li class="nav-item">
<a href="../developers/contributing.html" class="nav-link">Contributing</a>
</li>
<li class="nav-item">
<a href="../developers/tutorials/index.html" class="nav-link">Tutorials</a>
<ul class="flex-column pl-4 nav">
<li class="nav-item">
<a href="../developers/tutorials/writing-driver.html" class="nav-link">Writing Drivers</a>
</li>
<li class="nav-item">
<a href="../developers/tutorials/testing-serializers-and-parsers.html" class="nav-link">Testing Drivers</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="../developers/code-gen/index.html" class="nav-link">Code Generation</a>
<ul class="flex-column pl-4 nav">
<li class="nav-item">
<a href="../developers/code-gen/protocol/mspec.html" class="nav-link">Protocol: MSpec Format</a>
</li>
<li class="nav-item">
<a href="../developers/code-gen/language/freemarker.html" class="nav-link">Language: Apache Freemarker</a>
</li>
<li class="nav-item">
<a href="../developers/code-gen/protocol/df1.html" class="nav-link">Example: DF1 MSpec</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="../developers/infrastructure/index.html" class="nav-link">Infrastructure</a>
<ul class="flex-column pl-4 nav">
<li class="nav-item">
<a href="../developers/infrastructure/ci.html" class="nav-link">Continuous Integration</a>
</li>
<li class="nav-item">
<a href="../developers/infrastructure/issues.html" class="nav-link">Bug & Issue Tracker</a>
</li>
<li class="nav-item">
<a href="../developers/infrastructure/sonar.html" class="nav-link">Code Analysis</a>
</li>
<li class="nav-item">
<a href="../developers/infrastructure/wiki.html" class="nav-link">Wiki</a>
</li>
<li class="nav-item">
<a href="../developers/infrastructure/vm.html" class="nav-link">Build VM</a>
</li>
<li class="nav-item">
<a href="../developers/infrastructure/website.html" class="nav-link">Website</a>
</li>
<li class="nav-item">
<a href="../developers/infrastructure/vpn.html" class="nav-link">IoT VPN</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="../developers/release/index.html" class="nav-link">Releasing</a>
<ul class="flex-column pl-4 nav">
<li class="nav-item">
<a href="../developers/release/release.html" class="nav-link">Releasing</a>
</li>
<li class="nav-item">
<a href="../developers/release/validation.html" class="nav-link">Validating</a>
</li>
<li class="nav-item">
<a href="../developers/release/build-tools.html" class="nav-link">Releasing Build-Tools</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="../developers/tools.html" class="nav-link">Tools</a>
</li>
<li class="nav-item">
<a href="../developers/team.html" class="nav-link">Team</a>
</li>
<li class="nav-item">
<a href="../developers/decisions.html" class="nav-link">Decision Making</a>
</li>
<li class="nav-item">
<a href="../developers/maturity.html" class="nav-link">Maturity</a>
</li>
</ul>
</div>
</nav>
<main role="main" class="ml-sm-auto px-4 col-sm-pull col-md-9 col-lg-10 h-100">
<div class="sect1">
<h2 id="using_jqassistant">Using JQAssistant</h2>
<div class="sectionbody">
<div class="paragraph">
<p>In PLC4X we are using a tool called <code><a href="https://jqassistant.org/">JQAssistant</a></code> for enforcing quality assurance rules.</p>
</div>
<div class="paragraph">
<p><code>JQAssistant</code> can be thought of as a set of two components:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>A set of scanners that analyse a project and stores the gathered information in for of linked graphs in a Neo4j database.</p>
</li>
<li>
<p>An engine that executes defined rules against the graph created during the scan phase of the build</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>These rules can produce either reports and tables or they are used to enforce rules.</p>
</div>
<div class="paragraph">
<p>If a pre-defined rule is violated the failed checks can be marked as <code>warning</code> or <code>error</code> that breaks the build.</p>
</div>
<div class="paragraph">
<p>In contrast to using the <code>maven-enforcer-plugin</code> doing cross-domain checks is really simple as all information is available in one big graph.</p>
</div>
<div class="paragraph">
<p>Currently the following scanners are active:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>CDI</p>
</li>
<li>
<p>Common</p>
</li>
<li>
<p>Common Test</p>
</li>
<li>
<p>Core Analysis</p>
</li>
<li>
<p>EJB3</p>
</li>
<li>
<p>GraphML</p>
</li>
<li>
<p>JAX-RS</p>
</li>
<li>
<p>JPA 2</p>
</li>
<li>
<p>JSON</p>
</li>
<li>
<p>JUnit</p>
</li>
<li>
<p>Java</p>
</li>
<li>
<p>Java 9</p>
</li>
<li>
<p>Java EE 6</p>
</li>
<li>
<p>Maven 3</p>
</li>
<li>
<p>OSGi</p>
</li>
<li>
<p>RDBMS</p>
</li>
<li>
<p>TestNG</p>
</li>
<li>
<p>Tycho</p>
</li>
<li>
<p>XML</p>
</li>
<li>
<p>YAML</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>These rules that are automatically checked during the build are defined in <code>src/jjqassistant</code>.
If defined in a reactor project, the rules apply to all modules of that (sub-)reactor.
So if they are defined in the root module of the project, it applies to all modules.</p>
</div>
<div class="sect2">
<h3 id="defining_jqassistant_rules">Defining JQAssistant rules</h3>
<div class="paragraph">
<p>TODO: Finish this "little detail" &#8230;&#8203;</p>
</div>
</div>
<div class="sect2">
<h3 id="using_the_web_ui">Using the Web-UI</h3>
<div class="paragraph">
<p>The scan and analysis is automatically performed during a normal Maven build.
In order to do ad-hoc queries against the project or develop new rules, the Web-UI is very helpful.</p>
</div>
<div class="paragraph">
<p>To start the Web-UI, all you need to do, is run the following command (after a build):</p>
</div>
<div class="literalblock">
<div class="content">
<pre>mvn jqassistant:server</pre>
</div>
</div>
<div class="paragraph">
<p>This will start a Neo4j server with web console.</p>
</div>
<div class="literalblock">
<div class="content">
<pre>[INFO] --- jqassistant-maven-plugin:1.3.0:server (default-cli) @ plclogger ---
[INFO] Connecting to store at 'file:/Users/christofer.dutz/Projects/Apache/PLC4X/target/jqassistant/store/'
2018-04-05 19:11:14.369+0200 INFO [o.n.s.CommunityNeoServer] No SSL certificate found, generating a self-signed certificate..
2018-04-05 19:11:14.683+0200 INFO [o.n.s.CommunityNeoServer] Starting HTTP on port 7474 (8 threads available)
2018-04-05 19:11:14.859+0200 INFO [o.n.s.w.Jetty9WebServer] Mounting static content at /webadmin
2018-04-05 19:11:14.892+0200 INFO [o.n.s.w.Jetty9WebServer] Mounting static content at /browser
Apr 05, 2018 7:11:15 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFORMATION: Initiating Jersey application, version 'Jersey: 1.19 02/11/2015 03:25 AM'
Apr 05, 2018 7:11:15 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFORMATION: Initiating Jersey application, version 'Jersey: 1.19 02/11/2015 03:25 AM'
Apr 05, 2018 7:11:15 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFORMATION: Initiating Jersey application, version 'Jersey: 1.19 02/11/2015 03:25 AM'
2018-04-05 19:11:15.396+0200 INFO [o.n.s.CommunityNeoServer] Remote interface ready and available at http://localhost:7474/
[INFO] Running server for module org.apache.plc4x:plc4x-parent:0.0.1-SNAPSHOT
[INFO] Press &lt;Enter&gt; to finish.</pre>
</div>
</div>
<div class="paragraph">
<p>So when visiting the anounced url with a browser, you can use the pretty useful neo4j web console.</p>
</div>
<div class="imageblock">
<div class="content">
<img src="../images/neo4j-web-console.png" alt="Neo4j Web Console"/>
</div>
</div>
</div>
<div class="sect2">
<h3 id="using_intellij_idea">Using IntelliJ Idea</h3>
<div class="paragraph">
<p>IntelliJ comes with some interesting Neo4J support. Unfortunately this only supports <code>Neo4j 3</code>.</p>
</div>
<div class="paragraph">
<p>Unfortunately the process of enabling this toolset is a little less comfortable than the Web-UI version.</p>
</div>
<div class="paragraph">
<p>Even if JQAssistant uses <code>Neo4j 2</code> per default, we can force it to use <code>Neo4j 3</code> by providing an additional commandline parameter.</p>
</div>
<div class="literalblock">
<div class="content">
<pre>mvn -Djqassistant.neo4jVersion=3 clean install</pre>
</div>
</div>
<div class="paragraph">
<p>JQAssistant uses Neo4j 3 and the resulting data directory is then in Neo4j 3 format.</p>
</div>
<div class="paragraph">
<p>In this case the server has to be started with the same parameter:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>mvn -Djqassistant.neo4jVersion=3 jqassistant:server</pre>
</div>
</div>
<div class="paragraph">
<p>As soon as the server is started, we can connect from the IntelliJ plugin.</p>
</div>
<div class="paragraph">
<p>Note: The connection settings also contain a username and a password.</p>
</div>
<div class="imageblock">
<div class="content">
<img src="../images/neo4j-intellij-settings.png" alt="neo4j intellij settings" width="800"/>
</div>
</div>
<div class="paragraph">
<p>It appears that this can simply be left empty of can contain random values.</p>
</div>
<div class="paragraph">
<p>After creating the connection, the <code>Graph Neo4j</code> view should list the new connection.</p>
</div>
<div class="imageblock">
<div class="content">
<img src="../images/neo4j-intellij-database-connections-view.png" alt="neo4j intellij database connections view" width="300"/>
</div>
</div>
<div class="paragraph">
<p>You can now use this to perform queries</p>
</div>
<div class="imageblock">
<div class="content">
<img src="../images/neo4j-intellij-query-results.png" alt="neo4j intellij query results" width="800"/>
</div>
</div>
</div>
</div>
</div>
</main>
<footer class="pt-4 my-md-5 pt-md-5 w-100 border-top">
<div class="row justify-content-md-center" style="font-size: 13px">
<div class="col col-6 text-center">
Copyright &#169; 2017&#x2013;2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>.
All rights reserved.<br/>
Apache PLC4X, PLC4X, Apache, the Apache feather logo, and the Apache PLC4X project logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
<br/><div style="text-align:center;">Home screen image taken from <a
href="https://flic.kr/p/chEftd">Flickr</a>, "Tesla Robot Dance" by Steve Jurvetson, licensed
under <a href="https://creativecommons.org/licenses/by/2.0/">CC BY 2.0 Generic</a>, image cropped
and blur effect added.</div>
</div>
</div>
</footer>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../js/jquery.slim.min.js"></script>
<script src="../js/popper.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script type="text/javascript">
$('.carousel .carousel-item').each(function(){
var next = $(this).next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
for (let i = 0; i < 3; i++) {
next=next.next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
}
});
</script>
</body>
</html>