/** * Gets a list of String from a generic SCIM resource. If the path exists, * the JSON node at the path must be a list of String. If the path does * not exist, an empty list will be returned. * <p> * * For example: * In a GenericScimResource (gsr) representing the following resource: * <pre><code> * { * "path1": ["stringValue1", "stringValue2"] * } * </code></pre> * <p> * * getStringValueList("path1") * returns a list containing "stringValue1", "stringValue2" * <p> * * getStringValueList("bogusPath") * returns an empty list * * @param path the path to get the value from. * @return the value at the path, or an empty list. * @throws ScimException thrown if an error occurs. */ public List<String> getStringValueList(final String path) throws ScimException { return getStringValueList(Path.fromString(path)); }
/** * Gets a list of String from a generic SCIM resource. If the path exists, * the JSON node at the path must be a list of String. If the path does * not exist, an empty list will be returned. * <p> * * For example: * In a GenericScimResource (gsr) representing the following resource: * <pre><code> * { * "path1": ["stringValue1", "stringValue2"] * } * </code></pre> * <p> * * getStringValueList("path1") * returns a list containing "stringValue1", "stringValue2" * <p> * * getStringValueList("bogusPath") * returns an empty list * * @param path the path to get the value from. * @return the value at the path, or an empty list. * @throws ScimException thrown if an error occurs. */ public List<String> getStringValueList(final String path) throws ScimException { return getStringValueList(Path.fromString(path)); }
private void verifyEtagHeaders(GenericScimResource resource, boolean shouldContainIfMatch, boolean shouldContainIfNoneMatch) throws ScimException { if(shouldContainIfMatch) { List<String> ifMatchValues = resource.getStringValueList(HttpHeaders.IF_MATCH); Assert.assertNotNull(ifMatchValues); Assert.assertFalse(ifMatchValues.isEmpty()); } else { Assert.assertTrue(resource.getObjectNode(). path(HttpHeaders.IF_MATCH).isMissingNode()); } if(shouldContainIfNoneMatch) { List<String> ifNoneMatchValues = resource.getStringValueList(HttpHeaders.IF_NONE_MATCH); Assert.assertNotNull(ifNoneMatchValues); Assert.assertFalse(ifNoneMatchValues.isEmpty()); } else { Assert.assertTrue(resource.getObjectNode(). path(HttpHeaders.IF_NONE_MATCH).isMissingNode()); } }
getStringValueList(Path.fromString(path3)); Assert.assertEquals(list1.size(), 2); Assert.assertTrue(list1.contains(arrayValue1)); getStringValueList(path4); Assert.assertEquals(list2.size(), 2); Assert.assertTrue(list2.contains(arrayValue3)); Assert.assertTrue(gsr.getStringValueList("bogusPath").isEmpty()); Assert.assertTrue(gsr.getStringValueList( Path.fromString("bogusPath")).isEmpty());