public class FakeLoader<T extends RepoPackage> extends java.lang.Object implements LocalRepoLoader, RemoteRepoLoader
LocalRepoLoader or RemoteRepoLoader that returns the given packages.
TODO: Unless more shared functionality is needed it would probably make sense to split this up,
or maybe replaced with a Mockito-mocked class.| Constructor and Description |
|---|
FakeLoader() |
FakeLoader(java.util.Map<java.lang.String,T> packages) |
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<java.lang.String,RemotePackage> |
fetchPackages(ProgressIndicator progress,
Downloader downloader,
SettingsController settings)
Fetches the remote packages.
|
java.util.Map<java.lang.String,LocalPackage> |
getPackages(ProgressIndicator progress)
Gets our packages, loading them if necessary.
|
boolean |
needsUpdate(long lastLocalRefreshMs,
boolean deepCheck)
Checks whether it looks like we need to be reloaded.
|
protected java.util.Map<java.lang.String,T> |
run() |
public FakeLoader()
public FakeLoader(@NonNull
java.util.Map<java.lang.String,T> packages)
@NonNull public java.util.Map<java.lang.String,LocalPackage> getPackages(@NonNull ProgressIndicator progress)
LocalRepoLoadergetPackages in interface LocalRepoLoaderprogress - A ProgressIndicator used to show progress (unimplemented) and
logging.LocalPackage, containing all the packages found in
the given root.public boolean needsUpdate(long lastLocalRefreshMs,
boolean deepCheck)
LocalRepoLoaderneedsUpdate in interface LocalRepoLoaderlastLocalRefreshMs - The last time a load was donedeepCheck - How vigorously to check. If false, the check should be quite fast.
If true it should still be reasonably fast, but less so.true if a reload is needed, false otherwise.@NonNull public java.util.Map<java.lang.String,RemotePackage> fetchPackages(@NonNull ProgressIndicator progress, @NonNull Downloader downloader, @Nullable SettingsController settings)
RemoteRepoLoaderfetchPackages in interface RemoteRepoLoaderprogress - ProgressIndicator for logging and showing progress (TODO).downloader - The Downloader to use for RepositorySourceProviders to use
if needed.settings - The SettingsController for RepositorySourceProviders to use
if needed.RemotePackages. The remote package will be the most
recent version of the package in a channel at least as stable as the one specified by SettingsController.getChannel().protected java.util.Map<java.lang.String,T> run()