/** * {@inheritDoc} */ public GenericScimResource asGenericScimResource() { ObjectNode object = JsonUtils.valueToNode(this); return new GenericScimResource(object); }
/** * {@inheritDoc} */ public GenericScimResource asGenericScimResource() { ObjectNode object = JsonUtils.valueToNode(this); return new GenericScimResource(object); }
/** * {@inheritDoc} */ @Override public GenericScimResource deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException { ObjectNode objectNode = JsonUtils.getObjectReader().readTree(jp); return new GenericScimResource(objectNode); } }
/** * {@inheritDoc} */ @Override public GenericScimResource deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException { ObjectNode objectNode = JsonUtils.getObjectReader().readTree(jp); return new GenericScimResource(objectNode); } }
/** * Test the findMatchingPaths method. * * @throws ScimException If an error occurred. * @throws IOException If an error occurred. */ @Test public void testGetArray() throws ScimException, IOException { GenericScimResource gso = new GenericScimResource(getTestResource()); List<JsonNode> mapResult = JsonUtils.findMatchingPaths( Path.fromString("array"), gso.getObjectNode()); assertEquals(mapResult.size(), 1); assertEquals(mapResult.get(0).size(), 2); assertEquals(mapResult.get(0).get(0).size(), 11); mapResult = JsonUtils.findMatchingPaths( Path.fromString("complex.array[id eq \"2\"]"), gso.getObjectNode()); assertEquals(mapResult.size(), 1); assertEquals(mapResult.get(0).size(), 1); assertEquals(mapResult.get(0).get(0).size(), 11); }
/** * Test the findMatchingPaths method. * * @throws ScimException If an error occurred. * @throws IOException If an error occurred. */ @Test public void testGetComplex() throws ScimException, IOException { GenericScimResource gso = new GenericScimResource(getTestResource()); List<JsonNode> mapResult = JsonUtils.findMatchingPaths( Path.fromString("array.complex"), gso.getObjectNode()); assertEquals(mapResult.size(), 2); assertEquals(mapResult.get(0).size(), 9); mapResult = JsonUtils.findMatchingPaths( Path.fromString("aRray[ID eq \"2\"].cOmplex"), gso.getObjectNode()); assertEquals(mapResult.size(), 1); assertEquals(mapResult.get(0).size(), 9); }
genericResource = new GenericScimResource( ((GenericScimResource) resource).getObjectNode().deepCopy());
/** * Test that MethodNotAllowedExceptions are thrown properly. * * @throws ScimException uncaught exceptions indicate an error. */ @Test public void testMethodNotAllowed() throws ScimException { final ScimService service = new ScimService(target()); try { service.create("Users/schema", new GenericScimResource()); Assert.fail("Expecting a MethodNotFoundException"); } catch(MethodNotAllowedException ex) { ErrorResponse response = ex.getScimError(); Assert.assertEquals(response.getStatus(), Integer.valueOf(405)); Assert.assertTrue(response.getDetail().contains("Method Not Allowed")); } }
/** * Tests that etags work properly for retrievals when a not modified * exception is thrown. * @throws ScimException in case of error. */ @Test(expectedExceptions = NotModifiedException.class) public void testIfNoneMatch_retrieveException() throws ScimException { final ScimService scimService = new ScimService(target()); GenericScimResource gsr = new GenericScimResource(); Meta meta = new Meta(); meta.setLocation(UriBuilder.fromUri(ETAG_URI).path("/123").build()); meta.setVersion("123"); gsr.setMeta(meta); scimService.retrieveRequest( UriBuilder.fromUri(ETAG_URI).path("/exception/notModified").build()). ifNoneMatch("123").invoke(GenericScimResource.class); }
/** * Test bad/unexpected response from SCIM server. * * @throws Exception in case of error. */ @Test public void testBadErrorResult() throws Exception { final ScimService service = new ScimService(target()); try { service.create("Users/badException", new GenericScimResource()); Assert.fail("Expecting a ScimServiceException"); } catch(ScimServiceException ex) { ErrorResponse response = ex.getScimError(); Assert.assertEquals(response.getStatus(), Integer.valueOf(409)); Assert.assertNotNull(ex.getCause()); } }
Date arrayValue4 = new Date(9482087579L); GenericScimResource gsr = new GenericScimResource(); Assert.assertEquals(gsr.replaceValue(path1, value1). getDateValue(Path.fromString(path1)), value1);
new GenericScimResource(getTestResource());
Double arrayValue4 = new Double(1.2); GenericScimResource gsr = new GenericScimResource(); Assert.assertEquals(gsr.replaceValue(path1, value1). getDoubleValue(Path.fromString(path1)), value1, 0.01);
Integer arrayValue4 = 12; GenericScimResource gsr = new GenericScimResource(); Assert.assertEquals(gsr.replaceValue(path1, value1). getIntegerValue(Path.fromString(path1)), value1);
Boolean arrayValue4 = Boolean.TRUE; GenericScimResource gsr = new GenericScimResource(); Assert.assertEquals(gsr.replaceValue(path1, value1). getBooleanValue(Path.fromString(path1)), value1);
" \"sensitive\":\"hErE\"\n" + "}"); testResource = new GenericScimResource(node);
new GenericScimResource(getTestResource());
private GenericScimResource getEtagDocument(HttpHeaders headers) throws ScimException { GenericScimResource gsr = new GenericScimResource(); if(headers.getRequestHeaders().containsKey(HttpHeaders.IF_NONE_MATCH)) { gsr.addStringValues(HttpHeaders.IF_NONE_MATCH, headers.getRequestHeader(HttpHeaders.IF_NONE_MATCH)); } if(headers.getRequestHeaders().containsKey(HttpHeaders.IF_MATCH)) { gsr.addStringValues(HttpHeaders.IF_MATCH, headers.getRequestHeader(HttpHeaders.IF_MATCH)); } lastResult = gsr; return gsr; } }
GenericScimResource gsr = new GenericScimResource(); Meta meta = new Meta(); meta.setLocation(UriBuilder.fromUri(ETAG_URI).path("/123").build());
GenericScimResource gsr = new GenericScimResource(); Meta meta = new Meta(); meta.setLocation(UriBuilder.fromUri(ETAG_URI).path("/123").build());