Example usage for com.fasterxml.jackson.databind.node TextNode valueOf

List of usage examples for com.fasterxml.jackson.databind.node TextNode valueOf

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind.node TextNode valueOf.

Prototype

public static TextNode valueOf(String paramString) 

Source Link

Usage

From source file:jp.classmethod.aws.dynamodb.DynamoDbSpringInterfaceTest.java

License:asdf

private JsonPatch getPatch(String name) throws JsonPointerException {
    return new JsonPatch(
            Collections.singletonList(new AddOperation(new JsonPointer("/name"), TextNode.valueOf(name))));
}

From source file:de.thomaskrille.dropwizard.environment_configuration.EnvironmentConfigurationFactory.java

private void addOverride(JsonNode root, String name, String value) {
    JsonNode node = root;//from www . j a v a 2s  . c  o m
    final Iterable<String> split = Splitter.on('.').trimResults().split(name);
    final String[] parts = Iterables.toArray(split, String.class);

    for (int i = 0; i < parts.length; i++) {
        String key = parts[i];

        if (!(node instanceof ObjectNode)) {
            throw new IllegalArgumentException("Unable to override " + name + "; it's not a valid path.");
        }
        final ObjectNode obj = (ObjectNode) node;

        final String remainingPath = Joiner.on('.').join(Arrays.copyOfRange(parts, i, parts.length));
        if (obj.has(remainingPath) && !remainingPath.equals(key)) {
            if (obj.get(remainingPath).isValueNode()) {
                obj.put(remainingPath, value);
                return;
            }
        }

        JsonNode child;
        final boolean moreParts = i < parts.length - 1;

        if (key.matches(".+\\[\\d+\\]$")) {
            final int s = key.indexOf('[');
            final int index = Integer.parseInt(key.substring(s + 1, key.length() - 1));
            key = key.substring(0, s);
            child = obj.get(key);
            if (child == null) {
                throw new IllegalArgumentException(
                        "Unable to override " + name + "; node with index not found.");
            }
            if (!child.isArray()) {
                throw new IllegalArgumentException(
                        "Unable to override " + name + "; node with index is not an array.");
            } else if (index >= child.size()) {
                throw new ArrayIndexOutOfBoundsException(
                        "Unable to override " + name + "; index is greater than size of array.");
            }
            if (moreParts) {
                child = child.get(index);
                node = child;
            } else {
                ArrayNode array = (ArrayNode) child;
                array.set(index, TextNode.valueOf(value));
                return;
            }
        } else if (moreParts) {
            child = obj.get(key);
            if (child == null) {
                child = obj.objectNode();
                obj.put(key, child);
            }
            if (child.isArray()) {
                throw new IllegalArgumentException(
                        "Unable to override " + name + "; target is an array but no index specified");
            }
            node = child;
        }

        if (!moreParts) {
            if (node.get(key) != null && node.get(key).isArray()) {
                ArrayNode arrayNode = (ArrayNode) obj.get(key);
                arrayNode.removeAll();
                Pattern escapedComma = Pattern.compile("\\\\,");
                for (String val : Splitter.on(Pattern.compile("(?<!\\\\),")).trimResults().split(value)) {
                    arrayNode.add(escapedComma.matcher(val).replaceAll(","));
                }
            } else {
                obj.put(key, value);
            }
        }
    }
}

From source file:com.unboundid.scim2.common.GenericScimResource.java

/**
 * Adds or replaces a String value in a generic SCIM resource.
 *   <p>// ww  w  .j  a  v a  2 s  . c om
 * For example:
 * In a GenericScimResource (gsr) representing the following resource:
 * <pre><code>
 * {
 *   "path1":"stringValue"
 * }
 * </code></pre>
 *   <p>
 *   gsr.replaceValue(Path.fromString("path1"), path1value)
 *   where path1value is a String
 *   would change the "path1" field to the value of the path1value
 *   variable
 *   <p>
 *
 *   gsr.replaceValue(Path.fromString("path2"), path2value)
 *   where path2value is a String
 *   would add a field called "path2" with the value of the path2value
 *   variable
 *   <p>
 *
 *   Note that in a case where multiple paths match (for example
 *   a path with a filter), all paths that match will be affected.
 *
 * @param path the path to replace the value for.
 * @param value the new value.
 * @return returns the new generic SCIM resource (this).
 * @throws ScimException thrown if an error occurs (for example
 * if the path or value is "{@code null}" or invalid).
 */
