props.setProperty("generateFileAutomatically", "true");
props.setProperty("includeServerNode", "true");
final FileResourceModelSource fileNodesProvider = new FileResourceModelSource(getFrameworkInstance());
fileNodesProvider.configure(props);
final INodeSet nodes = fileNodesProvider.getNodes();
assertNotNull(nodes);
assertEquals(1, nodes.getNodes().size());
assertNotNull(nodes.getNode(getFrameworkInstance().getFrameworkNodeName()));
assertTrue(testfile.exists());
testfile.delete();
}
//explicit format resourcexml
{
File testfile2 = new File(frameworkProject.getEtcDir(), "testresources2.blah");
assertFalse(testfile2.exists());
Properties props2 = new Properties();
props2.setProperty("format", "resourcexml");
props2.setProperty("project", PROJ_NAME);
props2.setProperty("file", testfile2.getAbsolutePath());
props2.setProperty("generateFileAutomatically", "true");
props2.setProperty("includeServerNode", "true");
final FileResourceModelSource provider2 = new FileResourceModelSource(getFrameworkInstance());
provider2.configure(props2);
final INodeSet nodes2 = provider2.getNodes();
assertNotNull(nodes2);
assertEquals(1, nodes2.getNodes().size());
assertNotNull(nodes2.getNode(getFrameworkInstance().getFrameworkNodeName()));
assertTrue(testfile2.exists());
testfile2.delete();
}
//implicit from filename
{
File testfile2 = new File(frameworkProject.getEtcDir(), "testresources2.yaml");
assertFalse(testfile2.exists());
Properties props2 = new Properties();
props2.setProperty("project", PROJ_NAME);
props2.setProperty("file", testfile2.getAbsolutePath());
props2.setProperty("generateFileAutomatically", "true");
props2.setProperty("includeServerNode", "true");
final FileResourceModelSource provider2 = new FileResourceModelSource(getFrameworkInstance());
provider2.configure(props2);
final INodeSet nodes2 = provider2.getNodes();
assertNotNull(nodes2);
assertEquals(1, nodes2.getNodes().size());
assertNotNull(nodes2.getNode(getFrameworkInstance().getFrameworkNodeName()));
assertTrue(testfile2.exists());
}
//implicit from filename
{
File testfile2 = new File(frameworkProject.getEtcDir(), "testresources2.xml");
assertFalse(testfile2.exists());
Properties props2 = new Properties();
props2.setProperty("project", PROJ_NAME);
props2.setProperty("file", testfile2.getAbsolutePath());
props2.setProperty("generateFileAutomatically", "true");
props2.setProperty("includeServerNode", "true");
final FileResourceModelSource provider2 = new FileResourceModelSource(getFrameworkInstance());
provider2.configure(props2);
final INodeSet nodes2 = provider2.getNodes();
assertNotNull(nodes2);
assertEquals(1, nodes2.getNodes().size());
assertNotNull(nodes2.getNode(getFrameworkInstance().getFrameworkNodeName()));
assertTrue(testfile2.exists());
}
}