Fix build errors and start to add integration test