if (claimRequest != null) { Serializable claimExtension = request.getExtensions().get(CLAIMS); if (claimExtension == null || !claimRequest.equals(parseClaimRequest(claimExtension.toString()))) { logger.info("Mismatch between request object and regular parameter for claims, using request object");
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj instanceof JSONObjectBuilder) { final JSONObjectBuilder that = (JSONObjectBuilder) obj; return this == that || this.inner.equals(that.inner); } if (obj instanceof JsonObject) { final JsonObject that = (JsonObject) obj; return this.inner.equals(that); } return false; }
private static List<JsonObject> unify(List<JsonObject> toBeUnified) { List<JsonObject> unified = new ArrayList<>(); JsonObject prevWS = null; for (JsonObject wsItem : toBeUnified) { if (prevWS == null) { prevWS = wsItem; unified.add(prevWS); } else if (prevWS.get("i").getAsInt() != wsItem.get("i").getAsInt() && !prevWS.equals(wsItem)) { unified.add(wsItem); prevWS = wsItem; } } return unified; }
public static int updateUserShipData(JsonArray data) { Set<Integer> prevItemIds; if (userShipData == null) { userShipData = new HashMap<Integer, JsonObject>(); prevItemIds = new HashSet<Integer>(); } else { prevItemIds = new HashSet<Integer>(userShipData.keySet()); } JsonElement temp; for (Iterator<JsonElement> itr = data.iterator(); itr.hasNext(); ) { temp = itr.next(); Integer api_id = temp.getAsJsonObject().get("api_id").getAsInt(); if (!prevItemIds.contains(api_id)) { userShipData.put(api_id, temp.getAsJsonObject()); } else if (!userShipData.get(api_id).equals(temp)) { userShipData.put(api_id, temp.getAsJsonObject()); } prevItemIds.remove(api_id); } for (Integer i : prevItemIds) { userShipData.remove(i); } return userShipData.size(); }
if (other.fulltext != null) return false; } else if (!fulltext.equals(other.fulltext)) return false; if (views == null) {
return false; if (queryParams != null ? !queryParams.equals(that.queryParams) : that.queryParams != null) { return false;
private Object readFieldValue(JsonObject fields, CustomField customField) { String fieldId = customField.getId(); String fieldValue = ""; if(fieldIsDefined(fields, fieldId)) { if(fields.get(fieldId).isJsonPrimitive()) { fieldValue = fields.getAsJsonPrimitive(fieldId).getAsString(); } else if(fields.get(fieldId).isJsonObject()) { fieldValue = fields.getAsJsonObject(fieldId).toString(); } } if (isJSON(fieldValue)) { JsonObject field = new JsonParser().parse(fieldValue).getAsJsonObject(); if (customField.getType().equals("string") || customField.getType().equals("option")) { return field.equals(JsonNull.INSTANCE) ? "" : field.getAsJsonPrimitive("value").getAsString(); } else if (customField.getType().equals("array") || customField.getType().equals("option-with-child")) { return readListFrom(field); } } return fieldValue; }
&& (PacmanRuleConstants.ALLOW.equalsIgnoreCase(effect))) { if (conditionJsonObject.equals(publicIp) || conditionJsonArray.contains(publicIp)) { map.put(PacmanRuleConstants.WRITE, true); && accessType.equalsIgnoreCase(PacmanRuleConstants.READ_ACCESS) && (PacmanRuleConstants.ALLOW.equalsIgnoreCase(effect))) { if (conditionJsonObject.equals(publicIp) || conditionJsonArray.contains(publicIp)) { map.put("Read", true);
@Override public void run() { final String METHOD = "run"; running = true; LoggerUtility.log(Level.FINE, CLASS_NAME, METHOD, "Running..."); while (running) { try { JsonObject o = publishQueue.take(); if (o.equals(dummy)) { LoggerUtility.log(Level.FINE, CLASS_NAME, METHOD, "It is time to quit."); } else { publish(o); } } catch (Exception e) { LoggerUtility.log(Level.SEVERE, CLASS_NAME, METHOD, e.toString()); e.printStackTrace(); running = false; } } LoggerUtility.log(Level.FINE, CLASS_NAME, METHOD, "Exiting..."); }
@Override public void run() { final String METHOD = "run"; running = true; LoggerUtility.log(Level.FINE, CLASS_NAME, METHOD, "Running..."); while (running) { try { JsonObject o = publishQueue.take(); if (o.equals(dummy)) { LoggerUtility.log(Level.FINE, CLASS_NAME, METHOD, "It is time to quit."); } else { publish(o); } } catch (Exception e) { LoggerUtility.log(Level.SEVERE, CLASS_NAME, METHOD, e.toString()); e.printStackTrace(); running = false; } } LoggerUtility.log(Level.FINE, CLASS_NAME, METHOD, "Exiting..."); }
@Override public void run() { final String METHOD = "run"; running = true; LoggerUtility.log(Level.FINE, CLASS_NAME, METHOD, "Running..."); while (running) { try { JsonObject o = publishQueue.take(); if (o.equals(dummy)) { LoggerUtility.log(Level.FINE, CLASS_NAME, METHOD, "It is time to quit."); } else { publish(o); } } catch (Exception e) { LoggerUtility.log(Level.SEVERE, CLASS_NAME, METHOD, e.toString()); e.printStackTrace(); running = false; } } LoggerUtility.log(Level.FINE, CLASS_NAME, METHOD, "Exiting..."); }
@Override public void run() { final String METHOD = "run"; running = true; LoggerUtility.log(Level.FINE, CLASS_NAME, METHOD, "Running..."); while (running) { try { JsonObject o = publishQueue.take(); if (o.equals(dummy)) { LoggerUtility.log(Level.FINE, CLASS_NAME, METHOD, "It is time to quit."); } else { publish(o); } } catch (Exception e) { LoggerUtility.log(Level.SEVERE, CLASS_NAME, METHOD, e.toString()); e.printStackTrace(); running = false; } } LoggerUtility.log(Level.FINE, CLASS_NAME, METHOD, "Exiting..."); }
@Test public void getState() throws Exception { String stateKey = "State"; JsonObject obj = new JsonParser().parse("{\"value\":\"value\"}").getAsJsonObject(); stateStore.put(stateKey, obj); JsonObject obj2 = stateStore.get(stateKey); assertTrue(obj.equals(obj2)); log.debug(obj.getClass().toString()); }
@Test public void init() { JsonObject originObj = new JsonObject(); originObj.addProperty("test", "origin"); stateStore.put("TEST", originObj); TempStateStore store = new TempStateStore(stateStore); assert store.get("TEST").equals(originObj); JsonObject testObj = new JsonObject(); testObj.addProperty("test", "yes"); store.put("TEST", testObj); assert store.get("TEST").equals(testObj); store.close(); assert store.get("TEST").equals(originObj); } }
private void assertJsonInfo(String indexPath, String expectedJson) throws ParseException { NodeState idx = NodeStateUtils.getNode(nodeStore.getRoot(), indexPath); String json = new HybridPropertyIndexInfo(idx).getInfoAsJson(); JsonObject j1 = (JsonObject) new JsonParser().parse(json); JsonObject j2 = (JsonObject) new JsonParser().parse(expectedJson); if (!j1.equals(j2)){ assertEquals(j1, j2); } }
assertNotNull("Wrote null JSON structure", readRoot); assertTrue("JSON structures not equal", readRoot.equals(writeRoot));
if (claimRequest != null) { Serializable claimExtension = request.getExtensions().get(CLAIMS); if (claimExtension == null || !claimRequest.equals(parseClaimRequest(claimExtension.toString()))) { logger.info("Mismatch between request object and regular parameter for claims, using request object");