Skip to content

Commit d37f052

Browse files
authored
Issue 53419: Aliquot parent with number like names that starts with leading zeroes aren't resolved during import (#6848)
1 parent bec7f8b commit d37f052

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

experiment/src/client/test/integration/SampleTypeCrud.ispec.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ExperimentCRUDUtils, hookServer, RequestOptions, successfulResponse } from '@labkey/test';
1+
import { ExperimentCRUDUtils, hookServer, RequestOptions, selectRandomN, successfulResponse } from '@labkey/test';
22
import mock from 'mock-fs';
33
import {
44
checkDomainName,
@@ -394,6 +394,7 @@ describe('Aliquot crud', () => {
394394
const aliquotQueryCols = 'name, rowid, lsid, description, str, int, isAliquot, AliquotedFromLsid/name, rootmaterialrowid, Myparentcol, Myaliquotcol, Myindependentcol';
395395

396396
async function verifyImportingWithNameValue(parentSampleName: string, sampleType: string) {
397+
console.log('Selected parentSampleName: ' + parentSampleName);
397398
const parentInsertRow = {
398399
name: parentSampleName,
399400
description: 'testImportingWithNameValue parent'
@@ -559,14 +560,19 @@ describe('Aliquot crud', () => {
559560
* <li>An aliquot with the name formatted as an aliquot (SAI_1-101).</li>
560561
* <li>And have an aliquot w/o a name set.</li>
561562
* <li>Validate that the names are as expected.</li>
563+
* <li>Issue 53419: Aliquot parent with number like names that starts with leading zeroes aren't resolved during import</li>
562564
* </ul>
563565
* Because importing is batched the imported aliquot without an explicit name set it should have the next
564566
* index (default behavior).
565567
* </p>
566568
*/
567-
it('testImportingWithNameValue - with naming patten', async () => {
569+
570+
const parentSampleName = ['S-1', '123', '0001', '0002', 'With Space', '+ -_.&)(:'];
571+
572+
573+
it('(Fuzz Test) testImportingWithNameValue - with naming patten ', async () => {
568574
// also include scenarios from testImportWithUpdate
569-
await verifyImportingWithNameValue('withNameValueParent', SAMPLE_ALIQUOT_IMPORT_TYPE_NAME);
575+
await verifyImportingWithNameValue(selectRandomN(parentSampleName, 1)[0], SAMPLE_ALIQUOT_IMPORT_TYPE_NAME);
570576
});
571577

572578
/**
@@ -583,8 +589,8 @@ describe('Aliquot crud', () => {
583589
* </ul>
584590
* </p>
585591
*/
586-
it('testImportingWithNameValue - without naming patten', async () => {
587-
await verifyImportingWithNameValue('withNameValueParentNoPattern', SAMPLE_ALIQUOT_IMPORT_NO_NAME_PATTERN_NAME);
592+
it('(Fuzz Test) testImportingWithNameValue - without naming patten', async () => {
593+
await verifyImportingWithNameValue(selectRandomN(parentSampleName, 1)[0], SAMPLE_ALIQUOT_IMPORT_NO_NAME_PATTERN_NAME);
588594
});
589595

590596
async function verifyMultipleRootsAndAliquots(parentSampleName1: string, parentSampleName2: string, sampleType: string) {

experiment/src/org/labkey/experiment/controllers/exp/ExperimentController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4413,6 +4413,9 @@ protected Map<String, String> getRenamedColumns()
44134413
@Override
44144414
protected @Nullable Set<String> getLineageImportAliases() throws IOException
44154415
{
4416+
Set<String> aliases = new CaseInsensitiveHashSet();
4417+
// Issue 53419: Aliquot parent with number like names that starts with leading zeroes aren't resolved during import
4418+
aliases.add(ExpMaterial.ALIQUOTED_FROM_INPUT);
44164419
boolean crossTypeImport = getOptionParamValue(AbstractQueryImportAction.Params.crossTypeImport);
44174420
// Issue 51894: We need to stop conversion to numbers for alias fields for all type
44184421
// If there are aliases defined for one type that are number fields in another type, this will prevent
@@ -4421,18 +4424,15 @@ protected Map<String, String> getRenamedColumns()
44214424
if (crossTypeImport)
44224425
{
44234426
List<ExpSampleTypeImpl> sampleTypes = SampleTypeServiceImpl.get().getSampleTypes(getContainer(), getUser(), true);
4424-
Set<String> aliases = new CaseInsensitiveHashSet();
44254427
for (ExpSampleTypeImpl sampleType : sampleTypes)
4426-
{
44274428
aliases.addAll(sampleType.getImportAliases().keySet());
4428-
}
4429-
return aliases;
44304429
}
44314430
else
44324431
{
44334432
ExpSampleTypeImpl sampleType = SampleTypeServiceImpl.get().getSampleType(getContainer(), getUser(), _form.getQueryName());
4434-
return new CaseInsensitiveHashSet(sampleType.getImportAliases().keySet());
4433+
aliases.addAll(sampleType.getImportAliases().keySet());
44354434
}
4435+
return aliases;
44364436
}
44374437

44384438
@Override

0 commit comments

Comments
 (0)