You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by sb...@apache.org on 2015/02/16 19:14:22 UTC

svn commit: r1660179 [3/3] - in /sling/trunk/contrib/commons/js/nodetypes: ./ src/ src/main/ src/main/java/ src/main/java/de/ src/main/java/de/sandroboehme/ src/main/java/de/sandroboehme/jsnodetypes/ src/main/java/de/sandroboehme/jsnodetypes/downloadde...

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/java/de/sandroboehme/jsnodetypes/mock/MockPropertyDefGenerator.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/java/de/sandroboehme/jsnodetypes/mock/MockPropertyDefGenerator.java?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/java/de/sandroboehme/jsnodetypes/mock/MockPropertyDefGenerator.java (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/java/de/sandroboehme/jsnodetypes/mock/MockPropertyDefGenerator.java Mon Feb 16 18:14:21 2015
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package de.sandroboehme.jsnodetypes.mock;
+
+import static de.sandroboehme.jsnodetypes.GenerationConstants.CONSTRAINT_BINARY;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.CONSTRAINT_BOOLEAN;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.CONSTRAINT_DATE;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.CONSTRAINT_DOUBLE;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.CONSTRAINT_LONG;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.CONSTRAINT_NAME;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.CONSTRAINT_PATH;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.CONSTRAINT_REFERENCE;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.CONSTRAINT_STRING;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.DEFAULT_VALUE_BOOLEAN;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.DEFAULT_VALUE_CALENDAR;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.DEFAULT_VALUE_DOUBLE;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.DEFAULT_VALUE_LONG;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.DEFAULT_VALUE_NAME;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.DEFAULT_VALUE_PATH;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.DEFAULT_VALUE_REFERENCE;
+import static de.sandroboehme.jsnodetypes.GenerationConstants.DEFAULT_VALUE_STRING;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.jcr.Node;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+import javax.jcr.Workspace;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeIterator;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.nodetype.PropertyDefinition;
+import javax.jcr.version.OnParentVersionAction;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.resource.Resource;
+
+import de.sandroboehme.jsnodetypes.GenerationConstants;
+
+/**
+ * Generates the PropertyDefinition mocks to simulate the property definitions that the servlet gets
+ * from the node type manager.
+ *
+ */
+public class MockPropertyDefGenerator {
+
+	// mock classes
+	protected SlingHttpServletRequest request = null;
+	protected SlingHttpServletResponse response = null;
+	protected Resource resource = null;
+	protected Node currentNode = null;
+	protected Session session = null;
+	protected Workspace workspace = null;
+	protected NodeTypeManager ntManager = null;
+	protected NodeTypeIterator nodeTypeIterator = null;
+	protected ByteArrayOutputStream outStream = null;
+	
+	public PropertyDefinition getSimplePropertyDef(String name) {
+		PropertyDefinition propertyDef = mock(PropertyDefinition.class);
+		when(propertyDef.getOnParentVersion()).thenReturn(OnParentVersionAction.COPY);
+		when(propertyDef.getName()).thenReturn(name);
+		return propertyDef;
+	}	
+
+	private PropertyDefinition getCompletePropertyDev(String name, Integer type, String[] valueConstraints, String defaultValueString) throws ValueFormatException, RepositoryException {
+		Value defaultValue = mock(Value.class);
+		when(defaultValue.getString()).thenReturn(defaultValueString);
+		PropertyDefinition propertyDef = getPropertyDef(name, type, valueConstraints, new Value[] {defaultValue});
+		return propertyDef;
+	}
+
+	/**
+	 * @param name
+	 * @param type
+	 * @param valueConstraints
+	 * @param defaultValue - the getType() method will be mocked within this method. You only need to mock the getString(), getDouble() methods.
+	 * @return
+	 * @throws ValueFormatException
+	 * @throws RepositoryException
+	 */
+	public PropertyDefinition getPropertyDef(String name, Integer type, String[] valueConstraints, Value[] defaultValues)
+			throws ValueFormatException, RepositoryException {
+		return getPropertyDef(name, type, Boolean.TRUE, Boolean.TRUE, Boolean.TRUE, Boolean.TRUE, OnParentVersionAction.VERSION, valueConstraints, defaultValues);
+	}
+
+	public PropertyDefinition getPropertyDef(String propertyName, Integer type, Boolean isAutoCreated, Boolean isMandatory, Boolean isProtected, Boolean isMultiple, Integer onParentVersionAction, String[] valueConstraints, Value[] defaultValues)
+			throws ValueFormatException, RepositoryException {
+		PropertyDefinition propertyDef = mock(PropertyDefinition.class);
+		when(propertyDef.getOnParentVersion()).thenReturn(onParentVersionAction);
+		when(propertyDef.getName()).thenReturn(propertyName);
+		when(propertyDef.getRequiredType()).thenReturn(type);
+		when(propertyDef.getValueConstraints()).thenReturn(valueConstraints);
+		when(propertyDef.isMultiple()).thenReturn(isMultiple);
+		when(propertyDef.isProtected()).thenReturn(isProtected);
+		NodeType declaringNodeType = mock(NodeType.class);
+		when(declaringNodeType.getName()).thenReturn("ntName");
+		when(propertyDef.getDeclaringNodeType()).thenReturn(declaringNodeType);
+		if (defaultValues!=null){
+			for (Value defaultValue : defaultValues) {
+				when(defaultValue.getType()).thenReturn(type);
+			}
+		}
+		when(propertyDef.getDefaultValues()).thenReturn(defaultValues);
+		when(propertyDef.isAutoCreated()).thenReturn(isAutoCreated);
+		when(propertyDef.isMandatory()).thenReturn(isMandatory);
+		return propertyDef;
+	}
+	
+	@SuppressWarnings("deprecation")
+	public PropertyDefinition[] getDifferentPropertyDefinitions() throws ValueFormatException, RepositoryException{
+		Value defaultValue1 = mock(Value.class);
+		when(defaultValue1.getType()).thenReturn(PropertyType.BINARY);
+		when(defaultValue1.getStream()).thenReturn(new ByteArrayInputStream(GenerationConstants.DEFAULT_VALUE_BINARY_0.getBytes()));
+		Value defaultValue2 = mock(Value.class);
+		when(defaultValue2.getType()).thenReturn(PropertyType.BINARY);
+		when(defaultValue2.getStream()).thenReturn(new ByteArrayInputStream(GenerationConstants.DEFAULT_VALUE_BINARY_1.getBytes()));
+
+		PropertyDefinition binPropDef1 = this.getPropertyDef("binPropDef", PropertyType.BINARY, true, true, true, true, OnParentVersionAction.VERSION, new String[]{"[,1024]", "[,2048]"}, new Value[] {defaultValue1, defaultValue2});
+		PropertyDefinition binPropDef2 = this.getPropertyDef("binPropDef", PropertyType.BINARY, true, true, true, true, OnParentVersionAction.COPY, new String[]{"[,1024]", "[,512]"}, new Value[] {defaultValue1, defaultValue2});
+		PropertyDefinition binPropDef3 = this.getPropertyDef("binPropDef", PropertyType.BINARY, true, true, true, false, OnParentVersionAction.COPY, new String[]{"[,1024]", "[,512]"}, new Value[] {defaultValue1, defaultValue2});
+		PropertyDefinition binPropDef4 = this.getPropertyDef("binPropDef", PropertyType.BINARY, true, true, false, false, OnParentVersionAction.COPY, new String[]{"[,1024]", "[,512]"}, new Value[] {defaultValue1, defaultValue2});
+		PropertyDefinition binPropDef5 = this.getPropertyDef("binPropDef", PropertyType.BINARY, true, false, false, false, OnParentVersionAction.COPY, new String[]{"[,1024]", "[,512]"}, new Value[] {defaultValue1, defaultValue2});
+		PropertyDefinition binPropDef6 = this.getPropertyDef("binPropDef", PropertyType.BINARY, false, false, false, false, OnParentVersionAction.COPY, new String[]{"[,1024]", "[,512]"}, new Value[] {defaultValue1, defaultValue2});
+		PropertyDefinition binPropDef7 = this.getPropertyDef("binPropDef", PropertyType.BOOLEAN, false, false, false, false, OnParentVersionAction.COPY, new String[]{"[,1024]", "[,512]"}, new Value[] {defaultValue1, defaultValue2});
+		PropertyDefinition binPropDef8 = this.getPropertyDef("binPropDef2", PropertyType.BOOLEAN, false, false, false, false, OnParentVersionAction.COPY, new String[]{"[,1024]", "[,512]"}, new Value[] {defaultValue1, defaultValue2});
+		return new PropertyDefinition[]{binPropDef8, binPropDef7, binPropDef6, binPropDef5, binPropDef4, binPropDef3, binPropDef2, binPropDef1};
+	}
+	
+	@SuppressWarnings("deprecation")
+	public PropertyDefinition[] getEqualPropertyDefinitions() throws ValueFormatException, RepositoryException{
+		Value defaultValue1 = mock(Value.class);
+		when(defaultValue1.getType()).thenReturn(PropertyType.BINARY);
+		when(defaultValue1.getStream()).thenReturn(new ByteArrayInputStream("A content".getBytes()));
+		Value defaultValue2 = mock(Value.class);
+		when(defaultValue2.getType()).thenReturn(PropertyType.BINARY);
+		when(defaultValue2.getStream()).thenReturn(new ByteArrayInputStream("An other content".getBytes()));
+
+		PropertyDefinition binPropDef1 = this.getPropertyDef("binPropDef", PropertyType.BINARY, true, true, true, true, OnParentVersionAction.VERSION, new String[]{"[,1024]", "[,2048]"}, new Value[] {defaultValue1, defaultValue2});
+		PropertyDefinition binPropDef2 = this.getPropertyDef("binPropDef", PropertyType.BINARY, true, true, true, true, OnParentVersionAction.VERSION, new String[]{"[,1024]", "[,512]"}, new Value[] {defaultValue1, defaultValue2});
+		return new PropertyDefinition[]{binPropDef2, binPropDef1};
+	}
+	
+	public PropertyDefinition getCompleteStringPropertyDef(String name) throws ValueFormatException, IllegalStateException, RepositoryException {
+		return getCompletePropertyDev(name, PropertyType.STRING, new String[]{CONSTRAINT_STRING}, DEFAULT_VALUE_STRING);
+	}
+	
+	@SuppressWarnings("deprecation")
+	public PropertyDefinition getCompleteBinaryPropertyDef(String name) throws ValueFormatException, IllegalStateException, RepositoryException {
+		Value defaultValue = mock(Value.class);
+		when(defaultValue.getType()).thenReturn(PropertyType.BINARY);
+		when(defaultValue.getStream()).thenReturn(new ByteArrayInputStream("A content".getBytes()));
+		return getPropertyDef(name, PropertyType.BINARY, new String[]{CONSTRAINT_BINARY}, new Value[] {defaultValue});
+	}
+	
+	public PropertyDefinition getCompleteDatePropertyDef(String name) throws ValueFormatException, IllegalStateException, RepositoryException {
+		Value defaultValue = mock(Value.class);
+		when(defaultValue.getDate()).thenReturn(DEFAULT_VALUE_CALENDAR);
+		return getPropertyDef(name, PropertyType.DATE, new String[]{CONSTRAINT_DATE}, new Value[] {defaultValue});
+	}
+
+	public PropertyDefinition getCompleteDoublePropertyDef(String name) throws ValueFormatException, IllegalStateException, RepositoryException {
+		Value defaultValue = mock(Value.class);
+		when(defaultValue.getDouble()).thenReturn(DEFAULT_VALUE_DOUBLE);
+		return getPropertyDef(name, PropertyType.DOUBLE, new String[]{CONSTRAINT_DOUBLE}, new Value[] {defaultValue});
+	}
+	
+	public PropertyDefinition getCompleteLongPropertyDef(String name) throws ValueFormatException, IllegalStateException, RepositoryException {
+		Value defaultValue = mock(Value.class);
+		when(defaultValue.getLong()).thenReturn(DEFAULT_VALUE_LONG);
+		return getPropertyDef(name, PropertyType.LONG, new String[]{CONSTRAINT_LONG}, new Value[] {defaultValue});
+	}
+	
+	public PropertyDefinition getCompleteBooleanPropertyDef(String name) throws ValueFormatException, IllegalStateException, RepositoryException {
+		Value defaultValue = mock(Value.class);
+		when(defaultValue.getBoolean()).thenReturn(DEFAULT_VALUE_BOOLEAN);
+		return getPropertyDef(name, PropertyType.BOOLEAN, new String[]{CONSTRAINT_BOOLEAN}, new Value[] {defaultValue});
+	}
+	
+	public PropertyDefinition getCompleteNamePropertyDef(String name) throws ValueFormatException, IllegalStateException, RepositoryException {
+		Value defaultValue = mock(Value.class);
+		when(defaultValue.getString()).thenReturn(DEFAULT_VALUE_NAME);
+		return getPropertyDef(name, PropertyType.NAME, new String[]{CONSTRAINT_NAME}, new Value[] {defaultValue});
+	}
+	
+	public PropertyDefinition getCompletePathPropertyDef(String name) throws ValueFormatException, IllegalStateException, RepositoryException {
+		Value defaultValue = mock(Value.class);
+		when(defaultValue.getString()).thenReturn(DEFAULT_VALUE_PATH);
+		return getPropertyDef(name, PropertyType.PATH, new String[]{CONSTRAINT_PATH}, new Value[] {defaultValue});
+	}
+	
+	public PropertyDefinition getCompleteReferencePropertyDef(String name) throws ValueFormatException, IllegalStateException, RepositoryException {
+		Value defaultValue = mock(Value.class);
+		when(defaultValue.getString()).thenReturn(DEFAULT_VALUE_REFERENCE);
+		return getPropertyDef(name, PropertyType.REFERENCE, new String[]{CONSTRAINT_REFERENCE}, new Value[] {defaultValue});
+	}
+	
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/java/de/sandroboehme/jsnodetypes/test/JSONAssert.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/java/de/sandroboehme/jsnodetypes/test/JSONAssert.java?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/java/de/sandroboehme/jsnodetypes/test/JSONAssert.java (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/java/de/sandroboehme/jsnodetypes/test/JSONAssert.java Mon Feb 16 18:14:21 2015
@@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package de.sandroboehme.jsnodetypes.test;
+
+import java.util.Iterator;
+
+import org.apache.sling.commons.json.JSONArray;
+import org.apache.sling.commons.json.JSONException;
+import org.apache.sling.commons.json.JSONObject;
+import org.junit.Assert;
+
+/**
+ * Provides assertions on equality for JSON Arrays and Objects.
+ *
+ * This class is copied from org.apache.sling.commons.json.test.JSONAssert.
+ * This code in turn was based on code written by Andres Almiray <aa...@users.sourceforge.net> as
+ * part of the json-lib project - http://json-lib.sourceforge.net/
+ * 
+ * TODO: It should be made reusable in some way or the other. 
+ */
+public class JSONAssert extends Assert {
+	/**
+	 * Asserts that two JSONArrays are equal.
+	 */
+	public static void assertEquals(JSONArray expected, JSONArray actual)
+			throws JSONException {
+		assertEquals(null, expected, actual);
+	}
+
+	/**
+	 * Asserts that two JSONObjects are equal.
+	 */
+	public static void assertEquals(JSONObject expected, JSONObject actual)
+			throws JSONException {
+		assertEquals(null, expected, actual);
+	}
+
+	/**
+	 * Asserts that two JSONArrays are equal.
+	 */
+	public static void assertEquals(String message, JSONArray expected,
+			JSONArray actual) throws JSONException {
+		String header = message == null ? "" : message + ": ";
+		if (expected == null) {
+			fail(header + "expected array was null");
+		}
+		if (actual == null) {
+			fail(header + "actual array was null");
+		}
+		if (expected == actual || expected.equals(actual)) {
+			return;
+		}
+		if (actual.length() != expected.length()) {
+			fail(header + "arrays sizes differed, expected.length()="
+					+ expected.length() + " actual.length()=" + actual.length());
+		}
+
+		int max = expected.length();
+		for (int i = 0; i < max; i++) {
+			Object o1 = expected.get(i);
+			Object o2 = actual.get(i);
+
+			// handle nulls
+			if (JSONObject.NULL.equals(o1)) {
+				if (JSONObject.NULL.equals(o2)) {
+					continue;
+                }
+				fail(header + "arrays first differed at element [" + i
+						+ "];");
+			} else {
+				if (JSONObject.NULL.equals(o2)) {
+					fail(header + "arrays first differed at element [" + i
+							+ "];");
+				}
+			}
+
+			if (o1 instanceof JSONArray && o2 instanceof JSONArray) {
+				JSONArray e = (JSONArray) o1;
+				JSONArray a = (JSONArray) o2;
+				assertEquals(header + "arrays first differed at element " + i
+						+ ";", e, a);
+			} else if (o1 instanceof JSONObject && o2 instanceof JSONObject) {
+				assertEquals(header + "arrays first differed at element [" + i
+						+ "];", (JSONObject) o1, (JSONObject) o2);
+			} else if (o1 instanceof String) {
+				assertEquals(header + "arrays first differed at element [" + i
+						+ "];", (String) o1, String.valueOf(o2));
+			} else if (o2 instanceof String) {
+				assertEquals(header + "arrays first differed at element [" + i
+						+ "];", String.valueOf(o1), (String) o2);
+			} else {
+				assertEquals(header + "arrays first differed at element [" + i
+						+ "];", o1, o2);
+			}
+		}
+	}
+
+	/**
+	 * Asserts that two JSONObjects are equal.
+	 */
+	public static void assertEquals(String message, JSONObject expected,
+			JSONObject actual) throws JSONException {
+		String header = message == null ? "" : message + ": ";
+		if (expected == null) {
+			fail(header + "expected object was null");
+		}
+		if (actual == null) {
+			fail(header + "actual object was null");
+		}
+		if (expected == actual /* || expected.equals( actual ) */) {
+			return;
+		}
+
+		JSONArray expectedNames = expected.names();
+		JSONArray actualNames = actual.names();
+
+		if (expectedNames == null && actualNames == null) {
+			return;
+		}
+
+		if (expectedNames == null) {
+		    expectedNames = new JSONArray();
+		}
+
+		if (actualNames == null) {
+		    actualNames = new JSONArray();
+		}
+
+		assertEquals(header
+				+ "names sizes differed, expected.names().length()="
+				+ expectedNames.length() + " actual.names().length()="
+				+ actualNames.length(), expectedNames.length(), actualNames
+				.length());
+		for (Iterator<String> keys = expected.keys(); keys.hasNext();) {
+			String key = keys.next();
+			Object o1 = expected.opt(key);
+			Object o2 = actual.opt(key);
+
+			if (JSONObject.NULL.equals(o1)) {
+				if (JSONObject.NULL.equals(o2)) {
+					continue;
+                }
+				fail(header + "objects differed at key [" + key + "];");
+			} else {
+				if (JSONObject.NULL.equals(o2)) {
+					fail(header + "objects differed at key [" + key + "];");
+				}
+			}
+
+			if (o1 instanceof JSONObject && o2 instanceof JSONObject) {
+				assertEquals(header + "objects differed at key [" + key + "];",
+						(JSONObject) o1, (JSONObject) o2);
+			} else if (o1 instanceof JSONArray && o2 instanceof JSONArray) {
+				assertEquals(header + "objects differed at key [" + key + "];",
+						(JSONArray) o1, (JSONArray) o2);
+			} else if (o1 instanceof String) {
+				assertEquals(header + "objects differed at key [" + key + "];",
+						(String) o1, String.valueOf(o2));
+			} else if (o2 instanceof String) {
+				assertEquals(header + "objects differed at key [" + key + "];",
+						String.valueOf(o1), (String) o2);
+			} else {
+				assertEquals(header + "objects differed at key [" + key + "];",
+						o1, o2);
+			}
+		}
+	}
+
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/javascript/NodeTypesSpec.js
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/javascript/NodeTypesSpec.js?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/javascript/NodeTypesSpec.js (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/javascript/NodeTypesSpec.js Mon Feb 16 18:14:21 2015
@@ -0,0 +1,1129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+describe('The Node Type Manager', function() {
+
+	// The documentation about the spec format can be found here:
+	// http://pivotal.github.com/jasmine/
+	var defaultNTJsonURL = "src/defaultNT/defaultNT.json";
+	
+	function compareItemDefitions(actualItemDefinitions, expectedItemDefinitions){
+		expect(actualItemDefinitions.autoCreated).toEqual(expectedItemDefinitions.autoCreated);
+		expect(actualItemDefinitions.mandatory).toEqual(expectedItemDefinitions.mandatory);
+		expect(actualItemDefinitions.protected).toEqual(expectedItemDefinitions.protected);
+		expect(actualItemDefinitions.onParentVersion).toEqual(expectedItemDefinitions.onParentVersion);
+	}
+	
+	function compareNodeTypeProperties(actualNodeType, expectedNodeType){
+		expect(actualNodeType.mixin).toBe(expectedNodeType.mixin);
+		expect(actualNodeType.orderableChildNodes).toBe(expectedNodeType.orderableChildNodes);
+		expect(actualNodeType.declaredSupertypes).toEqual(expectedNodeType.declaredSupertypes);
+	}
+	
+	function comparePropertyDefProperties(actualPropertyDefs, expectedPropertyDefs){
+		expect(actualPropertyDefs.defaultValues).toEqual(expectedPropertyDefs.defaultValues);
+		expect(actualPropertyDefs.valueConstraints).toEqual(expectedPropertyDefs.valueConstraints);
+		expect(actualPropertyDefs.requiredType).toEqual(expectedPropertyDefs.requiredType);
+		expect(actualPropertyDefs.multiple).toEqual(expectedPropertyDefs.multiple);
+	}
+
+	function compareChildNodeDefProperties(actualChildNodeDefs, expectedChildNodeDefs){
+		expect(actualChildNodeDefs.allowsSameNameSiblings).toEqual(expectedChildNodeDefs.allowsSameNameSiblings);
+		expect(actualChildNodeDefs.defaultPrimaryType).toEqual(expectedChildNodeDefs.defaultPrimaryType);
+		expect(actualChildNodeDefs.requiredPrimaryTypes).toEqual(expectedChildNodeDefs.requiredPrimaryTypes);
+	}
+
+	it('returns the node type names.', function() {
+		var settings = {
+				"defaultNTJsonURL": defaultNTJsonURL,
+				"nodeTypesJson" : {
+					"nt:base" : {
+					},
+					"n1" : {
+					},"n2" : {
+					},"n3" : {
+					},"n4" : {
+				}} 
+		};
+		var ntManager = new de.sandroboehme.NodeTypeManager(settings);
+		expect(ntManager.getNodeTypeNames()).toEqual(["nt:base","n1","n2","n3","n4"]);
+	});
+
+	it('returns the specified node type.', function() {
+		var settings = {
+				"defaultNTJsonURL": defaultNTJsonURL,
+				"nodeTypesJson" : {
+					"nt:base" : {
+					},
+					"aNodeType" : {
+				}} 
+		};
+		var ntManager = new de.sandroboehme.NodeTypeManager(settings);
+		expect(ntManager.getNodeType("aNodeType")).toEqual(settings.nodeTypesJson["aNodeType"]);
+	});
+	
+	describe('collects', function () {
+		var ntManager;
+
+		describe('all child node definitions from the super types ', function () {
+			
+			function arrayContainsCnDefWithName(array, cnDefName){
+				var found = false;
+				for (var i=0; i<array.length && found===false; i++){
+					found = array[i].name === cnDefName;
+				}
+				return found;
+			}
+			
+			it('with <getAllChildNodeDefinitions()>.', function() {
+				var settings = {
+						"defaultNTJsonURL": defaultNTJsonURL,
+						"nodeTypesJson" : {"aNodeType" : {
+							"declaredSupertypes" : [ "aParentNodeType", "aMixinParentNodeType" ],
+							"declaredChildNodeDefinitions" : [{
+									"name" : "childNodeDef1"
+								},{
+									"name" : "childNodeDef2"} 
+								]
+						},"aParentNodeType" : {
+							"declaredSupertypes" : [ "aGrandParentNodeType" ],
+							"declaredChildNodeDefinitions" : [{
+									"name" : "childNodeDef3"
+								},{
+									"name" : "childNodeDef4"} 
+								]
+						},"aMixinParentNodeType" : {
+							"declaredChildNodeDefinitions" : [{
+									"name" : "childNodeDef5"
+								},{
+									"name" : "childNodeDef6"} 
+								]
+						},"aGrandParentNodeType" : {
+							"declaredChildNodeDefinitions" : [{
+									"name" : "childNodeDef7"
+								},{
+									"name" : "childNodeDef8"} 
+								]
+						},"nt:base" : {
+							"declaredSupertypes" : []
+						}} 
+				};
+				ntManager = new de.sandroboehme.NodeTypeManager(settings);
+				var resultingChildNodeDefs = ntManager.getNodeType("aNodeType").getAllChildNodeDefinitions();
+				expect(resultingChildNodeDefs.length).toBe(8);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef1")).toBe(true);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef2")).toBe(true);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef3")).toBe(true);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef4")).toBe(true);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef5")).toBe(true);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef6")).toBe(true);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef7")).toBe(true);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef8")).toBe(true);
+			});
+			
+			it('with <getAllChildNodeDefinitions()> but does not contain duplicate entries from the parents.', function() {
+				var settings = {
+						"defaultNTJsonURL": defaultNTJsonURL,
+						"nodeTypesJson" : {"aNodeType" : {
+							"declaredSupertypes" : [ "aParentNodeType" ],
+							"declaredChildNodeDefinitions" : [{
+									"name" : "childNodeDef1"
+								},{
+									"name" : "childNodeDef2"} 
+								]
+						},"aParentNodeType" : {
+							"declaredChildNodeDefinitions" : [{
+									"name" : "childNodeDef1"
+								},{
+									"name" : "childNodeDef2"} 
+								]
+						},"nt:base" : {
+						}
+					} 
+				};
+				ntManager = new de.sandroboehme.NodeTypeManager(settings);
+				var resultingChildNodeDefs = ntManager.getNodeType("aNodeType").getAllChildNodeDefinitions();
+				expect(resultingChildNodeDefs.length).toBe(2);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef1")).toBe(true);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef2")).toBe(true);
+			});
+			
+			it('with <getAllChildNodeDefinitions()> and lists child node definitions with the same name but different content.', function() {
+				var settings = {
+						"defaultNTJsonURL": defaultNTJsonURL,
+						"nodeTypesJson" : {"aNodeType" : {
+							"declaredSupertypes" : [ "aParentNodeType" ],
+							"declaredChildNodeDefinitions" : [{
+									"name" : "childNodeDef1",
+							        "requiredPrimaryTypes": [
+							            "aNodeType"
+		                            ],
+								},{
+									"name" : "childNodeDef2"
+								} 
+							]
+						},"aParentNodeType" : {
+							"declaredSupertypes" : [ "aGrandParentNodeType" ],
+							"declaredChildNodeDefinitions" : [{
+									"name" : "childNodeDef1"
+								},{
+									"name" : "childNodeDef2"
+								} 
+							]
+						},"aGrandParentNodeType" : {
+							"declaredChildNodeDefinitions" : [{
+									"name" : "childNodeDef1"
+								}
+							]
+						},"nt:base" : {
+							"declaredSupertypes" : []
+						}} 
+				};
+				ntManager = new de.sandroboehme.NodeTypeManager(settings);
+				var resultingChildNodeDefs = ntManager.getNodeType("aNodeType").getAllChildNodeDefinitions();
+				
+				expect(resultingChildNodeDefs.length).toBe(3);
+				
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef1")).toBe(true);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef2")).toBe(true);
+			});
+			
+			it('with <getAllChildNodeDefinitions()> but does not follow circular dependencies.', function() {
+				var settings = {
+						"defaultNTJsonURL": defaultNTJsonURL,
+						"nodeTypesJson" : {"aNodeType" : {
+							"declaredSupertypes" : [ "aParentNodeType", "aMixinParentNodeType" ],
+							"declaredChildNodeDefinitions" : [{
+									"name" : "childNodeDef1"
+								},{
+									"name" : "childNodeDef2"} 
+								]
+						},"aParentNodeType" : {
+							"declaredChildNodeDefinitions" : [{
+									"name" : "childNodeDef3"
+								},{
+									"name" : "childNodeDef4"} 
+								]
+						},"aMixinParentNodeType" : {
+							//this creates a circular dependency
+							"declaredSupertypes" : [ "aNodeType" ],
+							"declaredChildNodeDefinitions" : [{
+									"name" : "childNodeDef5"
+								},{
+									"name" : "childNodeDef6"} 
+								]
+						},"nt:base" : {
+							"declaredSupertypes" : []
+						}} 
+				};
+				ntManager = new de.sandroboehme.NodeTypeManager(settings);
+	
+				var resultingChildNodeDefs = ntManager.getNodeType("aNodeType").getAllChildNodeDefinitions();
+				expect(resultingChildNodeDefs.length).toBe(6);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef1")).toBe(true);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef2")).toBe(true);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef3")).toBe(true);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef4")).toBe(true);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef5")).toBe(true);
+				expect(arrayContainsCnDefWithName(resultingChildNodeDefs, "childNodeDef6")).toBe(true);
+			});
+		});
+	
+		describe('all property definitions from the super types', function () {
+			
+			function arrayContainsPropDefWithName(array, propDefName){
+				var found = false;
+				for (var i=0; i<array.length && found===false; i++){
+					found = array[i].name === propDefName;
+				}
+				return found;
+			}
+			
+			it('with <getAllPropertyDefinitions()>', function() {
+				var settings = {
+						"defaultNTJsonURL": defaultNTJsonURL,
+						"nodeTypesJson" : {"aNodeType" : {
+							"declaredSupertypes" : [ "aParentNodeType", "aMixinParentNodeType" ],
+							"declaredPropertyDefinitions" : [{
+									"name" : "propertyDef1"
+								},{
+									"name" : "propertyDef2"} 
+								]
+						},"aParentNodeType" : {
+							"declaredSupertypes" : [ "aGrandParentNodeType" ],
+							"declaredPropertyDefinitions" : [{
+									"name" : "propertyDef3"
+								},{
+									"name" : "propertyDef4"} 
+								]
+						},"aMixinParentNodeType" : {
+							"declaredPropertyDefinitions" : [{
+									"name" : "propertyDef5"
+								},{
+									"name" : "propertyDef6"} 
+								]
+						},"aGrandParentNodeType" : {
+							"declaredPropertyDefinitions" : [{
+									"name" : "propertyDef7"
+								},{
+									"name" : "propertyDef8"} 
+								]
+						},"nt:base" : {
+							"declaredSupertypes" : []
+						}}
+				};
+				ntManager = new de.sandroboehme.NodeTypeManager(settings);
+				var resultingPropertyDefs = ntManager.getNodeType("aNodeType").getAllPropertyDefinitions();
+				expect(resultingPropertyDefs.length).toBe(8);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef1")).toBe(true);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef2")).toBe(true);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef3")).toBe(true);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef4")).toBe(true);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef5")).toBe(true);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef6")).toBe(true);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef7")).toBe(true);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef8")).toBe(true);
+			});
+			
+			it('with <getAllPropertyDefinitions()> but does not contain duplicate entries from the parents.', function() {
+				var settings = {
+						"defaultNTJsonURL": defaultNTJsonURL,
+						"nodeTypesJson" : {"aNodeType" : {
+							"declaredSupertypes" : [ "aParentNodeType" ],
+							"declaredPropertyDefinitions" : [{
+									"name" : "propertyDef1"
+								},{
+									"name" : "propertyDef2"} 
+								]
+						},"aParentNodeType" : {
+							"declaredSupertypes" : [ "aGrandParentNodeType" ],
+							"declaredPropertyDefinitions" : [{
+								"name" : "propertyDef1"
+							},{
+								"name" : "propertyDef2"} 
+								]
+						},"aGrandParentNodeType" : {
+							"declaredPropertyDefinitions" : [{
+								"name" : "propertyDef1"
+							},{
+								"name" : "propertyDef2"} 
+								]
+						},"nt:base" : {
+							"declaredSupertypes" : []
+						}}
+				};
+				ntManager = new de.sandroboehme.NodeTypeManager(settings);
+				var resultingPropertyDefs = ntManager.getNodeType("aNodeType").getAllPropertyDefinitions();
+				expect(resultingPropertyDefs.length).toBe(2);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef1")).toBe(true);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef2")).toBe(true);
+			});
+			
+			it('with <getAllPropertyDefinitions()>  and lists property definitions with the same name but different content.', function() {
+				var settings = {
+						"defaultNTJsonURL": defaultNTJsonURL,
+						"nodeTypesJson" : {"aNodeType" : {
+							"declaredSupertypes" : [ "aParentNodeType" ],
+							"declaredPropertyDefinitions" : [{
+								"name" : "propertyDef1",
+								"multiple": true
+								},{
+								"name" : "propertyDef2",
+								"multiple": true
+								} 
+							]
+						},"aParentNodeType" : {
+							"declaredSupertypes" : [ "aGrandParentNodeType" ],
+							"declaredPropertyDefinitions" : [{
+								"name" : "propertyDef1"
+								},{
+								"name" : "propertyDef2",
+								"multiple": true
+								} 
+							]
+						},"aGrandParentNodeType" : {
+							"declaredSupertypes" : [ "aGrandGrandParentNodeType" ],
+							"declaredPropertyDefinitions" : [{
+								"name" : "propertyDef1",
+						        "valueConstraints": [
+						          "nt:versionHistory"
+						        ],
+								},{
+								"name" : "propertyDef2",
+								"multiple": true
+								} 
+							]
+						},"aGrandGrandParentNodeType" : {
+							"declaredPropertyDefinitions" : [{
+								"name" : "propertyDef1",
+								"defaultValues": [{
+									"name": "nt:base",
+									"type": "Name"
+                                }],
+								},{
+								"name" : "propertyDef2",
+								"multiple": true
+								} 
+							]
+						},"nt:base" : {
+							"declaredSupertypes" : []
+						}}
+				};
+				ntManager = new de.sandroboehme.NodeTypeManager(settings);
+				var resultingPropertyDefs = ntManager.getNodeType("aNodeType").getAllPropertyDefinitions();
+				expect(resultingPropertyDefs.length).toBe(5);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef1")).toBe(true);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef2")).toBe(true);
+			});
+			
+			it('with <getAllPropertyDefinitions()> but does not follow circular dependencies.', function() {
+				var settings = {
+						"defaultNTJsonURL": defaultNTJsonURL,
+						"nodeTypesJson" : {"aNodeType" : {
+							"declaredSupertypes" : [ "aParentNodeType", "aMixinParentNodeType" ],
+							"declaredPropertyDefinitions" : [{
+									"name" : "propertyDef1"
+								},{
+									"name" : "propertyDef2"} 
+								]
+						},"aParentNodeType" : {
+							"declaredPropertyDefinitions" : [{
+									"name" : "propertyDef3"
+								},{
+									"name" : "propertyDef4"} 
+								]
+						},"aMixinParentNodeType" : {
+							// this supertype should not create a circular dependency
+							"declaredSupertypes" : [ "aNodeType" ],
+							"declaredPropertyDefinitions" : [{
+									"name" : "propertyDef5"
+								},{
+									"name" : "propertyDef6"} 
+								]
+						},"nt:base" : {
+							"declaredSupertypes" : []
+						}}
+				};
+				ntManager = new de.sandroboehme.NodeTypeManager(settings);
+				var resultingPropertyDefs = ntManager.getNodeType("aNodeType").getAllPropertyDefinitions();
+				expect(resultingPropertyDefs.length).toBe(6);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef1")).toBe(true);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef2")).toBe(true);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef3")).toBe(true);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef4")).toBe(true);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef5")).toBe(true);
+				expect(arrayContainsPropDefWithName(resultingPropertyDefs, "propertyDef6")).toBe(true);
+			});
+
+		});
+	});
+	
+	describe('recognizes the default settings', function () {
+		var settings = {
+				"defaultNTJsonURL": defaultNTJsonURL,
+				"nodeTypesJson" : {
+					"nt": {
+					    "declaredPropertyDefinitions": [{"name": "propertyDef1"}, {"name": "propertyDef2"}],
+					    "declaredChildNodeDefinitions": [{"name": "childNodeDef1"}, {"name": "childNodeDef2"}],
+					},
+					"nt:base" : {
+					}
+				} 
+		};
+		var ntManager = new de.sandroboehme.NodeTypeManager(settings);
+		
+		it('for the properties at the node type level', function() {
+			compareNodeTypeProperties(ntManager.getNodeType("nt"), ntManager.internalGetDefaultNodeType())
+		});
+		
+		describe('for the properties at the property definition level', function() {
+			it('that do inherit from item definition', function() {
+				comparePropertyDefProperties(ntManager.getNodeType("nt").getAllPropertyDefinitions(), ntManager.internalGetDefaultNodeType().declaredPropertyDefinitions);
+			});
+			it('that don\'t inherit from item definition', function() {
+				compareItemDefitions(ntManager.getNodeType("nt").getAllPropertyDefinitions(), ntManager.internalGetDefaultNodeType().declaredPropertyDefinitions);
+			});
+		});
+		
+		describe('for the properties at the child node definition level', function() {
+			ntManager = new de.sandroboehme.NodeTypeManager(settings);
+			it('that do inherit from item definition', function() {
+				compareChildNodeDefProperties(ntManager.getNodeType("nt").getAllChildNodeDefinitions(), ntManager.internalGetDefaultNodeType().declaredChildNodeDefinitions);
+			});
+	        
+			it('that don\'t inherit from item definition', function() {
+				compareItemDefitions(ntManager.getNodeType("nt").getAllChildNodeDefinitions(), ntManager.internalGetDefaultNodeType().declaredChildNodeDefinitions);
+			});
+		});		
+	});
+	
+	describe('overwrites the default settings', function () {
+		var settings = {
+				"defaultNTJsonURL": defaultNTJsonURL,
+				"nodeTypesJson" : {
+					"nt": {
+					    "mixin": true,
+					    "orderableChildNodes": true,
+					    "declaredSupertypes": [
+					      "otherNodeType"
+					    ],
+					    "declaredPropertyDefinitions": [
+					      {
+					        "defaultValues":  [{
+								"string": "a default value",
+								"type": "String"
+                            }],
+					        "valueConstraints": ["banana","apple"],
+					        "requiredType": "String",
+					        "multiple": true,
+					        
+					        "autoCreated": true,
+					        "mandatory": true,
+					        "protected": true,
+					        "onParentVersion": "VERSION"
+					      }
+					    ],
+					    "declaredChildNodeDefinitions": [
+					      {
+					        "allowsSameNameSiblings": true,
+					        "defaultPrimaryType": "otherNodeType",
+					        "requiredPrimaryTypes": [
+					          "otherNodeType"
+					        ],
+					        
+					        "autoCreated": true,
+					        "mandatory": true,
+					        "protected": true,
+					        "onParentVersion": "VERSION"
+					      }
+					    ]
+					  },
+					"nt:base" : {
+					},
+					"otherNodeType" : {
+						
+					}
+			} 
+		};
+		var ntManager = new de.sandroboehme.NodeTypeManager(settings);
+
+		it('for the properties at the node type level', function() {
+			compareNodeTypeProperties(ntManager.getNodeType("nt"), settings.nodeTypesJson.nt)
+		});
+		
+		describe('for the properties at the property definition level', function() {
+			it('that do inherit from item definition', function() {
+				comparePropertyDefProperties(ntManager.getNodeType("nt").getAllPropertyDefinitions(), settings.nodeTypesJson.nt.declaredPropertyDefinitions);
+			});
+			it('that don\'t inherit from item definition', function() {
+				compareItemDefitions(ntManager.getNodeType("nt").getAllPropertyDefinitions(), settings.nodeTypesJson.nt.declaredPropertyDefinitions);
+			});
+		});
+		
+		describe('for the properties at the child node definition level', function() {
+			it('that do inherit from item definition', function() {
+				compareChildNodeDefProperties(ntManager.getNodeType("nt").getAllChildNodeDefinitions(), settings.nodeTypesJson.nt.declaredChildNodeDefinitions);
+			});
+	        
+			it('that don\'t inherit from item definition', function() {
+				compareItemDefitions(ntManager.getNodeType("nt").getAllChildNodeDefinitions(), settings.nodeTypesJson.nt.declaredChildNodeDefinitions);
+			});
+		});			
+	});
+
+	describe('returns in getApplicableCnTypesPerCnDef()', function () {
+		/* adding a keySize function to Object */
+		if (typeof Object.keySize === "undefined") {
+			Object.keySize = function(obj) {
+			    var keySize = 0, key;
+			    for (key in obj) {
+			        if (obj.hasOwnProperty(key)) keySize++;
+			    }
+			    return keySize;
+			};
+		}
+		describe('all valid child node types', function () {
+			var settings = {
+					"defaultNTJsonURL": defaultNTJsonURL,
+					"nodeTypesJson" : {
+						"nt:base" : {
+						},
+						"aSuperType" : {
+						    "declaredChildNodeDefinitions": [
+						     {
+						    	 "requiredPrimaryTypes": [
+						    	     "supCnDef1"
+						    	 ],
+						      	 "name" : "supCnDef1Name"
+						      },
+						      {
+							     "requiredPrimaryTypes": [
+		  					  		"supCnDef3",
+							  		"supCnDef2"
+							     ],
+							     "name" : "*"
+							  }
+						    ]
+						},
+						"mix:supSupCnDef1" : {
+						    "mixin": true
+						},
+						"mix:supSupCnDef2" : {
+						    "mixin": true
+						},
+						"supCnDef1" : {
+						    "declaredSupertypes": [
+						  		"mix:supSupCnDef1",
+						  		"mix:supSupCnDef2"
+						  	]
+						},
+						"supCnDef1Sub1" : {
+						    "declaredSupertypes": [
+						  		"supCnDef1"
+						  	]
+						},
+						"supCnDef1Sub11" : {
+						    "declaredSupertypes": [
+						  		"supCnDef1Sub1"
+						  	]
+						},
+						"supCnDef2": {
+						},
+						"supCnDef2Sub1" : {
+						    "declaredSupertypes": [
+						  		"supCnDef2"
+						  	]
+						},
+						"supCnDef2Sub11" : {
+						    "declaredSupertypes": [
+						  		"supCnDef2Sub1"
+						  	]
+						},
+						"supCnDef2Mixin" : {
+						    "declaredSupertypes": [
+						  		"supCnDef2Sub11"
+						  	],
+						  	"mixin": true
+						},
+						"supCnDef3": {
+						},
+						"supCnDef3Def2" : {
+						    "declaredSupertypes": [
+						  		"supCnDef3",
+						  		"supCnDef2"
+						  	]
+						},
+						"aNodeType" : {
+						    "declaredSupertypes": [
+						        "aSuperType"
+	 					    ],
+	 					    "declaredChildNodeDefinitions": [
+						     {
+						    	 "requiredPrimaryTypes": [
+						    	     "cnDef1"
+						    	 ],
+						      	 "name" : "cnDef1Name"
+						      },
+						      {
+							     "requiredPrimaryTypes": [
+							          "cnDef2"
+							     ],
+							     "name" : "cnDef2Name"
+						      },
+						      {
+							     "requiredPrimaryTypes": [
+							          "cnDef3"
+							     ],
+							     "name" : "*"
+								  
+						      },
+						      {
+							     "requiredPrimaryTypes": [
+							          "cnDef4",
+							          "cnDef5"
+							     ],
+							     "name" : "*"
+						      }
+						    ]
+						},
+						"cnDef1" : {
+						},
+						"cnDef2" : {
+						},
+						"cnDef2Sub1" : {
+						    "declaredSupertypes": [
+						        "cnDef2"
+						  	]
+						},
+						"cnDef2Sub11" : {
+						    "declaredSupertypes": [
+						        "cnDef2Sub1"
+						  	]
+						},
+						"cnDef2Sub2" : {
+						    "declaredSupertypes": [
+						        "cnDef2"
+						  	]
+						},
+						"cnDef3" : {
+						},
+						"cnDef4" : {
+						},
+						"cnDef5" : {
+						    "declaredSupertypes": [
+						  		"cnDef2Sub2"
+						  	]
+						},
+						"cnDef4Sub1" : {
+						    "declaredSupertypes": [
+						  		"cnDef4"
+						  	]
+						},
+						"cnDef4Sub11" : {
+						    "declaredSupertypes": [
+						  		"cnDef4Sub1"
+						  	]
+						},
+						"cnDef4Sub2" : {
+						    "declaredSupertypes": [
+						  		"cnDef4"
+						  	]
+						},
+						"cnDef5Sub1" : {
+						    "declaredSupertypes": [
+						  		"cnDef5"
+						  	]
+						},
+						"cnDef5Sub2" : {
+						    "declaredSupertypes": [
+						  		"cnDef5",
+						  		"cnDef2Sub2"
+						  	]
+						},
+						"CnDef2Mixin" : {
+						    "declaredSupertypes": [
+						  		"cnDef5Sub2"
+						  	],
+						  	"mixin": true
+						},
+						"cnDef45" : {
+						    "declaredSupertypes": [
+						  		"cnDef4Sub11",
+						  		"cnDef5Sub2"
+						  	]
+						},
+						"cnDef45Sub1" : {
+						    "declaredSupertypes": [
+						  		"cnDef45"
+						  	]
+						}
+					}
+			};
+	
+			// see "/src/test/resources/applicableChildNodeTypesDatastructure.jpg" for a
+			// visualization of the test datastructure
+			
+			var ntManager = new de.sandroboehme.NodeTypeManager(settings);
+			var applicableCnTypes = ntManager.getNodeType("aNodeType").getApplicableCnTypesPerCnDef();
+	
+			it('generally', function() {
+				expect(applicableCnTypes!=null).toBe(true);
+				expect(applicableCnTypes).toBeDefined();
+				
+				expect(applicableCnTypes["cnDef1Name"]).toBeDefined();
+				expect(Object.keySize(applicableCnTypes["cnDef1Name"])).toBe(1);
+				expect(applicableCnTypes["cnDef1Name"]["cnDef1"]).toBeDefined();
+	
+				expect(applicableCnTypes["cnDef2Name"]).toBeDefined();
+				expect(Object.keySize(applicableCnTypes["cnDef2Name"])).toBe(10);
+				expect(applicableCnTypes["cnDef2Name"]["cnDef2"]).toBeDefined();
+				expect(applicableCnTypes["cnDef2Name"]["cnDef2Sub1"]).toBeDefined();
+				expect(applicableCnTypes["cnDef2Name"]["cnDef2Sub11"]).toBeDefined();
+				expect(applicableCnTypes["cnDef2Name"]["cnDef2Sub2"]).toBeDefined();
+				expect(applicableCnTypes["cnDef2Name"]["cnDef5"]).toBeDefined();
+				expect(applicableCnTypes["cnDef2Name"]["cnDef5Sub1"]).toBeDefined();
+				expect(applicableCnTypes["cnDef2Name"]["cnDef5Sub2"]).toBeDefined();
+				expect(applicableCnTypes["cnDef2Name"]["cnDef45"]).toBeDefined();
+				expect(applicableCnTypes["cnDef2Name"]["cnDef45Sub1"]).toBeDefined();
+				expect(applicableCnTypes["cnDef2Name"]["CnDef2Mixin"]).toBeDefined();
+				
+				expect(applicableCnTypes["*"]).toBeDefined();
+				expect(Object.keySize(applicableCnTypes["*"])).toBe(4);
+				expect(applicableCnTypes["*"]["supCnDef3Def2"]).toBeDefined();
+				
+				expect(applicableCnTypes["*"]["cnDef3"]).toBeDefined();
+	
+				expect(applicableCnTypes["*"]["cnDef45"]).toBeDefined();
+				expect(applicableCnTypes["*"]["cnDef45Sub1"]).toBeDefined();
+	
+				expect(applicableCnTypes["supCnDef1Name"]).toBeDefined();
+				expect(Object.keySize(applicableCnTypes["supCnDef1Name"])).toBe(3);
+				expect(applicableCnTypes["supCnDef1Name"]["supCnDef1"]).toBeDefined();
+				expect(applicableCnTypes["supCnDef1Name"]["supCnDef1Sub1"]).toBeDefined();
+				expect(applicableCnTypes["supCnDef1Name"]["supCnDef1Sub11"]).toBeDefined();
+			});
+			
+			it('with multiple requiredPrimaryTypes', function() {
+				expect(applicableCnTypes["*"]).toBeDefined();
+				expect(applicableCnTypes["*"]["supCnDef3Def2"]).toBeDefined();
+				expect(applicableCnTypes["*"]["cnDef3"]).toBeDefined();			
+				expect(applicableCnTypes["*"]["cnDef45"]).toBeDefined();
+				expect(applicableCnTypes["*"]["cnDef45Sub1"]).toBeDefined();
+			});
+			
+			it('including all valid super types\' child node types and its subtypes with multiple requiredPrimaryTypes', function() {
+				expect(applicableCnTypes["supCnDef1Name"]).toBeDefined();
+				expect(applicableCnTypes["supCnDef1Name"]["supCnDef1Sub1"]).toBeDefined();
+				expect(applicableCnTypes["supCnDef1Name"]["supCnDef1Sub1"]).toBeDefined();
+				expect(applicableCnTypes["supCnDef1Name"]["supCnDef1Sub11"]).toBeDefined();
+				
+				expect(applicableCnTypes["*"]["supCnDef3Def2"]).toBeDefined();
+			});
+
+		});
+		describe('all node types', function () {
+			var settings = {
+					"defaultNTJsonURL": defaultNTJsonURL,
+					"nodeTypesJson" : {
+						"nt:base" : {
+						},
+						"aNodeType" : {
+	 					    "declaredChildNodeDefinitions": [
+						     {
+//						    	 no required primary types declared:
+						      	 "name" : "cnDef1Name"
+						      }
+						    ]
+						},
+						"nt1" : {
+						},
+						"nt2" : {
+						}
+					}
+			};
+	
+			var ntManager = new de.sandroboehme.NodeTypeManager(settings);
+			var applicableCnTypes = ntManager.getNodeType("aNodeType").getApplicableCnTypesPerCnDef();
+
+			it('if required primary types is \'nt:base\'', function() {
+				expect(applicableCnTypes!=null).toBe(true);
+				expect(applicableCnTypes["cnDef1Name"]).toBeDefined(true);
+				expect(applicableCnTypes["cnDef1Name"]["nt:base"]).toBeDefined(true);
+				expect(applicableCnTypes["cnDef1Name"]["aNodeType"]).toBeDefined(true);
+				expect(applicableCnTypes["cnDef1Name"]["nt1"]).toBeDefined(true);
+				expect(applicableCnTypes["cnDef1Name"]["nt2"]).toBeDefined(true);
+				expect(Object.keySize(applicableCnTypes["cnDef1Name"])).toBe(4);
+			});
+		});
+		it('the residual definition', function () {
+			var settings = {
+					"defaultNTJsonURL": defaultNTJsonURL,
+					"nodeTypesJson" : {
+						"nt:base" : {
+						},
+						"aNodeType" : {
+	 					    "declaredChildNodeDefinitions": [{
+   						    	 "requiredPrimaryTypes": [
+   						    	     "cnType1"
+   						    	 ],
+   						      	 "name" : "cnDef1Name"
+	   						 },{
+							     "requiredPrimaryTypes": [
+							    	  "cnType2"
+							     ],
+							     "name" : "*"
+							 }
+						    ]
+						},
+						"cnType1" : {
+						},
+						"cnType2" : {
+						}
+					}
+			};
+	
+			var ntManager = new de.sandroboehme.NodeTypeManager(settings);
+			var applicableCnTypes = ntManager.getNodeType("aNodeType").getApplicableCnTypesPerCnDef();
+
+			expect(applicableCnTypes!=null).toBe(true);
+			expect(applicableCnTypes["cnDef1Name"]).toBeDefined(true);
+			expect(applicableCnTypes["cnDef1Name"]["cnType1"]).toBeDefined(true);
+			expect(Object.keySize(applicableCnTypes["cnDef1Name"])).toBe(1);
+			
+			expect(applicableCnTypes["*"]["cnType2"]).toBeDefined(true);
+			expect(Object.keySize(applicableCnTypes["*"])).toBe(1);
+		});
+
+		it('the applicable mixin node types if \'true\' has been passed to the mixin parameter', function () {
+			var settings = {
+					"defaultNTJsonURL": defaultNTJsonURL,
+					"nodeTypesJson" : {
+						"nt:base" : {
+						},
+						"aNodeType" : {
+	 					    "declaredChildNodeDefinitions": [{
+  						    	 "requiredPrimaryTypes": [
+	   						    	     "cnType1"
+	   						    	 ],
+	   						      	 "name" : "cnDef1Name"
+		   						  },{
+	   						    	 "requiredPrimaryTypes": [
+	   						    	     "cnType2"
+	   						    	 ],
+	   						      	 "name" : "cnDef2Name"
+		   						 },{
+							     "requiredPrimaryTypes": [
+							    	  "cnType3"
+							     ],
+							     "name" : "*"
+							 }
+						    ]
+						},
+						"cnType1" : {
+						},
+						"cnType2" : {
+						    "mixin": true
+						},
+						"cnType3" : {
+							"mixin": true
+						}
+					}
+			};
+	
+			var ntManager = new de.sandroboehme.NodeTypeManager(settings);
+			var applicableCnTypesWithMixin = ntManager.getNodeType("aNodeType").getApplicableCnTypesPerCnDef(true);
+
+			expect(applicableCnTypesWithMixin!=null).toBe(true);
+			expect(applicableCnTypesWithMixin["cnDef1Name"]).toBeDefined(true);
+			expect(applicableCnTypesWithMixin["cnDef1Name"]["cnType1"]).toBeDefined(true);
+			expect(Object.keySize(applicableCnTypesWithMixin["cnDef1Name"])).toBe(1);
+			
+			expect(applicableCnTypesWithMixin["cnDef2Name"]).toBeDefined(true);
+			expect(applicableCnTypesWithMixin["cnDef2Name"]["cnType2"]).toBeDefined(true);
+			expect(Object.keySize(applicableCnTypesWithMixin["cnDef1Name"])).toBe(1);
+			
+			expect(applicableCnTypesWithMixin["*"]["cnType3"]).toBeDefined(true);
+			expect(Object.keySize(applicableCnTypesWithMixin["*"])).toBe(1);
+			
+
+			var applicableCnTypesWithoutMixin = ntManager.getNodeType("aNodeType").getApplicableCnTypesPerCnDef(false);
+
+			expect(applicableCnTypesWithoutMixin!=null).toBe(true);
+			expect(applicableCnTypesWithoutMixin["cnDef1Name"]).toBeDefined(true);
+			expect(applicableCnTypesWithoutMixin["cnDef1Name"]["cnType1"]).toBeDefined(true);
+			expect(Object.keySize(applicableCnTypesWithoutMixin["cnDef1Name"])).toBe(1);
+			
+			expect(applicableCnTypesWithoutMixin["cnDef2Name"]).toBeDefined(true);
+			expect(Object.keySize(applicableCnTypesWithoutMixin["cnDef2Name"])).toBe(0);
+
+			expect(applicableCnTypesWithoutMixin["*"]).toBeDefined(true);
+			expect(Object.keySize(applicableCnTypesWithoutMixin["*"])).toBe(0);
+		});
+	});
+
+	describe('checks in canAddChildNode()', function () {
+
+		var settings = {
+				"defaultNTJsonURL": defaultNTJsonURL,
+				"nodeTypesJson" : {
+					"ntResidualChild": {
+					    "declaredChildNodeDefinitions": [
+					      {
+					        "requiredPrimaryTypes": [
+					          "nt:base"
+					        ],
+					    	"name" : "*"
+					      }
+					    ]
+					  },
+					"ntNonResidualChild": {
+					    "declaredChildNodeDefinitions": [
+					      {
+					        "requiredPrimaryTypes": [
+					          "nt:base"
+					        ],
+					    	"name" : "aChildNodeDef1"
+					      }
+					    ]
+					  },
+					"ntNonResidualProtectedChild": {
+					    "declaredChildNodeDefinitions": [
+					      {
+					        "requiredPrimaryTypes": [
+					          "nt:base"
+					        ],
+					    	"name" : "aChildNodeDef2",
+					        "protected": true
+					      }
+					    ]
+					  },
+					"ntWithOtherChildNode": {
+					    "declaredChildNodeDefinitions": [
+					      {
+					        "requiredPrimaryTypes": [
+					          "otherNodeType"
+					        ],
+					    	"name" : "*"
+					      }
+					    ]
+					  },
+					"nt:base" : {
+					},
+					"otherNodeType" : {
+					},
+					"inheritedNodeType" : {
+					    "declaredSupertypes": [
+ 					      "otherNodeType"
+ 					    ]
+					},
+					"aNodeType" : {
+					    "declaredChildNodeDefinitions": [
+					      {
+					        "requiredPrimaryTypes": [
+					          "aChildNodeType"
+					        ],
+					    	"name" : "*"
+					      }
+					    ]
+					},
+					"aChildNodeType" : {
+					},
+					"aChildNodesSubtype" : {
+					    "declaredSupertypes": [
+ 					      "aChildNodeType"
+ 					    ]
+					}
+			}
+		};
+		var ntManager = new de.sandroboehme.NodeTypeManager(settings);
+		var ntBase = ntManager.getNodeType("nt:base");
+		var ntResidualChild = ntManager.getNodeType("ntResidualChild");
+		
+		describe('if the name is valid', function() {
+			it('for residual node names', function() {
+				expect(ntManager.getNodeType("ntResidualChild").canAddChildNode("childNodeDefName", ntBase)).toBe(true);
+			});
+			it('for non residual node names', function() {
+				expect(ntManager.getNodeType("ntNonResidualChild").canAddChildNode("aChildNodeDef1", ntBase)).toBe(true);
+				expect(ntManager.getNodeType("ntNonResidualChild").canAddChildNode("aChildNodeDefA", ntBase)).toBe(false);
+			});
+		});
+		it('if the destination is not protected', function() {
+			expect(ntManager.getNodeType("ntNonResidualProtectedChild").canAddChildNode("aChildNodeDef2", ntResidualChild)).toBe(false);
+		});
+		describe('if the type is valid', function() {
+			it('for direct types', function() {
+				var otherNodeType = ntManager.getNodeType("otherNodeType");
+				expect(ntManager.getNodeType("ntWithOtherChildNode").canAddChildNode("otherNodeType", otherNodeType)).toBe(true);
+				expect(ntManager.getNodeType("ntWithOtherChildNode").canAddChildNode("otherNodeType", ntBase)).toBe(false);
+			});
+			it('for an inherited type', function() {
+				var inheritedNodeType = ntManager.getNodeType("inheritedNodeType");
+				expect(ntManager.getNodeType("ntWithOtherChildNode").canAddChildNode("inheritedNodeType", inheritedNodeType)).toBe(true);
+				expect(ntManager.getNodeType("ntWithOtherChildNode").canAddChildNode("inheritedNodeType", ntBase)).toBe(false);
+			});
+			it('for subtype', function() {
+				var aChildNodeType = ntManager.getNodeType("aChildNodeType");
+				var aChildNodesSubtype = ntManager.getNodeType("aChildNodesSubtype");
+				expect(ntManager.getNodeType("aNodeType").canAddChildNode("aNodeName", aChildNodeType)).toBe(true);
+				expect(ntManager.getNodeType("aNodeType").canAddChildNode("aNodeName", aChildNodesSubtype)).toBe(true);
+			});
+		});
+	});
+
+	describe('checks in canAddProperty()', function () {
+
+		var settings = {
+				"defaultNTJsonURL": defaultNTJsonURL,
+				"nodeTypesJson" : {
+					"nt:base" : {
+					},
+					"aParentNodeType" : {
+						"declaredPropertyDefinitions" : [{
+							"name" : "propertyDef6",
+						    "requiredType": "Date"
+						},{
+							"name" : "propertyDef4",
+						    "requiredType": "Date",
+						    "protected": true
+						},{
+							"name" : "propertyDef5",
+						    "requiredType": "String"
+						},{
+							"name" : "*",
+						    "requiredType": "String"
+						},{
+							"name" : "propertyDef2",
+					        "requiredType": "undefined"
+						}]
+					},		
+					"aNodeType" : {
+						"declaredSupertypes" : [ "aParentNodeType" ],
+						"declaredPropertyDefinitions" : [{
+							"name" : "propertyDef1",
+				        	"requiredType": "String"
+						}]
+					}
+				}
+		};
+		
+		var ntManager = new de.sandroboehme.NodeTypeManager(settings);
+		
+		describe('if the name and type is applicable', function() {
+			it('for residual property names', function() {
+				expect(ntManager.getNodeType("aNodeType").canAddProperty("aPropertyDef", "String")).toBe(true);
+				expect(ntManager.getNodeType("aNodeType").canAddProperty("aPropertyDef", "Binary")).toBe(false);
+				expect(ntManager.getNodeType("aNodeType").canAddProperty("aPropertyDef", "Date")).toBe(false);
+			});
+			it('for undefined property types', function() {
+				expect(ntManager.getNodeType("aNodeType").canAddProperty("propertyDef2", "Binary")).toBe(true);
+				expect(ntManager.getNodeType("aNodeType").canAddProperty("propertyDef2", "Date")).toBe(true);
+				expect(ntManager.getNodeType("aNodeType").canAddProperty("propertyDef2", "String")).toBe(true);
+			});
+			it('for non residual property names', function() {
+				expect(ntManager.getNodeType("aNodeType").canAddProperty("propertyDef1", "String")).toBe(true);
+				expect(ntManager.getNodeType("aNodeType").canAddProperty("propertyDef1", "Binary")).toBe(false);
+			});
+			it('for properties of super types', function() {
+				expect(ntManager.getNodeType("aNodeType").canAddProperty("propertyDef5", "String")).toBe(true);
+				expect(ntManager.getNodeType("aNodeType").canAddProperty("propertyDef5", "Binary")).toBe(false);
+			});
+		});
+		it('if the type is case insensitive', function() {
+			expect(ntManager.getNodeType("aNodeType").canAddProperty("propertyDef1", "stRING")).toBe(true);
+		});
+		it('if the name and type is not applicable for protected properties', function() {
+			expect(ntManager.getNodeType("aNodeType").canAddProperty("propertyDef4", "Date")).toBe(false);
+		});
+		it('that residual property definitions are not applicable for non residual property types', function() {
+			expect(ntManager.getNodeType("aNodeType").canAddProperty("propertyDef6", "Date")).toBe(true);
+			expect(ntManager.getNodeType("aNodeType").canAddProperty("propertyDef6", "String")).toBe(false);
+		});
+	});
+	
+	function sameArrayContent(array1, array2){
+		expect(array1.length).toBe(array2.length); 
+		for (var i=0; i<array2.length; i++){
+			if (typeof array2[i] !== "undefined") {
+				expect(array1).toContain(array2[i]);
+			}
+		}
+	}
+
+});

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/applicableChildNodeTypesDatastructure.jpg
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/applicableChildNodeTypesDatastructure.jpg?rev=1660179&view=auto
==============================================================================
Binary file - no diff available.

