### Question:
BundleRequestServiceImpl implements BundleRequestService, ServletContextAware { @Override public BundleResponse validate(BundleRequest bundleRequest) { String id = getNextId(); bundleRequest.setId(id); BundleResponse bundleResponse = new BundleResponse(id); bundleResponse.addStatusMessage("queueing..."); _log.debug("validate id=" + bundleResponse.getId()); _validationMap.put(bundleResponse.getId(), bundleResponse); _executorService.execute(new ValidateThread(bundleRequest, bundleResponse)); return bundleResponse; }  @Autowired void setEmailService(EmailService service); @Autowired void setBundleServerService(BundleServerService service); @PostConstruct void setup(); void setInstanceId(String instanceId); String getInstanceId(); @Override /** * Make an asynchronous request to validate bundle(s). The BundleResponse object is * updated upon completion (successful or otherwise) of the validation process. */ BundleResponse validate(BundleRequest bundleRequest); @Override /** * Retrieve a BundleResponse object for the given id. */ BundleResponse lookupValidationRequest(String id); @Override /** * Retrieve a BundleBuildResponse object for the given id. */ BundleBuildResponse lookupBuildRequest(String id); void sendEmail(BundleBuildRequest request, BundleBuildResponse response); @Override BundleBuildResponse buildBundleResultURL(String id); @Override /** * cleanup resources. */ void cleanup(); @Override void setServletContext(ServletContext servletContext); String getServerURL(); void setServerURL(String url); @Override BundleBuildResponse build(BundleBuildRequest bundleRequest); @Autowired void setConfigurationService(ConfigurationService configurationService);  }### Answer:
@Test public void testValidate() throws Exception { BundleRequest req = new BundleRequest(); String key= "2012Jan"; req.setBundleDirectory(key); req.setBundleBuildName("test_0"); _log.debug("calling validate for dir=" + req.getBundleDirectory() + " name=" + req.getBundleBuildName()); BundleResponse res = service.validate(req); assertFalse(res.isComplete()); int count = 0; while (count < 300 && !res.isComplete() && res.getException() == null) { Thread.sleep(10 * 1000); count++; _log.debug("calling lookup(local) for id=" + res.getId()); res = service.lookupValidationRequest(res.getId()); assertNotNull(res); } if (res.getException() != null) { _log.error("Failed with exception=" + res.getException()); } assertNull(res.getException()); assertTrue(res.isComplete()); assertNotNull(res.getValidationFiles()); assertEquals(2, res.getValidationFiles().size()); }