public GenericScimResource replaceValue(final Path path, final String value) throws ScimException {
    return replaceValue(path, TextNode.valueOf(value));
}

From source file:com.unboundid.scim2.common.messages.PatchOperation.java

/**
 * Create a new replace patch operation.
 *
 * @param path The path targeted by this patch operation.  The path
 *             must not be {@code null}.
 *             Path string examples:// www .j a v a2s.co  m
 *               "{@code userName eq 'bjensen'}"
 *               "{@code userName}"
 * @param value The value(s) to replace.  The value(s) must not be {@code null}.
 *
 * @return The new replace patch operation.
 * @throws ScimException If the path is invalid.
 */
public static PatchOperation replace(final String path, final String value) throws ScimException {
    return replace(path, TextNode.valueOf(value));
}

From source file:com.unboundid.scim2.common.messages.PatchOperation.java

/**
 * Create a new replace patch operation.
 *
 * @param path The path targeted by this patch operation.  The path
 *             must not be {@code null}.
 * @param value The value(s) to replace.  The value(s) must not be {@code null}.
 *
 * @return The new replace patch operation.
 *//* ww w.  j  av a2 s  . c o m*/
public static PatchOperation replace(final Path path, final String value) {
    return replace(path, TextNode.valueOf(value));
}

From source file:com.unboundid.scim2.server.utils.SchemaChecker.java

/**
 * Check the attribute to see if it violated any mutability constraints.
 *
 * @param prefix The issue prefix.//from ww  w .j a v  a 2  s . c o  m
 * @param node The attribute value.
 * @param path The attribute path.
 * @param attribute The attribute definition.
 * @param results The schema check results.
 * @param currentObjectNode The current resource.
 * @param isPartialReplace Whether this is a partial replace.
 * @param isPartialAdd Whether this is a partial add.
 * @param isReplace Whether this is a replace.
 * @throws ScimException If an error occurs.
 */
private void checkAttributeMutability(final String prefix, final JsonNode node, final Path path,
        final AttributeDefinition attribute, final Results results, final ObjectNode currentObjectNode,
        final boolean isPartialReplace, final boolean isPartialAdd, final boolean isReplace)
        throws ScimException {
    if (attribute.getMutability() == AttributeDefinition.Mutability.READ_ONLY) {
        results.mutabilityIssues.add(prefix + "Attribute " + path + " is read-only");
    }
    if (attribute.getMutability() == AttributeDefinition.Mutability.IMMUTABLE) {
        if (node == null) {
            results.mutabilityIssues
                    .add(prefix + "Attribute " + path + " is immutable and value(s) may not be removed");
        }
        if (isPartialReplace && !isReplace) {
            results.mutabilityIssues
                    .add(prefix + "Attribute " + path + " is immutable and value(s) may not be replaced");
        } else if (isPartialAdd && currentObjectNode != null && JsonUtils.pathExists(path, currentObjectNode)) {
            results.mutabilityIssues
                    .add(prefix + "Attribute " + path + " is immutable and value(s) may not be added");
        } else if (currentObjectNode != null) {
            List<JsonNode> currentValues = JsonUtils.findMatchingPaths(path, currentObjectNode);
            if (currentValues.size() > 1 || (currentValues.size() == 1 && !currentValues.get(0).equals(node))) {
                results.mutabilityIssues
                        .add(prefix + "Attribute " + path + " is immutable and it already has a value");
            }
        }
    }

    Filter valueFilter = path.getElement(path.size() - 1).getValueFilter();
    if (attribute.equals(SchemaUtils.SCHEMAS_ATTRIBUTE_DEFINITION) && valueFilter != null) {
        // Make sure the core schema and/or required schemas extensions are
        // not removed.
        if (FilterEvaluator.evaluate(valueFilter, TextNode.valueOf(resourceType.getCoreSchema().getId()))) {
            results.syntaxIssues.add(prefix + "Attribute value(s) " + path
                    + " may not be removed or replaced because the core schema "
                    + resourceType.getCoreSchema().getId() + " is required for this resource type");
        }
        for (Map.Entry<SchemaResource, Boolean> schemaExtension : resourceType.getSchemaExtensions()
                .entrySet()) {
            if (schemaExtension.getValue() && FilterEvaluator.evaluate(valueFilter,
                    TextNode.valueOf(schemaExtension.getKey().getId()))) {
                results.syntaxIssues.add(prefix + "Attribute value(s) " + path
                        + " may not be removed or replaced because the schema " + "extension "
                        + schemaExtension.getKey().getId() + " is required for this resource type");
            }
        }
    }
}

