Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Verification for Decision Model and Notation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Container registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Blatt
Verification for Decision Model and Notation
Commits
acb80ff3
Commit
acb80ff3
authored
5 years ago
by
Jonas Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Add more logging for verifier execution
parent
1e87e467
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dmnverifierapi/src/main/java/de/unikoblenz/fgbks/core/dmn/verification/DmnVerificationService.java
+17
-10
17 additions, 10 deletions
...z/fgbks/core/dmn/verification/DmnVerificationService.java
with
17 additions
and
10 deletions
dmnverifierapi/src/main/java/de/unikoblenz/fgbks/core/dmn/verification/DmnVerificationService.java
+
17
−
10
View file @
acb80ff3
...
@@ -28,10 +28,15 @@ import javax.inject.Inject;
...
@@ -28,10 +28,15 @@ import javax.inject.Inject;
import
org.apache.commons.lang3.Validate
;
import
org.apache.commons.lang3.Validate
;
import
org.eclipse.microprofile.config.inject.ConfigProperty
;
import
org.eclipse.microprofile.config.inject.ConfigProperty
;
import
org.reflections.Reflections
;
import
org.reflections.Reflections
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
@ApplicationScoped
@ApplicationScoped
public
class
DmnVerificationService
{
public
class
DmnVerificationService
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
DmnVerificationService
.
class
.
getSimpleName
());
@ConfigProperty
(
name
=
"verifier.threads"
,
defaultValue
=
"2"
)
@ConfigProperty
(
name
=
"verifier.threads"
,
defaultValue
=
"2"
)
Integer
maxThreads
;
Integer
maxThreads
;
...
@@ -53,7 +58,8 @@ public class DmnVerificationService {
...
@@ -53,7 +58,8 @@ public class DmnVerificationService {
private
void
initVerifier
()
{
private
void
initVerifier
()
{
if
(
executor
==
null
||
verifierClasses
==
null
)
{
if
(
executor
==
null
||
verifierClasses
==
null
)
{
System
.
out
.
println
(
"Creating thread pool with "
+
maxThreads
+
" threads!"
);
// TODO remove
LOGGER
.
info
(
"Init verification."
);
LOGGER
.
info
(
"Creating thread pool with "
+
maxThreads
+
" threads."
);
executor
=
Executors
.
newFixedThreadPool
(
maxThreads
);
executor
=
Executors
.
newFixedThreadPool
(
maxThreads
);
Reflections
reflections
=
new
Reflections
(
packagePath
);
Reflections
reflections
=
new
Reflections
(
packagePath
);
verifierClasses
=
reflections
.
getTypesAnnotatedWith
(
DmnVerifier
.
class
);
verifierClasses
=
reflections
.
getTypesAnnotatedWith
(
DmnVerifier
.
class
);
...
@@ -62,8 +68,11 @@ public class DmnVerificationService {
...
@@ -62,8 +68,11 @@ public class DmnVerificationService {
Set
<
Class
<?>>
clVts
=
reflections
.
getTypesAnnotatedWith
(
Type
.
class
);
Set
<
Class
<?>>
clVts
=
reflections
.
getTypesAnnotatedWith
(
Type
.
class
);
for
(
Class
<?>
clVt
:
clVts
)
{
for
(
Class
<?>
clVt
:
clVts
)
{
try
{
try
{
verificationTypes
.
add
(
VerificationType
verificationType
=
(
VerificationType
)
clVt
.
getMethod
(
"getInstance"
).
invoke
(
null
,
null
));
(
VerificationType
)
clVt
.
getMethod
(
"getInstance"
).
invoke
(
null
,
null
);
LOGGER
.
info
(
"Verifier found: "
+
verificationType
.
getName
()
+
" ("
+
verificationType
.
getClassification
().
getName
()
+
")"
);
verificationTypes
.
add
(
verificationType
);
}
catch
(
IllegalAccessException
|
NoSuchMethodException
|
InvocationTargetException
e
)
{
}
catch
(
IllegalAccessException
|
NoSuchMethodException
|
InvocationTargetException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -120,11 +129,11 @@ public class DmnVerificationService {
...
@@ -120,11 +129,11 @@ public class DmnVerificationService {
.
getValue
()
.
getValue
()
.
equals
(
classificationName
)))
{
.
equals
(
classificationName
)))
{
// Create Configuration
// Create Configuration
AbstractDmnVerifierConfig
vConfig
=
AbstractDmnVerifierConfig
v
erifier
Config
=
configs
.
get
(
av
.
getClass
().
getAnnotation
(
DmnVerifier
.
class
).
verifierConfig
());
configs
.
get
(
av
.
getClass
().
getAnnotation
(
DmnVerifier
.
class
).
verifierConfig
());
// Add Configuration and start Calculation
// Add Configuration and start Calculation
results
.
add
(
av
.
withConfiguration
(
vConfig
).
verify
(
executor
));
results
.
add
(
av
.
withConfiguration
(
v
erifier
Config
).
verify
(
executor
));
}
}
}
}
...
@@ -132,9 +141,7 @@ public class DmnVerificationService {
...
@@ -132,9 +141,7 @@ public class DmnVerificationService {
r
->
{
r
->
{
try
{
try
{
resultBuilder
.
addVerifierResult
(
r
.
get
());
resultBuilder
.
addVerifierResult
(
r
.
get
());
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
e
.
printStackTrace
();
}
catch
(
ExecutionException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
});
});
...
@@ -143,13 +150,13 @@ public class DmnVerificationService {
...
@@ -143,13 +150,13 @@ public class DmnVerificationService {
}
}
private
Map
<
Class
<?
extends
AbstractDmnVerifierConfig
>,
AbstractDmnVerifierConfig
>
getConfigs
(
private
Map
<
Class
<?
extends
AbstractDmnVerifierConfig
>,
AbstractDmnVerifierConfig
>
getConfigs
(
String
dmnX
ML
)
{
String
dmnX
ml
)
{
Map
<
Class
<?
extends
AbstractDmnVerifierConfig
>,
AbstractDmnVerifierConfig
>
map
=
Map
<
Class
<?
extends
AbstractDmnVerifierConfig
>,
AbstractDmnVerifierConfig
>
map
=
new
ConcurrentHashMap
<>();
new
ConcurrentHashMap
<>();
map
.
put
(
map
.
put
(
DefaultConfiguration
.
class
,
DefaultConfiguration
.
class
,
DefaultConfiguration
.
getBuilder
()
DefaultConfiguration
.
getBuilder
()
.
withDmnObjectContainer
(
dmnService
.
getDmnServiceFromXml
(
dmnX
ML
))
.
withDmnObjectContainer
(
dmnService
.
getDmnServiceFromXml
(
dmnX
ml
))
.
build
());
.
build
());
return
map
;
return
map
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment