diff options
author | Sébastien Fabbro <sebfabbro@gmail.com> | 2012-05-14 20:29:22 +0100 |
---|---|---|
committer | Sébastien Fabbro <sebfabbro@gmail.com> | 2012-05-14 20:29:22 +0100 |
commit | 6eb8ccdee15f48f5d439a358aa45df27bff169fe (patch) | |
tree | dac3cc7feed4f6a2686550931e601ddb03224c3d /dev-java/fits/files | |
parent | sci-mathematics/flocq: QA fixe (diff) | |
download | sci-6eb8ccdee15f48f5d439a358aa45df27bff169fe.tar.gz sci-6eb8ccdee15f48f5d439a358aa45df27bff169fe.tar.bz2 sci-6eb8ccdee15f48f5d439a358aa45df27bff169fe.zip |
dev-java/fits: Version bump and import to the science overlay
(Portage version: 2.1.10.56/git/Linux x86_64, unsigned Manifest commit)
Diffstat (limited to 'dev-java/fits/files')
-rw-r--r-- | dev-java/fits/files/01-Use-getResource-to-access-CompressTest-data-for-unit.patch | 137 | ||||
-rw-r--r-- | dev-java/fits/files/02-Update-ArrayFuncsTest.java-to-JUnit-4.patch | 223 | ||||
-rw-r--r-- | dev-java/fits/files/README.Gentoo | 44 | ||||
-rw-r--r-- | dev-java/fits/files/build.xml | 84 |
4 files changed, 488 insertions, 0 deletions
diff --git a/dev-java/fits/files/01-Use-getResource-to-access-CompressTest-data-for-unit.patch b/dev-java/fits/files/01-Use-getResource-to-access-CompressTest-data-for-unit.patch new file mode 100644 index 000000000..389c233d1 --- /dev/null +++ b/dev-java/fits/files/01-Use-getResource-to-access-CompressTest-data-for-unit.patch @@ -0,0 +1,137 @@ +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); diff --git a/dev-java/fits/files/02-Update-ArrayFuncsTest.java-to-JUnit-4.patch b/dev-java/fits/files/02-Update-ArrayFuncsTest.java-to-JUnit-4.patch new file mode 100644 index 000000000..c9cd02d55 --- /dev/null +++ b/dev-java/fits/files/02-Update-ArrayFuncsTest.java-to-JUnit-4.patch @@ -0,0 +1,223 @@ +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 @@ + */
+ package nom.tam.util.test;
+
++import org.junit.Test;
++import static org.junit.Assert.assertEquals;
++import static org.junit.Assert.assertTrue;
++import static org.junit.Assert.assertFalse;
++import static org.junit.Assert.assertSame;
++import static org.junit.Assert.assertNotSame;
+ import junit.framework.*;
+ import java.lang.reflect.*;
+ import java.util.Arrays;
+@@ -15,21 +21,12 @@ import nom.tam.util.ArrayFuncs; + *
+ * @author Thomas McGlynn
+ */
+-public class ArrayFuncsTest extends TestCase {
+-
+- public ArrayFuncsTest(String testName) {
+- super(testName);
+- }
+-
+- protected void setUp() throws Exception {
+- }
+-
+- protected void tearDown() throws Exception {
+- }
++public class ArrayFuncsTest {
+
+ /**
+ * Test of computeSize method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testComputeSize() {
+ System.out.println("computeSize");
+
+@@ -58,6 +55,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of nElements method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testNElements() {
+ System.out.println("nElements");
+
+@@ -72,6 +70,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of deepClone method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testDeepClone() {
+ int[][] test = {{0, 1}, {2, 3}, {4, 5}};
+ int[][] result = (int[][]) nom.tam.util.ArrayFuncs.deepClone(test);
+@@ -96,6 +95,7 @@ public class ArrayFuncsTest extends TestCase { + }
+
+ public boolean equals(Object x) {
++ System.out.println("checking equality");
+ return (x instanceof CloneTest)
+ && (((CloneTest) x).value == this.value);
+ }
+@@ -104,6 +104,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of genericClone method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testGenericClone() {
+ System.out.println("genericClone");
+
+@@ -126,6 +127,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of copyArray method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testCopyArray() {
+ System.out.println("copyArray");
+
+@@ -138,6 +140,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of getDimensions method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testGetDimensions() {
+ System.out.println("getDimensions");
+
+@@ -157,6 +160,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of getBaseArray method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testGetBaseArray() {
+
+ int[][][] test = new int[2][3][4];
+@@ -169,6 +173,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of getBaseClass method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testGetBaseClass() {
+ System.out.println("getBaseClass");
+
+@@ -179,6 +184,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of getBaseLength method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testGetBaseLength() {
+
+ assertEquals(ArrayFuncs.getBaseLength(new int[2][3]), 4);
+@@ -195,6 +201,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of generateArray method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testGenerateArray() {
+ System.out.println("generateArray");
+
+@@ -213,6 +220,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of testPattern method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testTestPattern() {
+ System.out.println("testPattern");
+
+@@ -229,6 +237,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of flatten method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testFlatten() {
+ System.out.println("flatten");
+
+@@ -241,6 +250,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of curl method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testCurl() {
+ System.out.println("curl");
+
+@@ -259,6 +269,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of mimicArray method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testMimicArray() {
+ System.out.println("mimicArray");
+
+@@ -273,6 +284,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of convertArray method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testConvertArray() {
+ System.out.println("convertArray");
+
+@@ -286,7 +298,7 @@ public class ArrayFuncsTest extends TestCase { +
+ newType = int.class;
+ int[][] ires = (int[][]) ArrayFuncs.convertArray(array, newType, true);
+- assertEquals(array, ires);
++ assertSame(array, ires);
+
+ ires = (int[][]) ArrayFuncs.convertArray(array, newType, false);
+ assertNotSame(array, ires);
+@@ -296,6 +308,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of copyInto method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testCopyInto() {
+ System.out.println("copyInto");
+
+@@ -304,13 +317,14 @@ public class ArrayFuncsTest extends TestCase { +
+ ArrayFuncs.copyInto(x, y);
+
+- assertEquals((double) x[0][0], y[0][0]);
+- assertEquals((double) x[1][2], y[1][2]);
++ assertEquals((double) x[0][0], y[0][0], 0.01);
++ assertEquals((double) x[1][2], y[1][2], 0.01);
+ }
+
+ /**
+ * Test of arrayEquals method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testArrayEquals() {
+ System.out.println("arrayEquals");
+
+@@ -331,6 +345,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of doubleArrayEquals method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testDoubleArrayEquals() {
+
+ double x[] = {1, 2, 3};
+@@ -349,6 +364,7 @@ public class ArrayFuncsTest extends TestCase { + /**
+ * Test of floatArrayEquals method, of class nom.tam.util.ArrayFuncs.
+ */
++ @Test
+ public void testFloatArrayEquals() {
+ float x[] = {1f, 2f, 3f};
+ float y[] = {1f, 2f, 3f};
+-- +1.7.3.1.104.gc752e + diff --git a/dev-java/fits/files/README.Gentoo b/dev-java/fits/files/README.Gentoo new file mode 100644 index 000000000..62c238cdd --- /dev/null +++ b/dev-java/fits/files/README.Gentoo @@ -0,0 +1,44 @@ +I have been unable to track down a source repository for fits, so this +ebuild straps a build system onto source unpacked from a source JAR. +Not the greatest solution, but it's the best I can come up with. I've +also had trouble figuring out who holds copyright and what the +licensing terms are. If you find more authoritative information, let +me know! + +Authors (listed with the first release note to mention them): + Tom McGlynn <thomas.a.mcglynn@nasa.gov> [1,12] + Jens Knudstrup [2] + Alan Brighton [2] + R.J. Mathar [3] + Jorgo Bakker [3] + Laurent Michel [3] + R. Mathar [4] + Guillame Belanger [4] + A. Kovacs [5] + Javier Diaz [6] + Juan Carlos Segovia [7] + Thomas Granzer [7] + L. Michel [8] + Mark Taylor [9] + Laurent Bourges [10] + V. Forchi [11] + +From [11]: + +> [The] build procedure for FITS library has been changed. The library +> is now stored as a NetBeans project and the standard NetBeans build +> script has been modified to generate the fits.jar and fits_src.jar. + + +[1]: http://heasarc.gsfc.nasa.gov/docs/heasarc/fits/java/v0.9/NOTES/NOTE.v091 +[2]: http://heasarc.gsfc.nasa.gov/docs/heasarc/fits/java/v0.9/NOTES/NOTE.v093 +[3]: http://heasarc.gsfc.nasa.gov/docs/heasarc/fits/java/v0.9/NOTES/NOTE.v099 +[4]: http://heasarc.gsfc.nasa.gov/docs/heasarc/fits/java/v0.9/NOTES/NOTE.v099.1 +[5]: http://heasarc.gsfc.nasa.gov/docs/heasarc/fits/java/v0.9/NOTES/NOTE.v099.5 +[6]: http://heasarc.gsfc.nasa.gov/docs/heasarc/fits/java/v1.0/NOTE.v100.1 +[7]: http://heasarc.gsfc.nasa.gov/docs/heasarc/fits/java/v1.0/NOTE.v101.0 +[8]: http://heasarc.gsfc.nasa.gov/docs/heasarc/fits/java/v1.0/NOTE.v102.0 +[9]: http://heasarc.gsfc.nasa.gov/docs/heasarc/fits/java/v1.0/NOTE.v104.0 +[10]: http://heasarc.gsfc.nasa.gov/docs/heasarc/fits/java/v1.0/NOTE.v105.0 +[11]: http://heasarc.gsfc.nasa.gov/docs/heasarc/fits/java/v1.0/NOTE.v105.1 +[12]: http://asd.gsfc.nasa.gov/Thomas.McGlynn/ diff --git a/dev-java/fits/files/build.xml b/dev-java/fits/files/build.xml new file mode 100644 index 000000000..d8aa41b85 --- /dev/null +++ b/dev-java/fits/files/build.xml @@ -0,0 +1,84 @@ +<?xml version="1.0"?> +<project name="fits" default="all" basedir="."> + <target name="init" description="Sets build properties"> + <!-- package configuration --> + <property name="package.version" value="devel"/> + <!-- directory locations --> + <property name="src" value="${basedir}/src"/> + <property name="build" value="${basedir}/build"/> + <property name="doc" value="${basedir}/doc"/> + <property name="doc.api" value="${doc}/api"/> + <!-- external dependencies --> + <property name="junit.jar" value="junit.jar"/> + <!-- classpaths --> + <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> + <target name="all" depends="jar,javadoc" + description="Pseudo-target that builds JAR and Javadoc"> + </target> + <target name="build" depends="init" + description="Compiles the classes"> + <mkdir dir="${build}"/> + <javac destdir="${build}" srcdir="${src}" debug="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"> + <mkdir dir="${doc.api}"/> + <javadoc packagenames="*" + sourcepath="${src}" destdir="${doc.api}" + author="true" version="true" + use="true" private="true"> + <classpath refid="project.class.path" /> + <classpath refid="build.class.path"/> + </javadoc> + </target> + <target name="jar" depends="build" + description="Builds a project JAR file"> + <jar basedir="${build}" jarfile="${build}/fits.jar"> + <manifest> + <attribute name="Version" value="${package.version}"/> + </manifest> + </jar> + </target> + <target name="clean" depends="init" + description="Erase all generated files and dirs"> + <delete dir="${build}" verbose="true"/> + <delete dir="${doc}/api" verbose="true"/> + <delete verbose="true"> + <fileset dir="${basedir}" includes="*.fits"/> + <fileset dir="${basedir}" includes="*.fil"/> + <fileset dir="${basedir}" includes="*.hdr"/> + </delete> + </target> +</project> |