summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2012-08-09 23:46:34 -0500
committerEndi Sukma Dewata <edewata@redhat.com>2012-08-15 12:02:29 -0500
commita513ee42025af8bba22e6efb3e2fe268076fbd28 (patch)
treee1e14c5d39d65754f3047ab664e68cdeb04a30ff
parent0198bf929702b756214b5f509ffe677ca58bf650 (diff)
downloadpki-a513ee42025af8bba22e6efb3e2fe268076fbd28.tar.gz
pki-a513ee42025af8bba22e6efb3e2fe268076fbd28.tar.xz
pki-a513ee42025af8bba22e6efb3e2fe268076fbd28.zip
Updated test build scripts.
The build scripts for test, util test, and common test components have been updated to automatically find the source codes and not create unnecessary test jar files. Ticket #62
-rw-r--r--base/common/test/CMakeLists.txt65
-rw-r--r--base/test/src/CMakeLists.txt26
-rw-r--r--base/util/test/CMakeLists.txt49
-rw-r--r--cmake/Modules/Java.cmake3
4 files changed, 47 insertions, 96 deletions
diff --git a/base/common/test/CMakeLists.txt b/base/common/test/CMakeLists.txt
index 2f7b4fa4e..181c7530f 100644
--- a/base/common/test/CMakeLists.txt
+++ b/base/common/test/CMakeLists.txt
@@ -28,50 +28,24 @@ find_file(PKI_CMSBUNDLE_JAR
${JAVA_JAR_INSTALL_DIR}/pki
)
-# TODO: create CMake function to find all Java files
-set(pki-common-test_SRCS
- com/netscape/certsrv/app/CMSEngineDefaultStub.java
- com/netscape/certsrv/authentication/AuthTokenTest.java
- com/netscape/certsrv/logging/LoggerDefaultStub.java
- com/netscape/certsrv/request/AgentApprovalsTest.java
- com/netscape/cmscore/dbs/CertRecordListTest.java
- com/netscape/cmscore/dbs/DBRegistryDefaultStub.java
- com/netscape/cmscore/dbs/DBRegistryTest.java
- com/netscape/cmscore/dbs/DBSSessionDefaultStub.java
- com/netscape/cmscore/dbs/DBSubsystemDefaultStub.java
- com/netscape/cmscore/dbs/DBVirtualListDefaultStub.java
- com/netscape/cmscore/dbs/RequestRecordDefaultStub.java
- com/netscape/cmscore/request/DBDynAttrMapperDefaultStub.java
- com/netscape/cmscore/request/ExtAttrDynMapperTest.java
- com/netscape/cmscore/request/ExtDataHashtableTest.java
- com/netscape/cmscore/request/RequestDefaultStub.java
- com/netscape/cmscore/request/RequestModDefaultStub.java
- com/netscape/cmscore/request/RequestQueueTest.java
- com/netscape/cmscore/request/RequestRecordTest.java
- com/netscape/cmscore/request/RequestTest.java
- com/netscape/cmscore/test/CMSBaseTestCase.java
- com/netscape/cmscore/test/TestHelper.java
-)
-
-set(CMAKE_JAVA_INCLUDE_PATH
- ${PKI_NSUTIL_JAR} ${PKI_CMSUTIL_JAR}
- ${PKI_CERTSRV_JAR} ${PKI_CMS_JAR} ${PKI_CMSCORE_JAR} ${PKI_CMSBUNDLE_JAR}
- ${LDAPJDK_JAR} ${SERVLET_JAR} ${VELOCITY_JAR} ${XALAN_JAR} ${XERCES_JAR}
- ${JSS_JAR} ${COMMONS_CODEC_JAR} ${SYMKEY_JAR}
- ${PKI_TEST_JAR} ${JUNIT_JAR}
-)
-
-set(CMAKE_JAVA_TARGET_VERSION ${APPLICATION_VERSION})
-
-# build test jar file
-# TODO: create CMake function to compile without building jar file
+# build pki-common-test
# TODO: build test only when the test is invoked
-set(CMAKE_JAR_CLASSES_PREFIX com/netscape)
-add_jar(pki-common-test ${pki-common-test_SRCS})
-add_dependencies(pki-common-test
- pki-nsutil pki-cmsutil
- pki-certsrv pki-cms pki-cmscore pki-cmsbundle
- pki-test
+javac(pki-common-test-classes
+ SOURCES
+ com/netscape/certsrv/*.java
+ com/netscape/cmscore/*.java
+ CLASSPATH
+ ${PKI_NSUTIL_JAR} ${PKI_CMSUTIL_JAR}
+ ${PKI_CERTSRV_JAR} ${PKI_CMS_JAR} ${PKI_CMSCORE_JAR} ${PKI_CMSBUNDLE_JAR}
+ ${LDAPJDK_JAR} ${SERVLET_JAR} ${VELOCITY_JAR} ${XALAN_JAR} ${XERCES_JAR}
+ ${JSS_JAR} ${COMMONS_CODEC_JAR} ${SYMKEY_JAR} ${JUNIT_JAR}
+ ${CMAKE_BINARY_DIR}/test/classes
+ OUTPUT_DIR
+ ${CMAKE_BINARY_DIR}/test/classes
+ DEPENDS
+ pki-test-classes
+ pki-nsutil pki-cmsutil
+ pki-certsrv pki-cms pki-cmscore pki-cmsbundle
)
# create test target
@@ -79,12 +53,11 @@ add_dependencies(pki-common-test
# TODO: create CMake function to find all JUnit test classes
add_junit_test(test-pki-common
CLASSPATH
- ${pki-common-test_JAR_FILE}
${PKI_NSUTIL_JAR} ${PKI_CMSUTIL_JAR}
${PKI_CERTSRV_JAR} ${PKI_CMS_JAR} ${PKI_CMSCORE_JAR} ${PKI_CMSBUNDLE_JAR}
${LDAPJDK_JAR} ${SERVLET_JAR} ${VELOCITY_JAR}
- ${JSS_JAR} ${COMMONS_CODEC_JAR} ${SYMKEY_JAR}
- ${PKI_TEST_JAR} ${JUNIT_JAR}
+ ${JSS_JAR} ${COMMONS_CODEC_JAR} ${SYMKEY_JAR} ${JUNIT_JAR}
+ ${CMAKE_BINARY_DIR}/test/classes
TESTS
com.netscape.certsrv.authentication.AuthTokenTest
com.netscape.certsrv.request.AgentApprovalsTest
diff --git a/base/test/src/CMakeLists.txt b/base/test/src/CMakeLists.txt
index 3631baa73..5e7c12d64 100644
--- a/base/test/src/CMakeLists.txt
+++ b/base/test/src/CMakeLists.txt
@@ -1,20 +1,12 @@
project(pki-test_java Java)
-# TODO: create CMake function to find all Java files
-set(pki-test_java_SRCS
- com/netscape/test/TestListener.java
- com/netscape/test/TestRunner.java
-)
-
-set(CMAKE_JAVA_INCLUDE_PATH
- ${XALAN_JAR} ${XERCES_JAR} ${JUNIT_JAR}
-)
-
-set(CMAKE_JAVA_TARGET_VERSION ${APPLICATION_VERSION})
-
-# build test jar file
-# TODO: create CMake function to compile without building jar file
+# build pki-test
# TODO: build test only when the test is invoked
-set(CMAKE_JAR_CLASSES_PREFIX com/netscape)
-add_jar(pki-test ${pki-test_java_SRCS})
-set(PKI_TEST_JAR ${pki-test_JAR_FILE} CACHE INTERNAL "pki-test jar file") \ No newline at end of file
+javac(pki-test-classes
+ SOURCES
+ com/netscape/test/*.java
+ CLASSPATH
+ ${XALAN_JAR} ${XERCES_JAR} ${JUNIT_JAR}
+ OUTPUT_DIR
+ ${CMAKE_BINARY_DIR}/test/classes
+)
diff --git a/base/util/test/CMakeLists.txt b/base/util/test/CMakeLists.txt
index 592f3dbbb..28aae0a14 100644
--- a/base/util/test/CMakeLists.txt
+++ b/base/util/test/CMakeLists.txt
@@ -1,46 +1,29 @@
project(pki-util-test Java)
-# TODO: create CMake function to find all Java files
-set(pki-util-test_SRCS
- com/netscape/security/util/BMPStringTest.java
- com/netscape/security/util/IA5StringTest.java
- com/netscape/security/util/JSSUtil.java
- com/netscape/security/util/PrintableStringTest.java
- com/netscape/security/util/StringTestUtil.java
- com/netscape/security/util/TeletexStringTest.java
- com/netscape/security/util/UniversalStringTest.java
- com/netscape/security/util/UTF8StringTest.java
- com/netscape/security/x509/ConverterTestUtil.java
- com/netscape/security/x509/DirStrConverterTest.java
- com/netscape/security/x509/GenericValueConverterTest.java
- com/netscape/security/x509/IA5StringConverterTest.java
- com/netscape/security/x509/PrintableConverterTest.java
-)
-
-set(CMAKE_JAVA_INCLUDE_PATH
- ${PKI_NSUTIL_JAR} ${PKI_CMSUTIL_JAR}
- ${JSS_JAR} ${LDAPJDK_JAR} ${COMMONS_CODEC_JAR} ${XALAN_JAR} ${XERCES_JAR}
- ${PKI_TEST_JAR} ${JUNIT_JAR}
-)
-
-set(CMAKE_JAVA_TARGET_VERSION ${APPLICATION_VERSION})
-
-# build test jar file
-# TODO: create CMake function to compile without building jar file
+# build pki-util-test
# TODO: build test only when the test is invoked
-set(CMAKE_JAR_CLASSES_PREFIX com/netscape)
-add_jar(pki-util-test ${pki-util-test_SRCS})
-add_dependencies(pki-util-test pki-nsutil pki-cmsutil pki-test)
+javac(pki-util-test-classes
+ SOURCES
+ com/netscape/security/util/*.java
+ com/netscape/security/x509/*.java
+ CLASSPATH
+ ${PKI_NSUTIL_JAR} ${PKI_CMSUTIL_JAR}
+ ${JSS_JAR} ${LDAPJDK_JAR} ${COMMONS_CODEC_JAR} ${XALAN_JAR} ${XERCES_JAR}
+ ${PKI_TEST_JAR} ${JUNIT_JAR}
+ OUTPUT_DIR
+ ${CMAKE_BINARY_DIR}/test/classes
+ DEPENDS
+ pki-test-classes pki-nsutil pki-cmsutil
+)
# create test target
# do not include xalan and xerces in class path
# TODO: create CMake function to find all JUnit test classes
add_junit_test(test-pki-util
CLASSPATH
- ${pki-util-test_JAR_FILE}
${PKI_NSUTIL_JAR} ${PKI_CMSUTIL_JAR}
- ${JSS_JAR} ${LDAPJDK_JAR} ${COMMONS_CODEC_JAR}
- ${PKI_TEST_JAR} ${JUNIT_JAR}
+ ${JSS_JAR} ${LDAPJDK_JAR} ${COMMONS_CODEC_JAR} ${JUNIT_JAR}
+ ${CMAKE_BINARY_DIR}/test/classes
TESTS
com.netscape.security.util.BMPStringTest
com.netscape.security.util.IA5StringTest
diff --git a/cmake/Modules/Java.cmake b/cmake/Modules/Java.cmake
index bd2855baf..78f14a22a 100644
--- a/cmake/Modules/Java.cmake
+++ b/cmake/Modules/Java.cmake
@@ -67,6 +67,8 @@ function(javac target)
add_custom_target(${target} ALL DEPENDS ${depends})
+ file(MAKE_DIRECTORY ${output_dir})
+
add_custom_command(
TARGET ${target}
COMMAND ${CMAKE_COMMAND}
@@ -77,6 +79,7 @@ function(javac target)
-P ${CMAKE_MODULE_PATH}/JavaFileList.cmake
COMMAND ${CMAKE_Java_COMPILER}
${CMAKE_JAVA_COMPILE_FLAGS}
+ -encoding UTF-8
-cp ${native_classpath}
-d ${output_dir}
@${file_list}