Skip to content
Snippets Groups Projects
Commit 1c16b535 authored by cramakri's avatar cramakri
Browse files

BIS-38 SP-204 : Close hierarchical content objects

SVN: 26238
parent f23a5795
No related branches found
No related tags found
No related merge requests found
...@@ -94,12 +94,12 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPlugin implements IPr ...@@ -94,12 +94,12 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPlugin implements IPr
for (DatasetDescription dataset : datasets) for (DatasetDescription dataset : datasets)
{ {
IHierarchicalContent fileContent = null;
IHierarchicalContent pathInfoContent = null;
try try
{ {
IHierarchicalContent fileContent = fileContent = getFileProvider().asContent(dataset.getDataSetCode());
getFileProvider().asContent(dataset.getDataSetCode()); pathInfoContent = getPathInfoProvider().asContent(dataset.getDataSetCode());
IHierarchicalContent pathInfoContent =
getPathInfoProvider().asContent(dataset.getDataSetCode());
List<Difference> datasetDifferences = new ArrayList<Difference>(); List<Difference> datasetDifferences = new ArrayList<Difference>();
...@@ -128,6 +128,16 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPlugin implements IPr ...@@ -128,6 +128,16 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPlugin implements IPr
Status.createError("Couldn't check consistency of the file system and the path info database for a data set: " Status.createError("Couldn't check consistency of the file system and the path info database for a data set: "
+ dataset.getDataSetCode() + dataset.getDataSetCode()
+ " because of the following exception: " + e.getMessage())); + " because of the following exception: " + e.getMessage()));
} finally
{
if (null != fileContent)
{
fileContent.close();
}
if (null != pathInfoContent)
{
pathInfoContent.close();
}
} }
} }
......
...@@ -116,6 +116,7 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPluginTest extends ...@@ -116,6 +116,7 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPluginTest extends
childIsDirectory(); childIsDirectory();
getChildFileLength(); getChildFileLength();
childIsChecksumPrecalculated(); childIsChecksumPrecalculated();
closeContent();
sendEmail(); sendEmail();
} }
...@@ -127,6 +128,12 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPluginTest extends ...@@ -127,6 +128,12 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPluginTest extends
new EMailAddress("a@bc.de")); new EMailAddress("a@bc.de"));
} }
protected void closeContent()
{
oneOf(fileContent).close();
oneOf(pathInfoContent).close();
}
protected void childIsChecksumPrecalculated() protected void childIsChecksumPrecalculated()
{ {
oneOf(pathInfoChildNode).isChecksumCRC32Precalculated(); oneOf(pathInfoChildNode).isChecksumCRC32Precalculated();
...@@ -145,7 +152,7 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPluginTest extends ...@@ -145,7 +152,7 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPluginTest extends
{ {
exactly(2).of(fileChildNode).isDirectory(); exactly(2).of(fileChildNode).isDirectory();
will(returnValue(false)); will(returnValue(false));
exactly(2).of(pathInfoChildNode).isDirectory(); exactly(1).of(pathInfoChildNode).isDirectory();
will(returnValue(false)); will(returnValue(false));
} }
...@@ -214,5 +221,6 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPluginTest extends ...@@ -214,5 +221,6 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPluginTest extends
} }
}); });
plugin.process(Arrays.asList(ds1), processingContext); plugin.process(Arrays.asList(ds1), processingContext);
context.assertIsSatisfied();
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment