@Test(expected = NullPointerException.class) public void testNullPointerExceptionOnInvalidJsonTypeInGenerateJSONFromLastestJSON() throws UnknownHostException { String jsonType = null; persister4CollectorAPI.generateJSONFromLastestJSON(existedCollectionCode, jsonType); }
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/genJson") public Response generateJSONFromLastestJSON(@QueryParam("collectionCode") String collectionCode, @DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType) throws UnknownHostException { logger.info("Received request for collection: " + collectionCode + " with jsonType = " + jsonType); JsonDeserializer jsonD = new JsonDeserializer(); String fileName = jsonD.generateJSON2JSON_100K_BasedOnTweetCount(collectionCode, DownloadJsonType.getDownloadJsonTypeFromString(jsonType)); fileName = PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_DOWNLOAD_URL) + collectionCode+"/"+fileName; logger.info("Done processing request for collection: " + collectionCode + ", returning created file: " + fileName); JSONObject obj = new JSONObject(); obj.putAll(ResultStatus.getUIWrapper(collectionCode, null, fileName, true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, null, fileName, true)); return Response.ok(obj.toJSONString()).build(); }
Persister4CollectorAPI { @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genJson") public Response generateJSONFromLastestJSON(@QueryParam("collectionCode") String collectionCode, @DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType) throws UnknownHostException { logger.info("Received request for collection: " + collectionCode + " with jsonType = " + jsonType); JsonDeserializer jsonD = new JsonDeserializer(); String fileName = jsonD.generateJSON2JSON_100K_BasedOnTweetCount(collectionCode, DownloadJsonType.getDownloadJsonTypeFromString(jsonType)); fileName = PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_DOWNLOAD_URL) + collectionCode+"/"+fileName; logger.info("Done processing request for collection: " + collectionCode + ", returning created file: " + fileName); JSONObject obj = new JSONObject(); obj.putAll(ResultStatus.getUIWrapper(collectionCode, null, fileName, true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, null, fileName, true)); return Response.ok(obj.toJSONString()).build(); } }
Persister4CollectorAPI { @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genJson") public Response generateJSONFromLastestJSON(@QueryParam("collectionCode") String collectionCode, @DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType) throws UnknownHostException { logger.info("Received request for collection: " + collectionCode + " with jsonType = " + jsonType); JsonDeserializer jsonD = new JsonDeserializer(); String fileName = jsonD.generateJSON2JSON_100K_BasedOnTweetCount(collectionCode, DownloadJsonType.getDownloadJsonTypeFromString(jsonType)); fileName = PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_DOWNLOAD_URL) + collectionCode+"/"+fileName; logger.info("Done processing request for collection: " + collectionCode + ", returning created file: " + fileName); JSONObject obj = new JSONObject(); obj.putAll(ResultStatus.getUIWrapper(collectionCode, null, fileName, true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, null, fileName, true)); return Response.ok(obj.toJSONString()).build(); } Persister4CollectorAPI(); }
Persister4CollectorAPI { @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genJson") public Response generateJSONFromLastestJSON(@QueryParam("collectionCode") String collectionCode, @DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType) throws UnknownHostException { logger.info("Received request for collection: " + collectionCode + " with jsonType = " + jsonType); JsonDeserializer jsonD = new JsonDeserializer(); String fileName = jsonD.generateJSON2JSON_100K_BasedOnTweetCount(collectionCode, DownloadJsonType.getDownloadJsonTypeFromString(jsonType)); fileName = PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_DOWNLOAD_URL) + collectionCode+"/"+fileName; logger.info("Done processing request for collection: " + collectionCode + ", returning created file: " + fileName); JSONObject obj = new JSONObject(); obj.putAll(ResultStatus.getUIWrapper(collectionCode, null, fileName, true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, null, fileName, true)); return Response.ok(obj.toJSONString()).build(); } Persister4CollectorAPI(); @GET @Produces("application/json") @Consumes("application/json") @Path("/start") Response startPersister(@QueryParam("file") String fileLocation, @QueryParam("collectionCode") String collectionCode); @GET @Produces("application/json") @Consumes("application/json") @Path("/stop") Response stopPersister(@QueryParam("collectionCode") String collectionCode); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genCSV") Response generateCSVFromLastestJSON(@QueryParam("collectionCode") String collectionCode,
    				@QueryParam("exportLimit") int exportLimit); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genTweetIds") Response generateTweetsIDSCSVFromAllJSON(@QueryParam("collectionCode") String collectionCode,
    		@DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited); @GET @Produces("application/json") @Path("/ping") Response ping(); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genJson") Response generateJSONFromLastestJSON(@QueryParam("collectionCode") String collectionCode,
    		@DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genJsonTweetIds") Response generateTweetsIDSJSONFromAllJSON(@QueryParam("collectionCode") String collectionCode,
    			@DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited,
    			@DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType); }
Persister4CollectorAPI { @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genJson") public Response generateJSONFromLastestJSON(@QueryParam("collectionCode") String collectionCode, @DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType) throws UnknownHostException { logger.info("Received request for collection: " + collectionCode + " with jsonType = " + jsonType); JsonDeserializer jsonD = new JsonDeserializer(); String fileName = jsonD.generateJSON2JSON_100K_BasedOnTweetCount(collectionCode, DownloadJsonType.getDownloadJsonTypeFromString(jsonType)); fileName = PersisterConfigurator.getInstance().getProperty(PersisterConfigurationProperty.PERSISTER_DOWNLOAD_URL) + collectionCode+"/"+fileName; logger.info("Done processing request for collection: " + collectionCode + ", returning created file: " + fileName); JSONObject obj = new JSONObject(); obj.putAll(ResultStatus.getUIWrapper(collectionCode, null, fileName, true)); logger.info("Returning JSON object: " + ResultStatus.getUIWrapper(collectionCode, null, fileName, true)); return Response.ok(obj.toJSONString()).build(); } Persister4CollectorAPI(); @GET @Produces("application/json") @Consumes("application/json") @Path("/start") Response startPersister(@QueryParam("file") String fileLocation, @QueryParam("collectionCode") String collectionCode); @GET @Produces("application/json") @Consumes("application/json") @Path("/stop") Response stopPersister(@QueryParam("collectionCode") String collectionCode); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genCSV") Response generateCSVFromLastestJSON(@QueryParam("collectionCode") String collectionCode,
    				@QueryParam("exportLimit") int exportLimit); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genTweetIds") Response generateTweetsIDSCSVFromAllJSON(@QueryParam("collectionCode") String collectionCode,
    		@DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited); @GET @Produces("application/json") @Path("/ping") Response ping(); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genJson") Response generateJSONFromLastestJSON(@QueryParam("collectionCode") String collectionCode,
    		@DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/genJsonTweetIds") Response generateTweetsIDSJSONFromAllJSON(@QueryParam("collectionCode") String collectionCode,
    			@DefaultValue("true") @QueryParam("downloadLimited") Boolean downloadLimited,
    			@DefaultValue(DownloadType.TEXT_JSON) @QueryParam("jsonType") String jsonType);  }