SlideShare a Scribd company logo
1 of 83
Download to read offline
by 
Analysis of software systems using 
jQAssistant and Neo4j 
E-­‐POST Tech Talk & 
JUG Berlin-­‐Brandenburg 
Dirk Mahler
2 
AGENDA 
§ About 
Structures, 
Rules 
And 
Code 
§ So4ware 
As 
A 
Graph 
§ Demo#1 
§ jQAssistant 
§ Demo#2
Analysis of soAware systems using jQAssistant and Neo4j 
About Structures, Rules And Code 
3
4 
§ Sketch 
of 
an 
architecture
5 
§ Sketch 
of 
an 
architecture 
My 
Big 
Fat 
Demo 
ApplicaJon
6 
§ Sketch 
of 
an 
architecture 
- Business 
modules 
Usermanagement 
Shopping 
Cart
7 
§ Sketch 
of 
an 
architecture 
- Allowed 
dependencies 
between 
business 
modules 
Usermanagement 
Shopping 
Cart
8 
§ Sketch 
of 
an 
architecture 
- Technical 
layering 
JSF-­‐UI 
REST 
Business 
Logic 
Persistence 
JSF-­‐UI 
REST 
Business 
Logic 
Persistence
9 
§ Sketch 
of 
an 
architecture 
- Allowed 
dependencies 
between 
technical 
layers 
JSF-­‐UI 
REST 
Business 
Logic 
Persistence 
JSF-­‐UI 
REST 
Business 
Logic 
Persistence
10 
§ Sketch 
of 
an 
architecture 
- Allowed 
dependencies 
between 
business 
modules 
and 
technical 
layers 
JSF-­‐UI 
REST 
Business 
Logic 
Persistence 
JSF-­‐UI 
REST 
Business 
Logic 
Persistence
11 
§ Sketch 
of 
an 
architecture 
- Allowed 
dependencies 
between 
business 
modules 
and 
technical 
layers 
JSF-­‐UI 
REST 
Business 
Logic 
Persistence 
JSF-­‐UI 
REST 
Business 
Logic 
Persistence
12 
§ Sketch 
of 
an 
architecture 
- AbstracJon 
between 
layers 
(API 
vs. 
ImplementaJon) 
JSF-­‐UI 
REST 
Business 
Logic 
Persistence 
JSF-­‐UI 
REST 
Business 
Logic 
Persistence
13 
§ Sketch 
of 
an 
architecture 
- Forbidden 
dependency 
JSF-­‐UI 
REST 
Business 
Logic 
Persistence 
JSF-­‐UI 
REST 
Business 
Logic 
Persistence
14 
§ Sketch 
of 
an 
architecture 
- Allowed 
external 
dependencies 
per 
layer 
JSF-­‐UI 
REST 
EJB 
JPA 
JSF-­‐UI 
REST 
Business 
Logic 
Persistence
§ TranslaJon 
of 
architecture 
rules 
into 
the 
project 
structure 
- Java 
language 
element: 
Package 
org.jqassistant.demo 
15
§ TranslaJon 
of 
architecture 
rules 
into 
the 
project 
structure 
- Java 
language 
element: 
Package 
- DefiniJon 
of 
business 
modules 
on 
„top 
level“ 
16 
Shopping 
Cart 
„org.jqassistant.demo.cart“ 
Usermanagement 
„org.jqassistant.demo.user“
17 
§ TranslaJon 
of 
architecture 
rules 
into 
the 
project 
structure 
- Java 
language 
element: 
Package 
- Technical 
layers 
§ …demo.cart.ui 
§ …demo.cart.rest 
§ …demo.cart.logic 
§ …demo.cart.persistence 
JSF-­‐UI 
REST 
Business 
Logic 
Persistence
18 
§ TranslaJon 
of 
architecture 
rules 
into 
the 
project 
structure 
- Java 
language 
element: 
Package 
- Technical 
layers 
§ …demo.cart.ui 
§ …demo.cart.rest 
§ …demo.cart.logic.api 
§ …demo.cart.logic.impl 
§ …demo.cart.persistence.api 
§ …demo.cart.persistence.impl 
JSF-­‐UI 
REST 
Business 
Logic 
Persistence
19 
§ Package 
Names 
- All 
packages 
in 
a 
Maven 
module 
must 
be 
prefixed 
with 
$ 
{groupId}.${arJfactId} 
- Example: 
groupId=org.jqassistant 
arJfactId=demo 
=> 
org.jqassistant.demo
20 
§ Class 
Names 
- Message 
Driven 
Beans 
must 
have 
a 
suffix 
„MDB“.
21 
§ Class 
locaJon 
- JPA 
enJJes 
must 
be 
located 
in 
„api.model“ 
packages.
22 
§ Test 
design 
- Every 
test 
method 
must 
contain 
at 
least 
one 
asserJon. 
- Each 
asserJon 
must 
provide 
a 
human 
readable 
message.
23 
§ AbstracJon 
- Remote 
APIs 
must 
be 
interfaces 
declaring 
only 
primiJves 
or 
immutables 
as 
parameter 
or 
return 
types. 
- OSGi-­‐Bundles 
must 
only 
export 
dedicated 
API 
packages.
24 
Source 
Code 
Java, 
ProperJes, 
XML, 
YML 
„Code 
Quality“ 
Complexity 
Maintainability 
Erosion
25 
Source 
Code 
Java, 
ProperJes, 
XML, 
YML 
People 
Architect, 
Developer, 
Test 
DocumentaJon 
UML, 
Wiki, 
readme.txt 
Tooling 
Compiler, 
StaJc 
Code 
Analysis, 
CI
26 
§ Source 
Code 
– 
AbstracJon 
levels 
Architecture 
Design 
Module, 
Layer, 
Dependency 
AbstracJon, 
Immutable, 
Factory 
Java 
Package, 
Class, 
Field, 
Method, 
AnnotaJon 
File 
System 
Folder, 
File
27 
§ Source 
Code 
– 
Automated 
validaJon 
Architecture 
Design 
Module, 
Layer, 
Dependency 
AbstracJon, 
Immutable, 
Factory 
Java 
Package, 
Class, 
Field, 
Method, 
AnnotaJon 
File 
System 
Folder, 
File
28 
§ Java 
elements 
represent 
higher 
level 
concepts 
- Package 
ó 
Module 
- Annotated 
Class 
ó 
EnJty 
§ Constraints 
apply 
to 
these 
concepts 
- JPA 
enJJes 
must 
be 
located 
in 
„api.model“ 
packages
29 
§ Visibility 
of 
concepts 
and 
constraints 
- Explicit 
§ @Test 
- Implicit 
§ Every 
test 
method 
must 
contain 
at 
least 
one 
asserJon. 
- Invisible 
§ java.uJl.Calendar 
must 
not 
be 
used 
directly.
30 
§ Concepts 
and 
Constraints 
- How 
to 
make 
them 
visible? 
- Is 
there 
a 
language 
to 
describe 
them?
Analysis of soAware systems using jQAssistant and Neo4j 
Software As A Graph 
31
32 
§ All 
we 
need 
is… 
- Nodes 
- Labels 
- ProperJes 
- RelaJonships 
§ Modeling 
is 
just… 
- Taking 
a 
pen 
- Drawing 
the 
structures 
on 
a 
whiteboard 
(i.e. 
the 
database) 
§ We 
don‘t 
need… 
- Foreign 
keys 
- Tables 
and 
schemas 
- Knowledge 
in 
graph 
theory
Project 
ArJfact 
Maven 
CONTAINS 
Package 
name:org 
CONTAINS 
Package 
name:jqassistant 
CONTAINS 
Package 
name:usermanagement 
CONTAINS 
Package 
name:api 
CONTAINS 
Package 
name:model 
name:demo 
CONTAINS 
Package 
name:demo 
CREATES
Type 
Class 
CONTAINS 
CONTAINS 
CONTAINS 
fqn:org.jqassistant.demo. 
usermanagement.api. 
model.Person 
name:Person 
Package 
name:usermanagement 
Package 
name:api 
Package 
name:model 
CONTAINS
AnnotaJon 
ANNOTATED_BY 
Type 
fqn:javax.persistence.EnJty 
OF_TYPE 
Package 
name:usermanagement 
CONTAINS 
Package 
name:api 
CONTAINS 
Package 
name:model 
Type 
Class 
CONTAINS 
fqn:org.jqassistant.demo. 
usermanagement.api. 
model.Person 
name:Person 
CONTAINS
Type 
Class 
CONTAINS 
fqn:org.jqassistant.demo. 
usermanagement.api. 
model.Person 
name:Person 
AnnotaJon 
ANNOTATED_BY 
Type 
fqn:javax.persistence.EnJty 
OF_TYPE 
Package 
name:model
Package 
name:model 
Type 
Class 
CONTAINS 
fqn:org.jqassistant.demo. 
usermanagement.api. 
model.Person 
name:Person 
Type 
fqn:javax.persistence.EnJty 
OF_TYPE 
AnnotaJon 
fqn:org.jqassistant.demo. 
usermanagement.api. 
Model.Customer 
name:Customer 
ANNOTATED_BY 
Type 
EXTENDS 
Class 
OF_TYPE 
AnnotaJon 
ANNOTATED_BY
RETURNS 
READS 
Field 
DECLARES 
name:number 
Package 
name:model 
Type 
Class 
CONTAINS 
fqn:org.jqassistant.demo. 
usermanagement.api. 
model.Person 
name:Person 
Type 
fqn:javax.persistence.EnJty 
OF_TYPE 
fqn:org.jqassistant.demo. 
usermanagement.api. 
Model.Customer 
name:Customer 
Type 
EXTENDS 
Class 
Type 
OF_TYPE 
fqn:int 
DECLARES 
Method 
name:getNumber() 
signature:int 
getNumber() 
AnnotaJon 
ANNOTATED_BY 
OF_TYPE 
AnnotaJon 
ANNOTATED_BY
40 
§ Explore 
an 
applicaJon 
using 
queries 
- Which 
class 
extends 
from 
another 
class? 
EXTENDS 
Type 
Type 
Class 
§ Let‘s 
convert 
this 
to 
ASCII 
art… 
- () 
as 
nodes 
- -­‐[]-­‐> 
as 
directed 
relaJonships
41 
§ Explore 
an 
applicaJon 
using 
queries 
- Which 
class 
extends 
from 
another 
class? 
EXTENDS 
Type 
Type 
Class 
§ Let‘s 
convert 
this 
to 
ASCII 
art… 
- () 
as 
nodes 
- -­‐[]-­‐> 
as 
directed 
relaJonships 
()-­‐[]-­‐>()
42 
§ Explore 
an 
applicaJon 
using 
queries 
- Which 
class 
extends 
from 
another 
class? 
C2 
Type 
C1 
Type 
Class 
EXTENDS 
§ Let‘s 
convert 
this 
to 
ASCII 
art… 
- () 
as 
nodes 
- -­‐[]-­‐> 
as 
directed 
relaJonships 
(c1)-­‐[]-­‐>(c2)
43 
§ Explore 
an 
applicaJon 
using 
queries 
- Which 
class 
extends 
from 
another 
class? 
C2 
Type 
C1 
Type 
Class 
EXTENDS 
§ Let‘s 
convert 
this 
to 
ASCII 
art… 
- () 
as 
nodes 
- -­‐[]-­‐> 
as 
directed 
relaJonships 
(c1)-­‐[:EXTENDS]-­‐>(c2)
44 
§ Explore 
an 
applicaJon 
using 
queries 
- Which 
class 
extends 
from 
another 
class? 
C1 
Type 
Class 
EXTENDS 
§ Let‘s 
convert 
this 
to 
ASCII 
art… 
- () 
as 
nodes 
- -­‐[]-­‐> 
as 
directed 
relaJonships 
C2 
Type 
(c1:Class)-­‐[:EXTENDS]-­‐>(c2:Type)
45 
§ Explore 
an 
applicaJon 
using 
queries 
- Which 
class 
extends 
from 
another 
class? 
C2 
Type 
C1 
Type 
Class 
EXTENDS 
§ Paxern 
matching 
is 
the 
core 
principle 
of 
Cypher 
MATCH 
(c1:Class)-­‐[:EXTENDS]-­‐>(c2:Type) 
RETURN 
c1.fqn, c2.fqn
46 
§ Which 
classes 
contain 
the 
highest 
number 
of 
methods?
47 
§ Which 
classes 
contain 
the 
highest 
number 
of 
methods? 
MATCH 
(class:Class)-­‐[:DECLARES]-­‐>(method:Method)
48 
§ Which 
classes 
contain 
the 
highest 
number 
of 
methods? 
MATCH 
(class:Class)-­‐[:DECLARES]-­‐>(method:Method) 
RETURN 
class.fqn, count(method) as Methods
49 
§ Which 
classes 
contain 
the 
highest 
number 
of 
methods? 
MATCH 
(class:Class)-­‐[:DECLARES]-­‐>(method:Method) 
RETURN 
class.fqn, count(method) as Methods 
ORDER BY 
Methods DESC
50 
§ Which 
classes 
contain 
the 
highest 
number 
of 
methods? 
MATCH 
(class:Class)-­‐[:DECLARES]-­‐>(method:Method) 
RETURN 
class.fqn, count(method) as Methods 
ORDER BY 
Methods DESC 
LIMIT 20
51 
§ Which 
class 
has 
the 
deepest 
inheritance 
hierarchy?
52 
§ Which 
class 
has 
the 
deepest 
inheritance 
hierarchy? 
MATCH 
h=(class:Class)-­‐[:EXTENDS*]-­‐>(super:Type)
53 
§ Which 
class 
has 
the 
deepest 
inheritance 
hierarchy? 
MATCH 
h=(class:Class)-­‐[:EXTENDS*]-­‐>(super:Type) 
RETURN 
class.fqn, length(h) as Depth
54 
§ Which 
class 
has 
the 
deepest 
inheritance 
hierarchy? 
MATCH 
h=(class:Class)-­‐[:EXTENDS*]-­‐>(super:Type) 
RETURN 
class.fqn, length(h) as Depth 
ORDER BY 
Depth desc
55 
§ Which 
class 
has 
the 
deepest 
inheritance 
hierarchy? 
MATCH 
h=(class:Class)-­‐[:EXTENDS*]-­‐>(super:Type) 
RETURN 
class.fqn, length(h) as Depth 
ORDER BY 
Depth desc 
LIMIT 20
56 
§ Which 
classes 
are 
affected 
by 
IOExcepJons? 
MATCH 
(e:Type)-­‐[:DECLARES]-­‐>(init:Constructor) 
WHERE 
e.fqn="java.io.IOException" 
WITH 
e,init 
MATCH 
(type:Type)-­‐[:DECLARES]-­‐>(method:Method), 
path=(method)-­‐[:INVOKES*]-­‐>(init) 
RETURN 
e,type,path 
LIMIT 10
Analysis of soAware systems using jQAssistant and Neo4j 
Demo #1 
57
Analysis of soAware systems using jQAssistant and Neo4j 
jQAssistant 
58
59 
§ Project 
Homepage 
- hxp://jqassistant.org 
§ Open 
Source 
- GPL 
v3 
§ Milestone 
- 1.0.0-­‐M3 
(ASL 
v2.0), 
final 
Release: 
12/2014 
§ Based 
on 
Neo4j 
2.x 
- Embedded, 
no 
installaJon 
necessary
60 
Maven 
Scan 
Analyze 
Report 
Plugins 
Plugins 
Plugins
61 
§ Ge|ng 
started 
<build> 
<plugins> 
<plugin> 
<groupId>com.buschmais.jqassistant.scm</groupId> 
<artifactId>jqassistant-­‐maven-­‐plugin</artifactId> 
</plugin> 
</plugins> 
</build> 
§ mvn jqassistant:scan 
§ mvn jqassistant:server 
§ mvn jqassistant:available-­‐rules 
§ mvn jqassistant:analyze
62 
§ Analyze 
- ExecuJon 
of 
rules 
- Concepts 
§ Enrich 
data 
model 
- Constraints 
§ Detect 
violaJons 
- Group 
§ Allow 
different 
execuJon 
profiles
63 
Includes 
Group 
Constraint 
Requires 
Requires 
Requires 
Concept 
Concept 
Concept
64 
§ Concept 
<jqa:jqassistant-­‐rules xmlns:jqa="..."> 
<concept id="jpa2:Entity"> 
<description>Labels all types annotated with 
@javax.persistence.Entity with JPA and ENTITY. 
</description> 
<cypher><![CDATA[ 
MATCH 
(t:Type)-­‐[:ANNOTATED_BY]-­‐>()-­‐[:OF_TYPE]-­‐>(a:Type) 
WHERE a.fqn="javax.persistence.Entity" 
SET t:Jpa:Entity 
RETURN t AS Entity 
]]></cypher> 
</concept> 
</jqa:jqassistant-­‐rules>
65 
§ Concept 
<jqa:jqassistant-­‐rules xmlns:jqa="..."> 
<concept id="jpa2:Entity"> 
<description>Labels all types annotated with 
@javax.persistence.Entity with JPA and ENTITY. 
</description> 
<cypher><![CDATA[ 
MATCH 
(t:Type)-­‐[:ANNOTATED_BY]-­‐>()-­‐[:OF_TYPE]-­‐>(a:Type) 
WHERE a.fqn="javax.persistence.Entity" 
SET t:Jpa:Entity 
RETURN t AS Entity 
]]></cypher> 
</concept> 
</jqa:jqassistant-­‐rules>
66 
§ Concept 
<jqa:jqassistant-­‐rules xmlns:jqa="..."> 
<concept id="jpa2:Entity"> 
<description>Labels all types annotated with 
@javax.persistence.Entity with JPA and ENTITY. 
</description> 
<cypher><![CDATA[ 
MATCH 
(t:Type)-­‐[:ANNOTATED_BY]-­‐>()-­‐[:OF_TYPE]-­‐>(a:Type) 
WHERE a.fqn="javax.persistence.Entity" 
SET t:Jpa:Entity 
RETURN t AS Entity 
]]></cypher> 
</concept> 
</jqa:jqassistant-­‐rules>
67 
§ Concept 
fqn.org.jqassistant:demo. 
usermanagement.api. 
model.Person 
name:Person 
Type 
Class 
AnnotaJon 
ANNOTATED_BY 
Type 
fqn:javax.persistence.EnJty 
OF_TYPE 
AnnotaJon 
fqn.org.jqassistant:demo. 
usermanagement.api. 
Model.Customer 
name:Customer 
ANNOTATED_BY 
Type 
EXTENDS 
Class 
OF_TYPE
68 
§ Concept 
fqn.org.jqassistant:demo. 
usermanagement.api. 
model.Person 
name:Person 
Type 
Class 
AnnotaJon 
ANNOTATED_BY 
Type 
fqn:javax.persistence.EnJty 
OF_TYPE 
AnnotaJon 
fqn.org.jqassistant:demo. 
usermanagement.api. 
Model.Customer 
name:Customer 
ANNOTATED_BY 
Type 
EXTENDS 
Class 
OF_TYPE 
EnJty 
Jpa 
EnJty 
Jpa
69 
§ Constraint 
<jqa:jqassistant-­‐rules xmlns:jqa="..."> 
<constraint id="JpaEntitiesInModelPackage"> 
<requiresConcept refId="jpa2:Entity"/> 
<description>All JPA entities must be located in 
packages named "model". 
</description> 
<cypher><![CDATA[ 
MATCH (p:Package)-­‐[:CONTAINS]-­‐>(e) 
WHERE e:Jpa AND e:Entity AND NOT(p.name = "model") 
RETURN 
e AS EntityInWrongPackage 
]]></cypher> 
</constraint> 
</jqa:jqassistant-­‐rules>
70 
§ Constraint 
<jqa:jqassistant-­‐rules xmlns:jqa="..."> 
<constraint id="JpaEntitiesInModelPackage"> 
<requiresConcept refId="jpa2:Entity"/> 
<description>All JPA entities must be located in 
packages named "model". 
</description> 
<cypher><![CDATA[ 
MATCH (p:Package)-­‐[:CONTAINS]-­‐>(e) 
WHERE e:Jpa AND e:Entity AND NOT(p.name = "model") 
RETURN 
e AS EntityInWrongPackage 
]]></cypher> 
</constraint> 
</jqa:jqassistant-­‐rules>
71 
§ Constraint 
<jqa:jqassistant-­‐rules xmlns:jqa="..."> 
<constraint id="JpaEntitiesInModelPackage"> 
<requiresConcept refId="jpa2:Entity"/> 
<description>All JPA entities must be located in 
packages named "model". 
</description> 
<cypher><![CDATA[ 
MATCH (p:Package)-­‐[:CONTAINS]-­‐>(e) 
WHERE e:Jpa AND e:Entity AND NOT(p.name = "model") 
RETURN 
e AS EntityInWrongPackage 
]]></cypher> 
</constraint> 
</jqa:jqassistant-­‐rules>
72 
§ Constraint 
<jqa:jqassistant-­‐rules xmlns:jqa="..."> 
<constraint id="JpaEntitiesInModelPackage"> 
<requiresConcept refId="jpa2:Entity"/> 
<description>All JPA entities must be located in 
packages named "model". 
</description> 
<cypher><![CDATA[ 
MATCH (p:Package)-­‐[:CONTAINS]-­‐>(e) 
WHERE e:Jpa AND e:Entity AND NOT(p.name = "model") 
RETURN 
e AS EntityInWrongPackage 
]]></cypher> 
</constraint> 
</jqa:jqassistant-­‐rules>
73 
§ Group 
<jqa:jqassistant-­‐rules xmlns:jqa="..."> 
<group id="default"> 
<includeConstraint 
refId="abstractness:ApiMustNotDependOnImplementation"/> 
<includeConstraint 
refId="JpaEntitiesInModelPackage"/> 
<includeConstraint 
refId="EjbLocatedInImplementationPackage"/> 
<includeConstraint refId="TestClassNameHasTestSuffix"/> 
<includeConstraint refId="dependency:TypeCycles"/> 
<includeConstraint refId="dependency:ArtifactCycles"/> 
</group> 
</jqa:jqassistant-­‐rules>
74 
§ Group 
<jqa:jqassistant-­‐rules xmlns:jqa="..."> 
<group id="default"> 
<includeConstraint 
refId="abstractness:ApiMustNotDependOnImplementation"/> 
<includeConstraint 
refId="JpaEntitiesInModelPackage"/> 
<includeConstraint 
refId="EjbLocatedInImplementationPackage"/> 
<includeConstraint refId="TestClassNameHasTestSuffix"/> 
<includeConstraint refId="dependency:TypeCycles"/> 
<includeConstraint refId="dependency:ArtifactCycles"/> 
</group> 
</jqa:jqassistant-­‐rules>
75 
§ Plugins 
- Scanner, 
Rules, 
Report 
Java 
7/8 
EJB3 
JUnit 
Maven 
OSGi 
Tycho 
- Where‘s 
yours? 
ContribuJons 
welcome! 
JPA2 
JAX-­‐RS
Analysis of soAware systems using jQAssistant and Neo4j 
Demo #2 
76
§ All 
packages 
in 
a 
Maven 
module 
must 
be 
prefixed 
with 
${groupId}.${arJfactId} 
77 
MATCH 
(module:Maven)-­‐[:CREATES]-­‐>(artifact:Artifact) 
WITH 
artifact, artifact.group + "." + artifact.name + " 
..*" as prefixPattern 
MATCH 
(artifact)-­‐[:CONTAINS]-­‐>(type:Type) 
WHERE NOT 
type.fqn =~ prefixPattern 
RETURN 
type as TypeInInvalidPackage
78 
§ Message 
Driven 
Beans 
must 
have 
a 
suffix 
„MDB“. 
MATCH 
(mdb:MessageDrivenBean) 
WHERE NOT 
mdb.name =~ ".*MDB" 
RETURN 
mdb as InvalidBean
79 
§ JPA 
enJJes 
must 
be 
located 
in 
„api.model“ 
packages. 
MATCH 
(p:Package)-­‐[:CONTAINS]-­‐>(e:Jpa:Entity) 
WHERE NOT 
p.fqn =~ '.*.api.model' 
RETURN 
e.fqn as Entity
§ Every 
test 
method 
must 
contain 
at 
least 
one 
asserJon. 
80 
MATCH 
(testType:Type)-­‐[:DECLARES]-­‐>(testMethod:Test:Method) 
WHERE NOT 
(testMethod)-­‐[:INVOKES*..3]-­‐>(:Method:Assert) 
RETURN 
testType AS DeclaringType, 
testMethod AS Method
81 
§ Each 
asserJon 
must 
provide 
a 
human 
readable 
message. 
MATCH 
(testType:Type)-­‐[:DECLARES]-­‐>(testMethod:Method), 
(testMethod)-­‐[i:INVOKES]-­‐>(assertMethod:Assert:Method) 
WHERE NOT 
assertMethod.signature =~ 
'void assert.*(java.lang.String,.*)' 
RETURN 
i AS Invocation, // provides lineNumber 
testType AS DeclaringType, 
testMethod AS Method
§ Remote 
APIs 
must 
be 
interfaces 
declaring 
only 
primiJves 
or 
immutables 
as 
parameter 
or 
return 
types. 
82 
MATCH 
(api:Package:API:Remote), 
(api)-­‐[:CONTAINS*]-­‐>(interface:Interface), 
(interface)-­‐[:DECLARES]-­‐>(method:Method), 
(method)-­‐[:HAS|RETURNS]-­‐>(type:Type) 
WHERE NOT 
(type:Immutable OR type:Primitive) 
RETURN 
interface AS InvalidInterface, type AS InvalidType
83 
§ OSGi-­‐Bundles 
must 
only 
export 
dedicated 
API 
packages. 
MATCH 
(bundle:Artifact:Bundle)-­‐[:EXPORTS]-­‐>(package:Package) 
WHERE NOT 
(package:API) 
RETURN 
package AS InvalidExport
Thank You! – Questions? 
Mail: 
info@jqassistant.org 
Web: 
jqassistant.org 
Twixer: 
@jqassistant 
by

