mirror of
https://github.com/Athou/commafeed.git
synced 2026-11-04 03:14:47 +00:00
reformat using google-java-format 2.0
This commit is contained in:
@@ -66,8 +66,7 @@ public class HttpClientFactory {
|
||||
String userAgent =
|
||||
config.httpClient()
|
||||
.userAgent()
|
||||
.orElseGet(
|
||||
() ->
|
||||
.orElseGet(() ->
|
||||
String.format(
|
||||
"CommaFeed/%s (https://github.com/Athou/commafeed)",
|
||||
version.getVersion()));
|
||||
|
||||
@@ -283,8 +283,7 @@ public class HttpGetter {
|
||||
}
|
||||
|
||||
return CacheBuilder.newBuilder()
|
||||
.weigher(
|
||||
(HttpRequest key, HttpResponse value) ->
|
||||
.weigher((HttpRequest key, HttpResponse value) ->
|
||||
value.content() != null ? value.content().length : 0)
|
||||
.maximumWeight(cacheConfig.maximumMemorySize().asLongValue())
|
||||
.expireAfterWrite(cacheConfig.expiration())
|
||||
|
||||
@@ -124,10 +124,8 @@ public class FeedSubscriptionDAO extends GenericDAO<FeedSubscription> {
|
||||
Set<Long> categoryIds =
|
||||
categories.stream().map(AbstractModel::getId).collect(Collectors.toSet());
|
||||
return findAll(user).stream()
|
||||
.filter(
|
||||
s ->
|
||||
s.getCategory() != null
|
||||
&& categoryIds.contains(s.getCategory().getId()))
|
||||
.filter(s ->
|
||||
s.getCategory() != null && categoryIds.contains(s.getCategory().getId()))
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
@@ -104,17 +104,14 @@ public class FeedRefreshEngine {
|
||||
|
||||
private void startFeedProcessingLoop() {
|
||||
// take a feed from the queue, process it, rince, repeat
|
||||
feedProcessingLoopExecutor.submit(
|
||||
() -> {
|
||||
feedProcessingLoopExecutor.submit(() -> {
|
||||
while (!feedProcessingLoopExecutor.isShutdown()) {
|
||||
try {
|
||||
// take() is blocking until a feed is available from the queue
|
||||
Feed feed = queue.take();
|
||||
|
||||
// send the feed to be processed
|
||||
log.debug(
|
||||
"got feed {} from the queue, send it for processing",
|
||||
feed.getId());
|
||||
log.debug("got feed {} from the queue, send it for processing", feed.getId());
|
||||
processFeedAsync(feed);
|
||||
|
||||
// we removed a feed from the queue, try to refill it as it may now be
|
||||
@@ -135,8 +132,7 @@ public class FeedRefreshEngine {
|
||||
|
||||
private void startRefillLoop() {
|
||||
// refill the queue at regular intervals if it's empty
|
||||
refillLoopExecutor.submit(
|
||||
() -> {
|
||||
refillLoopExecutor.submit(() -> {
|
||||
while (!refillLoopExecutor.isShutdown()) {
|
||||
try {
|
||||
if (queue.isEmpty()) {
|
||||
@@ -184,8 +180,7 @@ public class FeedRefreshEngine {
|
||||
}
|
||||
},
|
||||
refillExecutor)
|
||||
.whenComplete(
|
||||
(data, ex) -> {
|
||||
.whenComplete((data, ex) -> {
|
||||
if (ex != null) {
|
||||
log.error("error while refilling the queue", ex);
|
||||
}
|
||||
@@ -195,49 +190,38 @@ public class FeedRefreshEngine {
|
||||
private void processFeedAsync(Feed feed) {
|
||||
CompletableFuture.supplyAsync(() -> worker.update(feed), workerExecutor)
|
||||
.thenApplyAsync(r -> updater.update(r.feed(), r.entries()), databaseUpdaterExecutor)
|
||||
.thenCompose(
|
||||
r -> {
|
||||
.thenCompose(r -> {
|
||||
List<CompletableFuture<Void>> futures =
|
||||
r.insertedUnreadEntriesBySubscription().entrySet().stream()
|
||||
.map(
|
||||
e -> {
|
||||
.map(e -> {
|
||||
FeedSubscription sub = e.getKey();
|
||||
List<FeedEntry> entries = e.getValue();
|
||||
|
||||
notifier.notifyOverWebsocket(sub, entries);
|
||||
return CompletableFuture.runAsync(
|
||||
() ->
|
||||
notifier
|
||||
.sendPushNotifications(
|
||||
sub,
|
||||
entries),
|
||||
() -> notifier.sendPushNotifications(sub, entries),
|
||||
notifierExecutor);
|
||||
})
|
||||
.toList();
|
||||
return CompletableFuture.allOf(
|
||||
futures.toArray(CompletableFuture[]::new));
|
||||
return CompletableFuture.allOf(futures.toArray(CompletableFuture[]::new));
|
||||
})
|
||||
.exceptionally(
|
||||
ex -> {
|
||||
.exceptionally(ex -> {
|
||||
log.error("error while processing feed {}", feed.getUrl(), ex);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
private List<Feed> getNextUpdatableFeeds(int max) {
|
||||
return unitOfWork.call(
|
||||
() -> {
|
||||
return unitOfWork.call(() -> {
|
||||
Instant lastLoginThreshold =
|
||||
config.feedRefresh().userInactivityPeriod().isZero()
|
||||
? null
|
||||
: Instant.now()
|
||||
.minus(config.feedRefresh().userInactivityPeriod());
|
||||
: Instant.now().minus(config.feedRefresh().userInactivityPeriod());
|
||||
List<Feed> feeds = feedDAO.findNextUpdatable(max, lastLoginThreshold);
|
||||
if (!feeds.isEmpty()) {
|
||||
// update disabledUntil to prevent feeds from being returned again by
|
||||
// feedDAO.findNextUpdatable()
|
||||
Instant nextUpdateDate =
|
||||
Instant.now().plus(config.feedRefresh().interval());
|
||||
Instant nextUpdateDate = Instant.now().plus(config.feedRefresh().interval());
|
||||
feedDAO.setDisabledUntil(
|
||||
feeds.stream().map(AbstractModel::getId).toList(), nextUpdateDate);
|
||||
}
|
||||
@@ -292,8 +276,7 @@ public class FeedRefreshEngine {
|
||||
ThreadPoolExecutor pool =
|
||||
new ThreadPoolExecutor(
|
||||
threads, threads, 0L, TimeUnit.MILLISECONDS, new SynchronousQueue<>());
|
||||
pool.setRejectedExecutionHandler(
|
||||
(r, e) -> {
|
||||
pool.setRejectedExecutionHandler((r, e) -> {
|
||||
if (e.isShutdown()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -91,8 +91,7 @@ public class FeedRefreshUpdater {
|
||||
if (locked1 && locked2) {
|
||||
processed = true;
|
||||
insertedEntry =
|
||||
unitOfWork.call(
|
||||
() -> {
|
||||
unitOfWork.call(() -> {
|
||||
if (feedEntryService.find(feed, entry) != null) {
|
||||
// entry already exists, nothing to do
|
||||
return null;
|
||||
@@ -101,8 +100,7 @@ public class FeedRefreshUpdater {
|
||||
FeedEntry feedEntry = feedEntryService.create(feed, entry);
|
||||
entryInserted.mark();
|
||||
for (FeedSubscription sub : subscriptions) {
|
||||
boolean unread =
|
||||
feedEntryService.applyFilter(sub, feedEntry);
|
||||
boolean unread = feedEntryService.applyFilter(sub, feedEntry);
|
||||
if (unread) {
|
||||
subscriptionsForWhichEntryIsUnread.add(sub);
|
||||
}
|
||||
@@ -147,8 +145,7 @@ public class FeedRefreshUpdater {
|
||||
AddEntryResult addEntryResult = addEntry(feed, entry, subscriptions);
|
||||
processed &= addEntryResult.processed;
|
||||
inserted += addEntryResult.insertedEntry != null ? 1 : 0;
|
||||
addEntryResult.subscriptionsForWhichEntryIsUnread.forEach(
|
||||
sub -> {
|
||||
addEntryResult.subscriptionsForWhichEntryIsUnread.forEach(sub -> {
|
||||
if (addEntryResult.insertedEntry != null) {
|
||||
insertedUnreadEntriesBySubscription
|
||||
.computeIfAbsent(sub, k -> new ArrayList<>())
|
||||
|
||||
@@ -65,18 +65,15 @@ public class OPMLExporter {
|
||||
|
||||
for (FeedCategory child :
|
||||
categories.stream()
|
||||
.filter(
|
||||
c ->
|
||||
c.getParent() != null
|
||||
&& c.getParent().getId().equals(cat.getId()))
|
||||
.filter(c ->
|
||||
c.getParent() != null && c.getParent().getId().equals(cat.getId()))
|
||||
.toList()) {
|
||||
outline.getChildren().add(buildCategoryOutline(child, categories, subscriptions));
|
||||
}
|
||||
|
||||
for (FeedSubscription sub :
|
||||
subscriptions.stream()
|
||||
.filter(
|
||||
s ->
|
||||
.filter(s ->
|
||||
s.getCategory() != null
|
||||
&& s.getCategory().getId().equals(cat.getId()))
|
||||
.toList()) {
|
||||
|
||||
@@ -148,15 +148,13 @@ public class FeedEntryService {
|
||||
List<FeedEntryStatus> statusesToMark =
|
||||
statuses.stream()
|
||||
.filter(FeedEntryStatus::isMarkable)
|
||||
.filter(
|
||||
s -> {
|
||||
.filter(s -> {
|
||||
Instant entryDate = s.getEntry().getPublished();
|
||||
return olderThan == null
|
||||
|| entryDate == null
|
||||
|| entryDate.isBefore(olderThan);
|
||||
})
|
||||
.filter(
|
||||
s -> {
|
||||
.filter(s -> {
|
||||
Instant insertedDate = s.getEntry().getInserted();
|
||||
return insertedBefore == null
|
||||
|| insertedDate == null
|
||||
@@ -164,8 +162,7 @@ public class FeedEntryService {
|
||||
})
|
||||
.toList();
|
||||
|
||||
statusesToMark.forEach(
|
||||
s -> {
|
||||
statusesToMark.forEach(s -> {
|
||||
s.setRead(true);
|
||||
feedEntryStatusDAO.merge(s);
|
||||
});
|
||||
|
||||
@@ -47,8 +47,7 @@ public class FeedSubscriptionService {
|
||||
// we need to use this hook because the feed needs to have been persisted before being
|
||||
// processed
|
||||
// by the feed engine
|
||||
feedSubscriptionDAO.onPostCommitInsert(
|
||||
sub -> {
|
||||
feedSubscriptionDAO.onPostCommitInsert(sub -> {
|
||||
Feed feed = sub.getFeed();
|
||||
if (feed.getDisabledUntil() == null
|
||||
|| feed.getDisabledUntil().isBefore(Instant.now())) {
|
||||
|
||||
@@ -79,13 +79,10 @@ public class DatabaseCleaningService {
|
||||
} while (entriesDeleted > 0);
|
||||
}
|
||||
deleted =
|
||||
unitOfWork.call(
|
||||
() ->
|
||||
unitOfWork.call(() ->
|
||||
feedDAO.delete(
|
||||
feedDAO.findByIds(
|
||||
feeds.stream()
|
||||
.map(AbstractModel::getId)
|
||||
.toList())));
|
||||
feeds.stream().map(AbstractModel::getId).toList())));
|
||||
total += deleted;
|
||||
log.debug("removed {} feeds without subscriptions", total);
|
||||
} while (deleted != 0);
|
||||
@@ -119,8 +116,7 @@ public class DatabaseCleaningService {
|
||||
}
|
||||
|
||||
List<FeedCapacity> feeds =
|
||||
unitOfWork.call(
|
||||
() ->
|
||||
unitOfWork.call(() ->
|
||||
feedEntryDAO.findFeedsExceedingCapacity(
|
||||
maxFeedCapacity, batchSize, keepStarredEntries));
|
||||
if (feeds.isEmpty()) {
|
||||
@@ -139,8 +135,7 @@ public class DatabaseCleaningService {
|
||||
|
||||
final long rem = remaining;
|
||||
deleted =
|
||||
unitOfWork.call(
|
||||
() ->
|
||||
unitOfWork.call(() ->
|
||||
feedEntryDAO.deleteOldEntries(
|
||||
feed.id(),
|
||||
Math.min(batchSize, rem),
|
||||
@@ -166,8 +161,7 @@ public class DatabaseCleaningService {
|
||||
}
|
||||
|
||||
deleted =
|
||||
unitOfWork.call(
|
||||
() ->
|
||||
unitOfWork.call(() ->
|
||||
feedEntryDAO.deleteEntriesOlderThan(
|
||||
olderThan, batchSize, keepStarredEntries));
|
||||
entriesDeletedMeter.mark(deleted);
|
||||
|
||||
@@ -31,8 +31,7 @@ public class DemoAccountCleanupTask extends ScheduledTask {
|
||||
}
|
||||
|
||||
log.info("recreating demo user account");
|
||||
unitOfWork.run(
|
||||
() -> {
|
||||
unitOfWork.run(() -> {
|
||||
User demoUser = userDAO.findByName(CommaFeedConstants.USERNAME_DEMO);
|
||||
if (demoUser == null) {
|
||||
return;
|
||||
|
||||
@@ -140,14 +140,9 @@ public class FeverREST {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
uri.getQueryParameters().forEach((k, v) -> params.put(k, v.getFirst()));
|
||||
form.getValues()
|
||||
.forEach(
|
||||
(k, v) ->
|
||||
.forEach((k, v) ->
|
||||
params.put(
|
||||
k,
|
||||
v.stream()
|
||||
.map(FormValue::getValue)
|
||||
.findFirst()
|
||||
.orElse(null)));
|
||||
k, v.stream().map(FormValue::getValue).findFirst().orElse(null)));
|
||||
return handle(userId, params);
|
||||
}
|
||||
|
||||
@@ -246,12 +241,10 @@ public class FeverREST {
|
||||
s -> s.getCategory() == null ? 0 : s.getCategory().getId()))
|
||||
.entrySet()
|
||||
.stream()
|
||||
.map(
|
||||
e -> {
|
||||
.map(e -> {
|
||||
FeverFeedGroup fg = new FeverFeedGroup();
|
||||
fg.setGroupId(e.getKey());
|
||||
fg.setFeedIds(
|
||||
e.getValue().stream().map(FeedSubscription::getId).toList());
|
||||
fg.setFeedIds(e.getValue().stream().map(FeedSubscription::getId).toList());
|
||||
return fg;
|
||||
})
|
||||
.toList();
|
||||
@@ -259,8 +252,7 @@ public class FeverREST {
|
||||
|
||||
private List<FeverGroup> buildGroups(List<FeedCategory> categories) {
|
||||
return categories.stream()
|
||||
.map(
|
||||
c -> {
|
||||
.map(c -> {
|
||||
FeverGroup g = new FeverGroup();
|
||||
g.setId(c.getId());
|
||||
g.setTitle(c.getName());
|
||||
@@ -271,8 +263,7 @@ public class FeverREST {
|
||||
|
||||
private List<FeverFeed> buildFeeds(List<FeedSubscription> subscriptions) {
|
||||
return subscriptions.stream()
|
||||
.map(
|
||||
s -> {
|
||||
.map(s -> {
|
||||
FeverFeed f = new FeverFeed();
|
||||
f.setId(s.getId());
|
||||
f.setFaviconId(s.getId());
|
||||
@@ -367,8 +358,7 @@ public class FeverREST {
|
||||
|
||||
private List<FeverFavicon> buildFavicons(List<FeedSubscription> subscriptions) {
|
||||
return subscriptions.stream()
|
||||
.map(
|
||||
s -> {
|
||||
.map(s -> {
|
||||
Favicon favicon = feedFaviconService.fetchFavicon(s.getFeed());
|
||||
|
||||
FeverFavicon f = new FeverFavicon();
|
||||
|
||||
@@ -216,8 +216,7 @@ public class GoogleReaderREST {
|
||||
List<GoogleReaderModel.Tag> tags = new ArrayList<>();
|
||||
feedCategoryDAO
|
||||
.findAll(user)
|
||||
.forEach(
|
||||
c ->
|
||||
.forEach(c ->
|
||||
tags.add(
|
||||
new GoogleReaderModel.Tag(
|
||||
GoogleReaderStreamId.label(c.getName()))));
|
||||
@@ -259,8 +258,7 @@ public class GoogleReaderREST {
|
||||
Map<Long, FeedCategory> categoriesById =
|
||||
feedCategoryDAO.findAll(user).stream()
|
||||
.collect(Collectors.toMap(FeedCategory::getId, c -> c));
|
||||
unreadByCategory.forEach(
|
||||
(categoryId, count) -> {
|
||||
unreadByCategory.forEach((categoryId, count) -> {
|
||||
if (categoryId == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -268,8 +266,7 @@ public class GoogleReaderREST {
|
||||
if (category == null) {
|
||||
return;
|
||||
}
|
||||
GoogleReaderModel.UnreadCountEntry entry =
|
||||
new GoogleReaderModel.UnreadCountEntry();
|
||||
GoogleReaderModel.UnreadCountEntry entry = new GoogleReaderModel.UnreadCountEntry();
|
||||
entry.setId(GoogleReaderStreamId.label(category.getName()));
|
||||
entry.setCount(count);
|
||||
entries.add(entry);
|
||||
@@ -334,10 +331,8 @@ public class GoogleReaderREST {
|
||||
GoogleReaderModel.ItemRefs resp = new GoogleReaderModel.ItemRefs();
|
||||
resp.setItemRefs(
|
||||
paged.statuses().stream()
|
||||
.map(
|
||||
s ->
|
||||
new GoogleReaderModel.ItemRef(
|
||||
String.valueOf(s.getEntry().getId())))
|
||||
.map(s ->
|
||||
new GoogleReaderModel.ItemRef(String.valueOf(s.getEntry().getId())))
|
||||
.toList());
|
||||
resp.setContinuation(paged.continuation());
|
||||
return resp;
|
||||
|
||||
@@ -38,13 +38,11 @@ public class DatabaseApiKeyIdentityProvider
|
||||
@Override
|
||||
public Uni<SecurityIdentity> authenticate(
|
||||
TokenAuthenticationRequest request, AuthenticationRequestContext context) {
|
||||
return context.runBlocking(
|
||||
() -> {
|
||||
return context.runBlocking(() -> {
|
||||
Optional<User> user =
|
||||
unitOfWork.call(() -> userService.login(request.getToken().getToken()));
|
||||
if (user.isEmpty()) {
|
||||
throw new AuthenticationFailedException(
|
||||
"could not find a user with this api key");
|
||||
throw new AuthenticationFailedException("could not find a user with this api key");
|
||||
}
|
||||
|
||||
Set<Role> roles = unitOfWork.call(() -> userService.getRoles(user.get()));
|
||||
|
||||
@@ -39,15 +39,12 @@ public class DatabaseUsernamePasswordIdentityProvider
|
||||
@Override
|
||||
public Uni<SecurityIdentity> authenticate(
|
||||
UsernamePasswordAuthenticationRequest request, AuthenticationRequestContext context) {
|
||||
return context.runBlocking(
|
||||
() -> {
|
||||
return context.runBlocking(() -> {
|
||||
Optional<User> user =
|
||||
unitOfWork.call(
|
||||
() ->
|
||||
unitOfWork.call(() ->
|
||||
userService.login(
|
||||
request.getUsername(),
|
||||
new String(
|
||||
request.getPassword().getPassword())));
|
||||
new String(request.getPassword().getPassword())));
|
||||
if (user.isEmpty()) {
|
||||
throw new CommaFeedApplicationException(
|
||||
CommaFeedExceptionType.WRONG_USERNAME_OR_PASSWORD);
|
||||
|
||||
@@ -40,8 +40,7 @@ public class TrustedIdentityProvider implements IdentityProvider<TrustedAuthenti
|
||||
@Override
|
||||
public Uni<SecurityIdentity> authenticate(
|
||||
TrustedAuthenticationRequest request, AuthenticationRequestContext context) {
|
||||
return context.runBlocking(
|
||||
() -> {
|
||||
return context.runBlocking(() -> {
|
||||
Long userId = Long.valueOf(request.getPrincipal());
|
||||
User user = unitOfWork.call(() -> userDAO.findById(userId));
|
||||
if (user == null) {
|
||||
|
||||
@@ -41,8 +41,7 @@ class NativeImageClassesTest {
|
||||
WireFeedGenerator.class)) {
|
||||
Set<Class<?>> moduleClasses =
|
||||
new HashSet<>(reflections.get(Scanners.SubTypes.of(clazz).asClass()));
|
||||
moduleClasses.removeIf(
|
||||
c ->
|
||||
moduleClasses.removeIf(c ->
|
||||
c.isInterface()
|
||||
|| Modifier.isAbstract(c.getModifiers())
|
||||
|| !Modifier.isPublic(c.getModifiers()));
|
||||
|
||||
@@ -317,8 +317,7 @@ class HttpGetterTest {
|
||||
|
||||
this.mockServerClient
|
||||
.when(HttpRequest.request().withMethod("GET"))
|
||||
.respond(
|
||||
req -> {
|
||||
.respond(req -> {
|
||||
calls.incrementAndGet();
|
||||
|
||||
if (req.containsHeader(HttpHeaders.COOKIE)) {
|
||||
@@ -341,8 +340,7 @@ class HttpGetterTest {
|
||||
|
||||
this.mockServerClient
|
||||
.when(HttpRequest.request().withMethod("GET"))
|
||||
.respond(
|
||||
req -> {
|
||||
.respond(req -> {
|
||||
calls.incrementAndGet();
|
||||
return HttpResponse.response().withBody("ok");
|
||||
});
|
||||
@@ -400,13 +398,11 @@ class HttpGetterTest {
|
||||
|
||||
this.mockServerClient
|
||||
.when(HttpRequest.request().withMethod("GET"))
|
||||
.respond(
|
||||
req -> {
|
||||
.respond(req -> {
|
||||
calls.incrementAndGet();
|
||||
|
||||
if (req.containsHeader(HttpHeaders.UPGRADE)) {
|
||||
throw new Exception(
|
||||
"upgrade header should not be sent by the client");
|
||||
throw new Exception("upgrade header should not be sent by the client");
|
||||
}
|
||||
|
||||
return HttpResponse.response().withBody("ok");
|
||||
@@ -438,17 +434,14 @@ class HttpGetterTest {
|
||||
HttpGetterTest.this
|
||||
.mockServerClient
|
||||
.when(HttpRequest.request().withMethod("GET"))
|
||||
.respond(
|
||||
req -> {
|
||||
.respond(req -> {
|
||||
try {
|
||||
String acceptEncodingHeader =
|
||||
req.getFirstHeader(HttpHeaders.ACCEPT_ENCODING);
|
||||
if (!ACCEPT_ENCODING.equals(acceptEncodingHeader)) {
|
||||
throw new Exception(
|
||||
"Wrong value in the Accept-Encoding header, should be '%s' but was '%s'"
|
||||
.formatted(
|
||||
ACCEPT_ENCODING,
|
||||
acceptEncodingHeader));
|
||||
.formatted(ACCEPT_ENCODING, acceptEncodingHeader));
|
||||
}
|
||||
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
|
||||
@@ -68,7 +68,8 @@ class YoutubeFaviconFetcherTest {
|
||||
|
||||
byte[] apiResponse =
|
||||
"""
|
||||
{"items":[{"snippet":{"thumbnails":{"default":{"url":"https://example.com/icon.png"}}}}]}"""
|
||||
{"items":[{"snippet":{"thumbnails":{"default":{"url":"https://example.com/icon.png"}}}}]}\
|
||||
"""
|
||||
.getBytes();
|
||||
HttpResult apiHttpResult =
|
||||
new HttpResult(apiResponse, "application/json", null, null, null, Duration.ZERO);
|
||||
@@ -102,7 +103,8 @@ class YoutubeFaviconFetcherTest {
|
||||
|
||||
byte[] apiResponse =
|
||||
"""
|
||||
{"items":[{"snippet":{"thumbnails":{"default":{"url":"https://example.com/icon.png"}}}}]}"""
|
||||
{"items":[{"snippet":{"thumbnails":{"default":{"url":"https://example.com/icon.png"}}}}]}\
|
||||
"""
|
||||
.getBytes();
|
||||
HttpResult apiHttpResult =
|
||||
new HttpResult(apiResponse, "application/json", null, null, null, Duration.ZERO);
|
||||
@@ -136,7 +138,8 @@ class YoutubeFaviconFetcherTest {
|
||||
|
||||
byte[] playlistResponse =
|
||||
"""
|
||||
{"items":[{"snippet":{"channelId":"testChannelId"}}]}"""
|
||||
{"items":[{"snippet":{"channelId":"testChannelId"}}]}\
|
||||
"""
|
||||
.getBytes();
|
||||
HttpResult playlistHttpResult =
|
||||
new HttpResult(
|
||||
@@ -151,7 +154,8 @@ class YoutubeFaviconFetcherTest {
|
||||
|
||||
byte[] channelResponse =
|
||||
"""
|
||||
{"items":[{"snippet":{"thumbnails":{"default":{"url":"https://example.com/icon.png"}}}}]}"""
|
||||
{"items":[{"snippet":{"thumbnails":{"default":{"url":"https://example.com/icon.png"}}}}]}\
|
||||
"""
|
||||
.getBytes();
|
||||
HttpResult channelHttpResult =
|
||||
new HttpResult(
|
||||
|
||||
@@ -229,11 +229,13 @@ class XMLCleanerTest {
|
||||
<!DOCTYPE
|
||||
html
|
||||
>
|
||||
<html><head></head><body></body></html>""";
|
||||
<html><head></head><body></body></html>\
|
||||
""";
|
||||
Assertions.assertEquals(
|
||||
"""
|
||||
|
||||
<html><head></head><body></body></html>""",
|
||||
<html><head></head><body></body></html>\
|
||||
""",
|
||||
xmlCleaner.removeDoctypeDeclarations(source));
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ class InPageReferenceFeedURLProviderTest {
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>""";
|
||||
</html>\
|
||||
""";
|
||||
|
||||
Assertions.assertIterableEquals(
|
||||
List.of("http://example.com/feed.atom", "http://example.com/feed.rss"),
|
||||
@@ -35,7 +36,8 @@ class InPageReferenceFeedURLProviderTest {
|
||||
"""
|
||||
<?xml version="1.0"?>
|
||||
<feed></feed>
|
||||
</xml>""";
|
||||
</xml>\
|
||||
""";
|
||||
|
||||
Assertions.assertTrue(provider.get(url, html).isEmpty());
|
||||
}
|
||||
@@ -51,7 +53,8 @@ class InPageReferenceFeedURLProviderTest {
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>""";
|
||||
</html>\
|
||||
""";
|
||||
|
||||
Assertions.assertTrue(provider.get(url, html).isEmpty());
|
||||
}
|
||||
|
||||
@@ -170,8 +170,7 @@ class GoogleReaderIT extends BaseIT {
|
||||
client.get(BASE + "/reader/api/0/unread-count").as(UnreadCounts.class);
|
||||
Assertions.assertTrue(
|
||||
counts.getUnreadCounts().stream()
|
||||
.anyMatch(
|
||||
c ->
|
||||
.anyMatch(c ->
|
||||
c.getId().equals("user/-/state/com.google/reading-list")
|
||||
&& c.getCount() == 2));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user