public class TestDepthTrackerClient extends java.lang.Object implements DepthTracker
Constructor and Description |
---|
TestDepthTrackerClient() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this client
|
void |
close(boolean resetAllCategories)
Closes this client and resets all categories on the site IFF this is the last thread scraping the site and this scrape wasn't stopped early
|
void |
close(boolean resetAllCategories,
boolean fullReset)
Closes this client and resets all categories on the site IFF this is the last thread scraping the site and this scrape wasn't stopped early
|
boolean |
enterCategory(java.lang.String categoryName) |
boolean |
enterCategory(java.lang.String categoryName,
boolean isBaseCategory) |
boolean |
enterCategory(java.lang.String categoryName,
int numRecords) |
boolean |
enterCategory(java.lang.String categoryName,
int numRecords,
boolean isBaseCategory) |
void |
exitCategory() |
void |
exitCategory(int numRecords,
RunState endState) |
void |
exitCategory(RunState endState) |
APIConnection |
getApiConnection()
Returns the connection to the API that this client uses.
|
Category |
getCategory(java.lang.String name)
Gets a category by name, assuming the category is a child of whatever we are currently in
|
java.lang.Long |
getCurrentCategoryId()
Returns the ID of the category we are currently in
|
java.util.Date |
getCurrentCategoryInitialEntryDate()
Returns the initial entry time for the current category, or null if there are no categories (or the first entry date is unknown)
|
java.util.Date |
getCurrentCategoryLastEntryTimeForSuccessfulExit()
Returns the last entry time when this category was entered and a thread successfully exited it.
|
java.util.Date |
getCurrentCategoryPreviousEntryDate()
Returns the last entry time for the current category (prior to the current entry), or null if there are no categories (or the category had never been entered prior to this
entry)
|
java.util.List<java.lang.String> |
getCurrentStack()
Returns the currently tracked stack of elements, as a list
|
java.util.Date |
getOldestSuccessfulEntryExitEncountered() |
long |
getSiteId()
Returns the id of the site that the client is dealing with.
|
long |
getThreadId()
Returns the id of the thread that the client is running under.
|
boolean |
runInCategory(java.lang.String categoryName,
java.lang.Runnable runOnEntry)
Enters the category (if possible) and runs the runnable
|
@NotNull public java.util.List<java.lang.String> getCurrentStack()
DepthTracker
getCurrentStack
in interface DepthTracker
@NotNull public java.lang.Long getCurrentCategoryId()
DepthTracker
getCurrentCategoryId
in interface DepthTracker
public boolean runInCategory(java.lang.String categoryName, @NotNull java.lang.Runnable runOnEntry)
DepthTracker
runInCategory
in interface DepthTracker
categoryName
- The name of the category to enterrunOnEntry
- Something to run if entry was successful@Nullable public java.util.Date getCurrentCategoryLastEntryTimeForSuccessfulExit()
DepthTracker
getCurrentCategoryLastEntryTimeForSuccessfulExit
in interface DepthTracker
@Nullable public java.util.Date getCurrentCategoryInitialEntryDate()
DepthTracker
getCurrentCategoryInitialEntryDate
in interface DepthTracker
@Nullable public java.util.Date getCurrentCategoryPreviousEntryDate()
DepthTracker
getCurrentCategoryPreviousEntryDate
in interface DepthTracker
public boolean enterCategory(java.lang.String categoryName)
enterCategory
in interface DepthTracker
public boolean enterCategory(java.lang.String categoryName, int numRecords)
enterCategory
in interface DepthTracker
public boolean enterCategory(java.lang.String categoryName, boolean isBaseCategory)
enterCategory
in interface DepthTracker
public boolean enterCategory(java.lang.String categoryName, int numRecords, boolean isBaseCategory)
enterCategory
in interface DepthTracker
public void exitCategory()
exitCategory
in interface DepthTracker
public void exitCategory(RunState endState)
exitCategory
in interface DepthTracker
public void exitCategory(int numRecords, RunState endState)
exitCategory
in interface DepthTracker
@Nullable public java.util.Date getOldestSuccessfulEntryExitEncountered()
getOldestSuccessfulEntryExitEncountered
in interface DepthTracker
public void close()
DepthTracker
close
in interface DepthTracker
public void close(boolean resetAllCategories)
DepthTracker
close
in interface DepthTracker
resetAllCategories
- True to reset this this is the last thread scraping the site and this scrape wasn't stopped early. If true is given but there is another thread OR
this session was stopped early, it will still not reset the sitepublic void close(boolean resetAllCategories, boolean fullReset)
DepthTracker
close
in interface DepthTracker
resetAllCategories
- True to reset this this is the last thread scraping the site and this scrape wasn't stopped early. If true is given but there is another thread OR
this session was stopped early, it will still not reset the sitefullReset
- True to reset all fields, false to reset only the status of the categories and site but leave the entry/exit dates@Nullable public Category getCategory(java.lang.String name)
DepthTracker
getCategory
in interface DepthTracker
name
- The name of the category@Nullable public APIConnection getApiConnection()
DepthTracker
getApiConnection
in interface DepthTracker
public long getSiteId()
DepthTracker
getSiteId
in interface DepthTracker
public long getThreadId()
DepthTracker
getThreadId
in interface DepthTracker