More Related Content

Similar to Analysis of software systems using jQAssistant and Neo4j

Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
Breaking Dependencies Legacy Code -  Cork Software Crafters - September 2019Breaking Dependencies Legacy Code -  Cork Software Crafters - September 2019
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019Paulo Clavijo
 
PRG 421 Education Specialist / snaptutorial.com
PRG 421 Education Specialist / snaptutorial.comPRG 421 Education Specialist / snaptutorial.com
PRG 421 Education Specialist / snaptutorial.comMcdonaldRyan108
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011YoungSu Son
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorialsakreyi
 
PRG 421 Massive success / tutorialrank.com
PRG 421 Massive success / tutorialrank.comPRG 421 Massive success / tutorialrank.com
PRG 421 Massive success / tutorialrank.comBromleyz1
 
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016 Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016 Alexander Lisachenko
 
PRG 421 Creative and Effective/newtonhelp.com
PRG 421 Creative and Effective/newtonhelp.comPRG 421 Creative and Effective/newtonhelp.com
PRG 421 Creative and Effective/newtonhelp.commyblue101
 
PRG 421 Extraordinary Life/newtonhelp.com 
PRG 421 Extraordinary Life/newtonhelp.com PRG 421 Extraordinary Life/newtonhelp.com 
PRG 421 Extraordinary Life/newtonhelp.com myblue41
 
