Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions experiment/src/client/test/integration/SampleTypeCrud.ispec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExperimentCRUDUtils, hookServer, RequestOptions, successfulResponse } from '@labkey/test';
import { ExperimentCRUDUtils, hookServer, RequestOptions, selectRandomN, successfulResponse } from '@labkey/test';
import mock from 'mock-fs';
import {
checkDomainName,
Expand Down Expand Up @@ -394,6 +394,7 @@ describe('Aliquot crud', () => {
const aliquotQueryCols = 'name, rowid, lsid, description, str, int, isAliquot, AliquotedFromLsid/name, rootmaterialrowid, Myparentcol, Myaliquotcol, Myindependentcol';

async function verifyImportingWithNameValue(parentSampleName: string, sampleType: string) {
console.log('Selected parentSampleName: ' + parentSampleName);
const parentInsertRow = {
name: parentSampleName,
description: 'testImportingWithNameValue parent'
Expand Down Expand Up @@ -559,14 +560,19 @@ describe('Aliquot crud', () => {
* <li>An aliquot with the name formatted as an aliquot (SAI_1-101).</li>
* <li>And have an aliquot w/o a name set.</li>
* <li>Validate that the names are as expected.</li>
* <li>Issue 53419: Aliquot parent with number like names that starts with leading zeroes aren't resolved during import</li>
* </ul>
* Because importing is batched the imported aliquot without an explicit name set it should have the next
* index (default behavior).
* </p>
*/
it('testImportingWithNameValue - with naming patten', async () => {

const parentSampleName = ['S-1', '123', '0001', '0002', 'With Space', '+ -_.&)(:'];


it('(Fuzz Test) testImportingWithNameValue - with naming patten ', async () => {
// also include scenarios from testImportWithUpdate
await verifyImportingWithNameValue('withNameValueParent', SAMPLE_ALIQUOT_IMPORT_TYPE_NAME);
await verifyImportingWithNameValue(selectRandomN(parentSampleName, 1)[0], SAMPLE_ALIQUOT_IMPORT_TYPE_NAME);
});

/**
Expand All @@ -583,8 +589,8 @@ describe('Aliquot crud', () => {
* </ul>
* </p>
*/
it('testImportingWithNameValue - without naming patten', async () => {
await verifyImportingWithNameValue('withNameValueParentNoPattern', SAMPLE_ALIQUOT_IMPORT_NO_NAME_PATTERN_NAME);
it('(Fuzz Test) testImportingWithNameValue - without naming patten', async () => {
await verifyImportingWithNameValue(selectRandomN(parentSampleName, 1)[0], SAMPLE_ALIQUOT_IMPORT_NO_NAME_PATTERN_NAME);
});

async function verifyMultipleRootsAndAliquots(parentSampleName1: string, parentSampleName2: string, sampleType: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4413,6 +4413,9 @@ protected Map<String, String> getRenamedColumns()
@Override
protected @Nullable Set<String> getLineageImportAliases() throws IOException
{
Set<String> aliases = new CaseInsensitiveHashSet();
// Issue 53419: Aliquot parent with number like names that starts with leading zeroes aren't resolved during import
aliases.add(ExpMaterial.ALIQUOTED_FROM_INPUT);
boolean crossTypeImport = getOptionParamValue(AbstractQueryImportAction.Params.crossTypeImport);
// Issue 51894: We need to stop conversion to numbers for alias fields for all type
// If there are aliases defined for one type that are number fields in another type, this will prevent
Expand All @@ -4421,18 +4424,15 @@ protected Map<String, String> getRenamedColumns()
if (crossTypeImport)
{
List<ExpSampleTypeImpl> sampleTypes = SampleTypeServiceImpl.get().getSampleTypes(getContainer(), getUser(), true);
Set<String> aliases = new CaseInsensitiveHashSet();
for (ExpSampleTypeImpl sampleType : sampleTypes)
{
aliases.addAll(sampleType.getImportAliases().keySet());
}
return aliases;
}
else
{
ExpSampleTypeImpl sampleType = SampleTypeServiceImpl.get().getSampleType(getContainer(), getUser(), _form.getQueryName());
return new CaseInsensitiveHashSet(sampleType.getImportAliases().keySet());
aliases.addAll(sampleType.getImportAliases().keySet());
}
return aliases;
}

@Override
Expand Down