mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2025-12-17 06:04:25 +01:00
update to spring boot 3
This commit is contained in:
@@ -55,7 +55,7 @@ class ArchUnitIT {
|
||||
ArchRule rule = ArchRuleDefinition.classes().that()
|
||||
.haveSimpleNameEndingWith("DaoImpl")
|
||||
.should()
|
||||
.beAnnotatedWith("javax.transaction.Transactional")
|
||||
.beAnnotatedWith("jakarta.transaction.Transactional")
|
||||
.orShould()
|
||||
.beAnnotatedWith("org.springframework.transaction.annotation.Transactional");
|
||||
// https://stackoverflow.com/q/26387399/947526
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package de.cotto.lndmanagej.service;
|
||||
|
||||
import com.github.valfirst.slf4jtest.TestLogger;
|
||||
import com.github.valfirst.slf4jtest.TestLoggerFactory;
|
||||
import de.cotto.lndmanagej.model.ChannelId;
|
||||
import de.cotto.lndmanagej.transactions.service.TransactionService;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -8,11 +10,10 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import uk.org.lidalia.slf4jtest.TestLogger;
|
||||
import uk.org.lidalia.slf4jtest.TestLoggerFactory;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.github.valfirst.slf4jtest.LoggingEvent.warn;
|
||||
import static de.cotto.lndmanagej.model.ChannelPointFixtures.CHANNEL_POINT;
|
||||
import static de.cotto.lndmanagej.model.ChannelPointFixtures.OUTPUT;
|
||||
import static de.cotto.lndmanagej.model.ChannelPointFixtures.TRANSACTION_HASH;
|
||||
@@ -21,7 +22,6 @@ import static de.cotto.lndmanagej.transactions.model.TransactionFixtures.POSITIO
|
||||
import static de.cotto.lndmanagej.transactions.model.TransactionFixtures.TRANSACTION;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static uk.org.lidalia.slf4jtest.LoggingEvent.warn;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class ChannelIdResolverImplTest {
|
||||
@@ -54,4 +54,4 @@ class ChannelIdResolverImplTest {
|
||||
assertThat(channelIdResolver.resolveFromChannelPoint(CHANNEL_POINT)).contains(expectedChannelId);
|
||||
assertThat(logger.getLoggingEvents()).isEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ import de.cotto.lndmanagej.model.BalanceInformation;
|
||||
import de.cotto.lndmanagej.model.ChannelId;
|
||||
import de.cotto.lndmanagej.model.Coins;
|
||||
import de.cotto.lndmanagej.model.CoinsAndDuration;
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
|
||||
@@ -5,11 +5,11 @@ import de.cotto.lndmanagej.balances.Balances;
|
||||
import de.cotto.lndmanagej.model.BalanceInformation;
|
||||
import de.cotto.lndmanagej.model.ChannelId;
|
||||
import de.cotto.lndmanagej.model.Coins;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.IdClass;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.IdClass;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ testing {
|
||||
suites {
|
||||
named("test") {
|
||||
dependencies {
|
||||
testImplementation("uk.org.lidalia:slf4j-test")
|
||||
testImplementation("com.github.valfirst:slf4j-test")
|
||||
configurations.named("testRuntimeOnly") {
|
||||
exclude(group = "ch.qos.logback", module = "logback-classic")
|
||||
exclude(group = "org.slf4j", module = "slf4j-nop")
|
||||
|
||||
@@ -3,11 +3,11 @@ package de.cotto.lndmanagej.forwardinghistory.persistence;
|
||||
import de.cotto.lndmanagej.model.ChannelId;
|
||||
import de.cotto.lndmanagej.model.Coins;
|
||||
import de.cotto.lndmanagej.model.ForwardingEvent;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Index;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Index;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ package de.cotto.lndmanagej.forwardinghistory.persistence;
|
||||
import de.cotto.lndmanagej.forwardinghistory.ForwardingEventsDao;
|
||||
import de.cotto.lndmanagej.model.ChannelId;
|
||||
import de.cotto.lndmanagej.model.ForwardingEvent;
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -7,10 +7,10 @@ import de.cotto.lndmanagej.model.HexString;
|
||||
import invoicesrpc.InvoicesGrpc;
|
||||
import invoicesrpc.InvoicesOuterClass;
|
||||
import invoicesrpc.InvoicesOuterClass.CancelInvoiceMsg;
|
||||
import jakarta.annotation.PreDestroy;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package de.cotto.lndmanagej.grpc;
|
||||
import com.codahale.metrics.annotation.Timed;
|
||||
import de.cotto.lndmanagej.configuration.ConfigurationService;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import jakarta.annotation.PreDestroy;
|
||||
import lnrpc.HTLCAttempt;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -12,7 +13,6 @@ import routerrpc.RouterOuterClass.QueryMissionControlRequest;
|
||||
import routerrpc.RouterOuterClass.QueryMissionControlResponse;
|
||||
import routerrpc.RouterOuterClass.SubscribeHtlcEventsRequest;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -9,6 +9,7 @@ import de.cotto.lndmanagej.model.Pubkey;
|
||||
import io.grpc.Status;
|
||||
import io.grpc.StatusRuntimeException;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import jakarta.annotation.PreDestroy;
|
||||
import lnrpc.AddInvoiceResponse;
|
||||
import lnrpc.ChanInfoRequest;
|
||||
import lnrpc.Channel;
|
||||
@@ -44,7 +45,6 @@ import lnrpc.Transaction;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.cotto.lndmanagej.invoices.persistence;
|
||||
|
||||
import javax.persistence.Embeddable;
|
||||
import jakarta.persistence.Embeddable;
|
||||
|
||||
@Embeddable
|
||||
public class ReceivedViaJpaDto {
|
||||
|
||||
@@ -3,15 +3,15 @@ package de.cotto.lndmanagej.invoices.persistence;
|
||||
import de.cotto.lndmanagej.model.ChannelId;
|
||||
import de.cotto.lndmanagej.model.Coins;
|
||||
import de.cotto.lndmanagej.model.SettledInvoice;
|
||||
import jakarta.persistence.CollectionTable;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.ElementCollection;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Index;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.persistence.CollectionTable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.ElementCollection;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Index;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@@ -3,9 +3,9 @@ package de.cotto.lndmanagej.invoices.persistence;
|
||||
import de.cotto.lndmanagej.invoices.SettledInvoicesDao;
|
||||
import de.cotto.lndmanagej.model.ChannelId;
|
||||
import de.cotto.lndmanagej.model.SettledInvoice;
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package de.cotto.lndmanagej.invoices.persistence;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "settled_invoices_index")
|
||||
|
||||
@@ -2,13 +2,13 @@ package de.cotto.lndmanagej.onlinepeers.persistence;
|
||||
|
||||
import de.cotto.lndmanagej.model.OnlineStatus;
|
||||
import de.cotto.lndmanagej.model.Pubkey;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.IdClass;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import javax.annotation.CheckForNull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.IdClass;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ package de.cotto.lndmanagej.onlinepeers.persistence;
|
||||
import de.cotto.lndmanagej.model.OnlineStatus;
|
||||
import de.cotto.lndmanagej.model.Pubkey;
|
||||
import de.cotto.lndmanagej.onlinepeers.OnlinePeersDao;
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package de.cotto.lndmanagej.payments.persistence;
|
||||
|
||||
import de.cotto.lndmanagej.model.Payment;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
|
||||
import static de.cotto.lndmanagej.model.PaymentFixtures.PAYMENT;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ package de.cotto.lndmanagej.payments.persistence;
|
||||
import de.cotto.lndmanagej.model.ChannelId;
|
||||
import de.cotto.lndmanagej.model.Coins;
|
||||
import de.cotto.lndmanagej.model.PaymentHop;
|
||||
|
||||
import javax.persistence.Embeddable;
|
||||
import jakarta.persistence.Embeddable;
|
||||
|
||||
@Embeddable
|
||||
class PaymentHopJpaDto {
|
||||
|
||||
@@ -2,16 +2,16 @@ package de.cotto.lndmanagej.payments.persistence;
|
||||
|
||||
import de.cotto.lndmanagej.model.Coins;
|
||||
import de.cotto.lndmanagej.model.Payment;
|
||||
import jakarta.persistence.CascadeType;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Index;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.OrderColumn;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Index;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OrderColumn;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.List;
|
||||
|
||||
@@ -2,15 +2,15 @@ package de.cotto.lndmanagej.payments.persistence;
|
||||
|
||||
import de.cotto.lndmanagej.model.PaymentHop;
|
||||
import de.cotto.lndmanagej.model.PaymentRoute;
|
||||
import jakarta.persistence.CollectionTable;
|
||||
import jakarta.persistence.ElementCollection;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.persistence.CollectionTable;
|
||||
import javax.persistence.ElementCollection;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -2,9 +2,9 @@ package de.cotto.lndmanagej.payments.persistence;
|
||||
|
||||
import de.cotto.lndmanagej.model.Payment;
|
||||
import de.cotto.lndmanagej.payments.PaymentsDao;
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package de.cotto.lndmanagej.payments.persistence;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "settled_payments_index")
|
||||
|
||||
@@ -9,9 +9,9 @@ javaPlatform {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
val springBootVersion = "2.7.6"
|
||||
val springBootVersion = "3.0.0"
|
||||
val grpcVersion = "1.50.2"
|
||||
api(platform("org.springframework.cloud:spring-cloud-dependencies:2021.0.4"))
|
||||
api(platform("org.springframework.cloud:spring-cloud-dependencies:2021.0.5"))
|
||||
api(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion"))
|
||||
|
||||
constraints {
|
||||
@@ -44,6 +44,6 @@ dependencies {
|
||||
api("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")
|
||||
api("org.webjars:bootstrap:5.2.2")
|
||||
api("org.webjars:webjars-locator:0.45")
|
||||
api("uk.org.lidalia:slf4j-test:1.2.0")
|
||||
api("com.github.valfirst:slf4j-test:2.6.1")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package de.cotto.lndmanagej.privatechannels.persistence;
|
||||
|
||||
import de.cotto.lndmanagej.model.ChannelId;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "private_channels")
|
||||
|
||||
@@ -2,9 +2,9 @@ package de.cotto.lndmanagej.privatechannels.persistence;
|
||||
|
||||
import de.cotto.lndmanagej.model.ChannelId;
|
||||
import de.cotto.lndmanagej.privatechannels.PrivateChannelsDao;
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.Optional;
|
||||
|
||||
@Component
|
||||
|
||||
@@ -3,9 +3,9 @@ package de.cotto.lndmanagej.selfpayments.persistence;
|
||||
import de.cotto.lndmanagej.model.ChannelId;
|
||||
import de.cotto.lndmanagej.model.SelfPayment;
|
||||
import de.cotto.lndmanagej.selfpayments.SelfPaymentsDao;
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.time.Duration;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package de.cotto.lndmanagej.selfpayments.persistence;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.List;
|
||||
|
||||
public interface SelfPaymentsRepository extends JpaRepository<SelfPaymentsRepository.DummyEntity, Long> {
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package de.cotto.lndmanagej.transactions.download;
|
||||
|
||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@EnableFeignClients
|
||||
@ImportAutoConfiguration(FeignAutoConfiguration.class)
|
||||
public class FeignConfiguration {
|
||||
public FeignConfiguration() {
|
||||
// default constructor
|
||||
|
||||
@@ -3,9 +3,9 @@ package de.cotto.lndmanagej.transactions.persistence;
|
||||
import de.cotto.lndmanagej.model.TransactionHash;
|
||||
import de.cotto.lndmanagej.transactions.TransactionDao;
|
||||
import de.cotto.lndmanagej.transactions.model.Transaction;
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.Optional;
|
||||
|
||||
@Component
|
||||
|
||||
@@ -4,13 +4,13 @@ import com.google.common.annotations.VisibleForTesting;
|
||||
import de.cotto.lndmanagej.model.Coins;
|
||||
import de.cotto.lndmanagej.model.TransactionHash;
|
||||
import de.cotto.lndmanagej.transactions.model.Transaction;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import javax.annotation.CheckForNull;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Optional;
|
||||
|
||||
@Entity
|
||||
|
||||
@@ -68,14 +68,14 @@ class DashboardControllerIT extends BaseControllerIT {
|
||||
@Test
|
||||
void channels_byRating_ok() throws Exception {
|
||||
when(pageService.channels(SortBy.RATING)).thenReturn(new ChannelsPage(List.of(OPEN_CHANNEL_DTO)));
|
||||
mockMvc.perform(get("/channels/").param(SORT_PARAM_KEY, "rating"))
|
||||
mockMvc.perform(get("/channels").param(SORT_PARAM_KEY, "rating"))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
@Test
|
||||
void nodes_byRating_ok() throws Exception {
|
||||
when(pageService.nodes(SortBy.NODE_RATING)).thenReturn(new NodesPage(List.of(NODE_DTO)));
|
||||
mockMvc.perform(get("/nodes/").param(SORT_PARAM_KEY, "node-rating"))
|
||||
mockMvc.perform(get("/nodes").param(SORT_PARAM_KEY, "node-rating"))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ package de.cotto.lndmanagej.ui.interceptor;
|
||||
|
||||
import de.cotto.lndmanagej.ui.StatusService;
|
||||
import de.cotto.lndmanagej.ui.dto.StatusModel;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Component
|
||||
public class StatusInterceptor implements HandlerInterceptor {
|
||||
@@ -53,4 +53,4 @@ public class StatusInterceptor implements HandlerInterceptor {
|
||||
modelAndView.getModel().put("status", statusService.getStatus());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,23 +35,23 @@
|
||||
<ul th:fragment="channel-list-group (title, channels)" class="list-group">
|
||||
<li class="list-group-item disabled" aria-disabled="true" th:text="${title}"></li>
|
||||
|
||||
<li class="list-group-item" th:if="${channels.size >= 1}">
|
||||
<li class="list-group-item" th:if="${channels.size() >= 1}">
|
||||
<a th:text="${channels.get(0)}" th:href="@{/channel/{id}(id=${channels.get(0).shortChannelId})}"></a>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item" th:if="${channels.size >= 2}">
|
||||
<li class="list-group-item" th:if="${channels.size() >= 2}">
|
||||
<a th:text="${channels.get(1)}" th:href="@{/channel/{id}(id=${channels.get(1).shortChannelId})}"></a>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item" th:if="${channels.size == 3}">
|
||||
<li class="list-group-item" th:if="${channels.size() == 3}">
|
||||
<a th:text="${channels.get(2)}" th:href="@{/channel/{id}(id=${channels.get(2).shortChannelId})}"></a>
|
||||
</li>
|
||||
|
||||
<div th:if="${channels.size > 3}">
|
||||
<div th:if="${channels.size() > 3}">
|
||||
<details>
|
||||
<summary>
|
||||
<li class="list-group-item">
|
||||
<span th:text="'('+${channels.size - 2} + ') more channels...'"></span>
|
||||
<span th:text="'('+${channels.size() - 2} + ') more channels...'"></span>
|
||||
<div class="chevron">
|
||||
<span data-feather="chevron-right"></span>
|
||||
</div>
|
||||
@@ -67,26 +67,26 @@
|
||||
<ul th:fragment="closed-channel-list-group (title, channels)" class="list-group">
|
||||
<li class="list-group-item disabled" aria-disabled="true" th:text="${title}"></li>
|
||||
|
||||
<li class="list-group-item" th:if="${channels.size >= 1}">
|
||||
<li class="list-group-item" th:if="${channels.size() >= 1}">
|
||||
<a th:text="${channels.get(0)}" th:href="@{/channel/{id}(id=${channels.get(0).shortChannelId})}"></a>
|
||||
<span th:text="'(' + ${channels.get(0).closeType.toString + ')'}"></span>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item" th:if="${channels.size >= 2}">
|
||||
<li class="list-group-item" th:if="${channels.size() >= 2}">
|
||||
<a th:text="${channels.get(1)}" th:href="@{/channel/{id}(id=${channels.get(1).shortChannelId})}"></a>
|
||||
<span th:text="'(' + ${channels.get(1).closeType.toString + ')'}"></span>
|
||||
</li>
|
||||
|
||||
<li class="list-group-item" th:if="${channels.size == 3}">
|
||||
<li class="list-group-item" th:if="${channels.size() == 3}">
|
||||
<a th:text="${channels.get(2)}" th:href="@{/channel/{id}(id=${channels.get(2).shortChannelId})}"></a>
|
||||
<span th:text="'(' + ${channels.get(2).closeType.toString + ')'}"></span>
|
||||
</li>
|
||||
|
||||
<div th:if="${channels.size > 3}">
|
||||
<div th:if="${channels.size() > 3}">
|
||||
<details>
|
||||
<summary>
|
||||
<li class="list-group-item">
|
||||
<span th:text="'('+${channels.size - 2} + ') more channels...'"></span>
|
||||
<span th:text="'('+${channels.size() - 2} + ') more channels...'"></span>
|
||||
<div class="chevron">
|
||||
<span data-feather="chevron-right"></span>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package de.cotto.lndmanagej.ui.interceptor;
|
||||
|
||||
import de.cotto.lndmanagej.ui.StatusService;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
@@ -8,9 +10,6 @@ import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import static de.cotto.lndmanagej.ui.dto.StatusModelFixture.STATUS_MODEL;
|
||||
import static de.cotto.lndmanagej.ui.dto.StatusModelFixture.STATUS_MODEL_NOT_SYNCED;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -50,7 +50,7 @@ class ObjectMapperConfigurationIT {
|
||||
{
|
||||
"channels" : [ "712345x123x1" ]
|
||||
}""";
|
||||
mockMvc.perform(get(PREFIX + "/open-channels/"))
|
||||
mockMvc.perform(get(PREFIX + "/open-channels"))
|
||||
.andExpect(content().string(expectedString));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,84 +36,84 @@ class RebalancesControllerIT {
|
||||
@Test
|
||||
void getRebalanceSourceCostsForChannel() throws Exception {
|
||||
when(rebalanceService.getSourceCostsForChannel(CHANNEL_ID)).thenReturn(Coins.ofMilliSatoshis(123));
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/rebalance-source-costs/"))
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/rebalance-source-costs"))
|
||||
.andExpect(content().string("123"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRebalanceSourceAmountForChannel() throws Exception {
|
||||
when(rebalanceService.getAmountFromChannel(CHANNEL_ID)).thenReturn(Coins.ofMilliSatoshis(456));
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/rebalance-source-amount/"))
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/rebalance-source-amount"))
|
||||
.andExpect(content().string("456"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRebalanceSourceCostsForPeer() throws Exception {
|
||||
when(rebalanceService.getSourceCostsForPeer(PUBKEY)).thenReturn(Coins.ofMilliSatoshis(124));
|
||||
mockMvc.perform(get(NODE_PREFIX + "/rebalance-source-costs/"))
|
||||
mockMvc.perform(get(NODE_PREFIX + "/rebalance-source-costs"))
|
||||
.andExpect(content().string("124"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRebalanceSourceAmountForPeer() throws Exception {
|
||||
when(rebalanceService.getAmountFromPeer(PUBKEY)).thenReturn(Coins.ofMilliSatoshis(666));
|
||||
mockMvc.perform(get(NODE_PREFIX + "/rebalance-source-amount/"))
|
||||
mockMvc.perform(get(NODE_PREFIX + "/rebalance-source-amount"))
|
||||
.andExpect(content().string("666"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRebalanceTargetCostsForChannel() throws Exception {
|
||||
when(rebalanceService.getTargetCostsForChannel(CHANNEL_ID)).thenReturn(Coins.ofMilliSatoshis(125));
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/rebalance-target-costs/"))
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/rebalance-target-costs"))
|
||||
.andExpect(content().string("125"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRebalanceTargetAmountForChannel() throws Exception {
|
||||
when(rebalanceService.getAmountToChannel(CHANNEL_ID)).thenReturn(Coins.ofMilliSatoshis(7777));
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/rebalance-target-amount/"))
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/rebalance-target-amount"))
|
||||
.andExpect(content().string("7777"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRebalanceTargetCostsForPeer() throws Exception {
|
||||
when(rebalanceService.getTargetCostsForPeer(PUBKEY)).thenReturn(Coins.ofMilliSatoshis(126));
|
||||
mockMvc.perform(get(NODE_PREFIX + "/rebalance-target-costs/"))
|
||||
mockMvc.perform(get(NODE_PREFIX + "/rebalance-target-costs"))
|
||||
.andExpect(content().string("126"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRebalanceTargetAmountForPeer() throws Exception {
|
||||
when(rebalanceService.getAmountToPeer(PUBKEY)).thenReturn(Coins.ofMilliSatoshis(999));
|
||||
mockMvc.perform(get(NODE_PREFIX + "/rebalance-target-amount/"))
|
||||
mockMvc.perform(get(NODE_PREFIX + "/rebalance-target-amount"))
|
||||
.andExpect(content().string("999"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRebalanceSupportAsSourceAmountForChannel() throws Exception {
|
||||
when(rebalanceService.getSupportAsSourceAmountFromChannel(CHANNEL_ID)).thenReturn(Coins.ofMilliSatoshis(1));
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/rebalance-support-as-source-amount/"))
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/rebalance-support-as-source-amount"))
|
||||
.andExpect(content().string("1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRebalanceSupportAsSourceAmountForPeer() throws Exception {
|
||||
when(rebalanceService.getSupportAsSourceAmountFromPeer(PUBKEY)).thenReturn(Coins.ofMilliSatoshis(2));
|
||||
mockMvc.perform(get(NODE_PREFIX + "/rebalance-support-as-source-amount/"))
|
||||
mockMvc.perform(get(NODE_PREFIX + "/rebalance-support-as-source-amount"))
|
||||
.andExpect(content().string("2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRebalanceSupportAsTargetAmountForChannel() throws Exception {
|
||||
when(rebalanceService.getSupportAsTargetAmountToChannel(CHANNEL_ID)).thenReturn(Coins.ofMilliSatoshis(3));
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/rebalance-support-as-target-amount/"))
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/rebalance-support-as-target-amount"))
|
||||
.andExpect(content().string("3"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRebalanceSupportAsTargetAmountForPeer() throws Exception {
|
||||
when(rebalanceService.getSupportAsTargetAmountToPeer(PUBKEY)).thenReturn(Coins.ofMilliSatoshis(4));
|
||||
mockMvc.perform(get(NODE_PREFIX + "/rebalance-support-as-target-amount/"))
|
||||
mockMvc.perform(get(NODE_PREFIX + "/rebalance-support-as-target-amount"))
|
||||
.andExpect(content().string("4"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class SelfPaymentsControllerIT {
|
||||
void getSelfPaymentsFromChannel() throws Exception {
|
||||
when(selfPaymentsService.getSelfPaymentsFromChannel(CHANNEL_ID))
|
||||
.thenReturn(List.of(SELF_PAYMENT_2, SELF_PAYMENT));
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/self-payments-from-channel/"))
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/self-payments-from-channel"))
|
||||
.andExpect(jsonPath("$.selfPayments[0].memo", is(SELF_PAYMENT_2.memo())))
|
||||
.andExpect(jsonPath("$.selfPayments[1].memo", is(SELF_PAYMENT.memo())))
|
||||
.andExpect(jsonPath("$.feesMilliSat", is("20")))
|
||||
@@ -58,7 +58,7 @@ class SelfPaymentsControllerIT {
|
||||
void getSelfPaymentsFromPeer() throws Exception {
|
||||
when(selfPaymentsService.getSelfPaymentsFromPeer(PUBKEY))
|
||||
.thenReturn(List.of(SELF_PAYMENT_2, SELF_PAYMENT));
|
||||
mockMvc.perform(get(NODE_PREFIX + "/self-payments-from-peer/"))
|
||||
mockMvc.perform(get(NODE_PREFIX + "/self-payments-from-peer"))
|
||||
.andExpect(jsonPath("$.selfPayments[0].memo", is(SELF_PAYMENT_2.memo())))
|
||||
.andExpect(jsonPath("$.selfPayments[1].memo", is(SELF_PAYMENT.memo())))
|
||||
.andExpect(jsonPath("$.feesMilliSat", is("20")))
|
||||
@@ -69,7 +69,7 @@ class SelfPaymentsControllerIT {
|
||||
void getSelfPaymentsToChannel() throws Exception {
|
||||
when(selfPaymentsService.getSelfPaymentsToChannel(CHANNEL_ID))
|
||||
.thenReturn(List.of(SELF_PAYMENT, SELF_PAYMENT_4));
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/self-payments-to-channel/"))
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/self-payments-to-channel"))
|
||||
.andExpect(jsonPath("$.selfPayments[0].memo", is(SELF_PAYMENT.memo())))
|
||||
.andExpect(jsonPath("$.selfPayments[0].settleDate", is(SELF_PAYMENT.settleDate().toString())))
|
||||
.andExpect(jsonPath("$.selfPayments[0].amountPaidMilliSat", is(msat(SELF_PAYMENT.amountPaid()))))
|
||||
@@ -93,7 +93,7 @@ class SelfPaymentsControllerIT {
|
||||
void getSelfPaymentsToPeer() throws Exception {
|
||||
when(selfPaymentsService.getSelfPaymentsToPeer(PUBKEY))
|
||||
.thenReturn(List.of(SELF_PAYMENT_2, SELF_PAYMENT));
|
||||
mockMvc.perform(get(NODE_PREFIX + "/self-payments-to-peer/"))
|
||||
mockMvc.perform(get(NODE_PREFIX + "/self-payments-to-peer"))
|
||||
.andExpect(jsonPath("$.selfPayments[0].memo", is(SELF_PAYMENT_2.memo())))
|
||||
.andExpect(jsonPath("$.selfPayments[1].memo", is(SELF_PAYMENT.memo())))
|
||||
.andExpect(jsonPath("$.feesMilliSat", is("20")))
|
||||
|
||||
@@ -70,7 +70,7 @@ class StatusControllerIT {
|
||||
LOCAL_OPEN_CHANNEL.getId().toString(),
|
||||
LOCAL_OPEN_CHANNEL_TO_NODE_3.getId().toString()
|
||||
);
|
||||
mockMvc.perform(get(PREFIX + "/open-channels/"))
|
||||
mockMvc.perform(get(PREFIX + "/open-channels"))
|
||||
.andExpect(jsonPath("$.channels", is(sortedChannelIds)));
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ class StatusControllerIT {
|
||||
CLOSED_CHANNEL.getId().toString(),
|
||||
LOCAL_OPEN_CHANNEL_TO_NODE_3.getId().toString()
|
||||
);
|
||||
mockMvc.perform(get(PREFIX + "/all-channels/"))
|
||||
mockMvc.perform(get(PREFIX + "/all-channels"))
|
||||
.andExpect(jsonPath("$.channels", is(sortedChannelIds)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user