+AUX 01-Use-getResource-to-access-CompressTest-data-for-unit.patch 4661 RMD160 aaa090107ab67588ad0e13de7c43c2a4588441b4 SHA1 48b310f6e10c1e091b02ef94026f0bf4e31a75b5 SHA256 eb121342dfba55ec3bb7988c0b91074b581e89be87262aee3ced25ffd3d97cff
+AUX 02-Update-ArrayFuncsTest.java-to-JUnit-4.patch 7206 RMD160 96a7f0b30a8f215e5895d9c4c6f7c6ed9ad61602 SHA1 5edfe76d0abb7f91335a953239ad4016c21a1f84 SHA256 3d62e65233b4893b96e806afb6a9141402ffacbd134c9766e80c8a3f5e66d6d3
AUX README.Gentoo 1872 RMD160 d1dd74e452a146eda2a7cbd2a77ebb56a553306e SHA1 a808f13153d79e45312981bdd1b70db9831cfecf SHA256 eff5ce2b235af399f751566aa395ca7b803b7314e3adb652f7ae395653ac8628
-AUX build.xml 1682 RMD160 1ee625d0c100404539c95a5b8969189a86af1ecb SHA1 6aa2e178ff42715fb2106865f1110380b8c9de33 SHA256 d7d8c497145f906165a7ba954c56482fad51b733ef3a2d186544fa3edabf343c
+AUX build.xml 2912 RMD160 ce8ed7ab2d8581c31b55eebbaa770d371ec97682 SHA1 0854c8cd54eca889d590d9daf12eaddcffc80cf4 SHA256 8ecea978246d47b111a364ec1a7d081b15b15b10e717264ae8a433351b9dbf7d
DIST fits-1.06.0_src.jar 174797 RMD160 af8bfea7039bc5ab9b3ad32be6d67f9145066005 SHA1 763c81042b8586ddba96e44a94fbd0d9e68217e4 SHA256 924c39f98114720917f2914e886d9f87050632a48769c289b0dffbbb646b7fcf
-EBUILD fits-1.06.0.ebuild 1141 RMD160 0db36320be2cab8a537cd1b8b5233037048a170f SHA1 70a8b581d18ba5e2f9eb9d33144aa2a400ffdeb0 SHA256 4edc7d3ccc7b1d3a7482fe1416eddeeba20e72a156af37bc6de7347371fb91e4
+EBUILD fits-1.06.0.ebuild 1405 RMD160 da88ce48b3925f3fd32760addae381e2ceee05c7 SHA1 af8792b81ce9be49c215f99d7f3239884aa7b756 SHA256 ea6ab865055812b3a5db462d2e218221e697004df7165de1daf3dc83780c5fa4
MISC ChangeLog 287 RMD160 e7a8dcb5e8f68f96c07fee8473eed16f6df1cd31 SHA1 314dcbbf441e47feac4bedf7b38000e0d4852e6d SHA256 b15c9d486f5b3ddb5d991e78b1f82a59ca2658b30807e1908a57a6ec72a0eb01
MISC metadata.xml 247 RMD160 6735f3a5dd2d7a2b70589d1693f35d54291b7147 SHA1 c015969fe50967340dd050a44cb9f8a30b5e34a5 SHA256 9e65060e5f9d0a50d28c7a69d9c27fed6c3037fdd3e420cc276627fde2794f72
--- /dev/null
+diff --git a/src/nom/tam/fits/test/CompressTest.java b/src/nom/tam/fits/test/CompressTest.java
+index dd3aad0..c6d953e 100644
+--- a/src/nom/tam/fits/test/CompressTest.java
++++ b/src/nom/tam/fits/test/CompressTest.java
+@@ -54,58 +54,57 @@ public class CompressTest {
+
+ @Test
+ public void testStream() throws Exception {
+- InputStream is;
++ String is;
+
+- is = new FileInputStream("test.fits");
++ is = "test.fits";
+ assertEquals("Stream1", 300, streamRead(is, false, false));
+
+- is = new FileInputStream("test.fits.Z");
++ is = "test.fits.Z";
+ assertEquals("Stream2", 300, streamRead(is, false, false));
+
+- is = new FileInputStream("test.fits.gz");
++ is = "test.fits.gz";
+ assertEquals("Stream3", 300, streamRead(is, false, false));
+
+- is = new FileInputStream("test.fits");
++ is = "test.fits";
+ assertEquals("Stream4", 300, streamRead(is, false, true));
+
+- is = new FileInputStream("test.fits.Z");
++ is = "test.fits.Z";
+ assertEquals("Stream5", 300, streamRead(is, false, true));
+
+- is = new FileInputStream("test.fits.gz");
++ is = "test.fits.gz";
+ assertEquals("Stream6", 300, streamRead(is, false, true));
+
+-
+- is = new FileInputStream("test.fits.Z");
++ is = "test.fits.Z";
+ assertEquals("Stream7", 300, streamRead(is, true, true));
+
+- is = new FileInputStream("test.fits.gz");
++ is = "test.fits.gz";
+ assertEquals("Stream8", 300, streamRead(is, true, true));
+
+- is = new FileInputStream("test.fits.bz2");
++ is = "test.fits.bz2";
+ assertEquals("Stream9", 300, streamRead(is, true, true));
+ }
+
+ @Test
+ public void testFile() throws Exception {
+- File is = new File("test.fits");
++ String is = "test.fits";
+ assertEquals("File1", 300, fileRead(is, false, false));
+
+- is = new File("test.fits.Z");
++ is = "test.fits.Z";
+ assertEquals("File2", 300, fileRead(is, false, false));
+
+- is = new File("test.fits.gz");
++ is = "test.fits.gz";
+ assertEquals("File3", 300, fileRead(is, false, false));
+
+- is = new File("test.fits");
++ is = "test.fits";
+ assertEquals("File4", 300, fileRead(is, false, true));
+
+- is = new File("test.fits.Z");
++ is = "test.fits.Z";
+ assertEquals("File7", 300, fileRead(is, true, true));
+
+- is = new File("test.fits.gz");
++ is = "test.fits.gz";
+ assertEquals("File8", 300, fileRead(is, true, true));
+
+- is = new File("test.fits.bz2");
++ is = "test.fits.bz2";
+ assertEquals("File9", 300, fileRead(is, true, true));
+ }
+
+@@ -131,7 +130,6 @@ public class CompressTest {
+
+ is = "test.fits.bz2";
+ assertEquals("String8", 300, stringRead(is, true, true));
+-
+ }
+
+ @Test
+@@ -158,13 +156,9 @@ public class CompressTest {
+ assertEquals("String8", 300, urlRead(is, true, true));
+ }
+
+- int urlRead(String is, boolean comp, boolean useComp)
++ int urlRead(String filename, boolean comp, boolean useComp)
+ throws Exception {
+- File fil = new File(is);
+-
+- String path = fil.getCanonicalPath();
+- URL u = new URL("file://" + path);
+-
++ URL u = CompressTest.class.getResource(filename);
+ Fits f;
+ if (useComp) {
+ f = new Fits(u, comp);
+@@ -176,8 +170,9 @@ public class CompressTest {
+ return total(data);
+ }
+
+- int streamRead(InputStream is, boolean comp, boolean useComp)
++ int streamRead(String filename, boolean comp, boolean useComp)
+ throws Exception {
++ InputStream is = CompressTest.class.getResourceAsStream(filename);
+ Fits f;
+ if (useComp) {
+ f = new Fits(is, comp);
+@@ -190,8 +185,9 @@ public class CompressTest {
+ return total(data);
+ }
+
+- int fileRead(File is, boolean comp, boolean useComp)
++ int fileRead(String filename, boolean comp, boolean useComp)
+ throws Exception {
++ File is = new File(CompressTest.class.getResource(filename).getPath());
+ Fits f;
+ if (useComp) {
+ f = new Fits(is, comp);
+@@ -203,8 +199,9 @@ public class CompressTest {
+ return total(data);
+ }
+
+- int stringRead(String is, boolean comp, boolean useComp)
++ int stringRead(String filename, boolean comp, boolean useComp)
+ throws Exception {
++ String is = CompressTest.class.getResource(filename).getPath();
+ Fits f;
+ if (useComp) {
+ f = new Fits(is, comp);
--- /dev/null
+From b9edd6a86e66d354b0c1d010125246d8359cbb37 Mon Sep 17 00:00:00 2001
+From: W. Trevor King <wking@drexel.edu>
+Date: Fri, 7 Oct 2011 03:44:18 -0400
+Subject: [PATCH 7/8] Update ArrayFuncsTest.java to JUnit-4.
+
+---
+ src/nom/tam/util/test/ArrayFuncsTest.java | 44 +++++++++++++++++++---------
+ 1 files changed, 30 insertions(+), 14 deletions(-)
+
+diff --git a/src/nom/tam/util/test/ArrayFuncsTest.java b/src/nom/tam/util/test/ArrayFuncsTest.java
+index df5efb0..7ad8e51 100644
+--- a/src/nom/tam/util/test/ArrayFuncsTest.java
++++ b/src/nom/tam/util/test/ArrayFuncsTest.java
+@@ -6,6 +6,12 @@
+ */\r
+ package nom.tam.util.test;\r
+ \r
++import org.junit.Test;\r
++import static org.junit.Assert.assertEquals;\r
++import static org.junit.Assert.assertTrue;\r
++import static org.junit.Assert.assertFalse;\r
++import static org.junit.Assert.assertSame;\r
++import static org.junit.Assert.assertNotSame;\r
+ import junit.framework.*;\r
+ import java.lang.reflect.*;\r
+ import java.util.Arrays;\r
+@@ -15,21 +21,12 @@ import nom.tam.util.ArrayFuncs;
+ *\r
+ * @author Thomas McGlynn\r
+ */\r
+-public class ArrayFuncsTest extends TestCase {\r
+-\r
+- public ArrayFuncsTest(String testName) {\r
+- super(testName);\r
+- }\r
+-\r
+- protected void setUp() throws Exception {\r
+- }\r
+-\r
+- protected void tearDown() throws Exception {\r
+- }\r
++public class ArrayFuncsTest {\r
+ \r
+ /**\r
+ * Test of computeSize method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testComputeSize() {\r
+ System.out.println("computeSize");\r
+ \r
+@@ -58,6 +55,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of nElements method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testNElements() {\r
+ System.out.println("nElements");\r
+ \r
+@@ -72,6 +70,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of deepClone method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testDeepClone() {\r
+ int[][] test = {{0, 1}, {2, 3}, {4, 5}};\r
+ int[][] result = (int[][]) nom.tam.util.ArrayFuncs.deepClone(test);\r
+@@ -96,6 +95,7 @@ public class ArrayFuncsTest extends TestCase {
+ }\r
+ \r
+ public boolean equals(Object x) {\r
++ System.out.println("checking equality");\r
+ return (x instanceof CloneTest)\r
+ && (((CloneTest) x).value == this.value);\r
+ }\r
+@@ -104,6 +104,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of genericClone method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testGenericClone() {\r
+ System.out.println("genericClone");\r
+ \r
+@@ -126,6 +127,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of copyArray method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testCopyArray() {\r
+ System.out.println("copyArray");\r
+ \r
+@@ -138,6 +140,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of getDimensions method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testGetDimensions() {\r
+ System.out.println("getDimensions");\r
+ \r
+@@ -157,6 +160,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of getBaseArray method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testGetBaseArray() {\r
+ \r
+ int[][][] test = new int[2][3][4];\r
+@@ -169,6 +173,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of getBaseClass method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testGetBaseClass() {\r
+ System.out.println("getBaseClass");\r
+ \r
+@@ -179,6 +184,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of getBaseLength method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testGetBaseLength() {\r
+ \r
+ assertEquals(ArrayFuncs.getBaseLength(new int[2][3]), 4);\r
+@@ -195,6 +201,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of generateArray method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testGenerateArray() {\r
+ System.out.println("generateArray");\r
+ \r
+@@ -213,6 +220,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of testPattern method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testTestPattern() {\r
+ System.out.println("testPattern");\r
+ \r
+@@ -229,6 +237,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of flatten method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testFlatten() {\r
+ System.out.println("flatten");\r
+ \r
+@@ -241,6 +250,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of curl method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testCurl() {\r
+ System.out.println("curl");\r
+ \r
+@@ -259,6 +269,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of mimicArray method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testMimicArray() {\r
+ System.out.println("mimicArray");\r
+ \r
+@@ -273,6 +284,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of convertArray method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testConvertArray() {\r
+ System.out.println("convertArray");\r
+ \r
+@@ -286,7 +298,7 @@ public class ArrayFuncsTest extends TestCase {
+ \r
+ newType = int.class;\r
+ int[][] ires = (int[][]) ArrayFuncs.convertArray(array, newType, true);\r
+- assertEquals(array, ires);\r
++ assertSame(array, ires);\r
+ \r
+ ires = (int[][]) ArrayFuncs.convertArray(array, newType, false);\r
+ assertNotSame(array, ires);\r
+@@ -296,6 +308,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of copyInto method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testCopyInto() {\r
+ System.out.println("copyInto");\r
+ \r
+@@ -304,13 +317,14 @@ public class ArrayFuncsTest extends TestCase {
+ \r
+ ArrayFuncs.copyInto(x, y);\r
+ \r
+- assertEquals((double) x[0][0], y[0][0]);\r
+- assertEquals((double) x[1][2], y[1][2]);\r
++ assertEquals((double) x[0][0], y[0][0], 0.01);\r
++ assertEquals((double) x[1][2], y[1][2], 0.01);\r
+ }\r
+ \r
+ /**\r
+ * Test of arrayEquals method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testArrayEquals() {\r
+ System.out.println("arrayEquals");\r
+ \r
+@@ -331,6 +345,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of doubleArrayEquals method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testDoubleArrayEquals() {\r
+ \r
+ double x[] = {1, 2, 3};\r
+@@ -349,6 +364,7 @@ public class ArrayFuncsTest extends TestCase {
+ /**\r
+ * Test of floatArrayEquals method, of class nom.tam.util.ArrayFuncs.\r
+ */\r
++ @Test\r
+ public void testFloatArrayEquals() {\r
+ float x[] = {1f, 2f, 3f};\r
+ float y[] = {1f, 2f, 3f};\r
+--
+1.7.3.1.104.gc752e
+
<property name="src" value="${basedir}/src"/>
<property name="build" value="${basedir}/build"/>
<property name="doc" value="${basedir}/doc"/>
+ <path id="project.class.path">
+ </path>
+ <path id="build.class.path">
+ <pathelement location="JUNIT.JAR"/>
+ </path>
+ <path id="test.class.path">
+ <pathelement location="${build}"/>
+ </path>
</target>
- <path id="project.class.path">
- <pathelement location="JUNIT.JAR"/>
- </path>
<target name="all" depends="jar,javadoc"
description="Pseudo-target that builds JAR and Javadoc">
</target>
description="Compiles the classes">
<mkdir dir="${build}"/>
<javac destdir="${build}" srcdir="${src}" debug="true"
- deprecation="true">
+ deprecation="true" includeantruntime="false">
<classpath refid="project.class.path"/>
+ <classpath refid="build.class.path"/>
+ <!--compilerarg line="-Xlint:unchecked"/-->
</javac>
+ <copy todir="${build}">
+ <mappedresources>
+ <fileset dir="${src}" includes="**/test/test.fits*"/>
+ <globmapper from="*" to="*"/>
+ </mappedresources>
+ </copy>
+ </target>
+ <target name="test" depends="build">
+ <junit>
+ <classpath refid="project.class.path" />
+ <classpath refid="test.class.path"/>
+ <formatter type="brief" usefile="false" />
+ <batchtest>
+ <fileset dir="${build}">
+ <include name="**/test/*.class" />
+ <exclude name="**/*$*.class" />
+ </fileset>
+ </batchtest>
+ </junit>
</target>
<target name="javadoc" depends="init"
description="Generates Javadoc API documentation">
description="Erase all generated files and dirs">
<delete dir="${build}" verbose="true"/>
<delete dir="${doc}/api" verbose="true"/>
- <delete file="fits.jar" verbose="true"/>
+ <delete verbose="true">
+ <fileset dir="${basedir}" includes="*.jar"/>
+ <fileset dir="${basedir}" includes="*.fits"/>
+ <fileset dir="${basedir}" includes="*.fil"/>
+ <fileset dir="${basedir}" includes="*.hdr"/>
+ </delete>
</target>
</project>
# $Header: $
EAPI=4
-JAVA_PKG_IUSE="doc source"
+JAVA_PKG_IUSE="doc source test"
inherit eutils java-pkg-2 java-ant-2
-DESCRIPTION="Java library for FITS (image format) input/output library"
+DESCRIPTION="Java library for FITS (image format) input/output"
HOMEPAGE="http://fits.gsfc.nasa.gov/fits_libraries.html#java_tam"
SRC_URI="http://heasarc.gsfc.nasa.gov/docs/heasarc/${PN}/java/v1.0/v${PV}/fits_src.jar -> ${P}_src.jar"
${COMMON_DEP}"
DEPEND=">=virtual/jdk-1.5
+ test? (
+ dev-java/ant-junit4
+ dev-java/hamcrest-core
+ )
${COMMON_DEP}"
src_unpack() {
cp "${FILESDIR}"/build.xml . || die
sed -i "s/VERSION/${PV}/" build.xml || die
sed -i "s:JUNIT.JAR:${junit}:" build.xml || die
+ epatch "${FILESDIR}"/01-Use-getResource-to-access-CompressTest-data-for-unit.patch
+ epatch "${FILESDIR}"/02-Update-ArrayFuncsTest.java-to-JUnit-4.patch
+}
+
+src_test() {
+ ANT_TASKS="ant-junit4" eant test || die
}
src_install() {
java-pkg_newjar ${PN}.jar ${PN}.jar
use doc && java-pkg_dojavadoc doc/api
- use source && java-pkg_dosrc src/nom
+ use source && java-pkg_dosrc src/*
#use examples && java-pkg_doexamples src/java/examples
}