mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-23 07:54:24 +01:00
use aggregated information from fee service
This commit is contained in:
@@ -2,7 +2,6 @@ package de.cotto.lndmanagej.controller;
|
||||
|
||||
import de.cotto.lndmanagej.metrics.Metrics;
|
||||
import de.cotto.lndmanagej.model.Coins;
|
||||
import de.cotto.lndmanagej.model.FeeConfiguration;
|
||||
import de.cotto.lndmanagej.service.BalanceService;
|
||||
import de.cotto.lndmanagej.service.ChannelService;
|
||||
import de.cotto.lndmanagej.service.FeeService;
|
||||
@@ -20,6 +19,7 @@ import static de.cotto.lndmanagej.model.BalanceInformationFixtures.BALANCE_INFOR
|
||||
import static de.cotto.lndmanagej.model.ChannelFixtures.CAPACITY;
|
||||
import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID;
|
||||
import static de.cotto.lndmanagej.model.ChannelPointFixtures.CHANNEL_POINT;
|
||||
import static de.cotto.lndmanagej.model.FeeConfigurationFixtures.FEE_CONFIGURATION;
|
||||
import static de.cotto.lndmanagej.model.LocalOpenChannelFixtures.LOCAL_OPEN_CHANNEL_PRIVATE;
|
||||
import static de.cotto.lndmanagej.model.NodeFixtures.ALIAS_2;
|
||||
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY_2;
|
||||
@@ -32,8 +32,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
@WebMvcTest(controllers = ChannelDetailsController.class)
|
||||
class ChannelDetailsControllerIT {
|
||||
private static final String CHANNEL_PREFIX = "/api/channel/" + CHANNEL_ID.getShortChannelId();
|
||||
private static final FeeConfiguration FEE_CONFIGURATION =
|
||||
new FeeConfiguration(1, Coins.ofMilliSatoshis(2), 3, Coins.ofMilliSatoshis(4));
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@@ -18,6 +18,7 @@ import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID;
|
||||
import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID_3;
|
||||
import static de.cotto.lndmanagej.model.CoopClosedChannelFixtures.CLOSED_CHANNEL;
|
||||
import static de.cotto.lndmanagej.model.CoopClosedChannelFixtures.CLOSED_CHANNEL_3;
|
||||
import static de.cotto.lndmanagej.model.FeeConfigurationFixtures.FEE_CONFIGURATION;
|
||||
import static de.cotto.lndmanagej.model.ForceClosingChannelFixtures.FORCE_CLOSING_CHANNEL;
|
||||
import static de.cotto.lndmanagej.model.ForceClosingChannelFixtures.FORCE_CLOSING_CHANNEL_3;
|
||||
import static de.cotto.lndmanagej.model.LocalOpenChannelFixtures.LOCAL_OPEN_CHANNEL;
|
||||
@@ -35,8 +36,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
class LegacyControllerIT {
|
||||
private static final String PUBKEY_BASE = "/legacy/node/" + PUBKEY;
|
||||
private static final String CHANNEL_BASE = "/legacy/channel/" + CHANNEL_ID;
|
||||
private static final long FEE_RATE = 123L;
|
||||
private static final Coins BASE_FEE = Coins.ofMilliSatoshis(10L);
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
@@ -101,32 +100,32 @@ class LegacyControllerIT {
|
||||
.andExpect(content().string(PUBKEY_2 + "\n" + PUBKEY_3));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getIncomingFeeRate() throws Exception {
|
||||
when(feeService.getIncomingFeeRate(CHANNEL_ID)).thenReturn(FEE_RATE);
|
||||
mockMvc.perform(get(CHANNEL_BASE + "/incoming-fee-rate"))
|
||||
.andExpect(content().string(Long.toString(FEE_RATE)));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getOutgoingFeeRate() throws Exception {
|
||||
when(feeService.getOutgoingFeeRate(CHANNEL_ID)).thenReturn(FEE_RATE);
|
||||
when(feeService.getFeeConfiguration(CHANNEL_ID)).thenReturn(FEE_CONFIGURATION);
|
||||
mockMvc.perform(get(CHANNEL_BASE + "/outgoing-fee-rate"))
|
||||
.andExpect(content().string(Long.toString(FEE_RATE)));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getIncomingBaseFee() throws Exception {
|
||||
when(feeService.getIncomingBaseFee(CHANNEL_ID)).thenReturn(BASE_FEE);
|
||||
mockMvc.perform(get(CHANNEL_BASE + "/incoming-base-fee"))
|
||||
.andExpect(content().string(String.valueOf(BASE_FEE.milliSatoshis())));
|
||||
.andExpect(content().string("1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getOutgoingBaseFee() throws Exception {
|
||||
when(feeService.getOutgoingBaseFee(CHANNEL_ID)).thenReturn(BASE_FEE);
|
||||
when(feeService.getFeeConfiguration(CHANNEL_ID)).thenReturn(FEE_CONFIGURATION);
|
||||
mockMvc.perform(get(CHANNEL_BASE + "/outgoing-base-fee"))
|
||||
.andExpect(content().string(String.valueOf(BASE_FEE.milliSatoshis())));
|
||||
.andExpect(content().string("2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getIncomingFeeRate() throws Exception {
|
||||
when(feeService.getFeeConfiguration(CHANNEL_ID)).thenReturn(FEE_CONFIGURATION);
|
||||
mockMvc.perform(get(CHANNEL_BASE + "/incoming-fee-rate"))
|
||||
.andExpect(content().string("3"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getIncomingBaseFee() throws Exception {
|
||||
when(feeService.getFeeConfiguration(CHANNEL_ID)).thenReturn(FEE_CONFIGURATION);
|
||||
mockMvc.perform(get(CHANNEL_BASE + "/incoming-base-fee"))
|
||||
.andExpect(content().string("4"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user