我正在使用PostgreSQL 9.2.
我有一些表,其中包含一些设备停止运行的时间.
+----------+----------+---------------------+
| event_id | device | time |
+----------+----------+---------------------+
| 1 | Switch4 | 2013-09-01 00:01:00 |
| 2 | Switch1 | 2013-09-01 00:02:30 |
| 3 | Switch10 | 2013-09-01 00:02:40 |
| 4 | Switch51 | 2013-09-01 03:05:00 |
| 5 | Switch49 | 2013-09-02 13:00:00 |
| 6 | Switch28 | 2013-09-02 13:01:00 |
| 7 | Switch9 | 2013-09-02 13:02:00 |
+----------+----------+---------------------+
Run Code Online (Sandbox Code Playgroud)
我希望将行分组+/- 3分钟的时差,如下所示:
+----------+----------+---------------------+--------+
| event_id | device | time | group …Run Code Online (Sandbox Code Playgroud) 可以通过 MockRestServiceServer(restTemplate) 模拟响应 FeignClient 吗?这个例子不起作用:
应用程序类
@SpringBootApplication
@EnableFeignClients
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
TicketService.class
@FeignClient("ws")
public interface TicketService {
@RequestMapping(value = "/tickets/")
List<Ticket> findAllTickets();
}
Run Code Online (Sandbox Code Playgroud)
测试配置类
@Profile("test")
@Configuration
public class TestConfig {
@Bean
@Primary
public RestTemplate restTemplate() {
return new RestTemplate();
}
}
Run Code Online (Sandbox Code Playgroud)
MyTest.class
@ActiveProfiles("test")
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {Application.class}, properties = {"ws.ribbon.listOfServers:example.com"})
public class MyTest {
@Autowired
RestTemplate restTemplate;
@Autowired
DispatcherService dispatcherService; // service where the execution of the method TicketService.findAllTickets(); …Run Code Online (Sandbox Code Playgroud)