%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
JavaFX8 TestFX - CDI
1. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 2/164
Sven Ruppert
has been coding java since 1996
Fellow / Senior Manager
reply Group
Germany - Munich
@SvenRuppert
@SvenRuppert 3/165
2. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 3/164
JavaFX 8 - JumpStart
Intro
Swing was yesterday.... now JavaFX ;-)
@SvenRuppert 4/165
3. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 4/164
JavaFX 8 - JumpStart
Intro
Swing was yesterday.... now JavaFX ;-)
Since Java8...
.. JavaFX8 is part of the JDK
@SvenRuppert 5/165
4. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 5/164
JavaFX 8 - JumpStart
Intro
Swing was yesterday.... now JavaFX ;-)
Since Java8...
.. JavaFX8 is part of the JDK
.. you could use it with JDK7, but you have to add it by yourself.
@SvenRuppert 6/165
5. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 6/164
JavaFX 8 - JumpStart
Intro
Swing was yesterday.... now JavaFX ;-)
Since Java8...
.. JavaFX8 is part of the JDK
.. you could use it with JDK7, but you have to add it by yourself.
BUT:
The switch from JavaFX 2.2 to JavaFX8 could be a lot of work..
@SvenRuppert 7/165
6. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 7/164
JavaFX 8 - JumpStart
Intro
Swing was yesterday.... now JavaFX ;-)
Since Java8...
.. JavaFX8 is part of the JDK
.. you could use it with JDK7, but you have to add it by yourself.
BUT:
The switch from JavaFX 2.2 to JavaFX8 could be a lot of work..
for example: Builder-API is now deprecated and a lot of the constructors are
changed.
@SvenRuppert 8/165
7. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 8/164
JavaFX 8 - JumpStart
Hello World - only to remember
a simple example with a button and a service...
@SvenRuppert 9/165
8. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 9/164
JavaFX 8 - JumpStart
Hello World - only to remember
a simple example with a button and a service...
different ways to implement..
@SvenRuppert 10/165
9. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 10/164
JavaFX 8 - JumpStart
Hello World - only to remember
a simple example with a button and a service...
different ways to implement..
.. lets start without fxml
@SvenRuppert 11/165
10. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 11/164
JavaFX 8 - JumpStart
Hello World - only to remember
@SvenRuppert
public class JavaFXPlain extends Application {
public static void main(String[] args) { launch(args); }
@Override
public void start(Stage primaryStage) {
final AnchorPane rootNode = new AnchorPane();
HBox hBox = new HBox();
final TextField tf1 = new TextField(), tf2 = new TextField(), tfResult = new TextField();
final Button button = new Button();
button.setText("Ohhh press me..");
button.setOnAction(event -> {
String v1 = tf1.getText(); String v2 = tf2.getText();
int result = valueOf(v1) + valueOf(v2);
tfResult.setText(result+"");
});
hBox.getChildren().addAll(tf1, tf2, button, tfResult);
rootNode.getChildren().add(hBox);
final Scene scene = new Scene(rootNode, 640, 60);
primaryStage.setScene(scene);
primaryStage.show();
}
}
JAVA
12/165
11. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 12/164
JavaFX 8 - JumpStart
Hello World - only to remember
Application:
The main class from an JavaFX Application will extend
javafx.application.Application.
@SvenRuppert 13/165
12. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 13/164
JavaFX 8 - JumpStart
Hello World - only to remember
Application:
The main class from an JavaFX Application will extend
javafx.application.Application.
Method: start
The start() Method will be the main start-point of the application.
@SvenRuppert 14/165
13. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 14/164
JavaFX 8 - JumpStart
Hello World - only to remember
Application:
The main class from an JavaFX Application will extend
javafx.application.Application.
Method: start
The start() Method will be the main start-point of the application.
Stage:
This instance is the top level container for all JavaFX Components
@SvenRuppert 15/165
14. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 15/164
JavaFX 8 - JumpStart
Hello World - only to remember
Application:
The main class from an JavaFX Application will extend
javafx.application.Application.
Method: start
The start() Method will be the main start-point of the application.
Stage:
This instance is the top level container for all JavaFX Components
Scene:
This instance will be the container for the your content.
@SvenRuppert 16/165
15. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 16/164
JavaFX 8 - JumpStart
Hello World - only to remember
@SvenRuppert
public class JavaFXPlain extends Application {
public static void main(String[] args) { launch(args); }
@Override
public void start(Stage primaryStage) {
final AnchorPane rootNode = new AnchorPane();
HBox hBox = new HBox();
final TextField tf1 = new TextField(), tf2 = new TextField(), tfResult = new TextField();
final Button button = new Button();
button.setText("Ohhh press me..");
button.setOnAction(event -> {
String v1 = tf1.getText(); String v2 = tf2.getText();
int result = valueOf(v1) + valueOf(v2);
tfResult.setText(result+"");
});
hBox.getChildren().addAll(tf1, tf2, button, tfResult);
rootNode.getChildren().add(hBox);
final Scene scene = new Scene(rootNode, 640, 60);
primaryStage.setScene(scene);
primaryStage.show();
}
}
JAVA
17/165
16. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 17/164
JavaFX 8 - JumpStart
Hello World - only to remember
oh now..... how to test it ???
@SvenRuppert 18/165
17. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 18/164
JavaFX 8 - JumpStart
Hello World - only to remember
oh now..... how to test it ???
we will start with jUnit....
@SvenRuppert 19/165
18. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 19/164
JavaFX 8 - JumpStart
Hello World - only to remember
oh now..... how to test it ???
we will start with jUnit....
.. so we have to extract the logic
@SvenRuppert 20/165
19. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 20/164
JavaFX 8 - JumpStart
Hello World - only to remember
oh now..... how to test it ???
we will start with jUnit....
.. so we have to extract the logic
@SvenRuppert
publicclassAddService{
publicintadd(inta,intb){returna+b;}
}
JAVA
21/165
20. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 21/164
JavaFX 8 - JumpStart
Hello World - only to remember
@SvenRuppert
publicclassAddService{
publicintadd(inta,intb){returna+b;}
}
@TestpublicvoidtestAdd001()throwsException{
AddServiceservice=newAddService();
intr=service.add(0,0);
Assert.assertEquals(0,r);
}
JAVA
22/165
21. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 22/164
JavaFX 8 - JumpStart
Hello World - only to remember
@SvenRuppert
publicclassAddService{
publicintadd(inta,intb){returna+b;}
}
@TestpublicvoidtestAdd001()throwsException{
AddServiceservice=newAddService();
intr=service.add(0,0);
Assert.assertEquals(0,r);
}
publicclassString2Int{
publicintconvert(Strings){returnInteger.valueOf(s);}
}
JAVA
23/165
22. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 23/164
JavaFX 8 - JumpStart
Hello World - only to remember
@SvenRuppert
public class AddService {
public int add(int a, int b){ return a +b; }
}
@Test public void testAdd001() throws Exception {
AddService service = new AddService();
int r = service.add(0, 0);
Assert.assertEquals(0, r);
}
public class String2Int {
public int convert(String s){ return Integer.valueOf(s); }
}
@Test public void test001() throws Exception {
String2Int s = new String2Int();
int r = s.convert("0");
Assert.assertEquals(r, 0);
}
JAVA
24/165
23. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 24/164
JavaFX 8 - JumpStart
Hello World - only to remember
What is reached?
@SvenRuppert 25/165
24. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 25/164
JavaFX 8 - JumpStart
Hello World - only to remember
What is reached?
.. UI with less logic
@SvenRuppert 26/165
25. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 26/164
JavaFX 8 - JumpStart
Hello World - only to remember
What is reached?
.. UI with less logic
.. we could test the logic with jUnit
@SvenRuppert 27/165
26. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 27/164
JavaFX 8 - JumpStart
Hello World - only to remember
What is reached?
.. UI with less logic
.. we could test the logic with jUnit
.. we increased the code coverage
@SvenRuppert 28/165
27. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 28/164
JavaFX 8 - JumpStart
Hello World - only to remember
What is reached?
.. UI with less logic
.. we could test the logic with jUnit
.. we increased the code coverage
but how much?
@SvenRuppert 29/165
28. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 29/164
JavaFX 8 - JumpStart
Hello World - only to remember
@SvenRuppert
private AddService addService = new AddService();
private String2Int string2Int = new String2Int();
public void start(Stage primaryStage) {
final AnchorPane rootNode = new AnchorPane();
HBox hBox = new HBox();
final TextField tf1 = new TextField(), tf2 = new TextField(), tfResult = new TextField();
final Button button = new Button();
button.setText("Ohhh press me..");
button.setOnAction(event -> {
String v1 = tf1.getText(); String v2 = tf2.getText();
int intA = string2Int.convert(v1); int intB = string2Int.convert(v2);
int result = addService.add(intA, intB);
tfResult.setText(result+"");
});
hBox.getChildren().addAll(tf1, tf2, button, tfResult);
rootNode.getChildren().add(hBox);
final Scene scene = new Scene(rootNode, 640, 60);
primaryStage.setScene(scene);
primaryStage.show();
}
JAVA
30/165
29. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 30/164
JavaFX 8 - JumpStart
Hello World - only to remember
performance is part of TDD
@SvenRuppert 31/165
30. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 31/164
JavaFX 8 - JumpStart
Hello World - only to remember
performance is part of TDD
.. how fast are the services?
@SvenRuppert 32/165
31. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 32/164
JavaFX 8 - JumpStart
Hello World - only to remember
performance is part of TDD
.. how fast are the services?
.. start with microbenchmarks
@SvenRuppert 33/165
32. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 33/164
JavaFX 8 - JumpStart
Hello World - only to remember
performance is part of TDD
.. how fast are the services?
.. start with microbenchmarks
.. use JMH -> http://openjdk.java.net/projects/code-tools/jmh/
@SvenRuppert 34/165
33. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 34/164
JavaFX 8 - JumpStart
Hello World - only to remember
performance is part of TDD
.. how fast are the services?
.. start with microbenchmarks
.. use JMH -> http://openjdk.java.net/projects/code-tools/jmh/
show the code v003 ;-)
@SvenRuppert 35/165
39. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 40/164
JavaFX 8 - TestFX
integration tests - including UI ?
but....
unit tests - how to test a UI component
@SvenRuppert 41/165
40. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 41/164
JavaFX 8 - TestFX
integration tests - including UI ?
but....
unit tests - how to test a UI component
system tests - how to test an UI workflow
@SvenRuppert 42/165
41. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 42/164
JavaFX 8 - TestFX
manual testing
a tester tests the complete app
@SvenRuppert 43/165
42. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 43/164
JavaFX 8 - TestFX
manual testing
a tester tests the complete app
create a test plan
@SvenRuppert 44/165
43. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 44/164
JavaFX 8 - TestFX
manual testing
a tester tests the complete app
create a test plan
update the test plan for each release
@SvenRuppert 45/165
44. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 45/164
JavaFX 8 - TestFX
manual testing
a tester tests the complete app
create a test plan
update the test plan for each release
test each release
@SvenRuppert 46/165
45. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 46/164
JavaFX 8 - TestFX
CI / CD
update the test plan for each commit
@SvenRuppert 47/165
46. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 47/164
JavaFX 8 - TestFX
CI / CD
update the test plan for each commit
test each commit
@SvenRuppert 48/165
47. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 48/164
JavaFX 8 - TestFX
IDE based Tools like Selenium
QF-Test
@SvenRuppert 49/165
48. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 49/164
JavaFX 8 - TestFX
IDE based Tools like Selenium
QF-Test
commercial product
@SvenRuppert 50/165
49. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 50/164
JavaFX 8 - TestFX
IDE based Tools like Selenium
QF-Test
commercial product
developer licence costs around 1995 €
@SvenRuppert 51/165
50. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 51/164
JavaFX 8 - TestFX
IDE based Tools like Selenium
QF-Test
commercial product
developer licence costs around 1995 €
no JUnit approach
@SvenRuppert 52/165
51. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 52/164
JavaFX 8 - TestFX
IDE based Tools like Selenium
QF-Test
commercial product
developer licence costs around 1995 €
no JUnit approach
CI integration
@SvenRuppert 53/165
52. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 53/164
JavaFX 8 - TestFX
IDE based Tools like Selenium
QF-Test
commercial product
developer licence costs around 1995 €
no JUnit approach
CI integration
nearly the same as froglogic...
@SvenRuppert 54/165
53. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 54/164
JavaFX 8 - TestFX
JemmyFX
is for JavaFX 2.2
last commit is over 2 yearsago
looks like there is no development activity
@SvenRuppert 55/165
54. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 55/164
JavaFX 8 - TestFX
JemmyFX
is for JavaFX 2.2
last commit is over 2 yearsago
looks like there is no development activity
Don´t use it
@SvenRuppert 56/165
56. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 57/164
JavaFX 8 - TestFX
MarvinFX
https://github.com/guigarage/MarvinFX
Provides Supervisors for JavaFX Properties
we (Hendrik Ebbers and Sven) are merging into TestFX
@SvenRuppert 58/165
57. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 58/164
JavaFX 8 - TestFX
MarvinFX
https://github.com/guigarage/MarvinFX
Provides Supervisors for JavaFX Properties
we (Hendrik Ebbers and Sven) are merging into TestFX
Don´t use it
@SvenRuppert 59/165
62. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 63/164
JavaFX 8 - TestFX
finally TestFX
active development
LTS branch for Java7 is available
active branch JavaFX8 only
@SvenRuppert 64/165
63. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 64/164
JavaFX 8 - TestFX
finally TestFX
verifying the behavior of JavaFX applications
@SvenRuppert 65/165
64. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 65/164
JavaFX 8 - TestFX
finally TestFX
verifying the behavior of JavaFX applications
API for interacting with JavaFX applications.
@SvenRuppert 66/165
65. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 66/164
JavaFX 8 - TestFX
finally TestFX
verifying the behavior of JavaFX applications
API for interacting with JavaFX applications.
fluent and clean API
@SvenRuppert 67/165
66. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 67/164
JavaFX 8 - TestFX
finally TestFX
verifying the behavior of JavaFX applications
API for interacting with JavaFX applications.
fluent and clean API
Supports Hamcrest Matchers and Lambda expressions.
@SvenRuppert 68/165
67. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 68/164
JavaFX 8 - TestFX
finally TestFX
verifying the behavior of JavaFX applications
API for interacting with JavaFX applications.
fluent and clean API
Supports Hamcrest Matchers and Lambda expressions.
Screenshots of failed tests.
@SvenRuppert 69/165
68. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 69/164
JavaFX 8 - TestFX
finally TestFX
verifying the behavior of JavaFX applications
API for interacting with JavaFX applications.
fluent and clean API
Supports Hamcrest Matchers and Lambda expressions.
Screenshots of failed tests.
internal used by Oracle for JavaFX
@SvenRuppert 70/165
69. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 70/164
JavaFX 8 - TestFX
finally TestFX
start with a Login Screen.
@SvenRuppert 71/165
70. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 71/164
JavaFX 8 - TestFX
finally TestFX
start with a Login Screen.
... TextField / Password-Field / Button
@SvenRuppert 72/165
72. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 73/164
JavaFX 8 - TestFX
finally TestFX
each test must extend the GUITest class
@SvenRuppert
publicclassMyTestextendsGuiTest{
@Test
publicvoidtestLogin(){...}
}
JAVA
74/165
73. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 74/164
JavaFX 8 - TestFX
finally TestFX
each test must extend the GUITest class
.. and provide the the root node
@SvenRuppert
publicclassMyTestextendsGuiTest{
protectedNodegetRootNode(){..}
@Test
publicvoidtestLogin(){...}
}
JAVA
75/165
74. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 75/164
JavaFX 8 - TestFX
finally TestFX
The GuiTest class provides a lot of functions that can be used to interact with
JavaFX
.. and provide the the root node
@SvenRuppert
publicclassMyTestextendsGuiTest{
protectedNodegetRootNode(){..}
@Test
publicvoidtestLogin(){
click(".text-field");
type("steve");
//...
}
}
JAVA
76/165
75. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 76/164
JavaFX 8 - TestFX
finally TestFX
ok, how we would do it ?
@SvenRuppert 77/165
76. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 77/164
JavaFX 8 - TestFX
finally TestFX
ok, how we would do it ?
..extract a component
@SvenRuppert 78/165
77. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 78/164
JavaFX 8 - TestFX
finally TestFX
@SvenRuppert
public class AddComponent extends HBox {
private Controller controller = new Controller();
final private TextField tf1 = new TextField();
final private TextField tf2 = new TextField();
final private TextField tfResult = new TextField();
final Button button = new Button();
{
tf1.setId("tf1");
tf2.setId("tf2");
tfResult.setId("tfResult");
button.setId("btnAdd");
button.setText("Ohhh press me..");
button.setOnAction(event -> {
String v1 = tf1.getText(); String v2 = tf2.getText();
String result = controller.add(v1, v2);
tfResult.setText(result);
});
this.getChildren().addAll(tf1, tf2, button, tfResult);
}
}
JAVA
79/165
78. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 79/164
JavaFX 8 - TestFX
finally TestFX
@SvenRuppert
public class JavaFXPlain extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
final AnchorPane rootNode = new AnchorPane();
rootNode.getChildren().add(new AddComponent());
final Scene scene = new Scene(rootNode, 640, 60);
primaryStage.setScene(scene);
primaryStage.show();
}
}
JAVA
80/165
80. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 81/164
JavaFX 8 - TestFX
finally TestFX
Controller is tested !
the main class is nearly only pure JDK/JavaFX8
@SvenRuppert 82/165
81. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 82/164
JavaFX 8 - TestFX
finally TestFX
Controller is tested !
the main class is nearly only pure JDK/JavaFX8
the component AddComponent needs to be tested at the Button Action Event
@SvenRuppert 83/165
82. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 83/164
JavaFX 8 - TestFX
finally TestFX
Controller is tested !
the main class is nearly only pure JDK/JavaFX8
the component AddComponent needs to be tested at the Button Action Event
if the Button Action Event is tested -> code coverage is increased
@SvenRuppert 84/165
83. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 84/164
JavaFX 8 - TestFX
finally TestFX
Controller is tested !
the main class is nearly only pure JDK/JavaFX8
the component AddComponent needs to be tested at the Button Action Event
if the Button Action Event is tested -> code coverage is increased
.. extend from GUITest
@SvenRuppert 85/165
84. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 85/164
JavaFX 8 - TestFX
finally TestFX
Controller is tested !
the main class is nearly only pure JDK/JavaFX8
the component AddComponent needs to be tested at the Button Action Event
if the Button Action Event is tested -> code coverage is increased
.. extend from GUITest
.. create RootNode
@SvenRuppert 86/165
85. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 86/164
JavaFX 8 - TestFX
finally TestFX
Controller is tested !
the main class is nearly only pure JDK/JavaFX8
the component AddComponent needs to be tested at the Button Action Event
if the Button Action Event is tested -> code coverage is increased
.. extend from GUITest
.. create RootNode
.. write your tests
@SvenRuppert 87/165
86. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 87/164
JavaFX 8 - TestFX
finally TestFX
@SvenRuppert
public class AddComponentTest extends GuiTest {
@Override
protected Parent getRootNode() {
AddComponent addComponent = new AddComponent();
addComponent.setId("c");
return addComponent;
}
JAVA
88/165
90. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 91/164
JavaFX 8 - TestFX
finally TestFX
Now... FXML
.. with FXML you could describe the UI
@SvenRuppert 92/165
91. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 92/164
JavaFX 8 - TestFX
finally TestFX
Now... FXML
.. with FXML you could describe the UI
.. but how ?
@SvenRuppert 93/165
92. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 93/164
JavaFX 8 - TestFX
finally TestFX
Now... FXML
.. with FXML you could describe the UI
.. but how ?
Create Components... beginning from the top.
@SvenRuppert 94/165
93. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 94/164
JavaFX 8 - TestFX
finally TestFX
Now... FXML
.. with FXML you could describe the UI
.. but how ?
Create Components... beginning from the top.
.. every Component will have
@SvenRuppert 95/165
94. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 95/164
JavaFX 8 - TestFX
finally TestFX
Now... FXML
.. with FXML you could describe the UI
.. but how ?
Create Components... beginning from the top.
.. every Component will have
.. .. a class called XYZPane
@SvenRuppert 96/165
95. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 96/164
JavaFX 8 - TestFX
finally TestFX
Now... FXML
.. with FXML you could describe the UI
.. but how ?
Create Components... beginning from the top.
.. every Component will have
.. .. a class called XYZPane
.. .. a class called XYZPaneController
@SvenRuppert 97/165
96. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 97/164
JavaFX 8 - TestFX
finally TestFX
Now... FXML
.. with FXML you could describe the UI
.. but how ?
Create Components... beginning from the top.
.. every Component will have
.. .. a class called XYZPane
.. .. a class called XYZPaneController
.. .. a file called XYZPane.fxml
@SvenRuppert 98/165
97. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 98/164
JavaFX 8 - TestFX
finally TestFX
@SvenRuppert
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
MainPane root = new MainPane();
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root, 300, 275));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
JAVA
99/165
104. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 105/164
Why CDI
we want to get rid of hard connections
@SvenRuppert 106/165
105. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 106/164
Why CDI
we want to get rid of hard connections
Have a look at the definition of a List. List will be the return value -> List.
@SvenRuppert
publicList<Data>execute(){...}; JAVA
107/165
106. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 107/164
Why CDI
the caller of the method dont know if it is an ArrayList or LinkedList... but
@SvenRuppert
importjava.util.List;
importjava.util.ArrayList;
publicList<Data>execute(){
finalList<Data>result=newArrayList<>();
//....
returnresult;
}
JAVA
108/165
107. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 108/164
Why CDI
the caller of the method dont know if it is an ArrayList or LinkedList... but
.. inside the method you will have a static ref to ArrayList
@SvenRuppert
importjava.util.List;
importjava.util.ArrayList;
publicList<Data>execute(){
finalList<Data>result=newArrayList<>();
//....
returnresult;
}
JAVA
109/165
108. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 109/164
Why CDI
if you are not using a special method from ArrayList ... -> trimToSize()
@SvenRuppert 110/165
109. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 110/164
Why CDI
if you are not using a special method from ArrayList ... -> trimToSize()
Why not get rid of the static ref ??
@SvenRuppert 111/165
110. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 111/164
Why CDI
if you are not using a special method from ArrayList ... -> trimToSize()
Why not get rid of the static ref ??
Maybe at runtime a LinkedList would be better.. we dont want to compile all
again..
@SvenRuppert 112/165
111. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 112/164
Why CDI
if you are not using a special method from ArrayList ... -> trimToSize()
Why not get rid of the static ref ??
Maybe at runtime a LinkedList would be better.. we dont want to compile all
again..
ok, we could use Factories..
@SvenRuppert 113/165
112. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 113/164
Why CDI
we are using plain SE
.. an example of a factory implementation
@SvenRuppert
importjava.util.ArrayList;
importjava.util.LinkedList;
importjava.util.List;
publicclassListFactory{
publicListcreateArrayList() {returnnewArrayList();}
publicListcreateLinkedList(){returnnewLinkedList();}
publicListcreateList() {returnnewArrayList();}
}
JAVA
114/165
113. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 114/164
Why CDI
Do we have something better reached?
@SvenRuppert 115/165
114. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 115/164
Why CDI
Do we have something better reached?
the developers in your project are using this factory...
@SvenRuppert 116/165
115. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 116/164
Why CDI
Do we have something better reached?
the developers in your project are using this factory... if they will know that there
is a factory ;-)
@SvenRuppert 117/165
118. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 119/164
Why CDI
ok, no static ref to ArrayList..
@SvenRuppert 120/165
119. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 120/164
Why CDI
ok, no static ref to ArrayList..
but we have a static ref to the factory method
@SvenRuppert 121/165
120. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 121/164
Why CDI
ok, no static ref to ArrayList..
but we have a static ref to the factory method
The implementation of the ListFactory itself will have all ref to all
implementations
@SvenRuppert 122/165
121. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 122/164
Solution Nr 1
based on Java SE
a little bit more dynamic..
@SvenRuppert 123/165
122. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 123/164
Solution Nr 1
based on Java SE
a little bit more dynamic..
@SvenRuppert
importjava.util.ArrayList;
importjava.util.LinkedList;
importjava.util.List;
importorg.rapidpm.demo.cdi.commons.registry.ContextResolver;
publicclassListFactory{
publicListcreateList(finalContextResolvercontextResolver){
if(contextResolver==null){returncreateArrayList();}
else{
if(contextResolver.resolveContext()){returncreateArrayList();}
else{returncreateLinkedList();}
}
}
}
JAVA
124/165
123. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 124/164
Solution Nr 1
based on Java SE
a little bit more dynamic..
the complexity is now -> ContextResolver
@SvenRuppert 125/165
124. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 125/164
Solution Nr 1
based on Java SE
a little bit more dynamic..
the complexity is now -> ContextResolver
Added dep to the ContextResolver
@SvenRuppert 126/165
125. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 126/164
Solution Nr 1
based on Java SE
a little bit more dynamic..
the complexity is now -> ContextResolver
Added dep to the ContextResolver
you got: at runtime you could switch the implementation
@SvenRuppert 127/165
126. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 127/164
Solution Nr 1
based on Java SE
if you want to get rid of the deps inside the factory.. create a registry
@SvenRuppert 128/165
127. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 128/164
Solution Nr 1
based on Java SE
if you want to get rid of the deps inside the factory.. create a registry
at runtime you could register / unregister implemenattaions..
@SvenRuppert 129/165
128. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 129/164
Solution Nr 1
based on Java SE
if you want to get rid of the deps inside the factory.. create a registry
at runtime you could register / unregister implemenattaions..
CDI will help...
@SvenRuppert 130/165
129. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 130/164
finally CDI ;-)
based on Weld / WELD-SE
instances are given from the container via @Inject
@SvenRuppert 131/165
130. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 131/164
finally CDI ;-)
based on Weld / WELD-SE
instances are given from the container via @Inject
@SvenRuppert
@InjectListlist; JAVA
132/165
131. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 132/164
finally CDI ;-)
based on Weld / WELD-SE
instances are given from the container via @Inject
@SvenRuppert
@Inject@CDILegacyTestListlist; JAVA
133/165
132. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 133/164
finally CDI ;-)
based on Weld / WELD-SE
instances are given from the container via @Inject
@SvenRuppert
@Inject@CDILegacyTestListlist;
@Produces@CDILegacyTest
publicListcreateList(...){...}
JAVA
134/165
133. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 134/164
finally CDI ;-)
based on Weld / WELD-SE
instances are given from the container via @Inject
@SvenRuppert
@Inject@CDILegacyTestListlist;
@Produces@CDILegacyTest
publicListcreateList(InjectionPointinjectionPoint,
BeanManagerbeanManager,ContextResolvercontextResolver){
....
}
JAVA
135/165
134. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 135/164
finally CDI ;-)
based on Weld / WELD-SE
instances are given from the container via @Inject
@SvenRuppert
@Inject@CDILegacyTestListlist;
@Produces@CDILegacyTest
publicListcreateList(InjectionPointinjectionPoint,
BeanManagerbeanManager,ContextResolvercontextResolver){
booleanb=contextResolver.resolveContext(...); //treffenderEntscheidungen...
if(b){returnnewLinkedList();}else{returnnewArrayList();}
}
JAVA
136/165
135. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 136/164
finally CDI ;-)
based on Weld / WELD-SE
instances are given from the container via @Inject
the time to create the instance is to early..
@SvenRuppert
@Inject@CDILegacyTestListlist;
@Produces@CDILegacyTest
publicListcreateList(InjectionPointinjectionPoint,
BeanManagerbeanManager,ContextResolvercontextResolver){
booleanb=contextResolver.resolveContext(...); //treffenderEntscheidungen...
if(b){returnnewLinkedList();}else{returnnewArrayList();}
}
JAVA
137/165
136. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 137/164
finally CDI ;-)
based on Weld / WELD-SE
but it could be done at runtime..
@SvenRuppert 138/165
137. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 138/164
finally CDI ;-)
based on Weld / WELD-SE
but it could be done at runtime..
decide as late as possible
@SvenRuppert 139/165
138. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 139/164
finally CDI ;-)
based on Weld / WELD-SE
but it could be done at runtime..
decide as late as possible
@SvenRuppert
@Inject@CDILegacyTestInstance<List>listInstance; JAVA
140/165
139. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 140/164
finally CDI ;-)
based on Weld / WELD-SE
but it could be done at runtime..
decide as late as possible
@SvenRuppert
@Inject@CDILegacyTestInstance<List>listInstance;
//..später
finalListlist=listInstance.get();
JAVA
141/165
140. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 141/164
finally CDI ;-)
based on Weld / WELD-SE
but it could be done at runtime..
decide as late as possible
@SvenRuppert
@Inject@CDILegacyTestInstance<List>listInstance;
//..später
finalListlist=listInstance.get();
@Produces@CDILegacyTest
publicListcreateList(InjectionPointinjectionPoint,
BeanManagerbeanManager,ContextResolvercontextResolver){
booleanb=contextResolver.resolveContext(...); //treffenderEntscheidungen...
if(b){returnnewLinkedList();}else{returnnewArrayList();}
}
JAVA
142/165
141. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 142/164
finally CDI ;-)
based on Weld / WELD-SE
static bound via AnnotationsLiteral:
@SvenRuppert
@Inject@MyQualifierListliste; JAVA
143/165
142. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 143/164
finally CDI ;-)
based on Weld / WELD-SE
static bound via AnnotationsLiteral:
Generics are not well supported
@SvenRuppert
@Inject@MyQualifierListliste; JAVA
144/165
143. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 144/164
finally CDI ;-)
based on Weld / WELD-SE
static bound via AnnotationsLiteral:
Generics are not well supported
but still complex to use
@SvenRuppert
@Inject@MyQualifierListliste; JAVA
145/165
144. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 145/164
CDI explained by code
Qualifier und AnnotationsLiterale
@SvenRuppert
@Inject@CDILoggerLoggerlogger; JAVA
146/165
145. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 146/164
CDI explained by code
Qualifier und AnnotationsLiterale
@SvenRuppert
@Inject@CDILoggerLoggerlogger; JAVA
147/165
146. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 147/164
CDI explained by code
Qualifier und AnnotationsLiterale
@SvenRuppert
@Inject@CDILoggerLoggerlogger; JAVA
@Producer@CDILoggerLoggercreate(...); JAVA
148/165
147. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 148/164
CDI explained by code
Qualifier und AnnotationsLiterale
@SvenRuppert
@Inject@CDILoggerLoggerlogger; JAVA
@Producer@CDILoggerLoggercreate(...); JAVA
@Producer@CDILoggerLoggercreate(..){
AnnotationsLiteralprodAL=contextResolver.resolve(..);
};
JAVA
149/165
148. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 149/164
CDI explained by code
Qualifier und AnnotationsLiterale
@SvenRuppert
@Inject@CDILoggerLoggerlogger; JAVA
@Producer@CDILoggerLoggercreate(...); JAVA
@Producer@CDILoggerLoggercreate(BeanManagerbm,ContextResolvercr){
AnnotationsLiteralprodAL=contextResolver.resolve(..);
returncreator.getManagedInstance(Logger.class,annotationLiteral);
};
JAVA
150/165
149. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 150/164
CDI explained by code
Qualifier und AnnotationsLiterale
you will get a dynamic AnnotationLiteral
@SvenRuppert
@Inject@CDILoggerLoggerlogger; JAVA
@Producer@CDILoggerLoggercreate(...); JAVA
@Producer@CDILoggerLoggercreate(BeanManagerbm,ContextResolvercr){
AnnotationsLiteralprodAL=contextResolver.resolve(..);
returncreator.getManagedInstance(Logger.class,annotationLiteral);
};
JAVA
151/165
150. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 151/164
CDI explained by code
Qualifier und AnnotationsLiterale
you will get a dynamic AnnotationLiteral
AnnotationsLiteral and class -> select the Producers
@SvenRuppert
@Inject@CDILoggerLoggerlogger; JAVA
@Producer@CDILoggerLoggercreate(...); JAVA
@Producer@CDILoggerLoggercreate(BeanManagerbm,ContextResolvercr){
AnnotationsLiteralprodAL=contextResolver.resolve(..);
returncreator.getManagedInstance(Logger.class,annotationLiteral);
};
JAVA
152/165
151. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 152/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
@SvenRuppert 153/165
152. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 153/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
@SvenRuppert 154/165
153. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 154/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
as lean as possible: 3 classes, no external dependencies
@SvenRuppert 155/165
154. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 155/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
as lean as possible: 3 classes, no external dependencies
combines: FXML, Convention over Configuration and JSR-330 / @Inject
integrated with maven 3
@SvenRuppert 156/165
155. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 156/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
as lean as possible: 3 classes, no external dependencies
combines: FXML, Convention over Configuration and JSR-330 / @Inject
integrated with maven 3
under active development
@SvenRuppert 157/165
156. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 157/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
as lean as possible: 3 classes, no external dependencies
combines: FXML, Convention over Configuration and JSR-330 / @Inject
integrated with maven 3
under active development
injection over a few steps is working
@SvenRuppert 158/165
157. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 158/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
as lean as possible: 3 classes, no external dependencies
combines: FXML, Convention over Configuration and JSR-330 / @Inject
integrated with maven 3
under active development
injection over a few steps is working
postconstruct is working
@SvenRuppert 159/165
158. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 159/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
as lean as possible: 3 classes, no external dependencies
combines: FXML, Convention over Configuration and JSR-330 / @Inject
integrated with maven 3
under active development
injection over a few steps is working
postconstruct is working
using existing CDI Services with Annotations (Scopes and so on) is not working with afterburner
@SvenRuppert 160/165
159. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 160/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
as lean as possible: 3 classes, no external dependencies
combines: FXML, Convention over Configuration and JSR-330 / @Inject
integrated with maven 3
under active development
injection over a few steps is working
postconstruct is working
using existing CDI Services with Annotations (Scopes and so on) is not working with afterburner
no mixed mode with CDI and afterburner.fx
@SvenRuppert 161/165
160. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 161/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner.fx ... show the code ..
@SvenRuppert 162/165
161. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 162/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with CDI bootstrap ... code only..
@SvenRuppert 163/165
162. 20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 163/164
@SvenRuppert
http://www.rapidpm.org // http://www.codecentric.de
(privater) Tech - Newsletter -> Core Java, Reflection, IoT, uvm
Bei Interesse bitte bei mir eintragen -> plain old Zettel ;-)
g+: www.google.com/+SvenRuppert
github : github.com/svenruppert