PRG 421 Inspiring Innovation / tutorialrank.com
PRG 421 Inspiring Innovation / tutorialrank.comPRG 421 Inspiring Innovation / tutorialrank.com
PRG 421 Inspiring Innovation / tutorialrank.comBromleyz24
 
Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answersKrishnaov
 
Strayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newStrayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newshyaminfo16
 
Strayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newStrayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newuopassignment
 
Strayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newStrayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newlroselyn
 
Strayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newStrayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newdixonbakerr
 
Strayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newStrayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newshyaminfo40
 
Strayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newStrayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newcharlesangles123
 
Strayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newStrayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newchanduruc123
 

Similar to Analysis of software systems using jQAssistant and Neo4j (20)

PRG 421 Entire Course NEW
PRG 421 Entire Course NEWPRG 421 Entire Course NEW
PRG 421 Entire Course NEW
 
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
Breaking Dependencies Legacy Code -  Cork Software Crafters - September 2019Breaking Dependencies Legacy Code -  Cork Software Crafters - September 2019
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
 
PRG 421 Education Specialist / snaptutorial.com
PRG 421 Education Specialist / snaptutorial.comPRG 421 Education Specialist / snaptutorial.com
PRG 421 Education Specialist / snaptutorial.com
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorials
 
PRG 421 Massive success / tutorialrank.com
PRG 421 Massive success / tutorialrank.comPRG 421 Massive success / tutorialrank.com
PRG 421 Massive success / tutorialrank.com
 
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016 Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
 
Prg421
Prg421Prg421
Prg421
 
PRG 421 Creative and Effective/newtonhelp.com
PRG 421 Creative and Effective/newtonhelp.comPRG 421 Creative and Effective/newtonhelp.com
PRG 421 Creative and Effective/newtonhelp.com
 
PRG 421 Extraordinary Life/newtonhelp.com 
PRG 421 Extraordinary Life/newtonhelp.com PRG 421 Extraordinary Life/newtonhelp.com 
PRG 421 Extraordinary Life/newtonhelp.com 
 
PRG 421 Inspiring Innovation / tutorialrank.com
PRG 421 Inspiring Innovation / tutorialrank.comPRG 421 Inspiring Innovation / tutorialrank.com
PRG 421 Inspiring Innovation / tutorialrank.com
 
Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answers
 
Strayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newStrayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade new
 
Java SE 8 & EE 7 Launch
Java SE 8 & EE 7 LaunchJava SE 8 & EE 7 Launch
Java SE 8 & EE 7 Launch
 
Strayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newStrayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade new
 
Strayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newStrayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade new
 
Strayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newStrayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade new
 
Strayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newStrayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade new
 
Strayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newStrayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade new
 
Strayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade newStrayer cis 406 week 10 assignment 2 u grade new
Strayer cis 406 week 10 assignment 2 u grade new
 

