View Javadoc

1   package org.kuali.common.http;
2   
3   import org.kuali.common.util.Assert;
4   import org.kuali.common.util.execute.Executable;
5   import org.slf4j.Logger;
6   import org.slf4j.LoggerFactory;
7   
8   public class HttpWaitExecutable implements Executable {
9   
10  	private final Logger logger = LoggerFactory.getLogger(HttpWaitExecutable.class);
11  
12  	HttpContext context;
13  	HttpService service = new DefaultHttpService();
14  	HttpStatus expected = HttpStatus.SUCCESS;
15  
16  	@Override
17  	public void execute() {
18  		logger.debug(context.getUrl());
19  		HttpWaitResult result = service.wait(context);
20  		HttpStatus actual = result.getStatus();
21  		Assert.isTrue(expected.equals(actual), "Expected status - [" + expected + "]  Actual status - [" + actual + "]");
22  	}
23  
24  	public HttpContext getContext() {
25  		return context;
26  	}
27  
28  	public void setContext(HttpContext context) {
29  		this.context = context;
30  	}
31  
32  	public HttpService getService() {
33  		return service;
34  	}
35  
36  	public void setService(HttpService service) {
37  		this.service = service;
38  	}
39  
40  	public HttpStatus getExpected() {
41  		return expected;
42  	}
43  
44  	public void setExpected(HttpStatus expected) {
45  		this.expected = expected;
46  	}
47  
48  }