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

BIS-38 SP-204 : Improved messages.

SVN: 26279
parent 28f9cf36
No related branches found
No related tags found
No related merge requests found
......@@ -176,8 +176,8 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPlugin implements IPr
// report a difference if node paths do not match
if (fileNode.getRelativePath().equals(pathInfoNode.getRelativePath()) == false)
{
differences.add(new NodeExistenceDifference(fileNode.getRelativePath(), true));
differences.add(new NodeExistenceDifference(pathInfoNode.getRelativePath(), false));
differences.add(new NodeChildrenDifference(fileNode.getRelativePath(), true));
differences.add(new NodeChildrenDifference(pathInfoNode.getRelativePath(), false));
}
if (fileNode.isDirectory() && pathInfoNode.isDirectory())
......@@ -194,11 +194,11 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPlugin implements IPr
// report differences for nodes that exist only in one place
for (IHierarchicalContentNode uncommonNode : children.getFileUncommonNodes())
{
differences.add(new NodeExistenceDifference(uncommonNode.getRelativePath(), true));
differences.add(new NodeChildrenDifference(uncommonNode.getRelativePath(), true));
}
for (IHierarchicalContentNode uncommonNode : children.getPathInfoUncommonNodes())
{
differences.add(new NodeExistenceDifference(uncommonNode.getRelativePath(), false));
differences.add(new NodeChildrenDifference(uncommonNode.getRelativePath(), false));
}
} else if (fileNode.isDirectory() == false && pathInfoNode.isDirectory() == false)
......@@ -366,10 +366,10 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPlugin implements IPr
{
if (existsInFS)
{
return "exists in the file system but doesn't exist in the path info database";
return "exists in the file system but does not exist in the path info database";
} else
{
return "exists in the path info database but doesn't exist in the file system";
return "exists in the path info database but does not exist in the file system";
}
}
......@@ -391,12 +391,42 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPlugin implements IPr
{
if (existsInFS)
{
return "'" + getPath()
+ "' exists on the file system but doesn't exist in the path info database";
return "'"
+ getPath()
+ "' exists on the file system but does not exist in the path info database";
} else
{
return "'"
+ getPath()
+ "' exists in the path info database but does not exist on the file system";
}
}
}
private class NodeChildrenDifference extends Difference
{
private boolean existsInFS;
public NodeChildrenDifference(String path, boolean existsInFS)
{
super(path);
this.existsInFS = existsInFS;
}
@Override
public String getDescription()
{
if (existsInFS)
{
return "'" + getPath()
+ "' exists in the path info database but doesn't exist on the file system";
+ "' is on the file system but is not referenced in the path info database";
} else
{
return "'"
+ getPath()
+ "' is referenced in the path info database but does not exist on the file system";
}
}
......
......@@ -90,7 +90,7 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPluginTest extends
// add more when necessary
public enum FailurePoint
{
ROOT_NODE_EXISTS, FILE_LENGTH;
ROOT_NODE_EXISTS, ROOT_NODE_PATH, FILE_LENGTH;
}
}
......@@ -176,6 +176,10 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPluginTest extends
testCase.failurePoints.add(TestCaseParameters.FailurePoint.ROOT_NODE_EXISTS);
testCases.add(testCase);
testCase = new TestCaseParameters("Root node path");
testCase.failurePoints.add(TestCaseParameters.FailurePoint.ROOT_NODE_PATH);
testCases.add(testCase);
testCase = new TestCaseParameters("File length discrepency");
testCase.failurePoints.add(TestCaseParameters.FailurePoint.FILE_LENGTH);
testCases.add(testCase);
......@@ -243,8 +247,17 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPluginTest extends
+ "Differences found:\n\n"
+ "Data set ds-1:\n"
+ "- 'targets/unit-test-wd/ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.DataSetAndPathInfoDBConsistencyCheckProcessingPluginTest' "
+ "exists in the path info database but doesn't exist on the file system\n\n";
+ "exists in the path info database but does not exist on the file system\n\n";
} else if (parameters.failurePoints
.contains(TestCaseParameters.FailurePoint.ROOT_NODE_PATH))
{
body =
"Data sets checked:\n\nds-1\n\n"
+ "Differences found:\n\n"
+ "Data set ds-1:\n"
+ "- 'different' is referenced in the path info database but does not exist on the file system\n"
+ "- 'targets/unit-test-wd/ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.DataSetAndPathInfoDBConsistencyCheckProcessingPluginTest' is on the file system but is not referenced in the path info database\n\n";
} else
{
body = "Data sets checked:\n\nds-1\n\nDifferences found:\n\nNone";
......@@ -335,14 +348,28 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPluginTest extends
protected void getRelativePath()
{
if (false == parameters.failurePoints
if (parameters.failurePoints
.contains(TestCaseParameters.FailurePoint.ROOT_NODE_EXISTS))
{
oneOf(fileRootNode).getRelativePath();
oneOf(pathInfoRootNode).getRelativePath();
will(returnValue(workingDirectory.getPath()));
return;
}
if (parameters.failurePoints
.contains(TestCaseParameters.FailurePoint.ROOT_NODE_PATH))
{
exactly(2).of(fileRootNode).getRelativePath();
will(returnValue(workingDirectory.getPath()));
exactly(2).of(pathInfoRootNode).getRelativePath();
will(returnValue("different"));
return;
}
oneOf(fileRootNode).getRelativePath();
will(returnValue(workingDirectory.getPath()));
oneOf(pathInfoRootNode).getRelativePath();
will(returnValue(workingDirectory.getPath()));
}
protected void rootNodeExists()
......@@ -354,13 +381,12 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPluginTest extends
will(returnValue(false));
oneOf(pathInfoRootNode).exists();
will(returnValue(true));
} else
{
oneOf(fileRootNode).exists();
will(returnValue(true));
oneOf(pathInfoRootNode).exists();
will(returnValue(true));
return;
}
oneOf(fileRootNode).exists();
will(returnValue(true));
oneOf(pathInfoRootNode).exists();
will(returnValue(true));
}
protected void getRootNode()
......
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