More from Java Usergroup Berlin-Brandenburg

Die fabelhafte Welt Java(Script)-getriebener Enterprise-WebApps (mit Ext JS)
Die fabelhafte Welt Java(Script)-getriebener Enterprise-WebApps (mit Ext JS)Die fabelhafte Welt Java(Script)-getriebener Enterprise-WebApps (mit Ext JS)
Die fabelhafte Welt Java(Script)-getriebener Enterprise-WebApps (mit Ext JS)Java Usergroup Berlin-Brandenburg
 
Jbossas7alsplattformmodernerenterprise anwendungen-130604114410-phpapp02
Jbossas7alsplattformmodernerenterprise anwendungen-130604114410-phpapp02Jbossas7alsplattformmodernerenterprise anwendungen-130604114410-phpapp02
Jbossas7alsplattformmodernerenterprise anwendungen-130604114410-phpapp02Java Usergroup Berlin-Brandenburg
 

More from Java Usergroup Berlin-Brandenburg (19)

Microbenchmarks - Wer nicht weiß, was er misst misst Mist
Microbenchmarks - Wer nicht weiß, was er misst misst MistMicrobenchmarks - Wer nicht weiß, was er misst misst Mist
Microbenchmarks - Wer nicht weiß, was er misst misst Mist
 
Collections.compare(() -> JDK; Apache; Eclipse, Guava...});
Collections.compare(() -> JDK; Apache; Eclipse, Guava...});Collections.compare(() -> JDK; Apache; Eclipse, Guava...});
Collections.compare(() -> JDK; Apache; Eclipse, Guava...});
 
Built To Last - Nachhaltige Software-Entwicklung
Built To Last - Nachhaltige Software-EntwicklungBuilt To Last - Nachhaltige Software-Entwicklung
Built To Last - Nachhaltige Software-Entwicklung
 
Feature Toggles On Steroids
Feature Toggles On SteroidsFeature Toggles On Steroids
Feature Toggles On Steroids
 
Resilience mit Hystrix
Resilience mit HystrixResilience mit Hystrix
Resilience mit Hystrix
 
Get Back in Control of your SQL
Get Back in Control of your SQLGet Back in Control of your SQL
Get Back in Control of your SQL
 
Die fabelhafte Welt Java(Script)-getriebener Enterprise-WebApps (mit Ext JS)
Die fabelhafte Welt Java(Script)-getriebener Enterprise-WebApps (mit Ext JS)Die fabelhafte Welt Java(Script)-getriebener Enterprise-WebApps (mit Ext JS)
Die fabelhafte Welt Java(Script)-getriebener Enterprise-WebApps (mit Ext JS)
 
Selbstvorstellung Steria Mummert Consulting
Selbstvorstellung Steria Mummert ConsultingSelbstvorstellung Steria Mummert Consulting
Selbstvorstellung Steria Mummert Consulting
 
Graphdatenbanken mit Neo4j
Graphdatenbanken mit Neo4jGraphdatenbanken mit Neo4j
Graphdatenbanken mit Neo4j
 
Jbosseapclustering 130605100557-phpapp02
Jbosseapclustering 130605100557-phpapp02Jbosseapclustering 130605100557-phpapp02
Jbosseapclustering 130605100557-phpapp02
 
Jbossas7alsplattformmodernerenterprise anwendungen-130604114410-phpapp02
Jbossas7alsplattformmodernerenterprise anwendungen-130604114410-phpapp02Jbossas7alsplattformmodernerenterprise anwendungen-130604114410-phpapp02
Jbossas7alsplattformmodernerenterprise anwendungen-130604114410-phpapp02
 
How long can you afford to Stop The World?
How long can you afford to Stop The World?How long can you afford to Stop The World?
How long can you afford to Stop The World?
 
JavaOne Update zur Java Plattform
JavaOne Update zur Java PlattformJavaOne Update zur Java Plattform
JavaOne Update zur Java Plattform
 
Java EE 7 - Overview and Status
Java EE 7  - Overview and StatusJava EE 7  - Overview and Status
Java EE 7 - Overview and Status
 
Restructuring
RestructuringRestructuring
Restructuring
 
Fighting Layout Bugs
Fighting Layout BugsFighting Layout Bugs
Fighting Layout Bugs
 
Die Java Plattform Strategie
Die Java Plattform StrategieDie Java Plattform Strategie
Die Java Plattform Strategie
 
Continuous Delivery
Continuous DeliveryContinuous Delivery
Continuous Delivery
 
