assertThat(properties, is(notNullValue()));
assertThat(properties.length(), is(3));
assertThat(properties.getString("jcr:primaryType"), is("nt:unstructured"));
assertThat(properties.getString("jcr:uuid"), is(notNullValue()));
JSONArray values = properties.getJSONArray("jcr:mixinTypes");
assertThat(values, is(notNullValue()));
assertThat(values.length(), is(1));
assertThat(values.getString(0), is("mix:referenceable"));
assertThat(connection.getResponseCode(), is(HttpURLConnection.HTTP_CREATED));
connection.disconnect();
postUrl = new URL(SERVER_URL + "/dna%3arepository/default/items/withMixinType");
connection = (HttpURLConnection)postUrl.openConnection();
// Make sure that we can retrieve the node with a GET
connection.setDoOutput(true);
connection.setRequestMethod("GET");
connection.setRequestProperty("Content-Type", MediaType.APPLICATION_JSON);
body = new JSONObject(getResponseFor(connection));
assertThat(body.length(), is(1));
properties = body.getJSONObject("properties");
assertThat(properties, is(notNullValue()));
assertThat(properties.length(), is(3));
assertThat(properties.getString("jcr:primaryType"), is("nt:unstructured"));
assertThat(properties.getString("jcr:uuid"), is(notNullValue()));
values = properties.getJSONArray("jcr:mixinTypes");
assertThat(values, is(notNullValue()));
assertThat(values.length(), is(1));
assertThat(values.getString(0), is("mix:referenceable"));
assertThat(connection.getResponseCode(), is(HttpURLConnection.HTTP_OK));
connection.disconnect();
}