Rename a method and expose channel in Updater

This commit is contained in:
Minecon724 2025-05-05 11:11:53 +02:00
commit e101493a00
Signed by: Minecon724
GPG key ID: A02E6E67AB961189
4 changed files with 14 additions and 5 deletions

View file

@ -17,7 +17,7 @@ public class MetadataFacade {
this.metadataDao = metadataDao;
}
public CompletableFuture<List<String>> getChannels() {
public CompletableFuture<List<String>> listChannels() {
if (channels == null)
channels = metadataDao.getChannels();

View file

@ -30,11 +30,20 @@ public class Updater {
}
/**
* Get all channels
* List all channels
* @return A future which returns the list of all channels
*/
public CompletableFuture<List<String>> getChannels() { return metadataProvider.getChannels(); }
public CompletableFuture<List<String>> listChannels() {
return metadataProvider.listChannels();
}
/**
* Gets the configured update channel
* @return the configured update channel
*/
public String getChannel() {
return environment.getChannel();
}
/**
* Get the latest available version

View file

@ -19,7 +19,7 @@ public class MetadataTest {
MetadataDAO dao = new MockMetadataDAO();
MetadataFacade facade = new MetadataFacade(environment, dao);
assert facade.getChannels().join().contains(environment.getChannel());
assert facade.listChannels().join().contains(environment.getChannel());
Version cur = facade.getCurrentVersionMetadata().join();
Version lat = facade.getLatestVersionMetadata().join();

View file

@ -41,7 +41,7 @@ public class UpdaterTest {
@Test
public void testChannels() {
List<String> channels = updater.getChannels().join();
List<String> channels = updater.listChannels().join();
assertEquals(channels, Arrays.asList("stable", "beta", "alpha"));
}