Skip to content
Snippets Groups Projects
Commit 69dcce3a authored by srosse's avatar srosse
Browse files

no-jira: reduce errors log in unit tests

parent 06e795bd
No related branches found
No related tags found
No related merge requests found
...@@ -59,27 +59,26 @@ public class VelocityTemplatesPreWarm implements PreWarm { ...@@ -59,27 +59,26 @@ public class VelocityTemplatesPreWarm implements PreWarm {
final File root = new File(WebappHelper.getContextRoot(), "WEB-INF/classes"); final File root = new File(WebappHelper.getContextRoot(), "WEB-INF/classes");
final Path fPath = root.toPath(); final Path fPath = root.toPath();
try { try {
Files.walkFileTree(fPath, new SimpleFileVisitor<Path>() { if(Files.exists(fPath)) {
Files.walkFileTree(fPath, new SimpleFileVisitor<Path>() {
@Override @Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
try { try {
String path = fPath.relativize(file).toString();
String path = fPath.relativize(file).toString(); if(path.endsWith(".html") && path.contains("/_content/")) {
if(path.endsWith(".html") && path.contains("/_content/")) { StringOutput writer = new StringOutput();
StringOutput writer = new StringOutput(); VelocityHelper.getInstance().mergeContent(path, context, writer, null);
VelocityHelper.getInstance().mergeContent(path, context, writer, null); numOfTemplates.incrementAndGet();
}
numOfTemplates.incrementAndGet(); } catch (ResourceNotFoundException e) {
log.error("", e);
} catch (ParseErrorException e) {
log.error("", e);
} }
} catch (ResourceNotFoundException e) { return FileVisitResult.CONTINUE;
log.error("", e);
} catch (ParseErrorException e) {
log.error("", e);
} }
return FileVisitResult.CONTINUE; });
} }
});
} catch (IOException e) { } catch (IOException e) {
log.error("", e); log.error("", e);
} }
......
...@@ -27,7 +27,6 @@ import java.net.URISyntaxException; ...@@ -27,7 +27,6 @@ import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.UUID; import java.util.UUID;
...@@ -114,10 +113,9 @@ public class OnyxToQtiWorksAssessementItemsTest { ...@@ -114,10 +113,9 @@ public class OnyxToQtiWorksAssessementItemsTest {
DefaultHandler2 myHandler = new Onyx38ToQtiWorksHandler(xtw); DefaultHandler2 myHandler = new Onyx38ToQtiWorksHandler(xtw);
saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", myHandler); saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", myHandler);
saxParser.parse(in, myHandler); saxParser.parse(in, myHandler);
Files.copy(outputFile.toPath(), new File("/HotCoffee/Onyx", xmlFile.getName()).toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch(Exception e1) { } catch(Exception e1) {
log.error("", e1); log.error("", e1);
throw e1;
} }
QtiXmlReader qtiXmlReader = new QtiXmlReader(new JqtiExtensionManager()); QtiXmlReader qtiXmlReader = new QtiXmlReader(new JqtiExtensionManager());
......
...@@ -27,7 +27,6 @@ import java.net.URISyntaxException; ...@@ -27,7 +27,6 @@ import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.UUID; import java.util.UUID;
...@@ -103,10 +102,9 @@ public class OnyxToQtiWorksAssessementTestsTest { ...@@ -103,10 +102,9 @@ public class OnyxToQtiWorksAssessementTestsTest {
DefaultHandler2 myHandler = new Onyx38ToQtiWorksHandler(xtw); DefaultHandler2 myHandler = new Onyx38ToQtiWorksHandler(xtw);
saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", myHandler); saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", myHandler);
saxParser.parse(in, myHandler); saxParser.parse(in, myHandler);
Files.copy(outputFile.toPath(), new File("/HotCoffee/Onyx", xmlFile.getName()).toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch(Exception e1) { } catch(Exception e1) {
log.error("", e1); log.error("", e1);
throw e1;
} }
QtiXmlReader qtiXmlReader = new QtiXmlReader(new JqtiExtensionManager()); QtiXmlReader qtiXmlReader = new QtiXmlReader(new JqtiExtensionManager());
......
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