|
15 | 15 | */ |
16 | 16 | package org.labkey.test.util.exp; |
17 | 17 |
|
| 18 | +import org.json.JSONArray; |
18 | 19 | import org.junit.Assert; |
19 | 20 | import org.labkey.remoteapi.CommandException; |
20 | 21 | import org.labkey.remoteapi.Connection; |
|
28 | 29 | import org.labkey.test.params.experiment.SampleTypeDefinition; |
29 | 30 | import org.labkey.test.util.DomainUtils; |
30 | 31 | import org.labkey.test.util.DomainUtils.DomainKind; |
31 | | -import org.labkey.test.util.EscapeUtil; |
32 | 32 | import org.labkey.test.util.TestDataGenerator; |
33 | 33 |
|
34 | 34 | import java.io.IOException; |
35 | 35 | import java.util.ArrayList; |
36 | 36 | import java.util.Arrays; |
37 | 37 | import java.util.HashSet; |
38 | | -import java.util.Iterator; |
39 | 38 | import java.util.List; |
40 | 39 | import java.util.Map; |
41 | 40 | import java.util.NoSuchElementException; |
@@ -150,19 +149,7 @@ public static Map<Integer, String> getSortedRowIdToSamplesMap(String containerPa |
150 | 149 | public static Map<String, Integer> getRowIdsForSamples(String containerPath, String sampleTypeName, List<String> sampleNames) throws IOException, CommandException |
151 | 150 | { |
152 | 151 | // Use json for the value parameter of the filter. This allows for tricky characters like ";" to be passed to the API. |
153 | | - StringBuilder json = new StringBuilder("{json:["); |
154 | | - |
155 | | - Iterator<String> iterator = sampleNames.iterator(); |
156 | | - |
157 | | - while (iterator.hasNext()) |
158 | | - { |
159 | | - String sampleName = iterator.next(); |
160 | | - json.append(EscapeUtil.toJSONStr(sampleName)); |
161 | | - if (iterator.hasNext()) |
162 | | - json.append(", "); |
163 | | - else |
164 | | - json.append("]}"); |
165 | | - } |
| 152 | + StringBuilder json = new StringBuilder("{json:").append(new JSONArray(sampleNames)).append("}"); |
166 | 153 |
|
167 | 154 | // Use the details view to avoid column and filter settings on the default view |
168 | 155 | String detailsView = "~~DETAILS~~"; |
|
0 commit comments