Added a test.
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 7 Apr 2008 11:59:26 +0000 (13:59 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 7 Apr 2008 11:59:26 +0000 (13:59 +0200)
build.xml
test/ConnectionTest.java [new file with mode: 0644]

index bd572bd..6b7e985 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -1,44 +1,52 @@
-<project name="yaz4j" default="compile" basedir=".">\r
-\r
-  <description>Build the java side of Yaz4J</description>\r
-\r
-  <property name="version" value="0.9.3"/>     \r
-  <property name="src" location="src"/>\r
-  <property name="bin" location="bin"/>\r
-  <property name="distributions"  location="distributions"/>\r
-       \r
-  <path id="project.classpath">\r
-    <pathelement location="${bin}"/>\r
-  </path>\r
-\r
-  <target name="init">\r
-    <mkdir dir="${bin}"/>\r
-  </target>\r
-\r
-  <target name="compile" depends="init" description="compile the source">\r
-    <javac srcdir="${src}" destdir="${bin}">\r
-       <classpath refid="project.classpath"/>\r
-    </javac>\r
-  </target>\r
-\r
-  <target name="build-dist" depends="compile" description="generate the distribution">\r
-    <mkdir dir="${distributions}/${version}"/>\r
-    <jar jarfile="${distributions}/${version}/yaz4j.jar" basedir="${bin}">\r
-      <manifest>\r
-        <attribute name="Version" value="${version}"/>\r
-        <attribute name="Author" value="Talis Information Ltd"/>\r
-        <attribute name="About" value="Java wrapper for the ZOOM API of YAZ"/>\r
-        <attribute name="Main-Class" value="org.yaz4j.Yaz4jMain"/>\r
-      </manifest>\r
-    </jar>\r
-    <copy file="libyaz4j/lib/libyaz4j.so" tofile="${distributions}/${version}/libyaz4j.so"/>\r
-    <copy file="dependencies/yaz-2.1.28/lib/libyaz.so" tofile="${distributions}/${version}/libyaz.so"/>\r
-  </target>\r
-\r
-  <target name="clean" description="clean up" >\r
-    <!-- Delete various paths as part of the clean trees -->\r
-    <delete dir="${bin}"/>\r
-    <!-- delete dir="${distributions}/${version}"/ -->\r
-  </target>\r
-\r
-</project>\r
+<project name="yaz4j" default="compile" basedir=".">
+
+  <description>Build the java side of Yaz4J</description>
+
+  <property name="version" value="0.9.3"/>     
+  <property name="src" location="src"/>
+  <property name="test" location="test"/>
+  <property name="bin" location="bin"/>
+  <property name="distributions"  location="distributions"/>
+       
+  <path id="project.classpath">
+    <pathelement location="${bin}"/>
+    <pathelement location="dependencies/JUnit-4.3.1/junit-4.3.1.jar"/>
+  </path>
+
+  <target name="init">
+    <mkdir dir="${bin}"/>
+  </target>
+
+  <target name="compile" depends="init" description="compile the source">
+    <javac srcdir="${src}" destdir="${bin}">
+       <classpath refid="project.classpath"/>
+    </javac>
+  </target>
+
+  <target name="test" depends="compile" description="test the code">
+    <javac srcdir="${test}" destdir="${bin}">
+       <classpath refid="project.classpath"/>
+    </javac>
+  </target>
+
+  <target name="build-dist" depends="compile" description="generate the distribution">
+    <mkdir dir="${distributions}/${version}"/>
+    <jar jarfile="${distributions}/${version}/yaz4j.jar" basedir="${bin}">
+      <manifest>
+        <attribute name="Version" value="${version}"/>
+        <attribute name="Author" value="Talis Information Ltd"/>
+        <attribute name="About" value="Java wrapper for the ZOOM API of YAZ"/>
+        <attribute name="Main-Class" value="org.yaz4j.Yaz4jMain"/>
+      </manifest>
+    </jar>
+    <copy file="libyaz4j/lib/libyaz4j.so" tofile="${distributions}/${version}/libyaz4j.so"/>
+    <copy file="dependencies/yaz-2.1.28/lib/libyaz.so" tofile="${distributions}/${version}/libyaz.so"/>
+  </target>
+
+  <target name="clean" description="clean up" >
+    <!-- Delete various paths as part of the clean trees -->
+    <delete dir="${bin}"/>
+    <!-- delete dir="${distributions}/${version}"/ -->
+  </target>
+
+</project>
diff --git a/test/ConnectionTest.java b/test/ConnectionTest.java
new file mode 100644 (file)
index 0000000..178356d
--- /dev/null
@@ -0,0 +1,14 @@
+package yaz4jtest;
+import org.junit.*;
+import static org.junit.Assert.*;
+import java.util.*;
+
+public class ConnectionTest {
+       @Test
+       public void testConnection() {
+               org.yaz4j.Connection con = new org.yaz4j.Connection("indexdata.dk:210/gils", 0);
+               assertNotNull(con);
+               org.yaz4j.PrefixQuery pqf = new org.yaz4j.PrefixQuery("@attr 1=4 utah");
+               con.Search(pqf);
+       }
+}