7373<%@ page import =" org.labkey.api.query.QueryUpdateService" %>
7474<%@ page import =" org.labkey.api.query.SchemaKey" %>
7575<%@ page import =" org.labkey.api.query.UserSchema" %>
76- <%@ page import =" org.labkey.api.query.ValidationException" %>
7776<%@ page import =" org.labkey.api.search.SearchService" %>
7877<%@ page import =" org.labkey.api.security.SecurityManager" %>
7978<%@ page import =" org.labkey.api.security.User" %>
@@ -473,9 +472,7 @@ public void testDataClassFromTemplate() throws Exception
473472
474473 DomainTemplateGroup templateGroup = DomainTemplateGroup . get(c, " TestingFromTemplate" );
475474 assertNotNull(templateGroup);
476- assertFalse(
477- " Errors in template: " + StringUtils . join(templateGroup. getErrors(), " , " ),
478- templateGroup. hasErrors());
475+ assertFalse(" Errors in template: " + StringUtils . join(templateGroup. getErrors(), " , " ), templateGroup. hasErrors());
479476
480477 DomainTemplate template = templateGroup. getTemplate(" testingFromTemplate" );
481478 assertNotNull(template);
@@ -494,31 +491,7 @@ public void testDataClassFromTemplate() throws Exception
494491 Set<String > mandatory = kind. getMandatoryPropertyNames(domain);
495492 assertTrue(" Expected template to set 'aa' as mandatory: " + mandatory, mandatory. contains(" aa" ));
496493
497- // Verify <reservedColumnNames> from the template are honored by the DomainKind
498- Set<String > reservedNames = kind. getReservedPropertyNames(domain, _user);
499- assertTrue(" Expected template reserved name 'reservedOne' in: " + reservedNames,
500- reservedNames. stream(). anyMatch(n - > n. equalsIgnoreCase(" reservedOne" )));
501- assertTrue(" Expected template reserved name 'ReservedTwo' in: " + reservedNames,
502- reservedNames. stream(). anyMatch(n - > n. equalsIgnoreCase(" ReservedTwo" )));
503-
504- // Attempt to add a field whose name collides with a template-reserved name (mixed case)
505- GWTDomain<GWTPropertyDescriptor > origGwt = DomainUtil . getDomainDescriptor(_user, domain);
506- GWTDomain<GWTPropertyDescriptor > updateGwt = new GWTDomain<> (origGwt);
507- List<GWTPropertyDescriptor > updatedFields = new ArrayList<> (updateGwt. getFields());
508- updatedFields. add(new GWTPropertyDescriptor (" RESERVEDONE" , " http://www.w3.org/2001/XMLSchema#string" ));
509- updateGwt. setFields(updatedFields);
510- ValidationException ve = DomainUtil . updateDomainDescriptor(origGwt, updateGwt, c, _user);
511- assertTrue(" Expected a validation error when adding a reserved-name field" , ve. hasErrors());
512- assertTrue(" Expected error message to flag the reserved name: " + ve. getMessage(),
513- ve. getMessage(). toLowerCase(). contains(" reserved" ));
514-
515- // A non-reserved field name should validate cleanly
516- GWTDomain<GWTPropertyDescriptor > okUpdate = new GWTDomain<> (origGwt);
517- List<GWTPropertyDescriptor > okFields = new ArrayList<> (okUpdate. getFields());
518- okFields. add(new GWTPropertyDescriptor (" nonReservedField" , " http://www.w3.org/2001/XMLSchema#string" ));
519- okUpdate. setFields(okFields);
520- ValidationException okVe = DomainUtil . validateProperties(domain, okUpdate, kind, origGwt, _user);
521- assertFalse(" Did not expect validation errors for a non-reserved field: " + okVe. getMessage(), okVe. hasErrors());
494+ helper. verifyReservedColumnNames(c, _user, domain);
522495
523496 ExpDataClassImpl dataClass = (ExpDataClassImpl )ExperimentService . get(). getDataClass(c, domainName);
524497 assertNotNull(dataClass);
@@ -571,7 +544,7 @@ public void testDomainTemplate() throws Exception
571544 assertNotNull(templateGroup);
572545 assertFalse(" Errors in template: " + StringUtils . join(templateGroup. getErrors(), " , " ), templateGroup. hasErrors());
573546
574- List< Domain > created = templateGroup. createAndImport(sub, _user, true , true );
547+ templateGroup. createAndImport(sub, _user, true , true );
575548
576549 // verify the "Priority" list was created and data was imported
577550 UserSchema listSchema = QueryService . get(). getUserSchema(_user, sub, " lists" );
@@ -646,6 +619,13 @@ public void testDomainTemplate() throws Exception
646619
647620 Collection<String > aliases = data. getAliases();
648621 assertTrue(" Expected aliases to contain 'xsd' and 'domain templates', got: " + aliases, aliases. containsAll(List . of(" xsd" , " domain templates" )));
622+
623+ // Verify reserved column names on lists
624+ TableInfo categoryTable = listSchema. getTable(" Category" );
625+ Domain categoryDomain = categoryTable. getDomain();
626+ assertNotNull(categoryDomain);
627+
628+ helper. verifyReservedColumnNames(c, _user, categoryTable. getDomain());
649629}
650630
651631// Issue 25224: NPE trying to delete a folder with a DataClass with at least one result row in it
0 commit comments