I tried this simple unit test but got not what I expected:
@Test
public void testReadPowerpoint() throws Exception {
PowerPointSystem pps=new PowerPointSystem();
pps.connect();
SimpleNode slideShowNode =
pps.moveTo("https://www.its.leeds.ac.uk/fileadmin/documents/alumni/Michele_Dix_Leeds_University_-_FINAL.PPTX");
List<SimpleNode> slides = slideShowNode.out("slides")
.collect(Collectors.toCollection(ArrayList::new));
debug=true;
if (debug)
slides.forEach(slide -> slide.printNameValues(System.out));
assertEquals(44, slides.size());
}
Does not work - i get 0 slides instead of 44. Is this a bug or exists a workaround?
My name is Wolfgang Fahl i am one of the committers of the SimpleGraph OpenSource Project .
I would consider this a bug/missing feature. The base question is what parameters moveTo should accept in the case of file/inputstream based modules. Powerpoint files can be read from any input inputstream with the Apache POI module. SimpleGraph needs a consistent way of handling the different cases of input and I think this is a valid discussion that should be done in the SimpleGraph dicussion group.
To fix your current issue I modified the code as a work around to make sure the Unit Tests runs and added your Unit Test to TestPowerPoint .
Current Workaround
The following is part of the Commit to fix your issue
/**
* create a SlideShow
*
* @param simpleGraph
* @param nodeQuery
* @throws Exception
*/
public SlideShowNode(SimpleGraph simpleGraph, String pathOrUrl,
String... keys) {
super(simpleGraph, "slideshow", keys);
InputStream is = null;
try {
try {
URL url = new URL(pathOrUrl);
is = url.openStream();
} catch (MalformedURLException e1) {
this.pathOrUl = pathOrUrl;
pptFile = new File(pathOrUl);
if (pptFile.canRead())
is = new FileInputStream(pathOrUl);
}
if (is != null)
slideshow = new XMLSlideShow(is);
else
slideshow = new XMLSlideShow();
} catch (IOException e) {
throw new RuntimeException(e);
}
super.setVertexFromMap();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.