Subject: [bug#28841] [PATCH 03/24] gnu: Add java-eclipse-jetty-test-helper.

From: [email-masked]
Date: Sun, 15 Oct 2017 00:23:28 +0200

From: Julien Lepiller <[email-masked]>

* gnu/packages/java.scm (java-eclipse-jetty-test-helper): New variable.
---
 gnu/packages/java.scm | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 4561b92d8..d8920a097 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -6101,3 +6101,51 @@ Servlet, JavaServer Pages, Java Expression Language and Java WebSocket
 technologies.  The Java Servlet, JavaServer Pages, Java Expression Language and
 Java WebSocket specifications are developed under the Java Community Process.")
     (license license:asl2.0)))
+
+(define-public java-eclipse-jetty-test-helper
+  (package
+    (name "java-eclipse-jetty-test-helper")
+    (version "4.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/eclipse/jetty.toolchain/"
+                                  "archive/jetty-test-helper-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1jd6r9wc26fa11si4rn2gvy8ml8q4zw1nr6v04mjp8wvwpgvzwx5"))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:jar-name "eclipse-jetty-test-helper.jar"
+       #:source-dir "src/main/java"
+       #:test-dir "src/test"
+       #:jdk ,icedtea-8
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'chdir
+           (lambda _
+             (chdir "jetty-test-helper")))
+         (add-before 'build 'fix-build-path
+           (lambda _
+             ;; FIXME:
+             ;; This file assumes that the build directory is named "target"
+             ;; but it is not the case with our ant-build-system. Once we have
+             ;; maven though, we will have to rebuild this package because this
+             ;; assumption is correct with maven-build-system.
+             (substitute*
+               "src/main/java/org/eclipse/jetty/toolchain/test/MavenTestingUtils.java"
+               (("\"target\"") "\"build\"")
+               (("\"tests\"") "\"test-classes\""))))
+         (add-before 'check 'fix-paths
+           (lambda _
+             (with-directory-excursion "src/test/java/org/eclipse/jetty/toolchain/test"
+               (substitute* '("FSTest.java" "OSTest.java" "TestingDirTest.java"
+                              "MavenTestingUtilsTest.java")
+                 (("target/tests") "build/test-classes")
+                 (("\"target") "\"build"))))))))
+    (inputs
+     `(("junit" ,java-junit)
+       ("hamcrest" ,java-hamcrest-all)))
+    (home-page "https://www.eclipse.org/jetty/")
+    (synopsis "Helper classes for jetty tests")
+    (description "This packages contains helper classes for testing jetty.")
+    (license (list license:epl1.0 license:asl2.0))))
-- 
2.14.2