Permalink
Browse files

[MOD] Windows scripts updated.

  • Loading branch information...
1 parent 40c5da8 commit 435ed4003a84541b4c092dabc983a5b9c27d79ff @ChristianGruen ChristianGruen committed Jul 11, 2012
Showing with 26 additions and 7 deletions.
  1. +3 −1 .idea/encodings.xml
  2. +23 −6 src/test/java/org/basex/test/WindowsScripts.java
View
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
- <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
+ <file url="file://$PROJECT_DIR$" charset="UTF-8" />
+ </component>
</project>
@@ -7,6 +7,7 @@
import org.basex.io.*;
import org.basex.io.in.*;
import org.basex.util.*;
+import org.basex.util.list.*;
import org.junit.*;
/**
@@ -32,7 +33,19 @@ public void libraries() throws Exception {
} else {
for(final IOFile f : new IOFile("etc").children()) {
final String n = f.name();
- if(n.endsWith(".bat")) libraries(n, libs);
+ final StringList missing = new StringList();
+ final StringList obsolete = new StringList();
+ if(n.endsWith(".bat")) libraries(n, libs, missing, obsolete);
+ if(!missing.isEmpty()) {
+ final StringBuilder sb = new StringBuilder();
+ for(final String l : missing) sb.append(';').append(l);
+ fail("Library not found in '" + n + "':\n" + sb.substring(1));
+ }
+ if(!obsolete.isEmpty()) {
+ final StringBuilder sb = new StringBuilder();
+ for(final String l : obsolete) sb.append(';').append(l);
+ fail("Library obsolete in '" + n + "':\n" + sb.substring(1));
+ }
}
}
}
@@ -41,9 +54,13 @@ public void libraries() throws Exception {
* Tests the library references in the Windows script.
* @param name script name
* @param libs libraries
+ * @param missing missing libraries
+ * @param obsolete obsolete libraries
* @throws Exception exception
*/
- private void libraries(final String name, final HashSet<String> libs) throws Exception {
+ private void libraries(final String name, final HashSet<String> libs,
+ final StringList missing, final StringList obsolete) throws Exception {
+
final HashSet<String> sl = new HashSet<String>();
final NewlineInput nli = new NewlineInput(IO.get("etc/" + name));
try {
@@ -58,10 +75,10 @@ private void libraries(final String name, final HashSet<String> libs) throws Exc
for(final String l : libs) {
if(l.contains("basex")) continue;
- assertTrue("Library not found in '" + name + "': " + l, sl.remove(l));
+ if(!sl.remove(l)) missing.add(l);
+ }
+ for(final String l : sl) {
+ if(l.endsWith(".jar")) obsolete.add(l);
}
- final StringBuilder sb = new StringBuilder();
- for(final String l : sl) sb.append("\n- ").append(l);
- assertTrue("Libraries superfluous in '" + name + "':" + sb, sl.isEmpty());
}
}

0 comments on commit 435ed40

Please sign in to comment.