From source file:com.unboundid.scim2.server.utils.SchemaCheckerTestCase.java

/**
 * Test to ensure modifications using patch operations on the schemas
 * attribute are checked correctly.//from   www .  j  a  v  a2s. c om
 *
 * @throws Exception if an error occurs.
 */
@Test
public void testSchemasModify() throws Exception {
    // Create one schema extension with a required attribute.
    AttributeDefinition reqAttr = new AttributeDefinition.Builder().setName("test")
            .setType(AttributeDefinition.Type.STRING).setRequired(true).build();
    SchemaResource extWithReqAttr = new SchemaResource("urn:id:extWithReqAttr", "extWithReqAttr", "",
            Collections.singleton(reqAttr));

    // Create one schema extension with a required attribute.
    AttributeDefinition optAttr = new AttributeDefinition.Builder().setName("test")
            .setType(AttributeDefinition.Type.STRING).build();
    SchemaResource extWithOptAttr = new SchemaResource("urn:id:extWithOptAttr", "extWithOptAttr", "",
            Collections.singleton(optAttr));

    ResourceTypeDefinition resourceTypeDefinition = new ResourceTypeDefinition.Builder("test", "/test")
            .setCoreSchema(coreSchema).addRequiredSchemaExtension(extWithReqAttr)
            .addOptionalSchemaExtension(extWithOptAttr).build();
    SchemaChecker checker = new SchemaChecker(resourceTypeDefinition);

    ObjectNode resource = JsonUtils.getJsonNodeFactory().objectNode();
    resource.putArray("schemas").add("urn:ietf:params:scim:schemas:core:2.0:User").add("urn:id:extWithReqAttr");
    resource.put("userName", "test");
    resource.putObject("urn:id:extWithReqAttr").put("test", "test");

    // Shouldn't be able to remove the core schema
    List<PatchOperation> patchOps = new LinkedList<PatchOperation>();
    patchOps.add(PatchOperation.remove(Path.root().attribute("schemas",
            Filter.eq("value", "urn:ietf:params:scim:schemas:core:2.0:User"))));

    SchemaChecker.Results results = checker.checkModify(patchOps, resource);
    assertEquals(results.getSyntaxIssues().size(), 2, results.getSyntaxIssues().toString());

    // Shouldn't be able to remove a required schema extension
    patchOps = new LinkedList<PatchOperation>();
    patchOps.add(PatchOperation
            .remove(Path.root().attribute("schemas", Filter.eq("value", "urn:id:extWithReqAttr"))));

    results = checker.checkModify(patchOps, resource);
    assertEquals(results.getSyntaxIssues().size(), 3, results.getSyntaxIssues().toString());

    // Shouldn't be able to replace the core schema
    patchOps = new LinkedList<PatchOperation>();
    patchOps.add(PatchOperation.replace(
            Path.root().attribute("schemas", Filter.eq("value", "urn:ietf:params:scim:schemas:core:2.0:User")),
            TextNode.valueOf("urn:id:extWithOptAttr")));

    results = checker.checkModify(patchOps, resource);
    assertEquals(results.getSyntaxIssues().size(), 2, results.getSyntaxIssues().toString());

    // Shouldn't be able to replace a required schema extension
    patchOps = new LinkedList<PatchOperation>();
    patchOps.add(PatchOperation.replace(
            Path.root().attribute("schemas", Filter.eq("value", "urn:id:extWithReqAttr")),
            TextNode.valueOf("urn:id:extWithOptAttr")));

    results = checker.checkModify(patchOps, resource);
    assertEquals(results.getSyntaxIssues().size(), 3, results.getSyntaxIssues().toString());

    // Shouldn't be able to add an undefined schema extension
    patchOps = new LinkedList<PatchOperation>();
    patchOps.add(PatchOperation.add(Path.root().attribute("schemas"),
            JsonUtils.getJsonNodeFactory().arrayNode().add("urn:id:undefined")));

    results = checker.checkModify(patchOps, resource);
    assertEquals(results.getSyntaxIssues().size(), 2, results.getSyntaxIssues().toString());
}

From source file:com.unboundid.scim2.server.EndpointTestCase.java

/**
 * Test ability of client to submit requests with arbitrary query parameters.
 *
 * @throws ScimException if an error occurs.
 *//*from   w ww . j a v a2 s.  co  m*/
