verifyDriftDefinition(descriptor, "TestServer", "test1", new AssertDriftTemplateRunnable() {
@Override
public void assertDriftTemplate(DriftDefinitionTemplate driftTemplate) throws Exception {
Configuration config = driftTemplate.getConfiguration();
DriftDefinition dconfig = new DriftDefinition(config);
assertEquals(dconfig.getInterval(), 11111L);
assertEquals(dconfig.getBasedir().getValueContext(), BaseDirValueContext.pluginConfiguration);
assertEquals(dconfig.getBasedir().getValueName(), "var.lib.test1");
assertNotNull(dconfig.getExcludes(), "though we have no excludes, still expect non-null empty list");
assertEquals(dconfig.getExcludes().size(), 0);
List<Filter> includes = dconfig.getIncludes();
assertNotNull(includes, "Expected to find default property set for <includes>");
assertEquals(includes.size(), 2, "Expected <includes> property list to have two property elements.");
Filter include1 = includes.get(0);
String path1 = include1.getPath();
String pattern1 = include1.getPattern();
assertNotNull(path1, "Expected to find a simple property for the path of the first <include>");
assertEquals(path1, "ilib", "The value is wrong for the path of the first <include>");
assertNotNull(pattern1, "Expected to find a simple property for the pattern of the first <include>");
assertEquals(pattern1, "*.ijar", "The value is wrong for the pattern of the first <include>");
Filter include2 = includes.get(1);
String path2 = include2.getPath();
String pattern2 = include2.getPattern();
assertNotNull(path2, "Expected to find a simple property for the path of the second <include>");
assertEquals(path2, "iconf", "The value is wrong for the path of the second <include>");
assertNotNull(pattern2, "Expected to find a simple property for the pattern of the second <include>");
assertEquals(pattern2, "*.ixml", "The value is wrong for the pattern of the second <include>");
}
});
verifyDriftDefinition(descriptor, "TestServer", "test2", new AssertDriftTemplateRunnable() {
@Override
public void assertDriftTemplate(DriftDefinitionTemplate driftTemplate) throws Exception {
Configuration config = driftTemplate.getConfiguration();
DriftDefinition dconfig = new DriftDefinition(config);
assertEquals(dconfig.getInterval(), 22222L);
assertEquals(dconfig.getBasedir().getValueContext(), BaseDirValueContext.resourceConfiguration);
assertEquals(dconfig.getBasedir().getValueName(), "var.lib.test2");
assertNotNull(dconfig.getIncludes(), "though we have no includes, still expect non-null empty list");
assertEquals(dconfig.getIncludes().size(), 0);
List<Filter> excludes = dconfig.getExcludes();
assertNotNull(excludes, "Expected to find default property set for <excludes>");
assertEquals(excludes.size(), 2, "Expected <excludes> property list to have two property elements.");
Filter exclude1 = excludes.get(0);
String path1 = exclude1.getPath();
String pattern1 = exclude1.getPattern();
assertNotNull(path1, "Expected to find a simple property for the path of the first <exclude>");
assertEquals(path1, "elib", "The value is wrong for the path of the first <exclude>");
assertNotNull(pattern1, "Expected to find a simple property for the pattern of the first <exclude>");
assertEquals(pattern1, "*.ejar", "The value is wrong for the pattern of the first <exclude>");
Filter exclude2 = excludes.get(1);
String path2 = exclude2.getPath();
String pattern2 = exclude2.getPattern();
assertNotNull(path2, "Expected to find a simple property for the path of the second <exclude>");
assertEquals(path2, "econf", "The value is wrong for the path of the second <exclude>");
assertNotNull(pattern2, "Expected to find a simple property for the pattern of the second <exclude>");
assertEquals(pattern2, "*.exml", "The value is wrong for the pattern of the second <exclude>");
}
});
verifyDriftDefinition(descriptor, "TestServer", "test3", new AssertDriftTemplateRunnable() {
@Override
public void assertDriftTemplate(DriftDefinitionTemplate driftTemplate) throws Exception {
Configuration config = driftTemplate.getConfiguration();
DriftDefinition dconfig = new DriftDefinition(config);
assertEquals(dconfig.getInterval(), 33333L);
assertEquals(dconfig.getBasedir().getValueContext(), BaseDirValueContext.measurementTrait);
assertEquals(dconfig.getBasedir().getValueName(), "var.lib.test3");
List<Filter> includes = dconfig.getIncludes();
assertNotNull(includes, "Expected to find default property set for <includes>");
assertEquals(includes.size(), 2, "Expected <includes> property list to have two property elements.");
Filter include1 = includes.get(0);
String path1 = include1.getPath();
String pattern1 = include1.getPattern();
assertNotNull(path1, "Expected to find a simple property for the path of the first <include>");
assertEquals(path1, "ilib", "The value is wrong for the path of the first <include>");
assertNotNull(pattern1, "Expected to find a simple property for the pattern of the first <include>");
assertEquals(pattern1, "*.ijar", "The value is wrong for the pattern of the first <include>");
Filter include2 = includes.get(1);
String path2 = include2.getPath();
String pattern2 = include2.getPattern();
assertNotNull(path2, "Expected to find a simple property for the path of the second <include>");
assertEquals(path2, "iconf", "The value is wrong for the path of the second <include>");
assertNotNull(pattern2, "Expected to find a simple property for the pattern of the second <include>");
assertEquals(pattern2, "*.ixml", "The value is wrong for the pattern of the second <include>");
List<Filter> excludes = dconfig.getExcludes();
assertNotNull(excludes, "Expected to find default property set for <excludes>");
assertEquals(excludes.size(), 2, "Expected <excludes> property list to have two property elements.");
Filter exclude1 = excludes.get(0);
path1 = exclude1.getPath();
pattern1 = exclude1.getPattern();
assertNotNull(path1, "Expected to find a simple property for the path of the first <exclude>");
assertEquals(path1, "elib", "The value is wrong for the path of the first <exclude>");
assertNotNull(pattern1, "Expected to find a simple property for the pattern of the first <exclude>");
assertEquals(pattern1, "*.ejar", "The value is wrong for the pattern of the first <exclude>");
Filter exclude2 = excludes.get(1);
path2 = exclude2.getPath();
pattern2 = exclude2.getPattern();
assertNotNull(path2, "Expected to find a simple property for the path of the second <exclude>");
assertEquals(path2, "econf", "The value is wrong for the path of the second <exclude>");
assertNotNull(pattern2, "Expected to find a simple property for the pattern of the second <exclude>");
assertEquals(pattern2, "*.exml", "The value is wrong for the pattern of the second <exclude>");
}
});
verifyDriftDefinition(descriptor, "TestServer", "test4", new AssertDriftTemplateRunnable() {
@Override
public void assertDriftTemplate(DriftDefinitionTemplate driftTemplate) throws Exception {
Configuration config = driftTemplate.getConfiguration();
DriftDefinition dconfig = new DriftDefinition(config);
assertEquals(dconfig.getInterval(), 44444L);
assertEquals(dconfig.getBasedir().getValueContext(), BaseDirValueContext.fileSystem);
assertEquals(dconfig.getBasedir().getValueName(), "/wot/gorilla");
assertNotNull(dconfig.getIncludes(), "though we have no includes, still expect non-null empty list");
assertEquals(dconfig.getIncludes().size(), 0);
assertNotNull(dconfig.getExcludes(), "though we have no excludes, still expect non-null empty list");
assertEquals(dconfig.getExcludes().size(), 0);
}
});
}