Java 类org.springframework.util.AlternativeJdkIdGenerator 实例源码

项目:spring4-understanding    文件:StompHeaderAccessorTests.java   
@Test
public void messageIdAndTimestampEnabled() {
    IdTimestampMessageHeaderInitializer headerInitializer = new IdTimestampMessageHeaderInitializer();
    headerInitializer.setIdGenerator(new AlternativeJdkIdGenerator());
    headerInitializer.setEnableTimestamp(true);

    StompHeaderAccessor headerAccessor = StompHeaderAccessor.create(StompCommand.SEND);
    headerInitializer.initHeaders(headerAccessor);

    assertNotNull(headerAccessor.getMessageHeaders().getId());
    assertNotNull(headerAccessor.getMessageHeaders().getTimestamp());
}