Propchange: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/applicableChildNodeTypesDatastructure.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteBinaryPropertyDefinition.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteBinaryPropertyDefinition.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteBinaryPropertyDefinition.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteBinaryPropertyDefinition.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,24 @@
+{
+  "ntWithPropertyDefs": {
+    "declaredPropertyDefinitions": [
+      {
+        "defaultValues": [
+          {
+            "binary": "/ntName/stringPropertyDef/Binary/true/true/true/true/VERSION/0.default_binary_value.bin",
+            "type": "Binary"
+          }
+        ],
+        "requiredType": "Binary",
+        "valueConstraints": [
+          "[,1024]"
+        ],
+        "multiple": true,
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "stringPropertyDef"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteBooleanPropertyDefinition.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteBooleanPropertyDefinition.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteBooleanPropertyDefinition.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteBooleanPropertyDefinition.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,24 @@
+{
+  "ntWithPropertyDefs": {
+    "declaredPropertyDefinitions": [
+      {
+        "defaultValues": [
+          {
+            "boolean": true,
+            "type": "Boolean"
+          }
+        ],
+        "requiredType": "Boolean",
+        "valueConstraints": [
+          "true"
+        ],
+        "multiple": true,
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "booleanPropertyDef"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteChildNodeDefinitions.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteChildNodeDefinitions.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteChildNodeDefinitions.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteChildNodeDefinitions.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,32 @@
+{
+  "ntWithChildNodeDefs": {
+    "declaredChildNodeDefinitions": [
+      {
+        "allowsSameNameSiblings": true,
+        "defaultPrimaryType": "requiredPrimaryType1",
+        "requiredPrimaryTypes": [
+          "requiredPrimaryType1",
+          "requiredPrimaryType2"
+        ],
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "childNodeDef1"
+      },
+      {
+        "allowsSameNameSiblings": true,
+        "defaultPrimaryType": "requiredPrimaryType1",
+        "requiredPrimaryTypes": [
+          "requiredPrimaryType1",
+          "requiredPrimaryType2"
+        ],
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "childNodeDef2"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteDatePropertyDefinition.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteDatePropertyDefinition.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteDatePropertyDefinition.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteDatePropertyDefinition.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,24 @@
+{
+  "ntWithPropertyDefs": {
+    "declaredPropertyDefinitions": [
+      {
+        "defaultValues": [
+          {
+            "date": "2012-02-01T00:00:00.000+01:00",
+            "type": "Date"
+          }
+        ],
+        "requiredType": "Date",
+        "valueConstraints": [
+          "2012-04-01T00:00:00Z"
+        ],
+        "multiple": true,
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "datePropertyDef"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteDoublePropertyDefinition.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteDoublePropertyDefinition.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteDoublePropertyDefinition.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteDoublePropertyDefinition.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,24 @@
+{
+  "ntWithPropertyDefs": {
+    "declaredPropertyDefinitions": [
+      {
+        "defaultValues": [
+          {
+            "double": 2.2,
+            "type": "Double"
+          }
+        ],
+        "requiredType": "Double",
+        "valueConstraints": [
+          "[,5]"
+        ],
+        "multiple": true,
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "doublePropertyDef"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteLongPropertyDefinition.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteLongPropertyDefinition.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteLongPropertyDefinition.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteLongPropertyDefinition.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,24 @@
+{
+  "ntWithPropertyDefs": {
+    "declaredPropertyDefinitions": [
+      {
+        "defaultValues": [
+          {
+            "long": 2,
+            "type": "Long"
+          }
+        ],
+        "requiredType": "Long",
+        "valueConstraints": [
+          "[,55]"
+        ],
+        "multiple": true,
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "longPropertyDef"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteNamePropertyDefinition.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteNamePropertyDefinition.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteNamePropertyDefinition.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteNamePropertyDefinition.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,24 @@
+{
+  "ntWithPropertyDefs": {
+    "declaredPropertyDefinitions": [
+      {
+        "defaultValues": [
+          {
+            "name": "myapp:myName",
+            "type": "Name"
+          }
+        ],
+        "requiredType": "Name",
+        "valueConstraints": [
+          "myapp:myName"
+        ],
+        "multiple": true,
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "namePropertyDef"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteNodeTypes.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteNodeTypes.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteNodeTypes.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteNodeTypes.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,56 @@
+{
+  "testNodeType": {
+    "declaredSupertypes": [
+      "superType1",
+      "superType2",
+      "superType3"
+    ],
+    "declaredPropertyDefinitions": [
+      {
+        "defaultValues": [
+          {
+            "string": "Default-String",
+            "type": "String"
+          }
+        ],
+        "valueConstraints": [
+          ".*"
+        ],
+        "multiple": true,
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "stringPropertyDef"
+      }
+    ],
+    "declaredChildNodeDefinitions": [
+      {
+        "allowsSameNameSiblings": true,
+        "defaultPrimaryType": "requiredPrimaryType1",
+        "requiredPrimaryTypes": [
+          "requiredPrimaryType1",
+          "requiredPrimaryType2"
+        ],
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "childNodeDef1"
+      },
+      {
+        "allowsSameNameSiblings": true,
+        "defaultPrimaryType": "requiredPrimaryType1",
+        "requiredPrimaryTypes": [
+          "requiredPrimaryType1",
+          "requiredPrimaryType2"
+        ],
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "childNodeDef2"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompletePathPropertyDefinition.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompletePathPropertyDefinition.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompletePathPropertyDefinition.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompletePathPropertyDefinition.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,24 @@
+{
+  "ntWithPropertyDefs": {
+    "declaredPropertyDefinitions": [
+      {
+        "defaultValues": [
+          {
+            "path": "/myapp:myName/myapp:myChildNode/aSubChildNode",
+            "type": "Path"
+          }
+        ],
+        "requiredType": "Path",
+        "valueConstraints": [
+          "/myapp:myName/myapp:myChildNode/*"
+        ],
+        "multiple": true,
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "pathPropertyDef"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteReferencePropertyDefinition.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteReferencePropertyDefinition.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteReferencePropertyDefinition.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteReferencePropertyDefinition.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,24 @@
+{
+  "ntWithPropertyDefs": {
+    "declaredPropertyDefinitions": [
+      {
+        "defaultValues": [
+          {
+            "reference": "nt:unstructured",
+            "type": "Reference"
+          }
+        ],
+        "requiredType": "Reference",
+        "valueConstraints": [
+          "nt:unstructured"
+        ],
+        "multiple": true,
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "referencePropertyDef"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteStringPropertyDefinition.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteStringPropertyDefinition.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteStringPropertyDefinition.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testCompleteStringPropertyDefinition.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,23 @@
+{
+  "ntWithPropertyDefs": {
+    "declaredPropertyDefinitions": [
+      {
+        "defaultValues": [
+          {
+            "string": "Default-String",
+            "type": "String"
+          }
+        ],
+        "valueConstraints": [
+          ".*"
+        ],
+        "multiple": true,
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "stringPropertyDef"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testIfDefaultsAreOmittedWithServlet.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testIfDefaultsAreOmittedWithServlet.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testIfDefaultsAreOmittedWithServlet.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testIfDefaultsAreOmittedWithServlet.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,12 @@
+{
+  "testNodeType": {
+    "declaredPropertyDefinitions": [{
+        "name": "stringPropertyDef"
+      }
+    ],
+    "declaredChildNodeDefinitions": [{
+        "name": "childNodeDef"
+      }
+    ]
+  }
+}
\ No newline at end of file

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testIfDefaultsAreOmittedWithoutServlet.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testIfDefaultsAreOmittedWithoutServlet.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testIfDefaultsAreOmittedWithoutServlet.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testIfDefaultsAreOmittedWithoutServlet.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,8 @@
+{
+  "declaredPropertyDefinitions": [
+    {}
+  ],
+  "declaredChildNodeDefinitions": [
+    {}
+  ]
+}
\ No newline at end of file

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testMultipleConstraints.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testMultipleConstraints.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testMultipleConstraints.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testMultipleConstraints.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,18 @@
+{
+  "ntWithPropertyDefs": {
+    "declaredPropertyDefinitions": [
+      {
+        "valueConstraints": [
+          "banana",
+          "apple"
+        ],
+        "multiple": true,
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "stringProp"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testMultipleDefaultValues.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testMultipleDefaultValues.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testMultipleDefaultValues.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testMultipleDefaultValues.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,27 @@
+{
+  "ntWithPropertyDefs": {
+    "declaredPropertyDefinitions": [
+      {
+        "defaultValues": [
+          {
+            "string": "Default-String",
+            "type": "String"
+          },
+          {
+            "string": "Default-String2",
+            "type": "String"
+          }
+        ],
+        "valueConstraints": [
+          ".*"
+        ],
+        "multiple": true,
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "stringProp"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testNodeTypeWithEmptyName.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testNodeTypeWithEmptyName.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testNodeTypeWithEmptyName.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testNodeTypeWithEmptyName.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,4 @@
+{
+  "testNodeType1": {
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testOneSimpleChildNodeDefinition.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testOneSimpleChildNodeDefinition.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testOneSimpleChildNodeDefinition.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testOneSimpleChildNodeDefinition.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,13 @@
+{
+  "ntWithChildNodeDefs": {
+    "declaredChildNodeDefinitions": [
+      {
+        "requiredPrimaryTypes": [
+          "requiredPrimaryType1",
+          "requiredPrimaryType2"
+        ],
+        "name": "childNodeDef1"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testOneSimpleNodeType.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testOneSimpleNodeType.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testOneSimpleNodeType.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testOneSimpleNodeType.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,4 @@
+{
+  "testNodeType": {
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testOneSimplePropertyDefinition.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testOneSimplePropertyDefinition.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testOneSimplePropertyDefinition.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testOneSimplePropertyDefinition.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,10 @@
+{
+  "ntWithPropertyDefs": {
+    "declaredPropertyDefinitions": [
+      {
+        "requiredType": "undefined",
+        "name": "simplePropertyDef"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testResidualChildNodeDefinitions.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testResidualChildNodeDefinitions.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testResidualChildNodeDefinitions.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testResidualChildNodeDefinitions.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,27 @@
+{
+  "ntWithChildNodeDefs": {
+    "declaredChildNodeDefinitions": [
+      {
+        "requiredPrimaryTypes": [
+          "requiredPrimaryType1",
+          "requiredPrimaryType2"
+        ],
+        "name": "*"
+      },
+      {
+        "requiredPrimaryTypes": [
+          "requiredPrimaryType1",
+          "requiredPrimaryType2"
+        ],
+        "name": "*"
+      },
+      {
+        "requiredPrimaryTypes": [
+          "requiredPrimaryType1",
+          "requiredPrimaryType2"
+        ],
+        "name": "childNodeDef"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testSimpleChildNodeDefinitions.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testSimpleChildNodeDefinitions.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testSimpleChildNodeDefinitions.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testSimpleChildNodeDefinitions.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,20 @@
+{
+  "ntWithChildNodeDefs": {
+    "declaredChildNodeDefinitions": [
+      {
+        "requiredPrimaryTypes": [
+          "requiredPrimaryType1",
+          "requiredPrimaryType2"
+        ],
+        "name": "childNodeDef1"
+      },
+      {
+        "requiredPrimaryTypes": [
+          "requiredPrimaryType1",
+          "requiredPrimaryType2"
+        ],
+        "name": "childNodeDef2"
+      }
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testSimpleNodeTypes.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testSimpleNodeTypes.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testSimpleNodeTypes.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testSimpleNodeTypes.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,6 @@
+{
+  "testNodeType2": {
+  },
+  "testNodeType1": {
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testSupertypeList.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testSupertypeList.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testSupertypeList.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testSupertypeList.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,9 @@
+{
+  "testNodeType": {
+    "declaredSupertypes": [
+      "superType1",
+      "superType2",
+      "superType3"
+    ]
+  }
+}

Added: sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testTwoResidualPropertyDefinitions.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testTwoResidualPropertyDefinitions.json?rev=1660179&view=auto
==============================================================================
--- sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testTwoResidualPropertyDefinitions.json (added)
+++ sling/trunk/contrib/commons/js/nodetypes/src/test/resources/expectedNTJSON/testTwoResidualPropertyDefinitions.json Mon Feb 16 18:14:21 2015
@@ -0,0 +1,41 @@
+{
+  "ntWithPropertyDefs": {
+    "declaredPropertyDefinitions": [
+      {
+        "defaultValues": [
+          {
+            "string": "Default-String",
+            "type": "String"
+          }
+        ],
+        "valueConstraints": [
+          ".*"
+        ],
+        "multiple": true,
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "*"
+      },
+      {
+        "defaultValues": [
+          {
+            "date": "2012-02-01T00:00:00.000+01:00",
+            "type": "Date"
+          }
+        ],
+        "requiredType": "Date",
+        "valueConstraints": [
+          "2012-04-01T00:00:00Z"
+        ],
+        "multiple": true,
+        "autoCreated": true,
+        "mandatory": true,
+        "protected": true,
+        "onParentVersion": "VERSION",
+        "name": "*"
+      }
+    ]
+  }
+}