Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/org/labkey/test/components/domain/DomainFieldRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ public DomainFieldRow clickRemoveOntologyConcept()
public void setAllowMultipleSelections(Boolean allowMultipleSelections)
{
WebDriverWrapper.waitFor(() -> elementCache().allowMultipleSelectionsCheckbox.isDisplayed(),
"Allow Multiple Selections checkbox did not become visible", 2000);
"Allow Multiple Selections checkbox did not become visible", 1000);
elementCache().allowMultipleSelectionsCheckbox.set(allowMultipleSelections);
}

Expand Down
6 changes: 6 additions & 0 deletions src/org/labkey/test/pages/assay/AssayRunsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ public void clickEditAssayDesign()
elementCache().manageMenu.doMenuAction("Edit Assay Design");
}

public AssayImportPage clickImportData()
{
clickAndWait(Locator.linkWithText("Import Data"));
return new AssayImportPage(getDriver());
}

@Override
protected ElementCache newElementCache()
{
Expand Down
49 changes: 41 additions & 8 deletions src/org/labkey/test/util/data/TestArrayDataUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVPrinter;
import org.apache.commons.csv.CSVRecord;
import org.labkey.remoteapi.query.Filter;

import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
Expand Down Expand Up @@ -45,19 +47,35 @@ public static <T> Map<String, List<String>> filterMap(Map<String, T> map, List<S
.filter(entry -> isMatch(entry.getValue(), searchValues, filterType))
.collect(Collectors.toMap(
Map.Entry::getKey,
e -> e.getValue().stream()
// Standard alphabetical sort that accounts for symbols and numbers.
// But uppercase letters are positioned before lowercase letters.
.sorted(Comparator
.comparing((String s) -> s.substring(0, 1).toLowerCase())
.thenComparing(s -> s.substring(0, 1))
.thenComparing(s -> s))
.collect(Collectors.toList()),
e -> sortValues(e.getValue()),
(e1, e2) -> e1,
LinkedHashMap::new
));
}

/**
* Standard alphabetical sort that accounts for symbols and numbers.
* Uppercase letters are positioned before lowercase letters.
*/
public static List<String> sortValues(List<String> values)
{
return values.stream()
.filter(s -> !s.isEmpty())
.sorted(Comparator
.comparing((String s) -> s.substring(0, 1).toLowerCase())
.thenComparing(s -> s.substring(0, 1))
.thenComparing(s -> s))
.collect(Collectors.toList());
}

/**
* Sorts values alphabetically and joins them with the given separator.
*/
public static String sortAndJoin(List<String> values, String separator)
{
return String.join(separator, sortValues(values));
}

public static Map<String, String> prepareMapForCheck(Map<String, List<String>> map)
{
return map.entrySet().stream()
Expand Down Expand Up @@ -87,6 +105,21 @@ public static List<String> parseMultiValueText(String multiValueString) throws I
}
}

public static String formatMultiValueText(List<String> values)
{
CSVFormat format = CSVFormat.RFC4180;
StringWriter stringWriter = new StringWriter();
try (CSVPrinter printer = new CSVPrinter(stringWriter, format))
{
printer.printRecord(values);
}
catch (IOException e)
{
throw new RuntimeException("Failed to format multi-value text", e);
}
return stringWriter.toString().trim();
}

private static boolean isMatch(List<String> actualValues, List<String> searchValues, Filter.Operator type)
{
return switch (type)
Expand Down
Loading