@Test
public void testReceiveEvents() throws JsonProcessingException{

	
	WebResource webResource = resource();
	String policyStr = "";
	policyStr = PolicyRestApiTest.getPolicyContent();
	ClientResponse response = webResource.path("/policies").type(MediaType.APPLICATION_JSON).post(ClientResponse.class,policyStr);
	String jsonStr = response.getEntity(String.class);
	JSONObject jo = new JSONObject(jsonStr);
	policyId = jo.getString("policyId");
	assertNotNull(policyId);
       assertEquals(response.getStatus(), STATUS201);
       
       webResource = resource();
	jo = new JSONObject();
	jo.put("policyId", policyId);
	jo.put("state", AutoScalerPolicy.STATE_ENABLED);
	response = webResource.path("/apps/" + TESTAPPID).type(MediaType.APPLICATION_JSON).put(ClientResponse.class, jo.toString());
       assertEquals(response.getStatus(), STATUS200);
       
	response = webResource.path("/events").type(MediaType.APPLICATION_JSON).post(ClientResponse.class, mapper.writeValueAsString(this.generateEvents()));
       assertEquals(response.getStatus(), STATUS200);
       
       
}