@Test public void getBufferedAIDRDataPostFilterTest() { String channelCode = null; String callbackName = null; int count = 1; String queryString = "{ \"constraints\": [ { \"queryType\": \"date_query\", \"comparator\": \"is_before\", \"timestamp\": 1427375693 }," + " { \"queryType\": \"date_query\", \"comparator\": \"is_after\", \"timestamp\": 1427352427 } ] }"; Response response = getBufferedAIDRData.getBufferedAIDRDataPostFilter(queryString, channelCode, callbackName, count); String statusString = (String)response.getEntity(); assertNotNull(statusString); assertEquals("[{}]", statusString); queryString = "{ \"constraints\": [ { \"queryType\": \"date_query\", \"comparator\": \"is_before\", \"timestamp\": 1427375693 }, " + "{ \"queryType\": \"date_query\", \"comparator\": \"is_after\", \"timestamp\": 1427352427 }, " + "{ \"queryType\": \"classifier_query\", \"classifier_code\": \"informative_pray_personal\", \"label_code\": \"praying\", \"comparator\": \"is\", \"min_confidence\": 0.8 }, " + "{ \"queryType\": \"classifier_query\", \"classifier_code\": \"informative_pray_personal\", \"label_code\": \"030_info\", \"comparator\": \"is_not\" }, " + "{ \"queryType\": \"classifier_query\", \"classifier_code\": \"informative_pray_personal\", \"label_code\": null, \"comparator\": \"has_confidence\", \"min_confidence\": 0.5 } ] }"; response = getBufferedAIDRData.getBufferedAIDRDataPostFilter(queryString, channelCode, callbackName, count); statusString = (String)response.getEntity(); assertNotNull(statusString); assertEquals("[{}]", statusString); }
@OPTIONS @Produces(MediaType.APPLICATION_JSON) @Path("/channel/filter/{crisisCode}") public Response getBufferedAIDRDataPostFilter(@PathParam("crisisCode") String channelCode, @QueryParam("callback") String callbackName, @DefaultValue("1000") @QueryParam("count") int count) { return Response.ok() .allow("POST", "GET", "PUT", "UPDATE", "OPTIONS", "HEAD") .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS, HEAD") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With") .build(); }
GetBufferedAIDRData implements ServletContextListener { @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Path("/channel/filter/{crisisCode}") public Response getBufferedAIDRDataPostFilter(@PathParam("crisisCode") String channelCode, @QueryParam("callback") String callbackName, @DefaultValue("1000") @QueryParam("count") int count) { return Response.ok() .allow("POST", "GET", "PUT", "UPDATE", "OPTIONS", "HEAD") .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS, HEAD") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With") .build(); } }
GetBufferedAIDRData implements ServletContextListener { @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Path("/channel/filter/{crisisCode}") public Response getBufferedAIDRDataPostFilter(@PathParam("crisisCode") String channelCode, @QueryParam("callback") String callbackName, @DefaultValue("1000") @QueryParam("count") int count) { return Response.ok() .allow("POST", "GET", "PUT", "UPDATE", "OPTIONS", "HEAD") .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS, HEAD") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With") .build(); }  }
GetBufferedAIDRData implements ServletContextListener { @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Path("/channel/filter/{crisisCode}") public Response getBufferedAIDRDataPostFilter(@PathParam("crisisCode") String channelCode, @QueryParam("callback") String callbackName, @DefaultValue("1000") @QueryParam("count") int count) { return Response.ok() .allow("POST", "GET", "PUT", "UPDATE", "OPTIONS", "HEAD") .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS, HEAD") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With") .build(); }  @GET @Path("/channels/list") @Produces("text/html") Response getActiveChannelsList(); @GET @Path("/channels/latest") @Produces("application/json") Response getLatestBufferedAIDRData(@QueryParam("callback") String callbackName,
			@DefaultValue("1") @QueryParam("count") Integer count,
			@DefaultValue("0.7") @QueryParam("confidence") Float confidence,
			@DefaultValue("true") @QueryParam("balanced_sampling") Boolean balanced_sampling); @GET @Path("/channel/{crisisCode}") @Produces({"application/json"}) Response getBufferedAIDRData(@PathParam("crisisCode") String channelCode,
			@QueryParam("callback") String callbackName,
			@DefaultValue("1000") @QueryParam("count") int count); @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Path("/channel/filter/{crisisCode}") Response getBufferedAIDRDataPostFilter(@PathParam("crisisCode") String channelCode,
			@QueryParam("callback") String callbackName,
			@DefaultValue("1000") @QueryParam("count") int count); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/channel/filter/{crisisCode}") Response getBufferedAIDRDataPostFilter(String queryString, @PathParam("crisisCode") String channelCode,
			@QueryParam("callback") String callbackName,
			@DefaultValue("1000") @QueryParam("count") int count); Response returnEmptyJson(final String callbackName); boolean isChannelPresent(String channel); @GET @Path("/channel/error/{crisisCode}") @Produces({"text/html"}) Response onErrorResponse(); @GET @Path("/manage/restart/{passcode}") @Produces("application/json") Response restartFetchService(@PathParam("passcode") String passcode); @POST @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.APPLICATION_JSON) @Path("/channel/test/{crisisCode}") Response testPost(String testString, @PathParam("crisisCode") String channelCode); @GET @Path("/channel/test/jsonmap") Response testJsonMap(); @GET @Path("/channel/test/channelpublic") Response testChannelPublicFlag(@QueryParam("channelCode") String channelCode); @Override void contextDestroyed(ServletContextEvent sce); @Override void contextInitialized(ServletContextEvent sce); }
