@Test public void testRetrieve() throws BadRequestException { ResourcePreparer<ScimResource> preparer = new ResourcePreparer<>(resourceTypeDefinition, attributes, excludedAttributes, testBaseUri); GenericScimResource prepared = preparer.trimRetrievedResource(testResource); assertTrue(prepared.getObjectNode().has("always")); ObjectNode innerNode = (ObjectNode) prepared.getObjectNode().get("always"); assertTrue(innerNode.has("always")); if (excludedAttributes != null && excludedAttributes.equalsIgnoreCase("always.default")) { assertFalse(innerNode.has("default")); } assertFalse(innerNode.has("never")); assertFalse(prepared.getObjectNode().has("never")); if ((attributes == null && excludedAttributes == null) || (excludedAttributes != null && !excludedAttributes.equalsIgnoreCase( "urn:test:default") && !excludedAttributes.equalsIgnoreCase("default.default")) || (attributes != null && (attributes.equalsIgnoreCase( "urn:test:default") || attributes.equalsIgnoreCase("default.default")))) { assertTrue(prepared.getObjectNode().has("default")); if (attributes != null && attributes.equalsIgnoreCase("default.default")) { assertTrue(prepared.getObjectNode().get("default").has("default")); assertFalse(prepared.getObjectNode().get("default").has("notDeclared")); } if (attributes != null && attributes.equalsIgnoreCase("urn:test:default")) { assertTrue(prepared.getObjectNode().get("default").has("default")); assertTrue(prepared.getObjectNode().get("default").has("notDeclared")); } } else { if (excludedAttributes != null && excludedAttributes.equalsIgnoreCase("default.default")) { assertTrue(prepared.getObjectNode().has("default")); assertFalse(prepared.getObjectNode().get("default").has("default")); assertTrue(prepared.getObjectNode().get("default").has("notDeclared")); assertTrue(prepared.getObjectNode().get("default").has("always")); } else { assertFalse(prepared.getObjectNode().has("default")); } } if (attributes != null && attributes.equalsIgnoreCase("request")) { assertTrue(prepared.getObjectNode().has("request")); innerNode = (ObjectNode) prepared.getObjectNode().get("request"); assertTrue(innerNode.has("always")); assertFalse(innerNode.has("never")); assertTrue(innerNode.has("request")); } else { assertFalse(prepared.getObjectNode().has("request")); } assertTrue(prepared.getObjectNode().has("urn:ext:1")); ObjectNode extNode = (ObjectNode) prepared.getObjectNode().get("urn:ext:1"); assertTrue(extNode.has("always")); assertFalse(extNode.has("never")); if ((attributes == null && excludedAttributes == null) || (excludedAttributes != null && !excludedAttributes.equalsIgnoreCase( "urn:ext:1:default")) || (attributes != null && attributes.equalsIgnoreCase("urn:ext:1:default"))) { assertTrue(extNode.has("default")); } else { assertFalse(extNode.has("default")); } if (attributes != null && attributes.equalsIgnoreCase("urn:ext:1:request")) { assertTrue(extNode.has("request")); } else { assertFalse(extNode.has("request")); } }
public GenericScimResource trimRetrievedResource(final T returnedResource) { return trimReturned(returnedResource, null, null); }
ResourcePreparer { public GenericScimResource trimRetrievedResource(final T returnedResource) { return trimReturned(returnedResource, null, null); } }
ResourcePreparer { public GenericScimResource trimRetrievedResource(final T returnedResource) { return trimReturned(returnedResource, null, null); } ResourcePreparer(final ResourceTypeDefinition resourceType,
                            final String attributesString,
                            final String excludedAttributesString,
                            final URI baseUri); }
ResourcePreparer { public GenericScimResource trimRetrievedResource(final T returnedResource) { return trimReturned(returnedResource, null, null); } ResourcePreparer(final ResourceTypeDefinition resourceType,
                            final String attributesString,
                            final String excludedAttributesString,
                            final URI baseUri); GenericScimResource trimRetrievedResource(final T returnedResource); GenericScimResource trimCreatedResource(final T returnedResource, final T requestResource); GenericScimResource trimReplacedResource(final T returnedResource, final T requestResource); GenericScimResource trimModifiedResource(final T returnedResource, final Iterable<PatchOperation> patchOperations); void setResourceTypeAndLocation(final T returnedResource); }
ResourcePreparer { public GenericScimResource trimRetrievedResource(final T returnedResource) { return trimReturned(returnedResource, null, null); } ResourcePreparer(final ResourceTypeDefinition resourceType,
                            final String attributesString,
                            final String excludedAttributesString,
                            final URI baseUri); GenericScimResource trimRetrievedResource(final T returnedResource); GenericScimResource trimCreatedResource(final T returnedResource, final T requestResource); GenericScimResource trimReplacedResource(final T returnedResource, final T requestResource); GenericScimResource trimModifiedResource(final T returnedResource, final Iterable<PatchOperation> patchOperations); void setResourceTypeAndLocation(final T returnedResource);  }