@Test
	public void testBook() throws Exception {
		//Create query arguments. TicketQueryArgs is used for external client with human readable parameters.
		TicketQueryArgs query = new TicketQueryArgs();
		query.setDate(LocalDate.now());
		query.setDepartureStation("北京南");
		query.setDestinationStation("南京南");
		query.setTrainNumber("G101");
		query.setSeatType(-1);
		query.setCount(1);

		
		
		TestTicketPool pool = this.createTicketPool();
		
		//Because book is the only operation which may change data, so in the future, toTicketPoolQueryArgs, book and toTicket will
		//be executed by different disruptor consumers.  

		
		//Convert query to pool query. pool query is only used inside pool system and holds seat, train as ids or java references.
				
		TicketPoolQueryArgs poolQuery = pool.toTicketPoolQueryArgs(query);
		
		TicketPoolTicket[] poolTickets = pool.book(poolQuery);
		
		
		//Convert pool ticket to human readable ticket.
		Ticket[] tickets = pool.toTicket(poolTickets);
		
		Assert.assertEquals(1, tickets.length);
		
		Ticket ticket = tickets[0];
		
		Assert.assertEquals(LocalDate.now(), ticket.getDepartureDate());
		
		Assert.assertEquals("北京南", ticket.getDepartureStation());
		Assert.assertEquals("南京南", ticket.getDestinationStation());
		Assert.assertEquals("G101", ticket.getTrainNumber());
		

	}