diff --git a/.gitignore b/.gitignore index c7a1ce33..4e1591ae 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,6 @@ test.*.log /testlog/ /coverage_html/ *.info +/java-api/Makefile +/java-api/classes/ +/java-api/testclasses/ diff --git a/Makefile.in b/Makefile.in index 28c253c2..fb9c3c18 100644 --- a/Makefile.in +++ b/Makefile.in @@ -85,6 +85,8 @@ CFLAGS+=-DSHA2_USE_INTTYPES_H -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ CFLAGS+=-D_DARWIN_C_SOURCE CFLAGS_SQLITE= @CFLAGS_SQLITE@ +JAVAC= @JAVAC@ + INSTALL= install INSTALL_PROGRAM=$(INSTALL) INSTALL_DATA= $(INSTALL) -m 644 @@ -124,6 +126,30 @@ clean: libmonitorclient.so libmonitorclient.a \ tfw_createfile directory_service fakeradio simulator serval-tests +# Only provide Java targets if the Java compiler is available. +ifneq ($(JAVAC),) + +all: java-api + +clean: java-api-clean + +.PHONY: java-api java-api-clean + +ifneq ($(SOURCE_PREFIX:/%=),) +SOURCE_PREFIX_JAVA_API= $(SOURCE_PREFIX)../java-api/ +else +SOURCE_PREFIX_JAVA_API= $(SOURCE_PREFIX) +endif + +java-api: + @mkdir -p java-api + cd java-api && $(MAKE) SOURCE_PREFIX=$(SOURCE_PREFIX_JAVA_API) all + +java-api-clean: + cd java-api 2>/dev/null && $(MAKE) SOURCE_PREFIX=$(SOURCE_PREFIX_JAVA_API) clean + +endif # $(JAVAC) + # Source code test coverage support -- see doc/Testing.md .PHONY: covzero covinit covhtml is_built_with_coverage has_coverage_data diff --git a/configure.ac b/configure.ac index 9fffbe6d..7cd93933 100644 --- a/configure.ac +++ b/configure.ac @@ -247,4 +247,5 @@ AC_SUBST([CONFIG_H], [config.h]) AC_OUTPUT([ Makefile testconfig.sh + java-api/Makefile ]) diff --git a/java-api/Makefile.in b/java-api/Makefile.in new file mode 100644 index 00000000..948d8590 --- /dev/null +++ b/java-api/Makefile.in @@ -0,0 +1,31 @@ +# Makefile.in for Serval DNA Java API +# vim: noet ts=8 sts=0 sw=8 +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@ +sbindir=@sbindir@ +sysconfdir=@sysconfdir@ +localstatedir=@localstatedir@ + +JAVAC = @JAVAC@ +CLASSDIR = classes +TESTCLASSDIR = testclasses + +.PHONY: all check clean classes testclasses + +all: check classes testclasses + +check: + @if [ -z "$(JAVAC)" ]; then echo "No java compiler configured" >&2; exit 1; fi + @if ! $(JAVAC) -version >/dev/null; then echo "Java compiler not executable" >&2; exit 1; fi + +classes: + @mkdir -p $(CLASSDIR) + find $(SOURCE_PREFIX)src -name '*.java' | xargs $(JAVAC) -Xlint:unchecked -d $(CLASSDIR) + +testclasses: classes + @mkdir -p $(TESTCLASSDIR) + find $(SOURCE_PREFIX)test -name '*.java' | xargs $(JAVAC) -Xlint:unchecked -d $(TESTCLASSDIR) -classpath $(CLASSDIR) + +clean: + @$(RM) -r $(CLASSDIR) $(TESTCLASSDIR) diff --git a/java/org/servalproject/codec/Base64.java b/java-api/src/org/servalproject/codec/Base64.java similarity index 100% rename from java/org/servalproject/codec/Base64.java rename to java-api/src/org/servalproject/codec/Base64.java diff --git a/java/org/servalproject/json/JSONInputException.java b/java-api/src/org/servalproject/json/JSONInputException.java similarity index 100% rename from java/org/servalproject/json/JSONInputException.java rename to java-api/src/org/servalproject/json/JSONInputException.java diff --git a/java/org/servalproject/json/JSONTableScanner.java b/java-api/src/org/servalproject/json/JSONTableScanner.java similarity index 100% rename from java/org/servalproject/json/JSONTableScanner.java rename to java-api/src/org/servalproject/json/JSONTableScanner.java diff --git a/java/org/servalproject/json/JSONTokeniser.java b/java-api/src/org/servalproject/json/JSONTokeniser.java similarity index 100% rename from java/org/servalproject/json/JSONTokeniser.java rename to java-api/src/org/servalproject/json/JSONTokeniser.java diff --git a/java/org/servalproject/servaldna/AbstractExternalInterface.java b/java-api/src/org/servalproject/servaldna/AbstractExternalInterface.java similarity index 100% rename from java/org/servalproject/servaldna/AbstractExternalInterface.java rename to java-api/src/org/servalproject/servaldna/AbstractExternalInterface.java diff --git a/java/org/servalproject/servaldna/AbstractId.java b/java-api/src/org/servalproject/servaldna/AbstractId.java similarity index 100% rename from java/org/servalproject/servaldna/AbstractId.java rename to java-api/src/org/servalproject/servaldna/AbstractId.java diff --git a/java/org/servalproject/servaldna/AbstractJniResults.java b/java-api/src/org/servalproject/servaldna/AbstractJniResults.java similarity index 100% rename from java/org/servalproject/servaldna/AbstractJniResults.java rename to java-api/src/org/servalproject/servaldna/AbstractJniResults.java diff --git a/java/org/servalproject/servaldna/AbstractJsonList.java b/java-api/src/org/servalproject/servaldna/AbstractJsonList.java similarity index 100% rename from java/org/servalproject/servaldna/AbstractJsonList.java rename to java-api/src/org/servalproject/servaldna/AbstractJsonList.java diff --git a/java/org/servalproject/servaldna/AbstractMdpProtocol.java b/java-api/src/org/servalproject/servaldna/AbstractMdpProtocol.java similarity index 100% rename from java/org/servalproject/servaldna/AbstractMdpProtocol.java rename to java-api/src/org/servalproject/servaldna/AbstractMdpProtocol.java diff --git a/java/org/servalproject/servaldna/AsyncResult.java b/java-api/src/org/servalproject/servaldna/AsyncResult.java similarity index 100% rename from java/org/servalproject/servaldna/AsyncResult.java rename to java-api/src/org/servalproject/servaldna/AsyncResult.java diff --git a/java/org/servalproject/servaldna/BundleId.java b/java-api/src/org/servalproject/servaldna/BundleId.java similarity index 100% rename from java/org/servalproject/servaldna/BundleId.java rename to java-api/src/org/servalproject/servaldna/BundleId.java diff --git a/java/org/servalproject/servaldna/BundleKey.java b/java-api/src/org/servalproject/servaldna/BundleKey.java similarity index 100% rename from java/org/servalproject/servaldna/BundleKey.java rename to java-api/src/org/servalproject/servaldna/BundleKey.java diff --git a/java/org/servalproject/servaldna/BundleSecret.java b/java-api/src/org/servalproject/servaldna/BundleSecret.java similarity index 100% rename from java/org/servalproject/servaldna/BundleSecret.java rename to java-api/src/org/servalproject/servaldna/BundleSecret.java diff --git a/java/org/servalproject/servaldna/ChannelSelector.java b/java-api/src/org/servalproject/servaldna/ChannelSelector.java similarity index 100% rename from java/org/servalproject/servaldna/ChannelSelector.java rename to java-api/src/org/servalproject/servaldna/ChannelSelector.java diff --git a/java/org/servalproject/servaldna/FileHash.java b/java-api/src/org/servalproject/servaldna/FileHash.java similarity index 100% rename from java/org/servalproject/servaldna/FileHash.java rename to java-api/src/org/servalproject/servaldna/FileHash.java diff --git a/java/org/servalproject/servaldna/IJniResults.java b/java-api/src/org/servalproject/servaldna/IJniResults.java similarity index 100% rename from java/org/servalproject/servaldna/IJniResults.java rename to java-api/src/org/servalproject/servaldna/IJniResults.java diff --git a/java/org/servalproject/servaldna/IJniServer.java b/java-api/src/org/servalproject/servaldna/IJniServer.java similarity index 100% rename from java/org/servalproject/servaldna/IJniServer.java rename to java-api/src/org/servalproject/servaldna/IJniServer.java diff --git a/java/org/servalproject/servaldna/JniResult.java b/java-api/src/org/servalproject/servaldna/JniResult.java similarity index 100% rename from java/org/servalproject/servaldna/JniResult.java rename to java-api/src/org/servalproject/servaldna/JniResult.java diff --git a/java/org/servalproject/servaldna/JniResultList.java b/java-api/src/org/servalproject/servaldna/JniResultList.java similarity index 100% rename from java/org/servalproject/servaldna/JniResultList.java rename to java-api/src/org/servalproject/servaldna/JniResultList.java diff --git a/java/org/servalproject/servaldna/MdpDnaLookup.java b/java-api/src/org/servalproject/servaldna/MdpDnaLookup.java similarity index 100% rename from java/org/servalproject/servaldna/MdpDnaLookup.java rename to java-api/src/org/servalproject/servaldna/MdpDnaLookup.java diff --git a/java/org/servalproject/servaldna/MdpPacket.java b/java-api/src/org/servalproject/servaldna/MdpPacket.java similarity index 100% rename from java/org/servalproject/servaldna/MdpPacket.java rename to java-api/src/org/servalproject/servaldna/MdpPacket.java diff --git a/java/org/servalproject/servaldna/MdpRoutingChanges.java b/java-api/src/org/servalproject/servaldna/MdpRoutingChanges.java similarity index 100% rename from java/org/servalproject/servaldna/MdpRoutingChanges.java rename to java-api/src/org/servalproject/servaldna/MdpRoutingChanges.java diff --git a/java/org/servalproject/servaldna/MdpServiceLookup.java b/java-api/src/org/servalproject/servaldna/MdpServiceLookup.java similarity index 100% rename from java/org/servalproject/servaldna/MdpServiceLookup.java rename to java-api/src/org/servalproject/servaldna/MdpServiceLookup.java diff --git a/java/org/servalproject/servaldna/MdpSocket.java b/java-api/src/org/servalproject/servaldna/MdpSocket.java similarity index 100% rename from java/org/servalproject/servaldna/MdpSocket.java rename to java-api/src/org/servalproject/servaldna/MdpSocket.java diff --git a/java/org/servalproject/servaldna/PostHelper.java b/java-api/src/org/servalproject/servaldna/PostHelper.java similarity index 100% rename from java/org/servalproject/servaldna/PostHelper.java rename to java-api/src/org/servalproject/servaldna/PostHelper.java diff --git a/java/org/servalproject/servaldna/ResultList.java b/java-api/src/org/servalproject/servaldna/ResultList.java similarity index 100% rename from java/org/servalproject/servaldna/ResultList.java rename to java-api/src/org/servalproject/servaldna/ResultList.java diff --git a/java/org/servalproject/servaldna/RouteLink.java b/java-api/src/org/servalproject/servaldna/RouteLink.java similarity index 100% rename from java/org/servalproject/servaldna/RouteLink.java rename to java-api/src/org/servalproject/servaldna/RouteLink.java diff --git a/java/org/servalproject/servaldna/ServalDClient.java b/java-api/src/org/servalproject/servaldna/ServalDClient.java similarity index 100% rename from java/org/servalproject/servaldna/ServalDClient.java rename to java-api/src/org/servalproject/servaldna/ServalDClient.java diff --git a/java/org/servalproject/servaldna/ServalDCommand.java b/java-api/src/org/servalproject/servaldna/ServalDCommand.java similarity index 100% rename from java/org/servalproject/servaldna/ServalDCommand.java rename to java-api/src/org/servalproject/servaldna/ServalDCommand.java diff --git a/java/org/servalproject/servaldna/ServalDFailureException.java b/java-api/src/org/servalproject/servaldna/ServalDFailureException.java similarity index 100% rename from java/org/servalproject/servaldna/ServalDFailureException.java rename to java-api/src/org/servalproject/servaldna/ServalDFailureException.java diff --git a/java/org/servalproject/servaldna/ServalDHttpConnectionFactory.java b/java-api/src/org/servalproject/servaldna/ServalDHttpConnectionFactory.java similarity index 100% rename from java/org/servalproject/servaldna/ServalDHttpConnectionFactory.java rename to java-api/src/org/servalproject/servaldna/ServalDHttpConnectionFactory.java diff --git a/java/org/servalproject/servaldna/ServalDInterfaceException.java b/java-api/src/org/servalproject/servaldna/ServalDInterfaceException.java similarity index 100% rename from java/org/servalproject/servaldna/ServalDInterfaceException.java rename to java-api/src/org/servalproject/servaldna/ServalDInterfaceException.java diff --git a/java/org/servalproject/servaldna/ServalDNotImplementedException.java b/java-api/src/org/servalproject/servaldna/ServalDNotImplementedException.java similarity index 100% rename from java/org/servalproject/servaldna/ServalDNotImplementedException.java rename to java-api/src/org/servalproject/servaldna/ServalDNotImplementedException.java diff --git a/java/org/servalproject/servaldna/ServerControl.java b/java-api/src/org/servalproject/servaldna/ServerControl.java similarity index 100% rename from java/org/servalproject/servaldna/ServerControl.java rename to java-api/src/org/servalproject/servaldna/ServerControl.java diff --git a/java/org/servalproject/servaldna/SigningKey.java b/java-api/src/org/servalproject/servaldna/SigningKey.java similarity index 100% rename from java/org/servalproject/servaldna/SigningKey.java rename to java-api/src/org/servalproject/servaldna/SigningKey.java diff --git a/java/org/servalproject/servaldna/Subscriber.java b/java-api/src/org/servalproject/servaldna/Subscriber.java similarity index 100% rename from java/org/servalproject/servaldna/Subscriber.java rename to java-api/src/org/servalproject/servaldna/Subscriber.java diff --git a/java/org/servalproject/servaldna/SubscriberId.java b/java-api/src/org/servalproject/servaldna/SubscriberId.java similarity index 100% rename from java/org/servalproject/servaldna/SubscriberId.java rename to java-api/src/org/servalproject/servaldna/SubscriberId.java diff --git a/java/org/servalproject/servaldna/keyring/KeyringCommon.java b/java-api/src/org/servalproject/servaldna/keyring/KeyringCommon.java similarity index 100% rename from java/org/servalproject/servaldna/keyring/KeyringCommon.java rename to java-api/src/org/servalproject/servaldna/keyring/KeyringCommon.java diff --git a/java/org/servalproject/servaldna/keyring/KeyringIdentity.java b/java-api/src/org/servalproject/servaldna/keyring/KeyringIdentity.java similarity index 100% rename from java/org/servalproject/servaldna/keyring/KeyringIdentity.java rename to java-api/src/org/servalproject/servaldna/keyring/KeyringIdentity.java diff --git a/java/org/servalproject/servaldna/keyring/KeyringIdentityList.java b/java-api/src/org/servalproject/servaldna/keyring/KeyringIdentityList.java similarity index 100% rename from java/org/servalproject/servaldna/keyring/KeyringIdentityList.java rename to java-api/src/org/servalproject/servaldna/keyring/KeyringIdentityList.java diff --git a/java/org/servalproject/servaldna/meshmb/MeshMBCommon.java b/java-api/src/org/servalproject/servaldna/meshmb/MeshMBCommon.java similarity index 100% rename from java/org/servalproject/servaldna/meshmb/MeshMBCommon.java rename to java-api/src/org/servalproject/servaldna/meshmb/MeshMBCommon.java diff --git a/java/org/servalproject/servaldna/meshmb/MessagePlyList.java b/java-api/src/org/servalproject/servaldna/meshmb/MessagePlyList.java similarity index 100% rename from java/org/servalproject/servaldna/meshmb/MessagePlyList.java rename to java-api/src/org/servalproject/servaldna/meshmb/MessagePlyList.java diff --git a/java/org/servalproject/servaldna/meshmb/PlyMessage.java b/java-api/src/org/servalproject/servaldna/meshmb/PlyMessage.java similarity index 100% rename from java/org/servalproject/servaldna/meshmb/PlyMessage.java rename to java-api/src/org/servalproject/servaldna/meshmb/PlyMessage.java diff --git a/java/org/servalproject/servaldna/meshms/MeshMSCommon.java b/java-api/src/org/servalproject/servaldna/meshms/MeshMSCommon.java similarity index 100% rename from java/org/servalproject/servaldna/meshms/MeshMSCommon.java rename to java-api/src/org/servalproject/servaldna/meshms/MeshMSCommon.java diff --git a/java/org/servalproject/servaldna/meshms/MeshMSConversation.java b/java-api/src/org/servalproject/servaldna/meshms/MeshMSConversation.java similarity index 100% rename from java/org/servalproject/servaldna/meshms/MeshMSConversation.java rename to java-api/src/org/servalproject/servaldna/meshms/MeshMSConversation.java diff --git a/java/org/servalproject/servaldna/meshms/MeshMSConversationList.java b/java-api/src/org/servalproject/servaldna/meshms/MeshMSConversationList.java similarity index 100% rename from java/org/servalproject/servaldna/meshms/MeshMSConversationList.java rename to java-api/src/org/servalproject/servaldna/meshms/MeshMSConversationList.java diff --git a/java/org/servalproject/servaldna/meshms/MeshMSException.java b/java-api/src/org/servalproject/servaldna/meshms/MeshMSException.java similarity index 100% rename from java/org/servalproject/servaldna/meshms/MeshMSException.java rename to java-api/src/org/servalproject/servaldna/meshms/MeshMSException.java diff --git a/java/org/servalproject/servaldna/meshms/MeshMSMessage.java b/java-api/src/org/servalproject/servaldna/meshms/MeshMSMessage.java similarity index 100% rename from java/org/servalproject/servaldna/meshms/MeshMSMessage.java rename to java-api/src/org/servalproject/servaldna/meshms/MeshMSMessage.java diff --git a/java/org/servalproject/servaldna/meshms/MeshMSMessageList.java b/java-api/src/org/servalproject/servaldna/meshms/MeshMSMessageList.java similarity index 100% rename from java/org/servalproject/servaldna/meshms/MeshMSMessageList.java rename to java-api/src/org/servalproject/servaldna/meshms/MeshMSMessageList.java diff --git a/java/org/servalproject/servaldna/meshms/MeshMSProtocolFaultException.java b/java-api/src/org/servalproject/servaldna/meshms/MeshMSProtocolFaultException.java similarity index 100% rename from java/org/servalproject/servaldna/meshms/MeshMSProtocolFaultException.java rename to java-api/src/org/servalproject/servaldna/meshms/MeshMSProtocolFaultException.java diff --git a/java/org/servalproject/servaldna/meshms/MeshMSStatus.java b/java-api/src/org/servalproject/servaldna/meshms/MeshMSStatus.java similarity index 100% rename from java/org/servalproject/servaldna/meshms/MeshMSStatus.java rename to java-api/src/org/servalproject/servaldna/meshms/MeshMSStatus.java diff --git a/java/org/servalproject/servaldna/meshms/MeshMSUnknownIdentityException.java b/java-api/src/org/servalproject/servaldna/meshms/MeshMSUnknownIdentityException.java similarity index 100% rename from java/org/servalproject/servaldna/meshms/MeshMSUnknownIdentityException.java rename to java-api/src/org/servalproject/servaldna/meshms/MeshMSUnknownIdentityException.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeBundleList.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeBundleList.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeBundleList.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeBundleList.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeBundleStatus.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeBundleStatus.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeBundleStatus.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeBundleStatus.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeCommon.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeCommon.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeCommon.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeCommon.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeDecryptionException.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeDecryptionException.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeDecryptionException.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeDecryptionException.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeDuplicateBundleException.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeDuplicateBundleException.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeDuplicateBundleException.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeDuplicateBundleException.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeEncryptionException.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeEncryptionException.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeEncryptionException.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeEncryptionException.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeException.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeException.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeException.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeException.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeFakeManifestException.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeFakeManifestException.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeFakeManifestException.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeFakeManifestException.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeIncompleteManifest.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeIncompleteManifest.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeIncompleteManifest.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeIncompleteManifest.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeInconsistencyException.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeInconsistencyException.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeInconsistencyException.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeInconsistencyException.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeInsertBundle.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeInsertBundle.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeInsertBundle.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeInsertBundle.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeInvalidManifestException.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeInvalidManifestException.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeInvalidManifestException.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeInvalidManifestException.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeListBundle.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeListBundle.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeListBundle.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeListBundle.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeManifest.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeManifest.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeManifest.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeManifest.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeManifestAlreadyStoredException.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeManifestAlreadyStoredException.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeManifestAlreadyStoredException.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeManifestAlreadyStoredException.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeManifestBundle.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeManifestBundle.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeManifestBundle.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeManifestBundle.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeManifestNotFoundException.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeManifestNotFoundException.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeManifestNotFoundException.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeManifestNotFoundException.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeManifestParseException.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeManifestParseException.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeManifestParseException.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeManifestParseException.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeManifestSizeException.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeManifestSizeException.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeManifestSizeException.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeManifestSizeException.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeOutdatedBundleException.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeOutdatedBundleException.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeOutdatedBundleException.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeOutdatedBundleException.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomePayloadBundle.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomePayloadBundle.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomePayloadBundle.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomePayloadBundle.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomePayloadRawBundle.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomePayloadRawBundle.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomePayloadRawBundle.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomePayloadRawBundle.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomePayloadStatus.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomePayloadStatus.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomePayloadStatus.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomePayloadStatus.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeReadOnlyException.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeReadOnlyException.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeReadOnlyException.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeReadOnlyException.java diff --git a/java/org/servalproject/servaldna/rhizome/RhizomeStoreFullException.java b/java-api/src/org/servalproject/servaldna/rhizome/RhizomeStoreFullException.java similarity index 100% rename from java/org/servalproject/servaldna/rhizome/RhizomeStoreFullException.java rename to java-api/src/org/servalproject/servaldna/rhizome/RhizomeStoreFullException.java diff --git a/javatest/org/servalproject/test/CommandLine.java b/java-api/test/org/servalproject/test/CommandLine.java similarity index 100% rename from javatest/org/servalproject/test/CommandLine.java rename to java-api/test/org/servalproject/test/CommandLine.java diff --git a/javatest/org/servalproject/test/Keyring.java b/java-api/test/org/servalproject/test/Keyring.java similarity index 100% rename from javatest/org/servalproject/test/Keyring.java rename to java-api/test/org/servalproject/test/Keyring.java diff --git a/javatest/org/servalproject/test/Meshms.java b/java-api/test/org/servalproject/test/Meshms.java similarity index 100% rename from javatest/org/servalproject/test/Meshms.java rename to java-api/test/org/servalproject/test/Meshms.java diff --git a/javatest/org/servalproject/test/Rhizome.java b/java-api/test/org/servalproject/test/Rhizome.java similarity index 100% rename from javatest/org/servalproject/test/Rhizome.java rename to java-api/test/org/servalproject/test/Rhizome.java diff --git a/javatest/org/servalproject/test/ServalDTests.java b/java-api/test/org/servalproject/test/ServalDTests.java similarity index 100% rename from javatest/org/servalproject/test/ServalDTests.java rename to java-api/test/org/servalproject/test/ServalDTests.java diff --git a/testdefs_java.sh b/testdefs_java.sh index 1d3dfc14..e587b0dc 100644 --- a/testdefs_java.sh +++ b/testdefs_java.sh @@ -1,5 +1,6 @@ # Definitions for test suites using Java. -# Copyright 2014 Serval Project Inc. +# Copyright 2014-2015 Serval Project Inc. +# Copyright 2016 Flinders University # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -15,7 +16,13 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source "${0%/*}/../testconfig.sh" +testdefs_java_sh=$(abspath "${BASH_SOURCE[0]}") +java_source_root="${testdefs_java_sh%/*}" +java_build_root="$java_source_root" +java_classdir="$java_build_root/java-api/classes" +java_testclassdir="$java_build_root/java-api/testclasses" + +source "$java_build_root/testconfig.sh" # Utility function for setting up servald JNI fixtures: # - check that libservaldaemon.so is present @@ -25,13 +32,10 @@ setup_servald_so() { export LD_LIBRARY_PATH="$servald_build_root" } -compile_java_classes() { - assert --message='Java compiler was detected by ./configure' type -p "$JAVAC" >/dev/null - mkdir classes - assert find "$servald_source_root"/java* -name *.java | xargs $JAVAC -Xlint:unchecked -d classes - assert [ -r classes/org/servalproject/servaldna/ServalDCommand.class ] - assert [ -r classes/org/servalproject/servaldna/IJniResults.class ] - assert [ -r classes/org/servalproject/test/ServalDTests.class ] +assert_java_classes_exist() { + assert [ -r "$java_classdir/org/servalproject/servaldna/ServalDCommand.class" ] + assert [ -r "$java_classdir/org/servalproject/servaldna/IJniResults.class" ] + assert [ -r "$java_testclassdir/org/servalproject/test/ServalDTests.class" ] } _executeJava() { @@ -45,7 +49,7 @@ _executeJava() { *) break;; esac done - "$func" "${opts[@]}" java "-Djava.library.path=$LD_LIBRARY_PATH" -classpath "$PWD/classes" "$@" + "$func" "${opts[@]}" java "-Djava.library.path=$LD_LIBRARY_PATH" -classpath "$java_classdir:$java_testclassdir" "$@" } _run() { @@ -79,7 +83,7 @@ unset_vars_with_prefix() { } # Utility function: -# +# # unpack_vars PREFIX TEXT # # parses the given TEXT which must have the form: diff --git a/tests/jni b/tests/jni index baf2fa65..d7a4d654 100755 --- a/tests/jni +++ b/tests/jni @@ -29,7 +29,7 @@ setup() { set debug.verbose 1 \ set log.console.level debug assert_echo_works - compile_java_classes + assert_java_classes_exist setup_servald_so } diff --git a/tests/keyringjava b/tests/keyringjava index 74762282..be8babf2 100755 --- a/tests/keyringjava +++ b/tests/keyringjava @@ -25,7 +25,7 @@ source "${0%/*}/../testdefs_java.sh" setup() { setup_servald setup_servald_so - compile_java_classes + assert_java_classes_exist set_instance +A set_keyring_config set_extra_config diff --git a/tests/meshmsjava b/tests/meshmsjava index b5ceafaa..684192af 100755 --- a/tests/meshmsjava +++ b/tests/meshmsjava @@ -26,7 +26,7 @@ source "${0%/*}/../testdefs_meshms.sh" setup() { setup_servald setup_servald_so - compile_java_classes + assert_java_classes_exist set_instance +A executeOk_servald config \ set log.console.level debug \ diff --git a/tests/rhizomejava b/tests/rhizomejava index 42ffa940..8de6614a 100755 --- a/tests/rhizomejava +++ b/tests/rhizomejava @@ -26,7 +26,7 @@ source "${0%/*}/../testdefs_rhizome.sh" setup() { setup_servald setup_servald_so - compile_java_classes + assert_java_classes_exist set_instance +A executeOk_servald config \ set log.console.level debug \