Continuous Delivery in der Praxis
Continuous Delivery in der PraxisContinuous Delivery in der Praxis
Continuous Delivery in der Praxis
 

Recently uploaded

Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 

Recently uploaded (20)

Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 

Analysis of software systems using jQAssistant and Neo4j

  • 1. by Analysis of software systems using jQAssistant and Neo4j E-­‐POST Tech Talk & JUG Berlin-­‐Brandenburg Dirk Mahler
  • 2. 2 AGENDA § About Structures, Rules And Code § So4ware As A Graph § Demo#1 § jQAssistant § Demo#2
  • 3. Analysis of soAware systems using jQAssistant and Neo4j About Structures, Rules And Code 3
  • 4. 4 § Sketch of an architecture
  • 5. 5 § Sketch of an architecture My Big Fat Demo ApplicaJon
  • 6. 6 § Sketch of an architecture - Business modules Usermanagement Shopping Cart
  • 7. 7 § Sketch of an architecture - Allowed dependencies between business modules Usermanagement Shopping Cart
  • 8. 8 § Sketch of an architecture - Technical layering JSF-­‐UI REST Business Logic Persistence JSF-­‐UI REST Business Logic Persistence
  • 9. 9 § Sketch of an architecture - Allowed dependencies between technical layers JSF-­‐UI REST Business Logic Persistence JSF-­‐UI REST Business Logic Persistence
  • 10. 10 § Sketch of an architecture - Allowed dependencies between business modules and technical layers JSF-­‐UI REST Business Logic Persistence JSF-­‐UI REST Business Logic Persistence
  • 11. 11 § Sketch of an architecture - Allowed dependencies between business modules and technical layers JSF-­‐UI REST Business Logic Persistence JSF-­‐UI REST Business Logic Persistence
  • 12. 12 § Sketch of an architecture - AbstracJon between layers (API vs. ImplementaJon) JSF-­‐UI REST Business Logic Persistence JSF-­‐UI REST Business Logic Persistence
  • 13. 13 § Sketch of an architecture - Forbidden dependency JSF-­‐UI REST Business Logic Persistence JSF-­‐UI REST Business Logic Persistence
  • 14. 14 § Sketch of an architecture - Allowed external dependencies per layer JSF-­‐UI REST EJB JPA JSF-­‐UI REST Business Logic Persistence
  • 15. § TranslaJon of architecture rules into the project structure - Java language element: Package org.jqassistant.demo 15
  • 16. § TranslaJon of architecture rules into the project structure - Java language element: Package - DefiniJon of business modules on „top level“ 16 Shopping Cart „org.jqassistant.demo.cart“ Usermanagement „org.jqassistant.demo.user“
  • 17. 17 § TranslaJon of architecture rules into the project structure - Java language element: Package - Technical layers § …demo.cart.ui § …demo.cart.rest § …demo.cart.logic § …demo.cart.persistence JSF-­‐UI REST Business Logic Persistence
  • 18. 18 § TranslaJon of architecture rules into the project structure - Java language element: Package - Technical layers § …demo.cart.ui § …demo.cart.rest § …demo.cart.logic.api § …demo.cart.logic.impl § …demo.cart.persistence.api § …demo.cart.persistence.impl JSF-­‐UI REST Business Logic Persistence
  • 19. 19 § Package Names - All packages in a Maven module must be prefixed with $ {groupId}.${arJfactId} - Example: groupId=org.jqassistant arJfactId=demo => org.jqassistant.demo
  • 20. 20 § Class Names - Message Driven Beans must have a suffix „MDB“.
  • 21. 21 § Class locaJon - JPA enJJes must be located in „api.model“ packages.
  • 22. 22 § Test design - Every test method must contain at least one asserJon. - Each asserJon must provide a human readable message.
  • 23. 23 § AbstracJon - Remote APIs must be interfaces declaring only primiJves or immutables as parameter or return types. - OSGi-­‐Bundles must only export dedicated API packages.
  • 24. 24 Source Code Java, ProperJes, XML, YML „Code Quality“ Complexity Maintainability Erosion
  • 25. 25 Source Code Java, ProperJes, XML, YML People Architect, Developer, Test DocumentaJon UML, Wiki, readme.txt Tooling Compiler, StaJc Code Analysis, CI
  • 26. 26 § Source Code – AbstracJon levels Architecture Design Module, Layer, Dependency AbstracJon, Immutable, Factory Java Package, Class, Field, Method, AnnotaJon File System Folder, File
  • 27. 27 § Source Code – Automated validaJon Architecture Design Module, Layer, Dependency AbstracJon, Immutable, Factory Java Package, Class, Field, Method, AnnotaJon File System Folder, File
  • 28. 28 § Java elements represent higher level concepts - Package ó Module - Annotated Class ó EnJty § Constraints apply to these concepts - JPA enJJes must be located in „api.model“ packages
  • 29. 29 § Visibility of concepts and constraints - Explicit § @Test - Implicit § Every test method must contain at least one asserJon. - Invisible § java.uJl.Calendar must not be used directly.
  • 30. 30 § Concepts and Constraints - How to make them visible? - Is there a language to describe them?
  • 31. Analysis of soAware systems using jQAssistant and Neo4j Software As A Graph 31
  • 32. 32 § All we need is… - Nodes - Labels - ProperJes - RelaJonships § Modeling is just… - Taking a pen - Drawing the structures on a whiteboard (i.e. the database) § We don‘t need… - Foreign keys - Tables and schemas - Knowledge in graph theory
  • 33. Project ArJfact Maven CONTAINS Package name:org CONTAINS Package name:jqassistant CONTAINS Package name:usermanagement CONTAINS Package name:api CONTAINS Package name:model name:demo CONTAINS Package name:demo CREATES
  • 34. Type Class CONTAINS CONTAINS CONTAINS fqn:org.jqassistant.demo. usermanagement.api. model.Person name:Person Package name:usermanagement Package name:api Package name:model CONTAINS
  • 35. AnnotaJon ANNOTATED_BY Type fqn:javax.persistence.EnJty OF_TYPE Package name:usermanagement CONTAINS Package name:api CONTAINS Package name:model Type Class CONTAINS fqn:org.jqassistant.demo. usermanagement.api. model.Person name:Person CONTAINS
  • 36. Type Class CONTAINS fqn:org.jqassistant.demo. usermanagement.api. model.Person name:Person AnnotaJon ANNOTATED_BY Type fqn:javax.persistence.EnJty OF_TYPE Package name:model
  • 37. Package name:model Type Class CONTAINS fqn:org.jqassistant.demo. usermanagement.api. model.Person name:Person Type fqn:javax.persistence.EnJty OF_TYPE AnnotaJon fqn:org.jqassistant.demo. usermanagement.api. Model.Customer name:Customer ANNOTATED_BY Type EXTENDS Class OF_TYPE AnnotaJon ANNOTATED_BY
  • 38. RETURNS READS Field DECLARES name:number Package name:model Type Class CONTAINS fqn:org.jqassistant.demo. usermanagement.api. model.Person name:Person Type fqn:javax.persistence.EnJty OF_TYPE fqn:org.jqassistant.demo. usermanagement.api. Model.Customer name:Customer Type EXTENDS Class Type OF_TYPE fqn:int DECLARES Method name:getNumber() signature:int getNumber() AnnotaJon ANNOTATED_BY OF_TYPE AnnotaJon ANNOTATED_BY
  • 39. 40 § Explore an applicaJon using queries - Which class extends from another class? EXTENDS Type Type Class § Let‘s convert this to ASCII art… - () as nodes - -­‐[]-­‐> as directed relaJonships
  • 40. 41 § Explore an applicaJon using queries - Which class extends from another class? EXTENDS Type Type Class § Let‘s convert this to ASCII art… - () as nodes - -­‐[]-­‐> as directed relaJonships ()-­‐[]-­‐>()
  • 41. 42 § Explore an applicaJon using queries - Which class extends from another class? C2 Type C1 Type Class EXTENDS § Let‘s convert this to ASCII art… - () as nodes - -­‐[]-­‐> as directed relaJonships (c1)-­‐[]-­‐>(c2)
  • 42. 43 § Explore an applicaJon using queries - Which class extends from another class? C2 Type C1 Type Class EXTENDS § Let‘s convert this to ASCII art… - () as nodes - -­‐[]-­‐> as directed relaJonships (c1)-­‐[:EXTENDS]-­‐>(c2)
  • 43. 44 § Explore an applicaJon using queries - Which class extends from another class? C1 Type Class EXTENDS § Let‘s convert this to ASCII art… - () as nodes - -­‐[]-­‐> as directed relaJonships C2 Type (c1:Class)-­‐[:EXTENDS]-­‐>(c2:Type)
  • 44. 45 § Explore an applicaJon using queries - Which class extends from another class? C2 Type C1 Type Class EXTENDS § Paxern matching is the core principle of Cypher MATCH (c1:Class)-­‐[:EXTENDS]-­‐>(c2:Type) RETURN c1.fqn, c2.fqn
  • 45. 46 § Which classes contain the highest number of methods?
  • 46. 47 § Which classes contain the highest number of methods? MATCH (class:Class)-­‐[:DECLARES]-­‐>(method:Method)
  • 47. 48 § Which classes contain the highest number of methods? MATCH (class:Class)-­‐[:DECLARES]-­‐>(method:Method) RETURN class.fqn, count(method) as Methods
  • 48. 49 § Which classes contain the highest number of methods? MATCH (class:Class)-­‐[:DECLARES]-­‐>(method:Method) RETURN class.fqn, count(method) as Methods ORDER BY Methods DESC
  • 49. 50 § Which classes contain the highest number of methods? MATCH (class:Class)-­‐[:DECLARES]-­‐>(method:Method) RETURN class.fqn, count(method) as Methods ORDER BY Methods DESC LIMIT 20
  • 50. 51 § Which class has the deepest inheritance hierarchy?
  • 51. 52 § Which class has the deepest inheritance hierarchy? MATCH h=(class:Class)-­‐[:EXTENDS*]-­‐>(super:Type)
  • 52. 53 § Which class has the deepest inheritance hierarchy? MATCH h=(class:Class)-­‐[:EXTENDS*]-­‐>(super:Type) RETURN class.fqn, length(h) as Depth
  • 53. 54 § Which class has the deepest inheritance hierarchy? MATCH h=(class:Class)-­‐[:EXTENDS*]-­‐>(super:Type) RETURN class.fqn, length(h) as Depth ORDER BY Depth desc
  • 54. 55 § Which class has the deepest inheritance hierarchy? MATCH h=(class:Class)-­‐[:EXTENDS*]-­‐>(super:Type) RETURN class.fqn, length(h) as Depth ORDER BY Depth desc LIMIT 20
  • 55. 56 § Which classes are affected by IOExcepJons? MATCH (e:Type)-­‐[:DECLARES]-­‐>(init:Constructor) WHERE e.fqn="java.io.IOException" WITH e,init MATCH (type:Type)-­‐[:DECLARES]-­‐>(method:Method), path=(method)-­‐[:INVOKES*]-­‐>(init) RETURN e,type,path LIMIT 10
  • 56. Analysis of soAware systems using jQAssistant and Neo4j Demo #1 57
  • 57. Analysis of soAware systems using jQAssistant and Neo4j jQAssistant 58
  • 58. 59 § Project Homepage - hxp://jqassistant.org § Open Source - GPL v3 § Milestone - 1.0.0-­‐M3 (ASL v2.0), final Release: 12/2014 § Based on Neo4j 2.x - Embedded, no installaJon necessary
  • 59. 60 Maven Scan Analyze Report Plugins Plugins Plugins
  • 60. 61 § Ge|ng started <build> <plugins> <plugin> <groupId>com.buschmais.jqassistant.scm</groupId> <artifactId>jqassistant-­‐maven-­‐plugin</artifactId> </plugin> </plugins> </build> § mvn jqassistant:scan § mvn jqassistant:server § mvn jqassistant:available-­‐rules § mvn jqassistant:analyze
  • 61. 62 § Analyze - ExecuJon of rules - Concepts § Enrich data model - Constraints § Detect violaJons - Group § Allow different execuJon profiles
  • 62. 63 Includes Group Constraint Requires Requires Requires Concept Concept Concept
  • 63. 64 § Concept <jqa:jqassistant-­‐rules xmlns:jqa="..."> <concept id="jpa2:Entity"> <description>Labels all types annotated with @javax.persistence.Entity with JPA and ENTITY. </description> <cypher><![CDATA[ MATCH (t:Type)-­‐[:ANNOTATED_BY]-­‐>()-­‐[:OF_TYPE]-­‐>(a:Type) WHERE a.fqn="javax.persistence.Entity" SET t:Jpa:Entity RETURN t AS Entity ]]></cypher> </concept> </jqa:jqassistant-­‐rules>
  • 64. 65 § Concept <jqa:jqassistant-­‐rules xmlns:jqa="..."> <concept id="jpa2:Entity"> <description>Labels all types annotated with @javax.persistence.Entity with JPA and ENTITY. </description> <cypher><![CDATA[ MATCH (t:Type)-­‐[:ANNOTATED_BY]-­‐>()-­‐[:OF_TYPE]-­‐>(a:Type) WHERE a.fqn="javax.persistence.Entity" SET t:Jpa:Entity RETURN t AS Entity ]]></cypher> </concept> </jqa:jqassistant-­‐rules>
  • 65. 66 § Concept <jqa:jqassistant-­‐rules xmlns:jqa="..."> <concept id="jpa2:Entity"> <description>Labels all types annotated with @javax.persistence.Entity with JPA and ENTITY. </description> <cypher><![CDATA[ MATCH (t:Type)-­‐[:ANNOTATED_BY]-­‐>()-­‐[:OF_TYPE]-­‐>(a:Type) WHERE a.fqn="javax.persistence.Entity" SET t:Jpa:Entity RETURN t AS Entity ]]></cypher> </concept> </jqa:jqassistant-­‐rules>
  • 66. 67 § Concept fqn.org.jqassistant:demo. usermanagement.api. model.Person name:Person Type Class AnnotaJon ANNOTATED_BY Type fqn:javax.persistence.EnJty OF_TYPE AnnotaJon fqn.org.jqassistant:demo. usermanagement.api. Model.Customer name:Customer ANNOTATED_BY Type EXTENDS Class OF_TYPE
  • 67. 68 § Concept fqn.org.jqassistant:demo. usermanagement.api. model.Person name:Person Type Class AnnotaJon ANNOTATED_BY Type fqn:javax.persistence.EnJty OF_TYPE AnnotaJon fqn.org.jqassistant:demo. usermanagement.api. Model.Customer name:Customer ANNOTATED_BY Type EXTENDS Class OF_TYPE EnJty Jpa EnJty Jpa
  • 68. 69 § Constraint <jqa:jqassistant-­‐rules xmlns:jqa="..."> <constraint id="JpaEntitiesInModelPackage"> <requiresConcept refId="jpa2:Entity"/> <description>All JPA entities must be located in packages named "model". </description> <cypher><![CDATA[ MATCH (p:Package)-­‐[:CONTAINS]-­‐>(e) WHERE e:Jpa AND e:Entity AND NOT(p.name = "model") RETURN e AS EntityInWrongPackage ]]></cypher> </constraint> </jqa:jqassistant-­‐rules>
  • 69. 70 § Constraint <jqa:jqassistant-­‐rules xmlns:jqa="..."> <constraint id="JpaEntitiesInModelPackage"> <requiresConcept refId="jpa2:Entity"/> <description>All JPA entities must be located in packages named "model". </description> <cypher><![CDATA[ MATCH (p:Package)-­‐[:CONTAINS]-­‐>(e) WHERE e:Jpa AND e:Entity AND NOT(p.name = "model") RETURN e AS EntityInWrongPackage ]]></cypher> </constraint> </jqa:jqassistant-­‐rules>
  • 70. 71 § Constraint <jqa:jqassistant-­‐rules xmlns:jqa="..."> <constraint id="JpaEntitiesInModelPackage"> <requiresConcept refId="jpa2:Entity"/> <description>All JPA entities must be located in packages named "model". </description> <cypher><![CDATA[ MATCH (p:Package)-­‐[:CONTAINS]-­‐>(e) WHERE e:Jpa AND e:Entity AND NOT(p.name = "model") RETURN e AS EntityInWrongPackage ]]></cypher> </constraint> </jqa:jqassistant-­‐rules>
  • 71. 72 § Constraint <jqa:jqassistant-­‐rules xmlns:jqa="..."> <constraint id="JpaEntitiesInModelPackage"> <requiresConcept refId="jpa2:Entity"/> <description>All JPA entities must be located in packages named "model". </description> <cypher><![CDATA[ MATCH (p:Package)-­‐[:CONTAINS]-­‐>(e) WHERE e:Jpa AND e:Entity AND NOT(p.name = "model") RETURN e AS EntityInWrongPackage ]]></cypher> </constraint> </jqa:jqassistant-­‐rules>
  • 72. 73 § Group <jqa:jqassistant-­‐rules xmlns:jqa="..."> <group id="default"> <includeConstraint refId="abstractness:ApiMustNotDependOnImplementation"/> <includeConstraint refId="JpaEntitiesInModelPackage"/> <includeConstraint refId="EjbLocatedInImplementationPackage"/> <includeConstraint refId="TestClassNameHasTestSuffix"/> <includeConstraint refId="dependency:TypeCycles"/> <includeConstraint refId="dependency:ArtifactCycles"/> </group> </jqa:jqassistant-­‐rules>
  • 73. 74 § Group <jqa:jqassistant-­‐rules xmlns:jqa="..."> <group id="default"> <includeConstraint refId="abstractness:ApiMustNotDependOnImplementation"/> <includeConstraint refId="JpaEntitiesInModelPackage"/> <includeConstraint refId="EjbLocatedInImplementationPackage"/> <includeConstraint refId="TestClassNameHasTestSuffix"/> <includeConstraint refId="dependency:TypeCycles"/> <includeConstraint refId="dependency:ArtifactCycles"/> </group> </jqa:jqassistant-­‐rules>
  • 74. 75 § Plugins - Scanner, Rules, Report Java 7/8 EJB3 JUnit Maven OSGi Tycho - Where‘s yours? ContribuJons welcome! JPA2 JAX-­‐RS
  • 75. Analysis of soAware systems using jQAssistant and Neo4j Demo #2 76
  • 76. § All packages in a Maven module must be prefixed with ${groupId}.${arJfactId} 77 MATCH (module:Maven)-­‐[:CREATES]-­‐>(artifact:Artifact) WITH artifact, artifact.group + "." + artifact.name + " ..*" as prefixPattern MATCH (artifact)-­‐[:CONTAINS]-­‐>(type:Type) WHERE NOT type.fqn =~ prefixPattern RETURN type as TypeInInvalidPackage
  • 77. 78 § Message Driven Beans must have a suffix „MDB“. MATCH (mdb:MessageDrivenBean) WHERE NOT mdb.name =~ ".*MDB" RETURN mdb as InvalidBean
  • 78. 79 § JPA enJJes must be located in „api.model“ packages. MATCH (p:Package)-­‐[:CONTAINS]-­‐>(e:Jpa:Entity) WHERE NOT p.fqn =~ '.*.api.model' RETURN e.fqn as Entity
  • 79. § Every test method must contain at least one asserJon. 80 MATCH (testType:Type)-­‐[:DECLARES]-­‐>(testMethod:Test:Method) WHERE NOT (testMethod)-­‐[:INVOKES*..3]-­‐>(:Method:Assert) RETURN testType AS DeclaringType, testMethod AS Method
  • 80. 81 § Each asserJon must provide a human readable message. MATCH (testType:Type)-­‐[:DECLARES]-­‐>(testMethod:Method), (testMethod)-­‐[i:INVOKES]-­‐>(assertMethod:Assert:Method) WHERE NOT assertMethod.signature =~ 'void assert.*(java.lang.String,.*)' RETURN i AS Invocation, // provides lineNumber testType AS DeclaringType, testMethod AS Method
  • 81. § Remote APIs must be interfaces declaring only primiJves or immutables as parameter or return types. 82 MATCH (api:Package:API:Remote), (api)-­‐[:CONTAINS*]-­‐>(interface:Interface), (interface)-­‐[:DECLARES]-­‐>(method:Method), (method)-­‐[:HAS|RETURNS]-­‐>(type:Type) WHERE NOT (type:Immutable OR type:Primitive) RETURN interface AS InvalidInterface, type AS InvalidType
  • 82. 83 § OSGi-­‐Bundles must only export dedicated API packages. MATCH (bundle:Artifact:Bundle)-­‐[:EXPORTS]-­‐>(package:Package) WHERE NOT (package:API) RETURN package AS InvalidExport
  • 83. Thank You! – Questions? Mail: info@jqassistant.org Web: jqassistant.org Twixer: @jqassistant by