List of usage examples for com.google.gson JsonObject getAsJsonObject
public JsonObject getAsJsonObject(String memberName)
From source file:com.ibm.streamsx.topology.internal.streaminganalytics.RestUtils.java
License:Open Source License
public static void checkInstanceStatus(CloseableHttpClient httpClient, JsonObject service) throws ClientProtocolException, IOException { final String serviceName = jstring(service, "name"); final JsonObject credentials = service.getAsJsonObject("credentials"); String url = getStatusURL(credentials); String apiKey = getAPIKey(credentials); HttpGet getStatus = new HttpGet(url); getStatus.addHeader(AUTH.WWW_AUTH_RESP, apiKey); JsonObject jsonResponse = getGsonResponse(httpClient, getStatus); RemoteContext.REMOTE_LOGGER.info("Streaming Analytics service (" + serviceName + "): instance status response:" + jsonResponse.toString()); if (!"true".equals(jstring(jsonResponse, "enabled"))) throw new IllegalStateException("Service is not enabled!"); if (!"running".equals(jstring(jsonResponse, "status"))) throw new IllegalStateException("Service is not running!"); }
From source file:com.ibm.streamsx.topology.internal.streaminganalytics.RestUtils.java
License:Open Source License
/** * Submit an application bundle to execute as a job. *//* w w w. j av a 2 s. c o m*/ public static JsonObject postJob(CloseableHttpClient httpClient, JsonObject service, File bundle, JsonObject jobConfigOverlay) throws ClientProtocolException, IOException { final String serviceName = jstring(service, "name"); final JsonObject credentials = service.getAsJsonObject("credentials"); String url = getJobSubmitURL(credentials, bundle); HttpPost postJobWithConfig = new HttpPost(url); postJobWithConfig.addHeader("accept", ContentType.APPLICATION_JSON.getMimeType()); postJobWithConfig.addHeader(AUTH.WWW_AUTH_RESP, getAPIKey(credentials)); FileBody bundleBody = new FileBody(bundle, ContentType.APPLICATION_OCTET_STREAM); StringBody configBody = new StringBody(jobConfigOverlay.toString(), ContentType.APPLICATION_JSON); HttpEntity reqEntity = MultipartEntityBuilder.create().addPart("sab", bundleBody) .addPart(DeployKeys.JOB_CONFIG_OVERLAYS, configBody).build(); postJobWithConfig.setEntity(reqEntity); JsonObject jsonResponse = getGsonResponse(httpClient, postJobWithConfig); RemoteContext.REMOTE_LOGGER.info("Streaming Analytics service (" + serviceName + "): submit job response:" + jsonResponse.toString()); return jsonResponse; }
From source file:com.ibm.watson.movieapp.dialog.rest.SearchTheMovieDbProxyResource.java
License:Open Source License
/** * Gets the details for the movie selected * <p>//from w ww. jav a 2 s .co m * This will retrieve the following movie info using themoviedb.org's /moviedetails API: * <ul> * <li>releaseDate the movie's release date * <li>releaseDateStr the movie's release date in String format * <li>genre the movie genre * <li>genreId the movie genre id * <li>movieId the movie id * <li>certification the movie certification * <li>certificationCountry the country of certification * <li>popularity the movie popularity (out of 10) * <li>movieName the movie name * <li>overview the brief summary of the movie * <li>runtime the runtime (in minutes) * <li>homepageUrl the url to the movie's homepage * <li>posterPath the path to the movie poster * <li>trailerUrl the url to the movie's trailer * </ul> * * @param movieId the movie id of the movie selected, not null * @param movieName the name of the movie selected * @return a response containing either of these two entities- {@code MoviePayload} or {@code ServerErrorPayload} */ @GET @Path("/getMovieDetails") @Produces(MediaType.APPLICATION_JSON) public Response getMovieDetails(@QueryParam("movieid") String movieId, @QueryParam("moviename") String movieName) { String errorMessage = null, issue = null; try { if (movieId == null) { errorMessage = Messages.getString("SearchTheMovieDbProxyResource.MOVIE_NOT_FOUND"); //$NON-NLS-1$ issue = Messages.getString("SearchTheMovieDbProxyResource.MOVIE_ID_NOT_SPECIFIED"); //$NON-NLS-1$ throw new WatsonTheatersException(errorMessage, issue); } // Get general movie info. Hashtable<String, String> params = new Hashtable<>(); params.put("append_to_response", "releases,videos"); //Make a single API call to retrieve all the info we need. //$NON-NLS-1$ //$NON-NLS-2$ URI uri = buildUriStringFromParamsHash(params, MOVIE_DETAILS + movieId); JsonObject tmdbResponse = UtilityFunctions.httpGet(createTMDBHttpClient(), uri); MoviePayload moviePayload = new MoviePayload(); moviePayload.setMovieId(Integer.parseInt(tmdbResponse.get("id").toString())); //$NON-NLS-1$ moviePayload.setMovieName(UtilityFunctions.getPropValue(tmdbResponse, "title")); //$NON-NLS-1$ moviePayload.setHomepageUrl(UtilityFunctions.getPropValue(tmdbResponse, "homepage")); //$NON-NLS-1$ moviePayload.setOverview(UtilityFunctions.getPropValue(tmdbResponse, "overview")); //$NON-NLS-1$ moviePayload.setPosterPath(UtilityFunctions.getPropValue(tmdbResponse, "poster_path")); //$NON-NLS-1$ if (Integer.parseInt(UtilityFunctions.getPropValue(tmdbResponse, "vote_count")) >= 10) { moviePayload.setPopularity( Double.parseDouble(UtilityFunctions.getPropValue(tmdbResponse, "vote_average"))); //$NON-NLS-1$ } else { moviePayload.setPopularity(-1.0); //$NON-NLS-1$ } moviePayload.setReleaseDateStr(UtilityFunctions.getPropValue(tmdbResponse, "release_date")); //$NON-NLS-1$ Date rDate = movieDateFormatter.parse(moviePayload.getReleaseDateStr()); moviePayload.setReleaseDate(rDate); String time = UtilityFunctions.getPropValue(tmdbResponse, "runtime"); //$NON-NLS-1$ if (time != null && !time.isEmpty()) { moviePayload.setRuntime(Integer.parseInt(time)); } String path = UtilityFunctions.getPropValue(tmdbResponse, "poster_path"); //$NON-NLS-1$ if (path != null) { try { String imageBaseURL = theMovieDbCache.get("imageUrl"); //$NON-NLS-1$ moviePayload.setPosterPath(imageBaseURL + path); } catch (ExecutionException e) { UtilityFunctions.logger .error(Messages.getString("SearchTheMovieDbProxyResource.CACHE_FAIL_IMAGE_URL"), e); //$NON-NLS-1$ } } // Get the link for the trailer here and add it to payload. JsonObject videos = tmdbResponse.getAsJsonObject("videos"); //$NON-NLS-1$ if (videos != null) { JsonArray jArray = videos.getAsJsonArray("results"); //$NON-NLS-1$ for (int i = 0; i < jArray.size(); i++) { JsonObject obj = jArray.get(i).getAsJsonObject(); String site = UtilityFunctions.getPropValue(obj, "site"); //$NON-NLS-1$ String type = UtilityFunctions.getPropValue(obj, "type"); //$NON-NLS-1$ if ("Trailer".equalsIgnoreCase(type)) { //$NON-NLS-1$ String key = UtilityFunctions.getPropValue(obj, "key"); //$NON-NLS-1$ if (key != null && "youtube".equalsIgnoreCase(site)) { //$NON-NLS-1$ // create youtube url String trailerUrl = "https://www.youtube.com/embed/" + key //$NON-NLS-1$ + "?controls=0&showinfo=0"; //$NON-NLS-1$ moviePayload.setTrailerUrl(trailerUrl); } } } } // Get the certification and release date and add it to the payload. JsonObject releases = tmdbResponse.getAsJsonObject("releases"); //$NON-NLS-1$ if (releases != null) { JsonArray jArray = releases.getAsJsonArray("countries"); //$NON-NLS-1$ for (int i = 0; i < jArray.size(); i++) { JsonObject obj = (JsonObject) jArray.get(i); if (obj.get("iso_3166_1").getAsString().equals("US")) { //$NON-NLS-1$ //$NON-NLS-2$ moviePayload.setCertificationCountry("US"); //$NON-NLS-1$ moviePayload.setCertification(UtilityFunctions.getPropValue(obj, "certification")); //$NON-NLS-1$ break; } } } return Response.ok(moviePayload, MediaType.APPLICATION_JSON_TYPE).build(); } catch (URISyntaxException e) { errorMessage = Messages.getString("SearchTheMovieDbProxyResource.TMDB_INVALID_URL"); //$NON-NLS-1$ issue = Messages.getString("SearchTheMovieDbProxyResource.URI_EXCEPTION"); //$NON-NLS-1$ UtilityFunctions.logger.error(issue, e); } catch (ClientProtocolException e) { errorMessage = Messages.getString("SearchTheMovieDbProxyResource.TMDB_CALL_FAIL"); //$NON-NLS-1$ issue = Messages.getString("SearchTheMovieDbProxyResource.TMDB_HTTP_GET_CLIENT_EXCEPTION"); //$NON-NLS-1$ UtilityFunctions.logger.error(issue, e); } catch (IllegalStateException e) { errorMessage = Messages.getString("SearchTheMovieDbProxyResource.TMDB_REQUEST_FAIL"); //$NON-NLS-1$ issue = Messages.getString("SearchTheMovieDbProxyResource.TMDB_HTTP_GET_ILLEGAL_STATE_EXCEPTION"); //$NON-NLS-1$ UtilityFunctions.logger.error(issue, e); } catch (IOException e) { errorMessage = Messages.getString("SearchTheMovieDbProxyResource.TMDB_REQUEST_FAIL"); //$NON-NLS-1$ issue = Messages.getString("SearchTheMovieDbProxyResource.IOEXCEPTION_TMDB_GET"); //$NON-NLS-1$ UtilityFunctions.logger.error(issue, e); } catch (HttpException e) { errorMessage = Messages.getString("SearchTheMovieDbProxyResource.TMDB_REQUEST_FAIL"); //$NON-NLS-1$ issue = Messages.getString("SearchTheMovieDbProxyResource.TMDB_HTTP_GET_EXCEPTION"); //$NON-NLS-1$ UtilityFunctions.logger.error(issue, e); } catch (ParseException e) { errorMessage = Messages.getString("SearchTheMovieDbProxyResource.UNEXPECTED_RESPONSE"); //$NON-NLS-1$ issue = Messages.getString("SearchTheMovieDbProxyResource.HTTPGET_PARSE_EXCEPTION"); //$NON-NLS-1$ UtilityFunctions.logger.error(issue, e); } catch (WatsonTheatersException e) { UtilityFunctions.logger.error(issue, e); } return Response.serverError().entity(new ServerErrorPayload(errorMessage, issue)).build(); }
From source file:com.ibm.watson.movieapp.dialog.rest.WDSBlueMixProxyResource.java
License:Open Source License
/** * Makes chat conversation with WDS/*from www . j a v a 2 s . com*/ * <p> * This makes chat conversation with WDS for the provided client id and conversation id, against the user input provided. * </p> * <p> * When WDS has collected all the required movie preferences, it sends a bunch of movie parameters embedded in the text response and signals to discover * movies from themoviedb.org. There may be the following kinds of discover movie calls: * <ul> * <li>New search: First time searching for the given set of parameters * <li>Repeat search: Repeat the search with the same parameters (just re-display the results) * <li>Previous search: Display the results on the previous page * <li>Next search: Display the results on the next page * </ul> * Depending on the kind of call, profile variables are set in WDS and personalized prompts are retrieved to be sent back to the UI in the payload. * </p> * * @param conversationId the conversation id for the client id specified * @param clientId the client id for the session * @param input the user's input * @return a response containing either of these two entities- {@code WDSConversationPayload} or {@code ServerErrorPayload} */ @GET @Path("/postConversation") @Produces(MediaType.APPLICATION_JSON) public Response postConversation(@QueryParam("conversationId") String conversationId, @QueryParam("clientId") String clientId, @QueryParam("input") String input) { long lStartTime = System.nanoTime(); long lEndTime, difference; String errorMessage = null, issue = null; String wdsMessage = null; JsonObject processedText = null; if (input == null || input.trim().isEmpty()) { errorMessage = Messages.getString("WDSBlueMixProxyResource.SPECIFY_INPUT"); //$NON-NLS-1$ issue = Messages.getString("WDSBlueMixProxyResource.EMPTY_QUESTION"); //$NON-NLS-1$ UtilityFunctions.logger.error(issue); return Response.serverError().entity(new ServerErrorPayload(errorMessage, issue)).build(); } try { // 1.Get all the class info from NLC and set appropriate profile variables. List<ClassifiedClass> classInfo = null; if (nlcService != null) { if (UtilityFunctions.logger.isTraceEnabled()) { UtilityFunctions.logger.trace(Messages.getString("WDSBlueMixProxyResource.NLC_SERVICE")); //$NON-NLS-1$ } // Send utterance to NLC to get user intent Classification classification = nlcService.classify(classifier_id, input); classInfo = classification.getClasses(); // Set classification profile variables for WDS. Map<String, String> profile = new HashMap<>(); profile.put("Class1", classInfo.get(0).getName()); profile.put("Class1_Confidence", Double.toString(classInfo.get(0).getConfidence())); profile.put("Class2", classInfo.get(1).getName()); profile.put("Class2_Confidence", Double.toString(classInfo.get(1).getConfidence())); dialogService.updateProfile(dialog_id, new Integer(clientId), profile); } // 2. Send original utterance to WDS Map<String, Object> converseParams = new HashMap<String, Object>(); converseParams.put("dialog_id", dialog_id); converseParams.put("client_id", Integer.parseInt(clientId)); converseParams.put("conversation_id", Integer.parseInt(conversationId)); converseParams.put("input", input); Conversation conversation = dialogService.converse(converseParams); wdsMessage = StringUtils.join(conversation.getResponse(), " "); processedText = matchSearchNowPattern(wdsMessage); WDSConversationPayload conversationPayload = new WDSConversationPayload(); if (!processedText.has("Params")) { //$NON-NLS-1$ // We do not have enough info to search the movie db, go back to the user for more info. conversationPayload.setClientId(clientId); //$NON-NLS-1$ conversationPayload.setConversationId(clientId); //$NON-NLS-1$ conversationPayload.setInput(input); //$NON-NLS-1$ conversationPayload.setWdsResponse(processedText.get("WDSMessage").getAsString()); //$NON-NLS-1$ if (UtilityFunctions.logger.isTraceEnabled()) { // Log the execution time. lEndTime = System.nanoTime(); difference = lEndTime - lStartTime; UtilityFunctions.logger.trace("Throughput: " + difference / 1000000 + "ms."); } return Response.ok(conversationPayload, MediaType.APPLICATION_JSON_TYPE).build(); } else { // Dialog says we have enough info to proceed with a search of themoviedb.. // Find out search variables. JsonObject paramsObj = processedText.getAsJsonObject("Params"); //$NON-NLS-1$ boolean newSearch = false, prevSearch = false, nextSearch = false, repeatSearch = false; String page = paramsObj.get("Page").getAsString(); //$NON-NLS-1$ switch (page) { case "new": //$NON-NLS-1$ newSearch = true; break; case "next": //$NON-NLS-1$ nextSearch = true; break; case "previous": //$NON-NLS-1$ prevSearch = true; break; case "repeat": //$NON-NLS-1$ repeatSearch = true; break; default: errorMessage = Messages.getString("WDSBlueMixProxyResource.DIALOG_UNDERSTAND_FAIL"); //$NON-NLS-1$ issue = Messages.getString("WDSBlueMixProxyResource.PAGE_TYPE_NOT_UNDERSTOOD"); //$NON-NLS-1$ UtilityFunctions.logger.error(issue); } if (UtilityFunctions.logger.isTraceEnabled()) { UtilityFunctions.logger .trace(Messages.getString("WDSBlueMixProxyResource.WDS_RESPONSE") + paramsObj); //$NON-NLS-1$ } String prompt; Integer currentIndex = Integer.parseInt(paramsObj.get("Index").getAsString()); //$NON-NLS-1$ Integer numMovies = 0; Integer totalPages = 0; boolean tmdbCallNeeded = true; Map<String, String> profile; if (paramsObj.has("Total_Movies")) { numMovies = Integer.parseInt(paramsObj.get("Total_Movies").getAsString()); totalPages = Integer.parseInt(paramsObj.get("Total_Pages").getAsString()); // If the user wishes to "go back" when the first set of results is displayed or // "show more" results when all results have been displayed already---> do not need to make a call to themoviedb.org tmdbCallNeeded = !((currentIndex <= 10 && prevSearch) || (currentIndex == numMovies && nextSearch)); } if (tmdbCallNeeded) { // Need to make a call to TMDB. int pageNum = (int) Math.ceil((float) currentIndex / 20);// round up.. 10/20 = .5 == page# 1 if ((nextSearch || newSearch) && (currentIndex % 20) == 0) { pageNum++; } // Decrement page num. eg.: currentIndex = 30, 23, etc. Do not decrement page num for currentIndex = 20, 36, etc. if (prevSearch && (currentIndex % 20 <= 10 && (currentIndex % 20 != 0))) { pageNum--; } int currentDisplayCount = (currentIndex % 10 == 0) ? 10 : currentIndex % 10; SearchTheMovieDbProxyResource tmdb = new SearchTheMovieDbProxyResource(); conversationPayload = tmdb.discoverMovies(UtilityFunctions.getPropValue(paramsObj, "Genre"), //$NON-NLS-1$ UtilityFunctions.getPropValue(paramsObj, "Rating"), //$NON-NLS-1$ UtilityFunctions.getPropValue(paramsObj, "Recency"), //$NON-NLS-1$ currentIndex, pageNum, nextSearch || newSearch); int size = conversationPayload.getMovies().size(); if (prevSearch) { currentIndex -= currentDisplayCount; } else if (nextSearch || newSearch) { currentIndex += size; } profile = new HashMap<>(); // Save the number of movies displayed till now. profile.put("Current_Index", currentIndex.toString()); //$NON-NLS-1$ // Save the total number of pages in a profile variable. profile.put("Total_Pages", conversationPayload.getTotalPages().toString()); //$NON-NLS-1$ // Save the total number of movies in Num_Movies. profile.put("Num_Movies", conversationPayload.getNumMovies().toString()); //$NON-NLS-1$ // Set the profile variables. dialogService.updateProfile(dialog_id, new Integer(clientId), profile); } if (!tmdbCallNeeded) { // Set the value of the Index_Updated profile variable to No so that WDS knows that no indices were updated. profile = new HashMap<>(); profile.put("Index_Updated", "No"); dialogService.updateProfile(dialog_id, new Integer(clientId), profile); // Set some values in the ConversationPayload which are needed by the UI. List<MoviePayload> movies = new ArrayList<MoviePayload>(); conversationPayload.setMovies(movies); conversationPayload.setNumMovies(numMovies); conversationPayload.setTotalPages(totalPages); } // If first time, get personalized prompt based on Num_Movies prompt = personalized_prompt_current_index; if (newSearch || repeatSearch) { prompt = personalized_prompt_movies_returned; } // Get the personalized prompt. converseParams = new HashMap<String, Object>(); converseParams.put("dialog_id", dialog_id); converseParams.put("client_id", Integer.parseInt(clientId)); converseParams.put("conversation_id", Integer.parseInt(conversationId)); converseParams.put("input", prompt); conversation = dialogService.converse(converseParams); wdsMessage = StringUtils.join(conversation.getResponse(), " "); // Build the moviePayload. conversationPayload.setWdsResponse(wdsMessage); conversationPayload.setClientId(clientId); //$NON-NLS-1$ conversationPayload.setConversationId(clientId); //$NON-NLS-1$ conversationPayload.setInput(input); //$NON-NLS-1$ if (UtilityFunctions.logger.isTraceEnabled()) { // Log the execution time. lEndTime = System.nanoTime(); difference = lEndTime - lStartTime; UtilityFunctions.logger.trace("Throughput: " + difference / 1000000 + "ms."); } // Return to UI. return Response.ok(conversationPayload, MediaType.APPLICATION_JSON_TYPE).build(); } } catch (ClientProtocolException e) { errorMessage = Messages.getString("WDSBlueMixProxyResource.API_CALL_NOT_EXECUTED"); //$NON-NLS-1$ issue = Messages.getString("WDSBlueMixProxyResource.CLIENT_EXCEPTION_IN_GET_RESPONSE"); //$NON-NLS-1$ UtilityFunctions.logger.error(issue, e); } catch (IllegalStateException e) { errorMessage = Messages.getString("WDSBlueMixProxyResource.API_CALL_NOT_EXECUTED"); //$NON-NLS-1$ issue = Messages.getString("WDSBlueMixProxyResource.ILLEGAL_STATE_GET_RESPONSE"); //$NON-NLS-1$ UtilityFunctions.logger.error(issue, e); } catch (IOException e) { errorMessage = Messages.getString("WDSBlueMixProxyResource.API_CALL_NOT_EXECUTED"); //$NON-NLS-1$ issue = Messages.getString("WDSBlueMixProxyResource.IO_EXCEPTION_GET_RESPONSE"); //$NON-NLS-1$ UtilityFunctions.logger.error(issue, e); } catch (HttpException e) { errorMessage = Messages.getString("WDSBlueMixProxyResource.TMDB_API_CALL_NOT_EXECUTED"); //$NON-NLS-1$ issue = Messages.getString("WDSBlueMixProxyResource.HTTP_EXCEPTION_GET_RESPONSE"); //$NON-NLS-1$ UtilityFunctions.logger.error(issue, e); } catch (WatsonTheatersException e) { errorMessage = e.getErrorMessage(); issue = e.getIssue(); UtilityFunctions.logger.error(issue, e); } catch (URISyntaxException e) { errorMessage = Messages.getString("WDSBlueMixProxyResource.TMDB_URL_INCORRECT"); //$NON-NLS-1$ issue = Messages.getString("WDSBlueMixProxyResource.URI_EXCEPTION_IN_DISOVERMOVIE"); //$NON-NLS-1$ UtilityFunctions.logger.error(issue, e); } catch (ParseException e) { errorMessage = Messages.getString("WDSBlueMixProxyResource.TMDB_RESPONSE_PARSE_FAIL"); //$NON-NLS-1$ issue = Messages.getString("WDSBlueMixProxyResource.PARSE_EXCEPTION_TMDB_GET"); //$NON-NLS-1$ UtilityFunctions.logger.error(issue, e); } return Response.serverError().entity(new ServerErrorPayload(errorMessage, issue)).build(); }
From source file:com.imaginea.betterdocs.BetterDocsAction.java
License:Apache License
private String getContentsForFile(String file) { String esFileQueryJson = getJsonForFileContent(file); String esFileResultJson = getESResultJson(esFileQueryJson, esURL + SOURCEFILE_SEARCH); JsonReader reader = new JsonReader(new StringReader(esFileResultJson)); reader.setLenient(true);//from ww w .java 2 s .com JsonElement jsonElement = new JsonParser().parse(reader); JsonObject jsonObject = jsonElement.getAsJsonObject(); JsonObject hitsObject = jsonObject.getAsJsonObject(HITS); JsonArray hitsArray = hitsObject.getAsJsonArray(HITS); JsonObject hitObject = hitsArray.get(0).getAsJsonObject(); JsonObject sourceObject = hitObject.getAsJsonObject(SOURCE); //Replacing \r as it's treated as bad end of line character String fileContent = sourceObject.getAsJsonPrimitive(FILE_CONTENT).getAsString().replaceAll("\r", ""); return fileContent; }
From source file:com.imaginea.betterdocs.BetterDocsAction.java
License:Apache License
private static Map<String, String> getFileTokens(String esResultJson) { Map<String, String> fileTokenMap = new HashMap<String, String>(); JsonReader reader = new JsonReader(new StringReader(esResultJson)); reader.setLenient(true);/* w w w. j ava 2 s .c om*/ JsonElement jsonElement = new JsonParser().parse(reader); JsonObject jsonObject = jsonElement.getAsJsonObject(); JsonObject hitsObject = jsonObject.getAsJsonObject(HITS); JsonArray hitsArray = hitsObject.getAsJsonArray(HITS); for (JsonElement hits : hitsArray) { JsonObject hitObject = hits.getAsJsonObject(); JsonObject sourceObject = hitObject.getAsJsonObject(SOURCE); String fileName = sourceObject.getAsJsonPrimitive(FILE).getAsString(); String tokens = sourceObject.get(TOKENS).toString(); fileTokenMap.put(fileName, tokens); } return fileTokenMap; }
From source file:com.imaginea.kodebeagle.base.util.ESUtils.java
License:Apache License
public final void fetchContentsAndUpdateMap(final List<String> fileNames) { String esFileQueryJson = jsonUtils.getJsonForFileContent(fileNames); String esFileResultJson;//from www . j a v a2s . c om esFileResultJson = getESResultJson(esFileQueryJson, windowObjects.getEsURL() + SOURCEFILE_SEARCH); JsonObject jsonElements = getJsonElements(esFileResultJson); if (jsonElements != null) { JsonArray hitsArray = getJsonHitsArray(jsonElements); for (JsonElement hits : hitsArray) { JsonObject hitObject = hits.getAsJsonObject(); JsonObject sourceObject = hitObject.getAsJsonObject(SOURCE); //Replacing \r as it's treated as bad end of line character String fileContent = sourceObject.getAsJsonPrimitive(FILE_CONTENT).getAsString(); String fileName = sourceObject.getAsJsonPrimitive(FILE_NAME).getAsString(); if (fileName != null && !fileName.isEmpty() && fileContent != null && !fileContent.isEmpty()) { windowObjects.getFileNameContentsMap().put(fileName, fileContent.replaceAll("\r", "")); } } } }
From source file:com.imaginea.kodebeagle.base.util.ESUtils.java
License:Apache License
public final Map<String, String> getFileTokens(final String esResultJson) { Map<String, String> fileTokenMap = new HashMap<String, String>(); final JsonObject hitsObject = getJsonElements(esResultJson); if (hitsObject != null) { JsonArray hitsArray = getJsonHitsArray(hitsObject); resultCount = hitsArray.size();//from ww w. j a va 2 s. c om totalHitsCount = getTotalHits(hitsObject); for (JsonElement hits : hitsArray) { JsonObject hitObject = hits.getAsJsonObject(); JsonObject sourceObject = hitObject.getAsJsonObject(SOURCE); String fileName = sourceObject.getAsJsonPrimitive(FILE).getAsString(); String tokens = sourceObject.get(TOKENS).toString(); fileTokenMap.put(fileName, tokens); } } return fileTokenMap; }
From source file:com.inmind.restful.testcases.Org.java
@Test public void GetOrgsId() { LOGGER.info("*****************Test case: Get Orgs by id List Started*****************"); System.out.println("*****************Test case: Get Org by id List Started*****************"); try {//from w w w . j av a2s. c o m String uri = APITest.getValue("baseuri"); String cookievalue = cookies.get(0); System.out.println(cookievalue); APIResponse response = APIRequest.GET(uri).path("/orgs/" + orgid).header("cookie", cookievalue) .type(MediaType.APPLICATION_JSON_TYPE).invoke(); response.assertBodyContains("200"); String responsbody = response.getBody(); JsonObject jsonObject = new JsonParser().parse(responsbody).getAsJsonObject(); JsonObject body = jsonObject.getAsJsonObject("_body"); int type = body.get("type").getAsInt(); long updatedBy = body.get("updatedBy").getAsLong(); String description = body.get("description").getAsString(); long ownerId = body.get("ownerId").getAsLong(); long createdAt = body.get("createdAt").getAsLong(); long createdBy = body.get("createdBy").getAsLong(); String simpleName = body.get("simpleName").getAsString(); String englishName = body.get("englishName").getAsString(); int source = body.get("source").getAsInt(); String aliases = body.get("aliases").getAsString(); String phoneNo = body.get("phoneNo").getAsString(); String logoUrl = body.get("logoUrl").getAsString(); String siteUrl = body.get("siteUrl").getAsString(); int finacingStatus = body.get("finacingStatus").getAsInt(); double finacingAmount = body.get("finacingAmount").getAsDouble(); String legalPerson = body.get("legalPerson").getAsString(); double registedCapital = body.get("registedCapital").getAsDouble(); long registedAt = body.get("registedAt").getAsLong(); double turnover = body.get("turnover").getAsDouble(); String registedNo = body.get("registedNo").getAsString(); String registedAuthority = body.get("registedAuthority").getAsString(); int natureCode = body.get("natureCode").getAsInt(); int empScale = body.get("empScale").getAsInt(); int empMeanSalary = body.get("empMeanSalary").getAsInt(); String wxPublicNo = body.get("wxPublicNo").getAsString(); String facebookUrl = body.get("facebookUrl").getAsString(); String linkedinUrl = body.get("linkedinUrl").getAsString(); String weiboUrl = body.get("weiboUrl").getAsString(); String twitterUrl = body.get("twitterUrl").getAsString(); String qccUnique = body.get("qccUnique").getAsString(); String orgCode = body.get("orgCode").getAsString(); String licenseNo = body.get("licenseNo").getAsString(); String imgUrls = body.get("imgUrls").getAsString(); String finacingDetail = body.get("finacingDetail").getAsString(); JsonObject createdByAccount = body.getAsJsonObject("createdByAccount"); //String createdByAccount_password=createdByAccount.get("password").getAsString(); String createdByAccount_nickname = createdByAccount.get("nickname").getAsString(); String createdByAccount_mobile = createdByAccount.get("mobile").getAsString(); long createdByAccount_id = createdByAccount.get("id").getAsLong(); String createdByAccount_email = createdByAccount.get("email").getAsString(); String createdByAccount_username = createdByAccount.get("username").getAsString(); String createdByAccountsql = "SELECT * FROM account WHERE id" + createdBy + ";"; ResultSet createdByAccountResultSet = dbCtrl.query(conn, createdByAccountsql); commonutil.AssertEqualsCustomize(createdByAccount_nickname, createdByAccountResultSet.getString("nickname")); commonutil.AssertEqualsCustomize(createdByAccount_email, createdByAccountResultSet.getString("email")); commonutil.AssertEqualsCustomize(createdByAccount_mobile, createdByAccountResultSet.getString("mobile")); commonutil.AssertEqualsCustomize(createdByAccount_username, createdByAccountResultSet.getString("username")); commonutil.AssertEqualsCustomize(createdByAccount_id, createdByAccountResultSet.getLong("id")); JsonObject updatedByAccount = body.getAsJsonObject("updatedByAccount"); //String updatedByAccount_password=updatedByAccount.get("password").getAsString(); String updatedByAccount_nickname = updatedByAccount.get("nickname").getAsString(); String updatedByAccount_mobile = updatedByAccount.get("mobile").getAsString(); long updatedByAccount_id = updatedByAccount.get("id").getAsLong(); String updatedByAccount_email = updatedByAccount.get("email").getAsString(); String updatedByAccount_username = updatedByAccount.get("username").getAsString(); String updatedByAccountsql = "SELECT * FROM account WHERE id" + createdBy + ";"; ResultSet UpdatedByAccountResultSet = dbCtrl.query(conn, updatedByAccountsql); commonutil.AssertEqualsCustomize(updatedByAccount_nickname, UpdatedByAccountResultSet.getString("nickname")); commonutil.AssertEqualsCustomize(updatedByAccount_email, UpdatedByAccountResultSet.getString("email")); commonutil.AssertEqualsCustomize(updatedByAccount_mobile, UpdatedByAccountResultSet.getString("mobile")); commonutil.AssertEqualsCustomize(updatedByAccount_username, UpdatedByAccountResultSet.getString("username")); commonutil.AssertEqualsCustomize(updatedByAccount_id, UpdatedByAccountResultSet.getLong("id")); JsonObject shareholders = body.getAsJsonObject("shareholders"); long shareholders_id = shareholders.get("id").getAsLong(); long shareholders_org_id = shareholders.get("orgId").getAsLong(); long shareholders_hold_id = shareholders.get("holdId").getAsLong(); double shareholders_hold_rate = shareholders.get("holdRate").getAsDouble(); double shareholders_invest_amount = shareholders.get("investAmount").getAsDouble(); String shareholders_invest_detail = shareholders.get("investDetail").getAsString(); long shareholders_created_by = shareholders.get("createdBy").getAsLong(); long shareholders_updated_by = shareholders.get("updatedBy").getAsLong(); long shareholders_created_at = shareholders.get("createdAt").getAsLong(); long shareholders_updated_at = shareholders.get("updatedAt").getAsLong(); JsonObject orgStocks = body.getAsJsonObject("orgStocks"); long orgStocks_id = orgStocks.get("id").getAsLong(); long orgStocks_org_id = orgStocks.get("orgId").getAsLong(); int orgStocks_stock_exchange = orgStocks.get("stockExchange").getAsInt(); String orgStocks_stock_code = orgStocks.get("stockCode").getAsString(); long orgStocks_created_by = orgStocks.get("createdBy").getAsLong(); long orgStocks_updated_by = orgStocks.get("updatedBy").getAsLong(); long orgStocks_created_at = orgStocks.get("createdAt").getAsLong(); long orgStocks_updated_at = orgStocks.get("updatedAt").getAsLong(); JsonArray industrialModeDicts = body.get("industrialModeDicts").getAsJsonArray(); for (int i = 0; i < industrialModeDicts.size(); i++) { JsonObject subObject = industrialModeDicts.get(i).getAsJsonObject(); String industrialModeDicts_sql = "SELECT * FROM organization WHERE target_id=" + orgid + ";"; ResultSet industrialModeDictsResultSet = dbCtrl.query(conn, industrialModeDicts_sql); commonutil.AssertEqualsCustomize(subObject.get("type").getAsString(), industrialModeDictsResultSet.getString("dict_type")); commonutil.AssertEqualsCustomize(subObject.get("title").getAsString(), industrialModeDictsResultSet.getString("dict_type")); String dicttype = industrialModeDictsResultSet.getString("dict_type"); String dict_code = subObject.get("code").getAsString(); ResultSet dictResultSet = dbCtrl.query(conn, "SELECT * FROM dict WHERE type=" + dicttype + " AND code=" + dict_code + ";"); Long dict_title = dictResultSet.getLong("title"); commonutil.AssertEqualsCustomize(subObject.get("title").getAsString(), dict_title); commonutil.AssertEqualsCustomize(subObject.get("generated").getAsLong(), industrialModeDictsResultSet.getLong("generated")); } JsonArray industryDicts = body.get("industryDicts").getAsJsonArray(); for (int i = 0; i < industryDicts.size(); i++) { JsonObject subObject = industryDicts.get(i).getAsJsonObject(); String industryDicts_sql = "SELECT * FROM organization WHERE target_id=" + orgid + ";"; ResultSet industryDictsResultSet = dbCtrl.query(conn, industryDicts_sql); commonutil.AssertEqualsCustomize(subObject.get("type").getAsString(), industryDictsResultSet.getString("dict_type")); commonutil.AssertEqualsCustomize(subObject.get("title").getAsString(), industryDictsResultSet.getString("dict_type")); String dicttype = industryDictsResultSet.getString("dict_type"); String dict_code = subObject.get("code").getAsString(); ResultSet dictResultSet = dbCtrl.query(conn, "SELECT * FROM dict WHERE type=" + dicttype + " AND code=" + dict_code + ";"); Long dict_title = dictResultSet.getLong("title"); commonutil.AssertEqualsCustomize(subObject.get("title").getAsString(), dict_title); commonutil.AssertEqualsCustomize(subObject.get("generated").getAsLong(), industryDictsResultSet.getLong("generated")); } JsonArray highlightDicts = body.get("highlightDicts").getAsJsonArray(); for (int i = 0; i < highlightDicts.size(); i++) { JsonObject subObject = highlightDicts.get(i).getAsJsonObject(); String industryDicts_sql = "SELECT * FROM organization WHERE target_id=" + orgid + ";"; ResultSet highlightDictsResultSet = dbCtrl.query(conn, industryDicts_sql); commonutil.AssertEqualsCustomize(subObject.get("type").getAsString(), highlightDictsResultSet.getString("dict_type")); commonutil.AssertEqualsCustomize(subObject.get("title").getAsString(), highlightDictsResultSet.getString("dict_type")); String dicttype = highlightDictsResultSet.getString("dict_type"); String dict_code = subObject.get("code").getAsString(); ResultSet dictResultSet = dbCtrl.query(conn, "SELECT * FROM dict WHERE type=" + dicttype + " AND code=" + dict_code + ";"); Long dict_title = dictResultSet.getLong("title"); commonutil.AssertEqualsCustomize(subObject.get("title").getAsString(), dict_title); commonutil.AssertEqualsCustomize(subObject.get("generated").getAsLong(), highlightDictsResultSet.getLong("generated")); } JsonObject orgContactWays = body.getAsJsonObject("orgContactWays"); long orgContactWays_id = orgContactWays.get("id").getAsLong(); long orgContactWays_org_id = orgContactWays.get("orgId").getAsLong(); String orgContactWays_phone_number = orgContactWays.get("phoneNumber").getAsString(); long orgContactWays_created_by = orgContactWays.get("createdBy").getAsLong(); long orgContactWays_updated_by = orgContactWays.get("updatedBy").getAsLong(); long orgContactWays_created_at = orgContactWays.get("createdAt").getAsLong(); long orgContactWays_updated_at = orgContactWays.get("updatedAt").getAsLong(); String orgContactWays_fax_number = orgContactWays.get("faxNumber").getAsString(); long orgContactWays_address_id = orgContactWays.get("addressId").getAsLong(); String name = body.get("name").getAsString(); JsonObject orgBrands = body.getAsJsonObject("orgBrands"); int orgBrands_type = orgBrands.get("type").getAsInt(); String orgBrands_description = orgBrands.get("description").getAsString(); String orgBrands_title = orgBrands.get("title").getAsString(); long orgBrands_created_by = orgBrands.get("createdBy").getAsLong(); long orgBrands_updated_by = orgBrands.get("updatedBy").getAsLong(); long orgBrands_id = orgBrands.get("id").getAsLong(); long orgBrands_created_at = orgBrands.get("createdAt").getAsLong(); long orgBrands_updated_at = orgBrands.get("updatedAt").getAsLong(); String orgBrands_siteUrl = orgBrands.get("siteUrl").getAsString(); String orgBrands_imgUrl = orgBrands.get("imgUrl").getAsString(); long orgBrands_org_id = orgBrands.get("orgId").getAsLong(); JsonObject orgHistories = body.getAsJsonObject("orgHistories"); OrgHistoryPO orgHistoryPO = new OrgHistoryPO(); commonutil.AssertEqualsCustomize(orgHistories.get("description").getAsString(), orgHistoryPO.getDescription()); commonutil.AssertEqualsCustomize(orgHistories.get("title").getAsString(), orgHistoryPO.getTitle()); commonutil.AssertEqualsCustomize(orgHistories.get("createdBy").getAsLong(), orgHistoryPO.getCreatedBy().longValue()); commonutil.AssertEqualsCustomize(orgHistories.get("createdAt").getAsLong(), orgHistoryPO.getCreatedAt()); commonutil.AssertEqualsCustomize(orgHistories.get("UpdatedAt").getAsLong(), orgHistoryPO.getUpdatedAt()); commonutil.AssertEqualsCustomize(orgHistories.get("UpdatedBy").getAsLong(), orgHistoryPO.getUpdatedBy().longValue()); commonutil.AssertEqualsCustomize(orgHistories.get("timeAt").getAsLong(), orgHistoryPO.getTimeAt()); commonutil.AssertEqualsCustomize(orgHistories.get("linkUrl").getAsLong(), orgHistoryPO.getLinkUrl()); long updatedAt = body.get("updatedAt").getAsLong(); // // String sql ="SELECT * FROM organization WHERE org_id=;"+orgid; // ResultSet organization=dbCtrl.query(conn, sql); // organizationPO.getName(); commonutil.AssertEqualsCustomize(orgid, organizationPO.getId().longValue()); commonutil.AssertEqualsCustomize(name, organizationPO.getName()); commonutil.AssertEqualsCustomize(createdAt, organizationPO.getCreatedAt()); commonutil.AssertEqualsCustomize(updatedAt, organizationPO.getUpdatedAt()); commonutil.AssertEqualsCustomize(body.get("createdBy").getAsLong(), organizationPO.getCreatedBy().longValue()); commonutil.AssertEqualsCustomize(updatedBy, organizationPO.getUpdatedBy().longValue()); commonutil.AssertEqualsCustomize(ownerId, organizationPO.getOwnerId().longValue()); commonutil.AssertEqualsCustomize(registedAt, organizationPO.getRegistedAt()); commonutil.AssertEqualsCustomize(source, organizationPO.getSource().longValue()); //commonutil.AssertEqualsCustomize(description, organizationPO.get); commonutil.AssertEqualsCustomize(englishName, organizationPO.getEnglishName()); commonutil.AssertEqualsCustomize(Integer.valueOf(type), organizationPO.getType()); commonutil.AssertEqualsCustomize(phoneNo, organizationPO.getPhoneNo()); commonutil.AssertEqualsCustomize(simpleName, organizationPO.getSimpleName()); //commonutil.AssertEqualsCustomize(aliases, organizationPO.getal); commonutil.AssertEqualsCustomize(logoUrl, organizationPO.getLogoUrl()); commonutil.AssertEqualsCustomize(siteUrl, organizationPO.getSiteUrl()); //commonutil.AssertEqualsCustomize(finacingDetail, organizationPO.getf); commonutil.AssertEqualsCustomize(finacingAmount, organizationPO.getFinancingAmount()); commonutil.AssertEqualsCustomize(legalPerson, organizationPO.getLegalPerson()); commonutil.AssertEqualsCustomize(registedCapital, organizationPO.getRegistedCapital()); commonutil.AssertEqualsCustomize(registedAt, organizationPO.getRegistedAt()); commonutil.AssertEqualsCustomize(turnover, organizationPO.getTurnover()); commonutil.AssertEqualsCustomize(registedNo, organizationPO.getRegistedNo()); commonutil.AssertEqualsCustomize(registedAuthority, organizationPO.getRegistedAuthority()); commonutil.AssertEqualsCustomize(natureCode, organizationPO.getNatureCode().longValue()); commonutil.AssertEqualsCustomize(empScale, organizationPO.getEmpScale().longValue()); commonutil.AssertEqualsCustomize(empMeanSalary, organizationPO.getEmpMeanSalary().longValue()); commonutil.AssertEqualsCustomize(wxPublicNo, organizationPO.getWxPublicNo()); //commonutil.AssertEqualsCustomize(facebookUrl,organizationPO.getfa); commonutil.AssertEqualsCustomize(linkedinUrl, organizationPO.getLinkedinUrl()); commonutil.AssertEqualsCustomize(weiboUrl, organizationPO.getWeiboUrl()); //commonutil.AssertEqualsCustomize(twitterUrl,organizationPO.gett); commonutil.AssertEqualsCustomize(qccUnique, organizationPO.getQccUnique()); commonutil.AssertEqualsCustomize(orgCode, organizationPO.getOrgCode()); commonutil.AssertEqualsCustomize(licenseNo, organizationPO.getLicenseNo()); //commonutil.AssertEqualsCustomize(imgUrls,organizationPO.get); //commonutil.AssertEqualsCustomize(finacingDetail,organizationPO.getf); commonutil.AssertEqualsCustomize(finacingStatus, organizationPO.getFinancingStatus().intValue()); OrgShareholderPO orgShareholderPO = new OrgShareholderPO(); commonutil.AssertEqualsCustomize(shareholders_id, orgShareholderPO.getId().longValue()); commonutil.AssertEqualsCustomize(shareholders_org_id, orgShareholderPO.getOrgId().longValue()); commonutil.AssertEqualsCustomize(shareholders_hold_id, orgShareholderPO.getHolderId().longValue()); commonutil.AssertEqualsCustomize(shareholders_hold_rate, orgShareholderPO.getHoldRate()); commonutil.AssertEqualsCustomize(shareholders_invest_amount, orgShareholderPO.getInvestAmount()); commonutil.AssertEqualsCustomize(shareholders_invest_detail, orgShareholderPO.getInvestDetail()); commonutil.AssertEqualsCustomize(shareholders_created_at, orgShareholderPO.getCreatedAt()); commonutil.AssertEqualsCustomize(shareholders_created_by, orgShareholderPO.getCreatedBy().longValue()); commonutil.AssertEqualsCustomize(shareholders_updated_by, orgShareholderPO.getUpdatedBy().longValue()); commonutil.AssertEqualsCustomize(shareholders_updated_at, orgShareholderPO.getUpdatedAt()); // // String shareholdings_sql ="SELECT * FROM org_shareholder WHERE org_id=;"+orgid; // ResultSet shareholdingsResultSet = dbCtrl.query(conn, shareholdings_sql); // Orgshareholdings // commonutil.AssertEqualsCustomize(shareholdings_created_at,shareholdings.get("created_at").getAsLong()); // commonutil.AssertEqualsCustomize(shareholdings_created_by,shareholdings.get("created_by").getAsLong()); // commonutil.AssertEqualsCustomize(shareholdings_id, shareholdingsResultSet.getLong("id")); // commonutil.AssertEqualsCustomize(shareholdings_org_id, shareholdingsResultSet.getLong("org_id")); // commonutil.AssertEqualsCustomize(shareholdings_hold_id, shareholdingsResultSet.getLong("hold_id")); // commonutil.AssertEqualsCustomize(shareholdings_hold_rate, shareholdingsResultSet.getDouble("hold_rate")); // commonutil.AssertEqualsCustomize(shareholdings_invest_amount, shareholdingsResultSet.getInt("invest_amount")); // commonutil.AssertEqualsCustomize(shareholdings_invest_detail, shareholdingsResultSet.getString("invest_detail")); // commonutil.AssertEqualsCustomize(shareholdings_updated_by,shareholdingsResultSet.getLong("updated_by")); // commonutil.AssertEqualsCustomize(shareholdings_updated_at, shareholdingsResultSet.getLong("updated_at")); OrgStockPO orgStockPO = new OrgStockPO(); commonutil.AssertEqualsCustomize(orgStocks_id, orgStockPO.getId().longValue()); commonutil.AssertEqualsCustomize(orgStocks_org_id, orgStockPO.getOrgId().longValue()); commonutil.AssertEqualsCustomize(orgStocks_stock_code, orgStockPO.getStockCode()); commonutil.AssertEqualsCustomize(orgStocks_stock_exchange, orgStockPO.getStockExchange().intValue()); commonutil.AssertEqualsCustomize(orgStocks_created_at, orgStockPO.getCreatedAt()); commonutil.AssertEqualsCustomize(orgStocks_created_by, orgStockPO.getCreatedBy().longValue()); commonutil.AssertEqualsCustomize(orgStocks_updated_at, orgStockPO.getUpdatedAt()); commonutil.AssertEqualsCustomize(orgStocks_updated_by, orgStockPO.getUpdatedBy().longValue()); OrgBrandPO orgBrandPO = new OrgBrandPO(); commonutil.AssertEqualsCustomize(orgBrands_type, orgBrandPO.getType().intValue()); commonutil.AssertEqualsCustomize(orgBrands_id, orgBrandPO.getId().longValue()); commonutil.AssertEqualsCustomize(orgBrands_description, orgBrandPO.getDescription()); commonutil.AssertEqualsCustomize(orgBrands_created_by, orgBrandPO.getCreatedBy().longValue()); commonutil.AssertEqualsCustomize(orgBrands_created_at, orgBrandPO.getCreatedAt()); commonutil.AssertEqualsCustomize(orgBrands_updated_at, orgBrandPO.getUpdatedAt()); commonutil.AssertEqualsCustomize(orgBrands_updated_by, orgBrandPO.getUpdatedBy().longValue()); commonutil.AssertEqualsCustomize(orgBrands_imgUrl, orgBrandPO.getImgUrl()); commonutil.AssertEqualsCustomize(orgBrands_siteUrl, orgBrandPO.getSiteUrl()); commonutil.AssertEqualsCustomize(orgBrands_title, orgBrandPO.getTitle()); commonutil.AssertEqualsCustomize(orgBrands_org_id, orgBrandPO.getOrgId().longValue()); OrgContactWayPO orgContactWayPO = new OrgContactWayPO(); commonutil.AssertEqualsCustomize(orgContactWays_id, orgContactWayPO.getId().longValue()); commonutil.AssertEqualsCustomize(orgContactWays_created_at, orgContactWayPO.getCreatedAt()); commonutil.AssertEqualsCustomize(orgContactWays_created_by, orgContactWayPO.getCreatedBy().longValue()); commonutil.AssertEqualsCustomize(orgContactWays_address_id, orgContactWayPO.getAddressId().longValue()); commonutil.AssertEqualsCustomize(orgContactWays_fax_number, orgContactWayPO.getFaxNumber()); commonutil.AssertEqualsCustomize(orgContactWays_org_id, orgContactWayPO.getOrgId().longValue()); commonutil.AssertEqualsCustomize(orgContactWays_phone_number, orgContactWayPO.getPhoneNumber()); commonutil.AssertEqualsCustomize(orgContactWays_updated_at, orgContactWayPO.getUpdatedAt()); commonutil.AssertEqualsCustomize(orgContactWays_updated_by, orgContactWayPO.getUpdatedBy().longValue()); } catch (Exception e) { // TODO: handle exception } finally { LOGGER.info("*****************Test case: Get Orgs by id List Ended*****************"); } }
From source file:com.inmind.restful.testcases.Org.java
@Test public void PostOrg() { LOGGER.info("*****************Test case: Post Organization add Started*****************"); try {/*from w w w . j av a 2s . c o m*/ ResultSet resultSet = dbCtrl.query(conn, "SELECT id FROM organization WHERE name=\"Test company\";"); while (resultSet.next()) { long id = resultSet.getLong("id"); String sqlstatement = "DELETE FROM organization WHERE id=" + id; dbCtrl.executeSql(conn, sqlstatement); String brand = "DELETE FROM org_brand WHERE org_id=" + id; dbCtrl.executeSql(conn, brand); String ContactWay = "DELETE FROM org_contact_way WHERE org_id=" + id; dbCtrl.executeSql(conn, ContactWay); String dept = "DELETE FROM org_dept WHERE org_id=" + id; dbCtrl.executeSql(conn, dept); String history = "DELETE FROM org_history WHERE org_id=" + id; dbCtrl.executeSql(conn, history); String shareholder = "DELETE FROM org_shareholder WHERE org_id=" + id; dbCtrl.executeSql(conn, shareholder); String stock = "DELETE FROM org_stock WHERE org_id=" + id; dbCtrl.executeSql(conn, stock); } String uri = APITest.getValue("baseuri"); String cookievalue = cookies.get(0); String payload = String.format(APITest.loadFile("Post_Org_Add.json")); System.out.println(cookievalue); LOGGER.info("Post request body is:" + payload); APIResponse postresponse = APIRequest.POST(uri).path("/orgs").header("cookie", cookievalue) .type(MediaType.APPLICATION_JSON_TYPE).body(payload).invoke(); postresponse.assertBodyContains("200"); ResultSet getorgid = dbCtrl.query(conn, "SELECT id FROM organization WHERE name=\"Test company\";"); getorgid.next(); APIResponse response = APIRequest.GET(uri).path("/orgs/" + getorgid.getString("id")) .header("cookie", cookievalue).type(MediaType.APPLICATION_JSON_TYPE).invoke(); response.assertBodyContains("200"); String responsbody = response.getBody(); LOGGER.info("The response body is: /n "); LOGGER.info(responsbody); JsonObject jsonObject = new JsonParser().parse(responsbody).getAsJsonObject(); JsonObject body = jsonObject.getAsJsonObject("_body").getAsJsonObject("basic"); int type = body.get("type").getAsInt(); long updatedBy = body.get("updatedBy").getAsLong(); String description = body.get("description").getAsString(); long ownerId = body.get("ownerId").getAsLong(); long createdAt = body.get("createdAt").getAsLong(); long createdBy = body.get("createdBy").getAsLong(); String simpleName = body.get("simpleName").getAsString(); String englishName = body.get("englishName").getAsString(); int source = body.get("source").getAsInt(); String aliases = body.get("aliases").getAsString(); String phoneNo = body.get("phoneNo").getAsString(); String logoUrl = body.get("logoUrl").getAsString(); String siteUrl = body.get("siteUrl").getAsString(); int finacingStatus = body.get("finacingStatus").getAsInt(); double finacingAmount = body.get("finacingAmount").getAsDouble(); String legalPerson = body.get("legalPerson").getAsString(); double registedCapital = body.get("registedCapital").getAsDouble(); long registedAt = body.get("registedAt").getAsLong(); double turnover = body.get("turnover").getAsDouble(); String registedNo = body.get("registedNo").getAsString(); String registedAuthority = body.get("registedAuthority").getAsString(); int natureCode = body.get("natureCode").getAsInt(); int empScale = body.get("empScale").getAsInt(); int empMeanSalary = body.get("empMeanSalary").getAsInt(); String wxPublicNo = body.get("wxPublicNo").getAsString(); String facebookUrl = body.get("facebookUrl").getAsString(); String linkedinUrl = body.get("linkedinUrl").getAsString(); String weiboUrl = body.get("weiboUrl").getAsString(); String twitterUrl = body.get("twitterUrl").getAsString(); String qccUnique = body.get("qccUnique").getAsString(); String orgCode = body.get("orgCode").getAsString(); String licenseNo = body.get("licenseNo").getAsString(); String imgUrls = body.get("imgUrls").getAsString(); String finacingDetail = body.get("finacingDetail").getAsString(); long id = body.get("id").getAsLong(); JsonObject shareholdings = body.getAsJsonObject("shareholdings"); long shareholdings_id = shareholdings.get("id").getAsLong(); long shareholdings_org_id = shareholdings.get("orgId").getAsLong(); long shareholdings_hold_id = shareholdings.get("holdId").getAsLong(); double shareholdings_hold_rate = shareholdings.get("holdRate").getAsDouble(); double shareholdings_invest_amount = shareholdings.get("investMount").getAsDouble(); String shareholdings_invest_detail = shareholdings.get("investDetail").getAsString(); long shareholdings_created_by = shareholdings.get("createdBy").getAsLong(); long shareholdings_updated_by = shareholdings.get("updatedBy").getAsLong(); long shareholdings_created_at = shareholdings.get("createdAt").getAsLong(); ; long shareholdings_updated_at = shareholdings.get("updatedAt").getAsLong(); JsonObject createdByAccount = body.getAsJsonObject("createdByAccount"); //String createdByAccount_password=createdByAccount.get("password").getAsString(); String createdByAccount_nickname = createdByAccount.get("nickname").getAsString(); String createdByAccount_mobile = createdByAccount.get("mobile").getAsString(); long createdByAccount_id = createdByAccount.get("id").getAsLong(); String createdByAccount_email = createdByAccount.get("email").getAsString(); String createdByAccount_username = createdByAccount.get("username").getAsString(); String createdByAccountsql = "SELECT * FROM account WHERE id" + createdBy + ";"; ResultSet createdByAccountResultSet = dbCtrl.query(conn, createdByAccountsql); commonutil.AssertEqualsCustomize(createdByAccount_nickname, createdByAccountResultSet.getString("nickname")); commonutil.AssertEqualsCustomize(createdByAccount_email, createdByAccountResultSet.getString("email")); commonutil.AssertEqualsCustomize(createdByAccount_mobile, createdByAccountResultSet.getString("mobile")); commonutil.AssertEqualsCustomize(createdByAccount_username, createdByAccountResultSet.getString("username")); commonutil.AssertEqualsCustomize(createdByAccount_id, createdByAccountResultSet.getLong("id")); JsonObject updatedByAccount = body.getAsJsonObject("updatedByAccount"); //String updatedByAccount_password=updatedByAccount.get("password").getAsString(); String updatedByAccount_nickname = updatedByAccount.get("nickname").getAsString(); String updatedByAccount_mobile = updatedByAccount.get("mobile").getAsString(); long updatedByAccount_id = updatedByAccount.get("id").getAsLong(); String updatedByAccount_email = updatedByAccount.get("email").getAsString(); String updatedByAccount_username = updatedByAccount.get("username").getAsString(); String updatedByAccountsql = "SELECT * FROM account WHERE id" + createdBy + ";"; ResultSet UpdatedByAccountResultSet = dbCtrl.query(conn, updatedByAccountsql); commonutil.AssertEqualsCustomize(updatedByAccount_nickname, UpdatedByAccountResultSet.getString("nickname")); commonutil.AssertEqualsCustomize(updatedByAccount_email, UpdatedByAccountResultSet.getString("email")); commonutil.AssertEqualsCustomize(updatedByAccount_mobile, UpdatedByAccountResultSet.getString("mobile")); commonutil.AssertEqualsCustomize(updatedByAccount_username, UpdatedByAccountResultSet.getString("username")); commonutil.AssertEqualsCustomize(updatedByAccount_id, UpdatedByAccountResultSet.getLong("id")); JsonObject shareholders = body.getAsJsonObject("shareholders"); long shareholders_id = shareholders.get("id").getAsLong(); long shareholders_org_id = shareholders.get("orgId").getAsLong(); long shareholders_hold_id = shareholders.get("holdId").getAsLong(); double shareholders_hold_rate = shareholders.get("holdRate").getAsDouble(); double shareholders_invest_amount = shareholders.get("investAmount").getAsDouble(); String shareholders_invest_detail = shareholders.get("investDetail").getAsString(); long shareholders_created_by = shareholders.get("createdBy").getAsLong(); long shareholders_updated_by = shareholders.get("updatedBy").getAsLong(); long shareholders_created_at = shareholders.get("createdAt").getAsLong(); long shareholders_updated_at = shareholders.get("updatedAt").getAsLong(); JsonObject orgStocks = body.getAsJsonObject("orgStocks"); long orgStocks_id = orgStocks.get("id").getAsLong(); long orgStocks_org_id = orgStocks.get("orgId").getAsLong(); int orgStocks_stock_exchange = orgStocks.get("stockExchange").getAsInt(); String orgStocks_stock_code = orgStocks.get("stockCode").getAsString(); long orgStocks_created_by = orgStocks.get("createdBy").getAsLong(); long orgStocks_updated_by = orgStocks.get("updatedBy").getAsLong(); long orgStocks_created_at = orgStocks.get("createdAt").getAsLong(); long orgStocks_updated_at = orgStocks.get("updatedAt").getAsLong(); JsonArray industrialModeDicts = body.get("industrialModeDicts").getAsJsonArray(); for (int i = 0; i < industrialModeDicts.size(); i++) { JsonObject subObject = industrialModeDicts.get(i).getAsJsonObject(); String industrialModeDicts_sql = "SELECT * FROM organization WHERE target_id=" + id + ";"; ResultSet industrialModeDictsResultSet = dbCtrl.query(conn, industrialModeDicts_sql); commonutil.AssertEqualsCustomize(subObject.get("type").getAsString(), industrialModeDictsResultSet.getString("dict_type")); commonutil.AssertEqualsCustomize(subObject.get("title").getAsString(), industrialModeDictsResultSet.getString("dict_type")); String dicttype = industrialModeDictsResultSet.getString("dict_type"); String dict_code = subObject.get("code").getAsString(); ResultSet dictResultSet = dbCtrl.query(conn, "SELECT * FROM dict WHERE type=" + dicttype + " AND code=" + dict_code + ";"); Long dict_title = dictResultSet.getLong("title"); commonutil.AssertEqualsCustomize(subObject.get("title").getAsString(), dict_title); commonutil.AssertEqualsCustomize(subObject.get("generated").getAsLong(), industrialModeDictsResultSet.getLong("generated")); } JsonArray industryDicts = body.get("industryDicts").getAsJsonArray(); for (int i = 0; i < industryDicts.size(); i++) { JsonObject subObject = industryDicts.get(i).getAsJsonObject(); String industryDicts_sql = "SELECT * FROM organization WHERE target_id=" + id + ";"; ResultSet industryDictsResultSet = dbCtrl.query(conn, industryDicts_sql); commonutil.AssertEqualsCustomize(subObject.get("type").getAsString(), industryDictsResultSet.getString("dict_type")); commonutil.AssertEqualsCustomize(subObject.get("title").getAsString(), industryDictsResultSet.getString("dict_type")); String dicttype = industryDictsResultSet.getString("dict_type"); String dict_code = subObject.get("code").getAsString(); ResultSet dictResultSet = dbCtrl.query(conn, "SELECT * FROM dict WHERE type=" + dicttype + " AND code=" + dict_code + ";"); Long dict_title = dictResultSet.getLong("title"); commonutil.AssertEqualsCustomize(subObject.get("title").getAsString(), dict_title); commonutil.AssertEqualsCustomize(subObject.get("generated").getAsLong(), industryDictsResultSet.getLong("generated")); } JsonArray highlightDicts = body.get("highlightDicts").getAsJsonArray(); for (int i = 0; i < highlightDicts.size(); i++) { JsonObject subObject = highlightDicts.get(i).getAsJsonObject(); String industryDicts_sql = "SELECT * FROM organization WHERE target_id=" + id + ";"; ResultSet highlightDictsResultSet = dbCtrl.query(conn, industryDicts_sql); commonutil.AssertEqualsCustomize(subObject.get("type").getAsString(), highlightDictsResultSet.getString("dict_type")); commonutil.AssertEqualsCustomize(subObject.get("title").getAsString(), highlightDictsResultSet.getString("dict_type")); String dicttype = highlightDictsResultSet.getString("dict_type"); String dict_code = subObject.get("code").getAsString(); ResultSet dictResultSet = dbCtrl.query(conn, "SELECT * FROM dict WHERE type=" + dicttype + " AND code=" + dict_code + ";"); Long dict_title = dictResultSet.getLong("title"); commonutil.AssertEqualsCustomize(subObject.get("title").getAsString(), dict_title); commonutil.AssertEqualsCustomize(subObject.get("generated").getAsLong(), highlightDictsResultSet.getLong("generated")); } JsonObject orgContactWays = body.getAsJsonObject("orgContactWays"); long orgContactWays_id = orgContactWays.get("id").getAsLong(); long orgContactWays_org_id = orgContactWays.get("orgId").getAsLong(); String orgContactWays_phone_number = orgContactWays.get("phoneNumber").getAsString(); long orgContactWays_created_by = orgContactWays.get("createdBy").getAsLong(); long orgContactWays_updated_by = orgContactWays.get("updatedBy").getAsLong(); long orgContactWays_created_at = orgContactWays.get("createdAt").getAsLong(); long orgContactWays_updated_at = orgContactWays.get("updatedAt").getAsLong(); String orgContactWays_fax_number = orgContactWays.get("faxNumber").getAsString(); long orgContactWays_address_id = orgContactWays.get("addressId").getAsLong(); String name = body.get("name").getAsString(); JsonObject orgBrands = body.getAsJsonObject("orgBrands"); int orgBrands_type = orgBrands.get("type").getAsInt(); String orgBrands_description = orgBrands.get("description").getAsString(); String orgBrands_title = orgBrands.get("title").getAsString(); long orgBrands_created_by = orgBrands.get("createdBy").getAsLong(); long orgBrands_updated_by = orgBrands.get("updatedBy").getAsLong(); long orgBrands_id = orgBrands.get("id").getAsLong(); long orgBrands_created_at = orgBrands.get("createdAt").getAsLong(); long orgBrands_updated_at = orgBrands.get("updatedAt").getAsLong(); String orgBrands_siteUrl = orgBrands.get("siteUrl").getAsString(); String orgBrands_imgUrl = orgBrands.get("imgUrl").getAsString(); long orgBrands_org_id = orgBrands.get("orgId").getAsLong(); String orgHistories_sql = "SELECT * FROM automind_test.organization WHERE org_id=" + id + ";"; ResultSet orghHistoriesResultSet = dbCtrl.query(conn, orgHistories_sql); JsonObject orgHistories = body.getAsJsonObject("orgHistories"); commonutil.AssertEqualsCustomize(orgHistories.get("description").getAsString(), orghHistoriesResultSet.getString("description")); commonutil.AssertEqualsCustomize(orgHistories.get("title").getAsString(), orghHistoriesResultSet.getString("title")); commonutil.AssertEqualsCustomize(orgHistories.get("createdBy").getAsLong(), orghHistoriesResultSet.getLong("created_by")); commonutil.AssertEqualsCustomize(orgHistories.get("createdAt").getAsLong(), orghHistoriesResultSet.getLong("created_at")); commonutil.AssertEqualsCustomize(orgHistories.get("UpdatedAt").getAsLong(), orghHistoriesResultSet.getLong("updated_at")); commonutil.AssertEqualsCustomize(orgHistories.get("UpdatedBy").getAsLong(), orghHistoriesResultSet.getLong("updated_by")); commonutil.AssertEqualsCustomize(orgHistories.get("timeAt").getAsLong(), orghHistoriesResultSet.getLong("time_at")); commonutil.AssertEqualsCustomize(orgHistories.get("linkUrl").getAsLong(), orghHistoriesResultSet.getLong("link_url")); long updatedAt = body.get("updatedAt").getAsLong(); String sql = "SELECT * FROM automind_test.organization WHERE org_id=;" + id; ResultSet organization = dbCtrl.query(conn, sql); commonutil.AssertEqualsCustomize(id, organization.getLong("id")); commonutil.AssertEqualsCustomize(name, organization.getString("name")); commonutil.AssertEqualsCustomize(createdAt, organization.getLong("created_at")); commonutil.AssertEqualsCustomize(updatedAt, organization.getLong("updated_at")); commonutil.AssertEqualsCustomize(createdBy, organization.getLong("created_by")); commonutil.AssertEqualsCustomize(updatedBy, organization.getLong("updated_by")); commonutil.AssertEqualsCustomize(ownerId, organization.getLong("owner_id")); commonutil.AssertEqualsCustomize(registedAt, organization.getLong("registed_at")); commonutil.AssertEqualsCustomize(source, organization.getInt("source")); commonutil.AssertEqualsCustomize(description, organization.getString("description")); commonutil.AssertEqualsCustomize(englishName, organization.getString("english_name")); commonutil.AssertEqualsCustomize(type, organization.getInt("type")); commonutil.AssertEqualsCustomize(phoneNo, organization.getString("phone_no")); commonutil.AssertEqualsCustomize(simpleName, organization.getString("simple_name")); commonutil.AssertEqualsCustomize(aliases, organization.getString("aliases")); commonutil.AssertEqualsCustomize(logoUrl, organization.getString("logo_url")); commonutil.AssertEqualsCustomize(siteUrl, organization.getString("site_url")); commonutil.AssertEqualsCustomize(finacingDetail, organization.getString("finacing_detail")); commonutil.AssertEqualsCustomize(finacingAmount, organization.getDouble("finacing_amount")); commonutil.AssertEqualsCustomize(legalPerson, organization.getString("legal_person")); commonutil.AssertEqualsCustomize(registedCapital, organization.getString("registed_capital")); commonutil.AssertEqualsCustomize(registedAt, organization.getString("registed_at")); commonutil.AssertEqualsCustomize(turnover, organization.getDouble("turnover")); commonutil.AssertEqualsCustomize(registedNo, organization.getString("registedNo")); commonutil.AssertEqualsCustomize(registedAuthority, organization.getString("registed_authority")); commonutil.AssertEqualsCustomize(natureCode, organization.getInt("natureCode")); commonutil.AssertEqualsCustomize(empScale, organization.getInt("empScale")); commonutil.AssertEqualsCustomize(empMeanSalary, organization.getInt("empMean_salary")); commonutil.AssertEqualsCustomize(wxPublicNo, organization.getString("wxPublic_no")); commonutil.AssertEqualsCustomize(facebookUrl, organization.getString("facebook_url")); commonutil.AssertEqualsCustomize(linkedinUrl, organization.getString("linkedin_url")); commonutil.AssertEqualsCustomize(weiboUrl, organization.getString("weibo_url")); commonutil.AssertEqualsCustomize(twitterUrl, organization.getString("twitter_url")); commonutil.AssertEqualsCustomize(qccUnique, organization.getString("qcc_unique")); commonutil.AssertEqualsCustomize(orgCode, organization.getString("org_code")); commonutil.AssertEqualsCustomize(licenseNo, organization.getString("license_no")); commonutil.AssertEqualsCustomize(imgUrls, organization.getString("img_urls")); commonutil.AssertEqualsCustomize(finacingDetail, organization.getString("finacing_detail")); commonutil.AssertEqualsCustomize(finacingStatus, organization.getString("finacing_status")); String shareholders_sql = "SELECT * FROM automind_test.org_shareholder WHERE org_id=;" + id; ResultSet shareholdersResultSet = dbCtrl.query(conn, shareholders_sql); commonutil.AssertEqualsCustomize(shareholders_id, shareholdersResultSet.getLong("id")); commonutil.AssertEqualsCustomize(shareholders_org_id, shareholdersResultSet.getLong("org_id")); commonutil.AssertEqualsCustomize(shareholders_hold_id, shareholdersResultSet.getLong("hold_id")); commonutil.AssertEqualsCustomize(shareholders_hold_rate, shareholdersResultSet.getDouble("hold_rate")); commonutil.AssertEqualsCustomize(shareholders_invest_amount, shareholdersResultSet.getInt("invest_amount")); commonutil.AssertEqualsCustomize(shareholders_invest_detail, shareholdersResultSet.getString("invest_detail")); commonutil.AssertEqualsCustomize(shareholders_created_at, shareholdersResultSet.getLong("created_at")); commonutil.AssertEqualsCustomize(shareholders_created_by, shareholdersResultSet.getLong("created_by")); commonutil.AssertEqualsCustomize(shareholders_updated_by, shareholdersResultSet.getLong("updated_by")); commonutil.AssertEqualsCustomize(shareholders_updated_at, shareholdersResultSet.getLong("updated_at")); String shareholdings_sql = "SELECT * FROM automind_test.org_shareholder WHERE org_id=;" + id; ResultSet shareholdingsResultSet = dbCtrl.query(conn, shareholdings_sql); commonutil.AssertEqualsCustomize(shareholdings_created_at, shareholdings.get("created_at").getAsLong()); commonutil.AssertEqualsCustomize(shareholdings_created_by, shareholdings.get("created_by").getAsLong()); commonutil.AssertEqualsCustomize(shareholdings_id, shareholdingsResultSet.getLong("id")); commonutil.AssertEqualsCustomize(shareholdings_org_id, shareholdingsResultSet.getLong("org_id")); commonutil.AssertEqualsCustomize(shareholdings_hold_id, shareholdingsResultSet.getLong("hold_id")); commonutil.AssertEqualsCustomize(shareholdings_hold_rate, shareholdingsResultSet.getDouble("hold_rate")); commonutil.AssertEqualsCustomize(shareholdings_invest_amount, shareholdingsResultSet.getInt("invest_amount")); commonutil.AssertEqualsCustomize(shareholdings_invest_detail, shareholdingsResultSet.getString("invest_detail")); commonutil.AssertEqualsCustomize(shareholdings_updated_by, shareholdingsResultSet.getLong("updated_by")); commonutil.AssertEqualsCustomize(shareholdings_updated_at, shareholdingsResultSet.getLong("updated_at")); String stock_sql = "SELECT * FROM automind_test.org_stock WHERE org_id=;" + id; ResultSet stockResultSet = dbCtrl.query(conn, stock_sql); commonutil.AssertEqualsCustomize(orgStocks_id, stockResultSet.getLong("id")); commonutil.AssertEqualsCustomize(orgStocks_org_id, stockResultSet.getLong("org_id")); commonutil.AssertEqualsCustomize(orgStocks_stock_code, stockResultSet.getString("stock_code")); commonutil.AssertEqualsCustomize(orgStocks_stock_exchange, stockResultSet.getInt("stock_exchange")); commonutil.AssertEqualsCustomize(orgStocks_created_at, stockResultSet.getLong("created_at")); commonutil.AssertEqualsCustomize(orgStocks_created_by, stockResultSet.getLong("created_by")); commonutil.AssertEqualsCustomize(orgStocks_updated_at, stockResultSet.getLong("updated_at")); commonutil.AssertEqualsCustomize(orgStocks_updated_by, stockResultSet.getLong("updated_by")); String brand_sql = "SELECT * FROM automind_test.org_brand WHERE org_id=;" + id; ResultSet brandResultSet = dbCtrl.query(conn, brand_sql); commonutil.AssertEqualsCustomize(orgBrands_type, brandResultSet.getInt("type")); commonutil.AssertEqualsCustomize(orgBrands_id, brandResultSet.getLong("id")); commonutil.AssertEqualsCustomize(orgBrands_description, brandResultSet.getString("description")); commonutil.AssertEqualsCustomize(orgBrands_created_by, brandResultSet.getLong("created_by")); commonutil.AssertEqualsCustomize(orgBrands_created_at, brandResultSet.getLong("created_at")); commonutil.AssertEqualsCustomize(orgBrands_updated_at, brandResultSet.getLong("updated_at")); commonutil.AssertEqualsCustomize(orgBrands_updated_by, brandResultSet.getLong("updated_by")); commonutil.AssertEqualsCustomize(orgBrands_imgUrl, brandResultSet.getString("img_Url")); commonutil.AssertEqualsCustomize(orgBrands_siteUrl, brandResultSet.getString("site_Url")); commonutil.AssertEqualsCustomize(orgBrands_title, brandResultSet.getString("title")); commonutil.AssertEqualsCustomize(orgBrands_org_id, brandResultSet.getLong("org_id")); String contacWays_sql = "SELECT * FROM automind_test.org_brand WHERE org_id=;" + id; ResultSet contactWaysResultSet = dbCtrl.query(conn, contacWays_sql); commonutil.AssertEqualsCustomize(orgContactWays_id, contactWaysResultSet.getInt("id")); commonutil.AssertEqualsCustomize(orgContactWays_created_at, contactWaysResultSet.getLong("created_at")); commonutil.AssertEqualsCustomize(orgContactWays_created_by, contactWaysResultSet.getLong("created_by")); commonutil.AssertEqualsCustomize(orgContactWays_address_id, contactWaysResultSet.getLong("address_id")); commonutil.AssertEqualsCustomize(orgContactWays_fax_number, contactWaysResultSet.getString("fax_number")); commonutil.AssertEqualsCustomize(orgContactWays_org_id, contactWaysResultSet.getLong("org_id")); commonutil.AssertEqualsCustomize(orgContactWays_phone_number, contactWaysResultSet.getString("phone_number")); commonutil.AssertEqualsCustomize(orgContactWays_updated_at, contactWaysResultSet.getLong("updated_at")); commonutil.AssertEqualsCustomize(orgContactWays_updated_by, contactWaysResultSet.getLong("updated_by")); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { LOGGER.info("*****************Test case: Post Organization add Started*****************"); } }