@Test
public void testQueryParams() throws ScimException {
    final ScimService service = new ScimService(target());
    final String expectedKey = "expectedKey";
    final String expectedValue = "expectedValue";

    requestFilter.addExpectedQueryParam(expectedKey, expectedValue);

    try {
        try {
            service.retrieveRequest(ScimService.ME_URI).queryParam(expectedKey, "unexpectedValue")
                    .invoke(UserResource.class);
            fail("Expected BadRequestException");
        } catch (BadRequestException e) {
            // Expected.
        }

        service.retrieveRequest(ScimService.ME_URI).queryParam(expectedKey, expectedValue)
                .invoke(UserResource.class);

        UserResource newUser = new UserResource().setUserName("queryParamUser");
        UserResource createdUser = service.createRequest("SingletonUsers", newUser)
                .queryParam(expectedKey, expectedValue).invoke();

        createdUser.setDisplayName("Bob");
        UserResource updatedUser = service.replaceRequest(createdUser).queryParam(expectedKey, expectedValue)
                .invoke();

        UserResource patchedUser = service.modifyRequest("SingletonUsers", updatedUser.getId())
                .addOperation(PatchOperation.replace("displayName", TextNode.valueOf("Joe")))
                .queryParam(expectedKey, expectedValue).invoke(UserResource.class);

        service.deleteRequest("SingletonUsers", patchedUser.getId()).queryParam(expectedKey, expectedValue)
                .invoke();

        // Confirm that query parameters set by other means are included.
        String filter = "meta.resourceType eq \"User\"";
        requestFilter.addExpectedQueryParam(ApiConstants.QUERY_PARAMETER_FILTER, filter);
        service.searchRequest("Users").filter(filter).queryParam(expectedKey, expectedValue)
                .invoke(UserResource.class);

        // Test a request including a query parameter with multiple expected
        // values.
        requestFilter.reset();
        requestFilter.addExpectedQueryParam(expectedKey, "expectedValue1");
        requestFilter.addExpectedQueryParam(expectedKey, "expectedValue2");

        service.retrieveRequest(ScimService.ME_URI).queryParam(expectedKey, "expectedValue1")
                .queryParam(expectedKey, "expectedValue2").invoke(UserResource.class);
    } finally {
        requestFilter.reset();
    }
}

From source file:com.unboundid.scim2.server.EndpointTestCase.java

/**
 * Test ability of client to submit requests with arbitrary headers.
 *
 * @throws ScimException if an error occurs.
 *//*from   www. ja  v  a2  s.  c om*/
@Test
public void testHeaders() throws ScimException {
    final ScimService service = new ScimService(target());
    final String expectedKey = "expectedKey";
    final String expectedValue = "expectedValue";

    requestFilter.addExpectedHeader(expectedKey, expectedValue);
    // Confirm that the default Accept header is preserved.
    requestFilter.addExpectedHeader(HttpHeaders.ACCEPT, ScimService.MEDIA_TYPE_SCIM_TYPE.toString());
    requestFilter.addExpectedHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_TYPE.toString());

    try {
        try {
            service.retrieveRequest(ScimService.ME_URI).header(expectedKey, "unexpectedValue")
                    .invoke(UserResource.class);
            fail("Expected BadRequestException");
        } catch (BadRequestException e) {
            // Expected.
        }

        service.retrieveRequest(ScimService.ME_URI).header(expectedKey, expectedValue)
                .invoke(UserResource.class);

        UserResource newUser = new UserResource().setUserName("queryParamUser");
        UserResource createdUser = service.createRequest("SingletonUsers", newUser)
                .header(expectedKey, expectedValue).invoke();

        createdUser.setDisplayName("Bob");
        UserResource updatedUser = service.replaceRequest(createdUser).header(expectedKey, expectedValue)
                .invoke();

        UserResource patchedUser = service.modifyRequest("SingletonUsers", updatedUser.getId())
                .addOperation(PatchOperation.replace("displayName", TextNode.valueOf("Joe")))
                .header(expectedKey, expectedValue).invoke(UserResource.class);

        service.deleteRequest("SingletonUsers", patchedUser.getId()).header(expectedKey, expectedValue)
                .invoke();

        service.searchRequest("Users").filter("meta.resourceType eq \"User\"")
                .header(expectedKey, expectedValue).invoke(UserResource.class);

        service.searchRequest("Users").filter("meta.resourceType eq \"User\"")
                .header(expectedKey, expectedValue).invokePost(UserResource.class);

        // Test a request including a header with multiple expected values.
        requestFilter.reset();
        requestFilter.addExpectedHeader(expectedKey, "expectedValue1");
        requestFilter.addExpectedHeader(expectedKey, "expectedValue2");

        service.retrieveRequest(ScimService.ME_URI).header(expectedKey, "expectedValue1")
                .header(expectedKey, "expectedValue2").invoke(UserResource.class);
    } finally {
        requestFilter.reset();
    }
}

