Added test for the IntegrityChecker around list-of-values, including leading and trailing spaces (ACE-5000)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@120880 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2016-01-14 12:15:03 +00:00
parent 074da3efea
commit 929e59bbdc
2 changed files with 39 additions and 0 deletions

View File

@@ -90,6 +90,7 @@ public class IntegrityTest extends TestCase
public static final QName TEST_PROP_TEXT_A = QName.createQName(NAMESPACE, "prop-text-a");
public static final QName TEST_PROP_TEXT_B = QName.createQName(NAMESPACE, "prop-text-b");
public static final QName TEST_PROP_TEXT_C = QName.createQName(NAMESPACE, "prop-text-c");
public static final QName TEST_PROP_TEXT_D = QName.createQName(NAMESPACE, "prop-text-d");
public static final QName TEST_PROP_INT_A = QName.createQName(NAMESPACE, "prop-int-a");
public static final QName TEST_PROP_INT_B = QName.createQName(NAMESPACE, "prop-int-b");
public static final QName TEST_PROP_INT_C = QName.createQName(NAMESPACE, "prop-int-c");
@@ -257,6 +258,21 @@ public class IntegrityTest extends TestCase
allProperties.put(TEST_PROP_TEXT_A, "");
NodeRef nodeRef = createNode("abc", TEST_TYPE_WITH_PROPERTIES, allProperties);
checkIntegrityNoFailure();
checkIntegrityNoFailure();
}
public void testCreateWithIncorrectListValue() throws Exception
{
allProperties.put(TEST_PROP_TEXT_D, "DEF");
NodeRef nodeRef = createNode("def", TEST_TYPE_WITH_PROPERTIES, allProperties);
checkIntegrityExpectFailure("Failed to detect incorrect LoV without trailing space", 1);
}
public void testCreateWithcorrectListValue() throws Exception
{
allProperties.put(TEST_PROP_TEXT_D, " HIJ ");
NodeRef nodeRef = createNode("def", TEST_TYPE_WITH_PROPERTIES, allProperties);
checkIntegrityNoFailure();
}
public void testMandatoryPropertiesRemoved() throws Exception

View File

@@ -15,6 +15,22 @@
<namespace uri="http://www.alfresco.org/test/IntegrityTest" prefix="test"/>
</namespaces>
<constraints>
<constraint name="test:lov1" type="LIST">
<title>lov11 title</title>
<description>lov1 description</description>
<parameter name="allowedValues">
<list>
<value>ABC</value>
<value>DEF </value>
<value> EFG</value>
<value> HIJ </value>
</list>
</parameter>
<parameter name="caseSensitive"><value>true</value></parameter>
</constraint>
</constraints>
<types>
<!-- Type without anyting -->
<type name="test:typeWithoutAnything">
@@ -37,6 +53,13 @@
<type>d:text</type>
<mandatory enforced="false">true</mandatory>
</property>
<property name="test:prop-text-d">
<type>d:text</type>
<mandatory enforced="false">false</mandatory>
<constraints>
<constraint ref="test:lov1"/>
</constraints>
</property>
</properties>
</type>
<!-- Type with encrypted properties -->