Skip to content

Commit

Permalink
Java 11 migrate remaining p (#1122)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
anuragagarwal561994 authored and iluwatar committed Jan 16, 2020
1 parent 1401acc commit 428efc7
Show file tree
Hide file tree
Showing 82 changed files with 534 additions and 603 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
package com.iluwatar.masterworker;

import com.iluwatar.masterworker.system.ArrayTransposeMasterWorker;
import com.iluwatar.masterworker.system.MasterWorker;
import com.iluwatar.masterworker.system.systemmaster.ArrayTransposeMaster;
import com.iluwatar.masterworker.system.systemmaster.Master;
import com.iluwatar.masterworker.system.systemworkers.ArrayTransposeWorker;
import com.iluwatar.masterworker.system.systemworkers.Worker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
17 changes: 17 additions & 0 deletions page-object/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ private App() {
public static void main(String[] args) {

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

// should work for unix like OS (mac, unix etc...)
if (Desktop.isDesktopSupported()) {
Expand Down
4 changes: 2 additions & 2 deletions page-object/src/main/java/com/iluwatar/pageobject/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ private App() {
public static void main(String[] args) {

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

// Should work for unix like OS (mac, unix etc...)
if (Desktop.isDesktopSupported()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@

package com.iluwatar.pageobject;

import static org.junit.jupiter.api.Assertions.assertTrue;

import com.gargoylesoftware.htmlunit.WebClient;
import com.iluwatar.pageobject.pages.AlbumListPage;
import com.iluwatar.pageobject.pages.AlbumPage;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* Test Album Selection and Album Listing
*/
Expand All @@ -45,7 +45,7 @@ public void setUp() {

@Test
public void testSelectAlbum() {
AlbumPage albumPage = albumListPage.selectAlbum("21");
var albumPage = albumListPage.selectAlbum("21");
albumPage.navigateToPage();
assertTrue(albumPage.isAt());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@

package com.iluwatar.pageobject;

import static org.junit.jupiter.api.Assertions.assertTrue;

import com.gargoylesoftware.htmlunit.WebClient;
import com.iluwatar.pageobject.pages.AlbumListPage;
import com.iluwatar.pageobject.pages.AlbumPage;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* Test Album Page Operations
*/
Expand All @@ -46,7 +46,7 @@ public void setUp() {
@Test
public void testSaveAlbum() {

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

@Test
public void testCancelChanges() {
AlbumListPage albumListPage = albumPage.cancelChanges();
var albumListPage = albumPage.cancelChanges();
albumListPage.navigateToPage();
assertTrue(albumListPage.isAt());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@

package com.iluwatar.pageobject;

import static org.junit.jupiter.api.Assertions.assertTrue;

import com.gargoylesoftware.htmlunit.WebClient;
import com.iluwatar.pageobject.pages.AlbumListPage;
import com.iluwatar.pageobject.pages.LoginPage;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* Test Login Page Object
*/
Expand All @@ -45,7 +45,7 @@ public void setUp() {

@Test
public void testLogin() {
AlbumListPage albumListPage = loginPage
var albumListPage = loginPage
.enterUsername("admin")
.enterPassword("password")
.login();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
import com.gargoylesoftware.htmlunit.html.HtmlPage;

import java.io.IOException;
import java.util.List;

Expand Down Expand Up @@ -79,8 +78,8 @@ public boolean isAt() {
*/
public AlbumPage selectAlbum(String albumTitle) {
// uses XPath to find list of html anchor tags with the class album in it
List<HtmlAnchor> albumLinks = (List<HtmlAnchor>) page.getByXPath("//tr[@class='album']//a");
for (HtmlAnchor anchor : albumLinks) {
var albumLinks = (List<HtmlAnchor>) page.getByXPath("//tr[@class='album']//a");
for (var anchor : albumLinks) {
if (anchor.getTextContent().equals(albumTitle)) {
try {
anchor.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.gargoylesoftware.htmlunit.html.HtmlSelect;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;

import java.io.IOException;

/**
Expand Down Expand Up @@ -83,7 +82,7 @@ public boolean isAt() {
* @return {@link AlbumPage}
*/
public AlbumPage changeAlbumTitle(String albumTitle) {
HtmlTextInput albumTitleInputTextField = (HtmlTextInput) page.getElementById("albumTitle");
var albumTitleInputTextField = (HtmlTextInput) page.getElementById("albumTitle");
albumTitleInputTextField.setText(albumTitle);
return this;
}
Expand All @@ -96,7 +95,7 @@ public AlbumPage changeAlbumTitle(String albumTitle) {
* @return {@link AlbumPage}
*/
public AlbumPage changeArtist(String artist) {
HtmlTextInput artistInputTextField = (HtmlTextInput) page.getElementById("albumArtist");
var artistInputTextField = (HtmlTextInput) page.getElementById("albumArtist");
artistInputTextField.setText(artist);
return this;
}
Expand All @@ -109,8 +108,8 @@ public AlbumPage changeArtist(String artist) {
* @return {@link AlbumPage}
*/
public AlbumPage changeAlbumYear(int year) {
HtmlSelect albumYearSelectOption = (HtmlSelect) page.getElementById("albumYear");
HtmlOption yearOption = albumYearSelectOption.getOptionByValue(Integer.toString(year));
var albumYearSelectOption = (HtmlSelect) page.getElementById("albumYear");
var yearOption = albumYearSelectOption.getOptionByValue(Integer.toString(year));
albumYearSelectOption.setSelectedAttribute(yearOption, true);
return this;
}
Expand All @@ -123,7 +122,7 @@ public AlbumPage changeAlbumYear(int year) {
* @return {@link AlbumPage}
*/
public AlbumPage changeAlbumRating(String albumRating) {
HtmlTextInput albumRatingInputTextField = (HtmlTextInput) page.getElementById("albumRating");
var albumRatingInputTextField = (HtmlTextInput) page.getElementById("albumRating");
albumRatingInputTextField.setText(albumRating);
return this;
}
Expand All @@ -135,7 +134,7 @@ public AlbumPage changeAlbumRating(String albumRating) {
* @return {@link AlbumPage}
*/
public AlbumPage changeNumberOfSongs(int numberOfSongs) {
HtmlNumberInput numberOfSongsNumberField = (HtmlNumberInput) page.getElementById("numberOfSongs");
var numberOfSongsNumberField = (HtmlNumberInput) page.getElementById("numberOfSongs");
numberOfSongsNumberField.setText(Integer.toString(numberOfSongs));
return this;
}
Expand All @@ -147,7 +146,7 @@ public AlbumPage changeNumberOfSongs(int numberOfSongs) {
* @return {@link AlbumListPage}
*/
public AlbumListPage cancelChanges() {
HtmlSubmitInput cancelButton = (HtmlSubmitInput) page.getElementById("cancelButton");
var cancelButton = (HtmlSubmitInput) page.getElementById("cancelButton");
try {
cancelButton.click();
} catch (IOException e) {
Expand All @@ -163,7 +162,7 @@ public AlbumListPage cancelChanges() {
* @return {@link AlbumPage}
*/
public AlbumPage saveChanges() {
HtmlSubmitInput saveButton = (HtmlSubmitInput) page.getElementById("saveButton");
var saveButton = (HtmlSubmitInput) page.getElementById("saveButton");
try {
saveButton.click();
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public boolean isAt() {
* @return {@link LoginPage}
*/
public LoginPage enterUsername(String username) {
HtmlTextInput usernameInputTextField = (HtmlTextInput) page.getElementById("username");
var usernameInputTextField = (HtmlTextInput) page.getElementById("username");
usernameInputTextField.setText(username);
return this;
}
Expand All @@ -92,7 +92,7 @@ public LoginPage enterUsername(String username) {
* @return {@link LoginPage}
*/
public LoginPage enterPassword(String password) {
HtmlPasswordInput passwordInputPasswordField = (HtmlPasswordInput) page.getElementById("password");
var passwordInputPasswordField = (HtmlPasswordInput) page.getElementById("password");
passwordInputPasswordField.setText(password);
return this;
}
Expand All @@ -101,11 +101,11 @@ public LoginPage enterPassword(String password) {
/**
* Clicking on the login button to 'login'
*
* @return {@link AlbumListPage}
* - this is the page that user gets navigated to once successfully logged in
* @return {@link AlbumListPage} - this is the page that user gets navigated to once successfully
* logged in
*/
public AlbumListPage login() {
HtmlSubmitInput loginButton = (HtmlSubmitInput) page.getElementById("loginButton");
var loginButton = (HtmlSubmitInput) page.getElementById("loginButton");
try {
loginButton.click();
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
public abstract class Page {

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public boolean isAt() {
*/
public AlbumPage selectAlbum(String albumTitle) {
// uses XPath to find list of html anchor tags with the class album in it
List<HtmlAnchor> albumLinks = (List<HtmlAnchor>) page.getByXPath("//tr[@class='album']//a");
for (HtmlAnchor anchor : albumLinks) {
var albumLinks = (List<HtmlAnchor>) page.getByXPath("//tr[@class='album']//a");
for (var anchor : albumLinks) {
if (anchor.getTextContent().equals(albumTitle)) {
try {
anchor.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlNumberInput;
import com.gargoylesoftware.htmlunit.html.HtmlOption;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSelect;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
Expand Down Expand Up @@ -85,7 +84,7 @@ public boolean isAt() {
* @return {@link AlbumPage}
*/
public AlbumPage changeAlbumTitle(String albumTitle) {
HtmlTextInput albumTitleInputTextField = (HtmlTextInput) page.getElementById("albumTitle");
var albumTitleInputTextField = (HtmlTextInput) page.getElementById("albumTitle");
albumTitleInputTextField.setText(albumTitle);
return this;
}
Expand All @@ -98,7 +97,7 @@ public AlbumPage changeAlbumTitle(String albumTitle) {
* @return {@link AlbumPage}
*/
public AlbumPage changeArtist(String artist) {
HtmlTextInput artistInputTextField = (HtmlTextInput) page.getElementById("albumArtist");
var artistInputTextField = (HtmlTextInput) page.getElementById("albumArtist");
artistInputTextField.setText(artist);
return this;
}
Expand All @@ -111,8 +110,8 @@ public AlbumPage changeArtist(String artist) {
* @return {@link AlbumPage}
*/
public AlbumPage changeAlbumYear(int year) {
HtmlSelect albumYearSelectOption = (HtmlSelect) page.getElementById("albumYear");
HtmlOption yearOption = albumYearSelectOption.getOptionByValue(Integer.toString(year));
var albumYearSelectOption = (HtmlSelect) page.getElementById("albumYear");
var yearOption = albumYearSelectOption.getOptionByValue(Integer.toString(year));
albumYearSelectOption.setSelectedAttribute(yearOption, true);
return this;
}
Expand All @@ -125,7 +124,7 @@ public AlbumPage changeAlbumYear(int year) {
* @return {@link AlbumPage}
*/
public AlbumPage changeAlbumRating(String albumRating) {
HtmlTextInput albumRatingInputTextField = (HtmlTextInput) page.getElementById("albumRating");
var albumRatingInputTextField = (HtmlTextInput) page.getElementById("albumRating");
albumRatingInputTextField.setText(albumRating);
return this;
}
Expand All @@ -137,8 +136,7 @@ public AlbumPage changeAlbumRating(String albumRating) {
* @return {@link AlbumPage}
*/
public AlbumPage changeNumberOfSongs(int numberOfSongs) {
HtmlNumberInput numberOfSongsNumberField =
(HtmlNumberInput) page.getElementById("numberOfSongs");
var numberOfSongsNumberField = (HtmlNumberInput) page.getElementById("numberOfSongs");
numberOfSongsNumberField.setText(Integer.toString(numberOfSongs));
return this;
}
Expand All @@ -150,7 +148,7 @@ public AlbumPage changeNumberOfSongs(int numberOfSongs) {
* @return {@link AlbumListPage}
*/
public AlbumListPage cancelChanges() {
HtmlSubmitInput cancelButton = (HtmlSubmitInput) page.getElementById("cancelButton");
var cancelButton = (HtmlSubmitInput) page.getElementById("cancelButton");
try {
cancelButton.click();
} catch (IOException e) {
Expand All @@ -166,7 +164,7 @@ public AlbumListPage cancelChanges() {
* @return {@link AlbumPage}
*/
public AlbumPage saveChanges() {
HtmlSubmitInput saveButton = (HtmlSubmitInput) page.getElementById("saveButton");
var saveButton = (HtmlSubmitInput) page.getElementById("saveButton");
try {
saveButton.click();
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public boolean isAt() {
* @return {@link LoginPage}
*/
public LoginPage enterUsername(String username) {
HtmlTextInput usernameInputTextField = (HtmlTextInput) page.getElementById("username");
var usernameInputTextField = (HtmlTextInput) page.getElementById("username");
usernameInputTextField.setText(username);
return this;
}
Expand All @@ -95,8 +95,7 @@ public LoginPage enterUsername(String username) {
* @return {@link LoginPage}
*/
public LoginPage enterPassword(String password) {
HtmlPasswordInput passwordInputPasswordField =
(HtmlPasswordInput) page.getElementById("password");
var passwordInputPasswordField = (HtmlPasswordInput) page.getElementById("password");
passwordInputPasswordField.setText(password);
return this;
}
Expand All @@ -109,7 +108,7 @@ public LoginPage enterPassword(String password) {
* logged in
*/
public AlbumListPage login() {
HtmlSubmitInput loginButton = (HtmlSubmitInput) page.getElementById("loginButton");
var loginButton = (HtmlSubmitInput) page.getElementById("loginButton");
try {
loginButton.click();
} catch (IOException e) {
Expand Down
Loading

0 comments on commit 428efc7

Please sign in to comment.