refactoring

This commit is contained in:
cagache
2019-04-11 17:33:26 +03:00
parent 2e5ce4c6a2
commit ce8522a2c1
2 changed files with 13 additions and 15 deletions

View File

@@ -141,7 +141,7 @@ public class BaseRMRestTest extends RestTest
/** Valid root containers where electronic and non-electronic records can be created */ /** Valid root containers where electronic and non-electronic records can be created */
@DataProvider(name = "validRootContainers") @DataProvider(name = "validRootContainers")
public String[][] getValidRootContainers() throws Exception public Object[][] getValidRootContainers() throws Exception
{ {
return new String[][] return new String[][]
{ {
@@ -655,19 +655,17 @@ public class BaseRMRestTest extends RestTest
try try
{ {
this.wait(waitInMilliSeconds); this.wait(waitInMilliSeconds);
} catch (InterruptedException e) }
catch (InterruptedException e)
{ {
} }
} }
List<SearchNodeModel> searchResults = getRestAPIFactory().getRmRestWrapper().withSearchAPI().search(query) List<SearchNodeModel> searchResults = getRestAPIFactory().getRmRestWrapper().withSearchAPI().search(query)
.getEntries(); .getEntries();
if ((searchResults != null && !searchResults.isEmpty())) if (searchResults != null && !searchResults.isEmpty())
{ {
searchResults.forEach(childNode -> searchResults.forEach(childNode -> names.add(childNode.onModel().getName()));
{
names.add(childNode.onModel().getName());
});
break; break;
} }
else else
@@ -675,7 +673,7 @@ public class BaseRMRestTest extends RestTest
counter++; counter++;
} }
// double wait time to not overdo solr search // double wait time to not overdo solr search
waitInMilliSeconds = (waitInMilliSeconds * 2); waitInMilliSeconds = waitInMilliSeconds * 2;
} }
return names; return names;
} }
@@ -711,8 +709,8 @@ public class BaseRMRestTest extends RestTest
} }
} }
results = searchApi.searchForNodeNamesAsUser(user.getUsername(), user.getPassword(), term, sortby, results = searchApi.searchForNodeNamesAsUser(user.getUsername(), user.getPassword(), term, sortby,
includeFolders, includeCategories); includeFolders, includeCategories);
if (!results.isEmpty() && results.containsAll(expectedResults)) if (!results.isEmpty() && results.containsAll(expectedResults))
{ {
break; break;
@@ -722,7 +720,7 @@ public class BaseRMRestTest extends RestTest
counter++; counter++;
} }
// double wait time to not overdo solr search // double wait time to not overdo solr search
waitInMilliSeconds = (waitInMilliSeconds * 2); waitInMilliSeconds = waitInMilliSeconds * 2;
} }
return results; return results;
} }

View File

@@ -71,7 +71,7 @@ public class ElectronicRecordTests extends BaseRMRestTest
/** Invalid parent containers where electronic records can't be created */ /** Invalid parent containers where electronic records can't be created */
@DataProvider(name = "invalidParentContainers") @DataProvider(name = "invalidParentContainers")
public Object[][] invalidParentContainers() throws Exception public Object[][] invalidParentContainers()
{ {
return new String[][] return new String[][]
{ {
@@ -99,7 +99,7 @@ public class ElectronicRecordTests extends BaseRMRestTest
dataProvider = "invalidParentContainers", dataProvider = "invalidParentContainers",
description = "Electronic records can't be created in invalid parent containers" description = "Electronic records can't be created in invalid parent containers"
) )
public void cantCreateElectronicRecordsInInvalidContainers(String container) throws Exception public void cantCreateElectronicRecordsInInvalidContainers(String container)
{ {
// Create an electronic record in the given container, this should throw an IllegalArgumentException // Create an electronic record in the given container, this should throw an IllegalArgumentException
getRestAPIFactory().getRecordFolderAPI().createRecord(createElectronicRecordModel(), container, getFile(IMAGE_FILE)); getRestAPIFactory().getRecordFolderAPI().createRecord(createElectronicRecordModel(), container, getFile(IMAGE_FILE));
@@ -158,7 +158,7 @@ public class ElectronicRecordTests extends BaseRMRestTest
* Then nothing happens * Then nothing happens
* And an error is reported * And an error is reported
* </pre> * </pre>
* @param folderid The folder, which the record will be created in * @param folderId The folder, which the record will be created in
* @param type The type of the record folder, which the record will be created in * @param type The type of the record folder, which the record will be created in
* @throws Exception if record can't be created * @throws Exception if record can't be created
*/ */
@@ -405,7 +405,7 @@ public class ElectronicRecordTests extends BaseRMRestTest
*/ */
@Test(description = "Electronic records can be created in record folder with duplicate name") @Test(description = "Electronic records can be created in record folder with duplicate name")
@Bug(id ="RM-5116, RM-5012") @Bug(id ="RM-5116, RM-5012")
public void canCreateElectronicRecordsWithDuplicateName() throws Exception public void canCreateElectronicRecordsWithDuplicateName()
{ {
RecordCategoryChild recordFolder = createCategoryFolderInFilePlan(); RecordCategoryChild recordFolder = createCategoryFolderInFilePlan();