Tests for the DataSetService and the REST APIs (RM-486, RM-487, RM-488)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@41490 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2012-09-11 21:51:53 +00:00
parent 6c061c9f7a
commit 873a0efa3f
6 changed files with 509 additions and 13 deletions

View File

@@ -1,5 +1,6 @@
package org.alfresco.module.org_alfresco_module_rm.dataset;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
@@ -216,21 +217,43 @@ public class DataSetServiceImpl implements DataSetService, RecordsManagementMode
DataSet dataSet = getDataSets().get(dataSetId);
// Import the RM test data ACP into the the provided file plan node reference
InputStream is = DataSetServiceImpl.class.getClassLoader().getResourceAsStream(
dataSet.getPath());
if (is == null)
InputStream is = null;
try
{
throw new AlfrescoRuntimeException("The '" + dataSet.getLabel()
+ "' import file could not be found!");
is = getClass().getClassLoader().getResourceAsStream(dataSet.getPath());
if (is == null)
{
throw new AlfrescoRuntimeException("The '" + dataSet.getLabel()
+ "' import file could not be found!");
}
// Import view
Reader viewReader = new InputStreamReader(is);
Location location = new Location(filePlan);
importerService.importView(viewReader, location, null, null);
// Patch data
patchLoadedData();
}
catch (Exception ex)
{
throw new RuntimeException("Unexpected exception thrown", ex);
}
finally
{
if (is != null)
{
try
{
is.close();
is = null;
}
catch (IOException ex)
{
throw new RuntimeException("Failed to close the input stream!", ex);
}
}
}
// Import view
Reader viewReader = new InputStreamReader(is);
Location location = new Location(filePlan);
importerService.importView(viewReader, location, null, null);
// Patch data
patchLoadedData();
}
/**