Skip to content

Commit

Permalink
Added docstring to SearchThread. minor changes and typos fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Durilian committed Sep 11, 2020
1 parent 0666a08 commit cd3b280
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>pl.durilian</groupId>
<artifactId>wordAutomation</artifactId>
<version>1.0.0</version>
<version>1.0.2</version>
<packaging>jar</packaging>
<properties>
<java.version>11</java.version>
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 54,11 @@ Jeśli masz uwagi, pomysły, bugi, bądź po prostu chciałbyś wyrazić swoją
<br>

## Hello everyone!
I made this project for my girlfriend which is currently trying to get a driving license. But the terms for the exam are very long. So I made this checker for her and then decided to make it public.
I made this project for my girlfriend which is currently trying to get a driving license. The terms for the exam are very long. So I made this checker for her and then decided to make it public.

Writing this project gave me a lot of fun and I have still a lot of ideas on how to improve it and expand its functionalities. So probably I will be still committing here.
Writing this project gave me a lot of fun, and I have still a lot of ideas on how to improve it and expand its functionalities. So probably I will be still committing here.

I have decided to write it as well as my programmatic skills allow me to. So if you are here because you are thinking of hiring me this code is something you can expect from me. But before you make your decision some explanation:
I have decided to write it as well as my programmatic skills allow me to. So if you are here because you are thinking of hiring me this code is something you can expect from me. Before you make your decision some explanation:

1. As there is only one rest post API request I just put everything straight in one method. Because making some larger architecture for it would be an overkill for me.
2. UI class - I just made it to allow non-technical users to use my project. It was my first adventure with UI and I am aware that it is terribly written and probably has tons of anti-patterns in it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 16,7 @@
@Setter
@Log4j2
@FieldDefaults(level = AccessLevel.PRIVATE)

/**
* contains fields and elements shared between all pages
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 8,7 @@

@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
public class NewPage extends AbstractBasePage<NewPage> {
public final static String URI = "/new";
public static String URI = "/new";

//locators
SelenideElement searchField = $("input");
Expand Down
19 changes: 0 additions & 19 deletions src/main/java/pl/durilian/wordTermsChecker/ui/UserInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 211,8 @@ public UserInterface() {
ActionListener logAction = timerActionLogs();
new Timer(LOGS_DELAY, logAction).start();

/**
* method updating logs every @{LOGS_DELAY} miliseconds
*/

/**
* Add start action to run button.
* You can launch multiple searches with different configuration in parallel
*/
runButton.addActionListener(ae -> {
List<String> cities = new ArrayList<String>();
Expand Down Expand Up @@ -268,20 263,6 @@ private void createLogsIfNotExist() {
}
}

/**
* <pre>
* Key point for the application responsible for launching checker of free terms
* </pre>
*
* @param cities array of cities passed from UI as Miasto1, Miasto2 etc.
* @param category category passed from UI e.g. "B"
* @param examType teoria or praktyka String passed from UI
* @param email email used as login on info-car passed from UI
* @param password password for emmail on info-car passed from UI
* @param poolingTime interval between running search again
*/


/**
* Method overwrriting file with todays logs with empty String
*/
Expand Down
24 changes: 22 additions & 2 deletions src/main/java/pl/durilian/wordTermsChecker/utils/SearchThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 12,10 @@
@Setter
@Getter
@Slf4j
/**
* It is not a thread itself but it contains a thread that is responsible for running searches.
* Currently application create only 1 search thread and this thread need to be stopped to run new search.
*/
public class SearchThread implements Runnable {
final String name = "searchThread";
final Thread thread;
Expand All @@ -26,6 30,18 @@ public class SearchThread implements Runnable {
boolean checkNextMonth;
ConfigurationManager configurationManager = ConfigurationManager.getInstance();

/**
* <pre>
* Loads data to thread responsible for launching searches
* </pre>
*
* @param cities array of cities passed from UI as Miasto1, Miasto2 etc.
* @param category category passed from UI e.g. "B"
* @param examType teoria or praktyka String passed from UI
* @param email email used as login on info-car passed from UI
* @param password password for email on info-car passed from UI
* @param poolingTime interval between running search again
*/
public SearchThread(String[] cities, String category, String examType, String email, String
password, String wirePusherId, int poolingTime, boolean checkNextMonth) {
thread = new Thread(this, name);
Expand All @@ -43,6 59,9 @@ public SearchThread(String[] cities, String category, String examType, String em

}

/**
* Run the test that looks for a free term. Method uses data stored in thread to find desired exam
*/
public void run() {
while (!exit) {
String citiesSingleString = String.join(",", cities);
Expand All @@ -62,12 81,13 @@ public void run() {
testSuite.setTestClasses(new Class[]{WordTest.class});
testSuite.addListener(new TestSuiteListener());
testSuite.run();
stop();
log.debug("thread kurna interrupted!");
}

}

/**
* Sets flag responsible for stopping search
*/
public void stop() {
exit = true;
}
Expand Down

0 comments on commit cd3b280

Please sign in to comment.