GetBufferedAIDRData implements ServletContextListener { @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Path("/channel/filter/{crisisCode}") public Response getBufferedAIDRDataPostFilter(@PathParam("crisisCode") String channelCode, @QueryParam("callback") String callbackName, @DefaultValue("1000") @QueryParam("count") int count) { return Response.ok() .allow("POST", "GET", "PUT", "UPDATE", "OPTIONS", "HEAD") .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS, HEAD") .header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With") .build(); }  @GET @Path("/channels/list") @Produces("text/html") Response getActiveChannelsList(); @GET @Path("/channels/latest") @Produces("application/json") Response getLatestBufferedAIDRData(@QueryParam("callback") String callbackName,
			@DefaultValue("1") @QueryParam("count") Integer count,
			@DefaultValue("0.7") @QueryParam("confidence") Float confidence,
			@DefaultValue("true") @QueryParam("balanced_sampling") Boolean balanced_sampling); @GET @Path("/channel/{crisisCode}") @Produces({"application/json"}) Response getBufferedAIDRData(@PathParam("crisisCode") String channelCode,
			@QueryParam("callback") String callbackName,
			@DefaultValue("1000") @QueryParam("count") int count); @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Path("/channel/filter/{crisisCode}") Response getBufferedAIDRDataPostFilter(@PathParam("crisisCode") String channelCode,
			@QueryParam("callback") String callbackName,
			@DefaultValue("1000") @QueryParam("count") int count); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/channel/filter/{crisisCode}") Response getBufferedAIDRDataPostFilter(String queryString, @PathParam("crisisCode") String channelCode,
			@QueryParam("callback") String callbackName,
			@DefaultValue("1000") @QueryParam("count") int count); Response returnEmptyJson(final String callbackName); boolean isChannelPresent(String channel); @GET @Path("/channel/error/{crisisCode}") @Produces({"text/html"}) Response onErrorResponse(); @GET @Path("/manage/restart/{passcode}") @Produces("application/json") Response restartFetchService(@PathParam("passcode") String passcode); @POST @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.APPLICATION_JSON) @Path("/channel/test/{crisisCode}") Response testPost(String testString, @PathParam("crisisCode") String channelCode); @GET @Path("/channel/test/jsonmap") Response testJsonMap(); @GET @Path("/channel/test/channelpublic") Response testChannelPublicFlag(@QueryParam("channelCode") String channelCode); @Override void contextDestroyed(ServletContextEvent sce); @Override void contextInitialized(ServletContextEvent sce);  }