Skip to content

Commit 428efc7

Browse files
anuragagarwal561994iluwatar
authored andcommitted
Java 11 migrate remaining p (#1122)
* Moves partial-response to Java 11 * Moves pipeline to Java 11 * Moves poison-pill to Java 11 * Moves priority-queue to Java 11 * Moves private-class-data to Java 11 * Moves producer-consumer to Java 11 * Moves promise to Java 11 * Moves property to Java 11 * Moves prototype to Java 11 * Moves proxy to Java 11 * Corrects checkstyle errors * Fixes build for pipeline pattern
1 parent 1401acc commit 428efc7

File tree

82 files changed

+534
-603
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+534
-603
lines changed

master-worker-pattern/src/main/java/com/iluwatar/masterworker/App.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
package com.iluwatar.masterworker;
2525

2626
import com.iluwatar.masterworker.system.ArrayTransposeMasterWorker;
27+
import com.iluwatar.masterworker.system.MasterWorker;
28+
import com.iluwatar.masterworker.system.systemmaster.ArrayTransposeMaster;
29+
import com.iluwatar.masterworker.system.systemmaster.Master;
30+
import com.iluwatar.masterworker.system.systemworkers.ArrayTransposeWorker;
31+
import com.iluwatar.masterworker.system.systemworkers.Worker;
2732
import org.slf4j.Logger;
2833
import org.slf4j.LoggerFactory;
2934

page-object/pom.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,23 @@
2626
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2727
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2828
<modelVersion>4.0.0</modelVersion>
29+
<properties>
30+
<maven.compiler.source>11</maven.compiler.source>
31+
<maven.compiler.target>11</maven.compiler.target>
32+
</properties>
33+
<dependencies>
34+
<dependency>
35+
<groupId>net.sourceforge.htmlunit</groupId>
36+
<artifactId>htmlunit</artifactId>
37+
<scope>test</scope>
38+
</dependency>
39+
<dependency>
40+
<groupId>org.junit.jupiter</groupId>
41+
<artifactId>junit-jupiter</artifactId>
42+
<version>RELEASE</version>
43+
<scope>test</scope>
44+
</dependency>
45+
</dependencies>
2946
<parent>
3047
<groupId>com.iluwatar</groupId>
3148
<artifactId>java-design-patterns</artifactId>

page-object/sample-application/src/main/java/com/iluwatar/pageobject/App.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ private App() {
7171
public static void main(String[] args) {
7272

7373
try {
74-
File applicationFile =
75-
new File(App.class.getClassLoader().getResource("sample-ui/login.html").getPath());
74+
var classLoader = App.class.getClassLoader();
75+
var applicationFile = new File(classLoader.getResource("sample-ui/login.html").getPath());
7676

7777
// should work for unix like OS (mac, unix etc...)
7878
if (Desktop.isDesktopSupported()) {

page-object/src/main/java/com/iluwatar/pageobject/App.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ private App() {
6767
public static void main(String[] args) {
6868

6969
try {
70-
File applicationFile =
71-
new File(App.class.getClassLoader().getResource("sample-ui/login.html").getPath());
70+
var classLoader = App.class.getClassLoader();
71+
var applicationFile = new File(classLoader.getResource("sample-ui/login.html").getPath());
7272

7373
// Should work for unix like OS (mac, unix etc...)
7474
if (Desktop.isDesktopSupported()) {

page-object/src/test/java/com/iluwatar/pageobject/AlbumListPageTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323

2424
package com.iluwatar.pageobject;
2525

26+
import static org.junit.jupiter.api.Assertions.assertTrue;
27+
2628
import com.gargoylesoftware.htmlunit.WebClient;
2729
import com.iluwatar.pageobject.pages.AlbumListPage;
2830
import com.iluwatar.pageobject.pages.AlbumPage;
2931
import org.junit.jupiter.api.BeforeEach;
3032
import org.junit.jupiter.api.Test;
3133

32-
import static org.junit.jupiter.api.Assertions.assertTrue;
33-
3434
/**
3535
* Test Album Selection and Album Listing
3636
*/
@@ -45,7 +45,7 @@ public void setUp() {
4545

4646
@Test
4747
public void testSelectAlbum() {
48-
AlbumPage albumPage = albumListPage.selectAlbum("21");
48+
var albumPage = albumListPage.selectAlbum("21");
4949
albumPage.navigateToPage();
5050
assertTrue(albumPage.isAt());
5151
}

page-object/src/test/java/com/iluwatar/pageobject/AlbumPageTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323

2424
package com.iluwatar.pageobject;
2525

26+
import static org.junit.jupiter.api.Assertions.assertTrue;
27+
2628
import com.gargoylesoftware.htmlunit.WebClient;
2729
import com.iluwatar.pageobject.pages.AlbumListPage;
2830
import com.iluwatar.pageobject.pages.AlbumPage;
2931
import org.junit.jupiter.api.BeforeEach;
3032
import org.junit.jupiter.api.Test;
3133

32-
import static org.junit.jupiter.api.Assertions.assertTrue;
33-
3434
/**
3535
* Test Album Page Operations
3636
*/
@@ -46,7 +46,7 @@ public void setUp() {
4646
@Test
4747
public void testSaveAlbum() {
4848

49-
AlbumPage albumPageAfterChanges = albumPage
49+
var albumPageAfterChanges = albumPage
5050
.changeAlbumTitle("25")
5151
.changeArtist("Adele Laurie Blue Adkins")
5252
.changeAlbumYear(2015)
@@ -60,7 +60,7 @@ public void testSaveAlbum() {
6060

6161
@Test
6262
public void testCancelChanges() {
63-
AlbumListPage albumListPage = albumPage.cancelChanges();
63+
var albumListPage = albumPage.cancelChanges();
6464
albumListPage.navigateToPage();
6565
assertTrue(albumListPage.isAt());
6666
}

page-object/src/test/java/com/iluwatar/pageobject/LoginPageTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323

2424
package com.iluwatar.pageobject;
2525

26+
import static org.junit.jupiter.api.Assertions.assertTrue;
27+
2628
import com.gargoylesoftware.htmlunit.WebClient;
2729
import com.iluwatar.pageobject.pages.AlbumListPage;
2830
import com.iluwatar.pageobject.pages.LoginPage;
2931
import org.junit.jupiter.api.BeforeEach;
3032
import org.junit.jupiter.api.Test;
3133

32-
import static org.junit.jupiter.api.Assertions.assertTrue;
33-
3434
/**
3535
* Test Login Page Object
3636
*/
@@ -45,7 +45,7 @@ public void setUp() {
4545

4646
@Test
4747
public void testLogin() {
48-
AlbumListPage albumListPage = loginPage
48+
var albumListPage = loginPage
4949
.enterUsername("admin")
5050
.enterPassword("password")
5151
.login();

page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumListPage.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import com.gargoylesoftware.htmlunit.WebClient;
2727
import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
2828
import com.gargoylesoftware.htmlunit.html.HtmlPage;
29-
3029
import java.io.IOException;
3130
import java.util.List;
3231

@@ -79,8 +78,8 @@ public boolean isAt() {
7978
*/
8079
public AlbumPage selectAlbum(String albumTitle) {
8180
// uses XPath to find list of html anchor tags with the class album in it
82-
List<HtmlAnchor> albumLinks = (List<HtmlAnchor>) page.getByXPath("//tr[@class='album']//a");
83-
for (HtmlAnchor anchor : albumLinks) {
81+
var albumLinks = (List<HtmlAnchor>) page.getByXPath("//tr[@class='album']//a");
82+
for (var anchor : albumLinks) {
8483
if (anchor.getTextContent().equals(albumTitle)) {
8584
try {
8685
anchor.click();

page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumPage.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import com.gargoylesoftware.htmlunit.html.HtmlSelect;
3131
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
3232
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
33-
3433
import java.io.IOException;
3534

3635
/**
@@ -83,7 +82,7 @@ public boolean isAt() {
8382
* @return {@link AlbumPage}
8483
*/
8584
public AlbumPage changeAlbumTitle(String albumTitle) {
86-
HtmlTextInput albumTitleInputTextField = (HtmlTextInput) page.getElementById("albumTitle");
85+
var albumTitleInputTextField = (HtmlTextInput) page.getElementById("albumTitle");
8786
albumTitleInputTextField.setText(albumTitle);
8887
return this;
8988
}
@@ -96,7 +95,7 @@ public AlbumPage changeAlbumTitle(String albumTitle) {
9695
* @return {@link AlbumPage}
9796
*/
9897
public AlbumPage changeArtist(String artist) {
99-
HtmlTextInput artistInputTextField = (HtmlTextInput) page.getElementById("albumArtist");
98+
var artistInputTextField = (HtmlTextInput) page.getElementById("albumArtist");
10099
artistInputTextField.setText(artist);
101100
return this;
102101
}
@@ -109,8 +108,8 @@ public AlbumPage changeArtist(String artist) {
109108
* @return {@link AlbumPage}
110109
*/
111110
public AlbumPage changeAlbumYear(int year) {
112-
HtmlSelect albumYearSelectOption = (HtmlSelect) page.getElementById("albumYear");
113-
HtmlOption yearOption = albumYearSelectOption.getOptionByValue(Integer.toString(year));
111+
var albumYearSelectOption = (HtmlSelect) page.getElementById("albumYear");
112+
var yearOption = albumYearSelectOption.getOptionByValue(Integer.toString(year));
114113
albumYearSelectOption.setSelectedAttribute(yearOption, true);
115114
return this;
116115
}
@@ -123,7 +122,7 @@ public AlbumPage changeAlbumYear(int year) {
123122
* @return {@link AlbumPage}
124123
*/
125124
public AlbumPage changeAlbumRating(String albumRating) {
126-
HtmlTextInput albumRatingInputTextField = (HtmlTextInput) page.getElementById("albumRating");
125+
var albumRatingInputTextField = (HtmlTextInput) page.getElementById("albumRating");
127126
albumRatingInputTextField.setText(albumRating);
128127
return this;
129128
}
@@ -135,7 +134,7 @@ public AlbumPage changeAlbumRating(String albumRating) {
135134
* @return {@link AlbumPage}
136135
*/
137136
public AlbumPage changeNumberOfSongs(int numberOfSongs) {
138-
HtmlNumberInput numberOfSongsNumberField = (HtmlNumberInput) page.getElementById("numberOfSongs");
137+
var numberOfSongsNumberField = (HtmlNumberInput) page.getElementById("numberOfSongs");
139138
numberOfSongsNumberField.setText(Integer.toString(numberOfSongs));
140139
return this;
141140
}
@@ -147,7 +146,7 @@ public AlbumPage changeNumberOfSongs(int numberOfSongs) {
147146
* @return {@link AlbumListPage}
148147
*/
149148
public AlbumListPage cancelChanges() {
150-
HtmlSubmitInput cancelButton = (HtmlSubmitInput) page.getElementById("cancelButton");
149+
var cancelButton = (HtmlSubmitInput) page.getElementById("cancelButton");
151150
try {
152151
cancelButton.click();
153152
} catch (IOException e) {
@@ -163,7 +162,7 @@ public AlbumListPage cancelChanges() {
163162
* @return {@link AlbumPage}
164163
*/
165164
public AlbumPage saveChanges() {
166-
HtmlSubmitInput saveButton = (HtmlSubmitInput) page.getElementById("saveButton");
165+
var saveButton = (HtmlSubmitInput) page.getElementById("saveButton");
167166
try {
168167
saveButton.click();
169168
} catch (IOException e) {

page-object/src/test/java/com/iluwatar/pageobject/pages/LoginPage.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public boolean isAt() {
7979
* @return {@link LoginPage}
8080
*/
8181
public LoginPage enterUsername(String username) {
82-
HtmlTextInput usernameInputTextField = (HtmlTextInput) page.getElementById("username");
82+
var usernameInputTextField = (HtmlTextInput) page.getElementById("username");
8383
usernameInputTextField.setText(username);
8484
return this;
8585
}
@@ -92,7 +92,7 @@ public LoginPage enterUsername(String username) {
9292
* @return {@link LoginPage}
9393
*/
9494
public LoginPage enterPassword(String password) {
95-
HtmlPasswordInput passwordInputPasswordField = (HtmlPasswordInput) page.getElementById("password");
95+
var passwordInputPasswordField = (HtmlPasswordInput) page.getElementById("password");
9696
passwordInputPasswordField.setText(password);
9797
return this;
9898
}
@@ -101,11 +101,11 @@ public LoginPage enterPassword(String password) {
101101
/**
102102
* Clicking on the login button to 'login'
103103
*
104-
* @return {@link AlbumListPage}
105-
* - this is the page that user gets navigated to once successfully logged in
104+
* @return {@link AlbumListPage} - this is the page that user gets navigated to once successfully
105+
* logged in
106106
*/
107107
public AlbumListPage login() {
108-
HtmlSubmitInput loginButton = (HtmlSubmitInput) page.getElementById("loginButton");
108+
var loginButton = (HtmlSubmitInput) page.getElementById("loginButton");
109109
try {
110110
loginButton.click();
111111
} catch (IOException e) {

page-object/src/test/java/com/iluwatar/pageobject/pages/Page.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
public abstract class Page {
3232

3333
/**
34-
* Application Under Test path
35-
* This directory location is where html web pages are located
34+
* Application Under Test path This directory location is where html web pages are located
3635
*/
3736
public static final String AUT_PATH = "src/main/resources/sample-ui/";
3837

page-object/test-automation/src/main/java/com/iluwatar/pageobject/AlbumListPage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ public boolean isAt() {
8181
*/
8282
public AlbumPage selectAlbum(String albumTitle) {
8383
// uses XPath to find list of html anchor tags with the class album in it
84-
List<HtmlAnchor> albumLinks = (List<HtmlAnchor>) page.getByXPath("//tr[@class='album']//a");
85-
for (HtmlAnchor anchor : albumLinks) {
84+
var albumLinks = (List<HtmlAnchor>) page.getByXPath("//tr[@class='album']//a");
85+
for (var anchor : albumLinks) {
8686
if (anchor.getTextContent().equals(albumTitle)) {
8787
try {
8888
anchor.click();

page-object/test-automation/src/main/java/com/iluwatar/pageobject/AlbumPage.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
import com.gargoylesoftware.htmlunit.WebClient;
2727
import com.gargoylesoftware.htmlunit.html.HtmlNumberInput;
28-
import com.gargoylesoftware.htmlunit.html.HtmlOption;
2928
import com.gargoylesoftware.htmlunit.html.HtmlPage;
3029
import com.gargoylesoftware.htmlunit.html.HtmlSelect;
3130
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
@@ -85,7 +84,7 @@ public boolean isAt() {
8584
* @return {@link AlbumPage}
8685
*/
8786
public AlbumPage changeAlbumTitle(String albumTitle) {
88-
HtmlTextInput albumTitleInputTextField = (HtmlTextInput) page.getElementById("albumTitle");
87+
var albumTitleInputTextField = (HtmlTextInput) page.getElementById("albumTitle");
8988
albumTitleInputTextField.setText(albumTitle);
9089
return this;
9190
}
@@ -98,7 +97,7 @@ public AlbumPage changeAlbumTitle(String albumTitle) {
9897
* @return {@link AlbumPage}
9998
*/
10099
public AlbumPage changeArtist(String artist) {
101-
HtmlTextInput artistInputTextField = (HtmlTextInput) page.getElementById("albumArtist");
100+
var artistInputTextField = (HtmlTextInput) page.getElementById("albumArtist");
102101
artistInputTextField.setText(artist);
103102
return this;
104103
}
@@ -111,8 +110,8 @@ public AlbumPage changeArtist(String artist) {
111110
* @return {@link AlbumPage}
112111
*/
113112
public AlbumPage changeAlbumYear(int year) {
114-
HtmlSelect albumYearSelectOption = (HtmlSelect) page.getElementById("albumYear");
115-
HtmlOption yearOption = albumYearSelectOption.getOptionByValue(Integer.toString(year));
113+
var albumYearSelectOption = (HtmlSelect) page.getElementById("albumYear");
114+
var yearOption = albumYearSelectOption.getOptionByValue(Integer.toString(year));
116115
albumYearSelectOption.setSelectedAttribute(yearOption, true);
117116
return this;
118117
}
@@ -125,7 +124,7 @@ public AlbumPage changeAlbumYear(int year) {
125124
* @return {@link AlbumPage}
126125
*/
127126
public AlbumPage changeAlbumRating(String albumRating) {
128-
HtmlTextInput albumRatingInputTextField = (HtmlTextInput) page.getElementById("albumRating");
127+
var albumRatingInputTextField = (HtmlTextInput) page.getElementById("albumRating");
129128
albumRatingInputTextField.setText(albumRating);
130129
return this;
131130
}
@@ -137,8 +136,7 @@ public AlbumPage changeAlbumRating(String albumRating) {
137136
* @return {@link AlbumPage}
138137
*/
139138
public AlbumPage changeNumberOfSongs(int numberOfSongs) {
140-
HtmlNumberInput numberOfSongsNumberField =
141-
(HtmlNumberInput) page.getElementById("numberOfSongs");
139+
var numberOfSongsNumberField = (HtmlNumberInput) page.getElementById("numberOfSongs");
142140
numberOfSongsNumberField.setText(Integer.toString(numberOfSongs));
143141
return this;
144142
}
@@ -150,7 +148,7 @@ public AlbumPage changeNumberOfSongs(int numberOfSongs) {
150148
* @return {@link AlbumListPage}
151149
*/
152150
public AlbumListPage cancelChanges() {
153-
HtmlSubmitInput cancelButton = (HtmlSubmitInput) page.getElementById("cancelButton");
151+
var cancelButton = (HtmlSubmitInput) page.getElementById("cancelButton");
154152
try {
155153
cancelButton.click();
156154
} catch (IOException e) {
@@ -166,7 +164,7 @@ public AlbumListPage cancelChanges() {
166164
* @return {@link AlbumPage}
167165
*/
168166
public AlbumPage saveChanges() {
169-
HtmlSubmitInput saveButton = (HtmlSubmitInput) page.getElementById("saveButton");
167+
var saveButton = (HtmlSubmitInput) page.getElementById("saveButton");
170168
try {
171169
saveButton.click();
172170
} catch (IOException e) {

page-object/test-automation/src/main/java/com/iluwatar/pageobject/LoginPage.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public boolean isAt() {
8282
* @return {@link LoginPage}
8383
*/
8484
public LoginPage enterUsername(String username) {
85-
HtmlTextInput usernameInputTextField = (HtmlTextInput) page.getElementById("username");
85+
var usernameInputTextField = (HtmlTextInput) page.getElementById("username");
8686
usernameInputTextField.setText(username);
8787
return this;
8888
}
@@ -95,8 +95,7 @@ public LoginPage enterUsername(String username) {
9595
* @return {@link LoginPage}
9696
*/
9797
public LoginPage enterPassword(String password) {
98-
HtmlPasswordInput passwordInputPasswordField =
99-
(HtmlPasswordInput) page.getElementById("password");
98+
var passwordInputPasswordField = (HtmlPasswordInput) page.getElementById("password");
10099
passwordInputPasswordField.setText(password);
101100
return this;
102101
}
@@ -109,7 +108,7 @@ public LoginPage enterPassword(String password) {
109108
* logged in
110109
*/
111110
public AlbumListPage login() {
112-
HtmlSubmitInput loginButton = (HtmlSubmitInput) page.getElementById("loginButton");
111+
var loginButton = (HtmlSubmitInput) page.getElementById("loginButton");
113112
try {
114113
loginButton.click();
115114
} catch (IOException e) {

0 commit comments

Comments
 (0)