From source file:com.unboundid.scim2.server.utils.SchemaCheckerTestCase.java

/**
 * Test that undefined attributes are detected correctly.
 *
 * @throws Exception if an error occurs.
 *//*from  w  ww.ja  va 2s .c  om*/
@Test
public void testUndefinedAttributes() throws Exception {
    SchemaResource coreSchema = SchemaUtils.getSchema(UserResource.class);
    SchemaResource enterpriseExtension = SchemaUtils.getSchema(EnterpriseUserExtension.class);

    ResourceTypeDefinition resourceTypeDefinition = new ResourceTypeDefinition.Builder("test", "/test")
            .setCoreSchema(coreSchema).addOptionalSchemaExtension(enterpriseExtension).build();
    SchemaChecker checker = new SchemaChecker(resourceTypeDefinition);

    // Core attribute is undefined
    ObjectNode coreUndefined = JsonUtils.getJsonNodeFactory().objectNode();
    coreUndefined.putArray("schemas").add("urn:ietf:params:scim:schemas:core:2.0:User")
            .add("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User");
    coreUndefined.put("userName", "test");
    coreUndefined.put("undefined", "value");

    SchemaChecker.Results results = checker.checkCreate(coreUndefined);
    assertEquals(results.getSyntaxIssues().size(), 1, results.getSyntaxIssues().toString());
    assertTrue(containsIssueWith(results.getSyntaxIssues(), "is undefined for schema"));

    results = checker.checkModify(Collections.singleton(
            PatchOperation.add(Path.root().attribute("undefined"), TextNode.valueOf("value"))), null);
    assertEquals(results.getPathIssues().size(), 1, results.getPathIssues().toString());
    assertTrue(containsIssueWith(results.getPathIssues(), "is undefined"));

    results = checker.checkModify(
            Collections.singleton(
                    PatchOperation.replace(Path.root().attribute("undefined"), TextNode.valueOf("value"))),
            null);
    assertEquals(results.getPathIssues().size(), 1, results.getPathIssues().toString());
    assertTrue(containsIssueWith(results.getPathIssues(), "is undefined"));

    results = checker.checkModify(
            Collections.singleton(PatchOperation.remove(Path.root().attribute("undefined"))), null);
    assertEquals(results.getPathIssues().size(), 1, results.getPathIssues().toString());
    assertTrue(containsIssueWith(results.getPathIssues(), "is undefined"));

    results = checker.checkSearch(Filter.fromString("undefined eq \"value\""));
    assertEquals(results.getFilterIssues().size(), 1, results.getFilterIssues().toString());
    assertTrue(containsIssueWith(results.getFilterIssues(), "is undefined"));

    // Core sub-attribute is undefined
    ObjectNode coreSubUndefined = JsonUtils.getJsonNodeFactory().objectNode();
    coreSubUndefined.putArray("schemas").add("urn:ietf:params:scim:schemas:core:2.0:User")
            .add("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User");
    coreSubUndefined.put("userName", "test");
    coreSubUndefined.putObject("name").put("undefined", "value");

    results = checker.checkCreate(coreSubUndefined);
    assertEquals(results.getSyntaxIssues().size(), 1, results.getSyntaxIssues().toString());
    assertTrue(containsIssueWith(results.getSyntaxIssues(), "is undefined for attribute"));

    results = checker
            .checkModify(
                    Collections.singleton(PatchOperation.add(
                            Path.root().attribute("name").attribute("undefined"), TextNode.valueOf("value"))),
                    null);
    assertEquals(results.getPathIssues().size(), 1, results.getPathIssues().toString());
    assertTrue(containsIssueWith(results.getPathIssues(), "is undefined"));

    results = checker
            .checkModify(
                    Collections.singleton(PatchOperation.replace(
                            Path.root().attribute("name").attribute("undefined"), TextNode.valueOf("value"))),
                    null);
    assertEquals(results.getPathIssues().size(), 1, results.getPathIssues().toString());
    assertTrue(containsIssueWith(results.getPathIssues(), "is undefined"));

    results = checker.checkModify(
            Collections.singleton(PatchOperation.remove(Path.root().attribute("name").attribute("undefined"))),
            null);
    assertEquals(results.getPathIssues().size(), 1, results.getPathIssues().toString());
    assertTrue(containsIssueWith(results.getPathIssues(), "is undefined"));

    results = checker.checkSearch(Filter.fromString("name.undefined eq \"value\""));
    assertEquals(results.getFilterIssues().size(), 1, results.getFilterIssues().toString());
    assertTrue(containsIssueWith(results.getFilterIssues(), "is undefined"));

    // Extended attribute is undefined
    ObjectNode extendedUndefined = JsonUtils.getJsonNodeFactory().objectNode();
    extendedUndefined.putArray("schemas").add("urn:ietf:params:scim:schemas:core:2.0:User")
            .add("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User");
    extendedUndefined.put("userName", "test");
    extendedUndefined.putObject("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User").put("undefined",
            "value");

    results = checker.checkCreate(extendedUndefined);
    assertEquals(results.getSyntaxIssues().size(), 1, results.getSyntaxIssues().toString());
    assertTrue(containsIssueWith(results.getSyntaxIssues(), "is undefined for schema"));

    results = checker.checkModify(Collections.singleton(PatchOperation.add(
            Path.root("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User").attribute("undefined"),
            TextNode.valueOf("value"))), null);
    assertEquals(results.getPathIssues().size(), 1, results.getPathIssues().toString());
    assertTrue(containsIssueWith(results.getPathIssues(), "is undefined"));

    results = checker.checkModify(Collections.singleton(PatchOperation.replace(
            Path.root("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User").attribute("undefined"),
            TextNode.valueOf("value"))), null);
    assertEquals(results.getPathIssues().size(), 1, results.getPathIssues().toString());
    assertTrue(containsIssueWith(results.getPathIssues(), "is undefined"));

    results = checker.checkModify(Collections.singleton(PatchOperation.remove(
            Path.root("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User").attribute("undefined"))),
            null);
    assertEquals(results.getPathIssues().size(), 1, results.getPathIssues().toString());
    assertTrue(containsIssueWith(results.getPathIssues(), "is undefined"));

    results = checker.checkSearch(Filter
            .fromString("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User:undefined eq \"value\""));
    assertEquals(results.getFilterIssues().size(), 1, results.getFilterIssues().toString());
    assertTrue(containsIssueWith(results.getFilterIssues(), "is undefined"));

    // Extended sub-attribute is undefined
    ObjectNode extendedSubUndefined = JsonUtils.getJsonNodeFactory().objectNode();
    extendedSubUndefined.putArray("schemas").add("urn:ietf:params:scim:schemas:core:2.0:User")
            .add("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User");
    extendedSubUndefined.put("userName", "test");
    extendedSubUndefined.putObject("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User")
            .putObject("manager").put("$ref", "https://value").put("value", "value").put("undefined", "value");

    results = checker.checkCreate(extendedSubUndefined);
    assertEquals(results.getSyntaxIssues().size(), 1, results.getSyntaxIssues().toString());
    assertTrue(containsIssueWith(results.getSyntaxIssues(), "is undefined for attribute"));

    results = checker
            .checkModify(
                    Collections
                            .singleton(PatchOperation.add(
                                    Path.root("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User")
                                            .attribute("manager").attribute("undefined"),
                                    TextNode.valueOf("value"))),
                    null);
    assertEquals(results.getPathIssues().size(), 1, results.getPathIssues().toString());
    assertTrue(containsIssueWith(results.getPathIssues(), "is undefined"));

    results = checker
            .checkModify(
                    Collections
                            .singleton(PatchOperation.replace(
                                    Path.root("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User")
                                            .attribute("manager").attribute("undefined"),
                                    TextNode.valueOf("value"))),
                    null);
    assertEquals(results.getPathIssues().size(), 1, results.getPathIssues().toString());
    assertTrue(containsIssueWith(results.getPathIssues(), "is undefined"));

    results = checker.checkModify(Collections.singleton(
            PatchOperation.remove(Path.root("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User")
                    .attribute("manager").attribute("undefined"))),
            null);
    assertEquals(results.getPathIssues().size(), 1, results.getPathIssues().toString());
    assertTrue(containsIssueWith(results.getPathIssues(), "is undefined"));

    results = checker.checkSearch(Filter.fromString(
            "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User:manager.undefined eq \"value\""));
    assertEquals(results.getFilterIssues().size(), 1, results.getFilterIssues().toString());
    assertTrue(containsIssueWith(results.getFilterIssues(), "is undefined"));
}