@@ -149,45 +149,48 @@ public static Map<Integer, String> getSortedRowIdToSamplesMap(String containerPa
149149 */
150150 public static Map <String , Integer > getRowIdsForSamples (String containerPath , String sampleTypeName , List <String > sampleNames ) throws IOException , CommandException
151151 {
152-
153152 // Use json for the value parameter of the filter. This allows for tricky characters like ";" to be passed to the API.
154153 StringBuilder json = new StringBuilder ("{json:[" );
155154
156155 Iterator <String > iterator = sampleNames .iterator ();
157156
158- while (iterator .hasNext ()) {
157+ while (iterator .hasNext ())
158+ {
159159 String sampleName = iterator .next ();
160160 json .append (EscapeUtil .toJSONStr (sampleName ));
161- if (iterator .hasNext ()) {
161+ if (iterator .hasNext ())
162162 json .append (", " );
163- } else {
163+ else
164164 json .append ("]}" );
165- }
166165 }
167166
167+ // Use the details view to avoid column and filter settings on the default view
168+ String detailsView = "~~DETAILS~~" ;
168169 Connection connection = WebTestHelper .getRemoteApiConnection ();
169170 SelectRowsCommand cmd = new SelectRowsCommand ("samples" , sampleTypeName );
170- cmd .setColumns (Arrays . asList ("RowId" , "Name" ));
171+ cmd .setColumns (List . of ("RowId" , "Name" ));
171172 cmd .addFilter ("Name" , json , Filter .Operator .IN );
173+ cmd .setViewName (detailsView );
172174
173175 SelectRowsResponse response = cmd .execute (connection , containerPath );
174176
175177 String errorMsg = "The sample names returned from the query do not match the sample names sent in." ;
176178
177179 // There have been some TC failures where selectRows is not returning anything when it should. Adding this
178180 // logging to help get more logging when/if it happens again.
179- if (response .getRowCount ().intValue () == 0 )
181+ if (response .getRowCount ().intValue () == 0 )
180182 {
181183 cmd = new SelectRowsCommand ("samples" , sampleTypeName );
182- cmd .setColumns (Arrays .asList ("Name" ));
184+ cmd .setColumns (List .of ("Name" ));
185+ cmd .setViewName (detailsView );
183186
184187 SelectRowsResponse responseCount = cmd .execute (connection , containerPath );
185188
186189 errorMsg = errorMsg + "\n " + String .format ("No rows were returned with filter. The sample type '%s' has %d rows." ,
187190 sampleTypeName , responseCount .getRowCount ().intValue ());
188191
189192 List <String > names = new ArrayList <>();
190- for (Map <String , Object > row : responseCount .getRows ())
193+ for (Map <String , Object > row : responseCount .getRows ())
191194 {
192195 Object tempName = row .get ("Name" );
193196 names .add (tempName .toString ());
@@ -198,16 +201,15 @@ public static Map<String, Integer> getRowIdsForSamples(String containerPath, Str
198201
199202 Map <String , Integer > rowIds = new TreeMap <>();
200203
201- for (Map <String , Object > row : response .getRows ())
204+ for (Map <String , Object > row : response .getRows ())
202205 {
203206 Object name = row .get ("Name" );
204207 Object value = row .get ("RowId" );
205208 rowIds .put (name .toString (), Integer .parseInt (value .toString ()));
206209 }
207210
208211 // Check that the names returned from the query match the names sent in.
209- Assert .assertEquals (errorMsg ,
210- new HashSet <>(sampleNames ), rowIds .keySet ());
212+ Assert .assertEquals (errorMsg , new HashSet <>(sampleNames ), rowIds .keySet ());
211213
212214 return rowIds ;
213215 }
0 commit comments