summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2018-08-09Update stroke's junit testsHEADmasterAlex Clayton
Update stroke junit tests so it can cope with the latest version of Junit 4 (4.12) which no requires both Junit and Hamcrest to be on the classpath. This is done using a method similar to how JUNIT is currently set. The make file passes a new HAMCREST enviroment variable to the ant script as HAMCREST_JAR which ant then adds to the tests classpath. So to run the tests with the new JUNIT will need to set JUNIT to point to junit.jar and HAMCREST to the hamcrest jar, then run Make test. Also make use of ant's junitreport task to create a html version of the junit test's results, which makes diagnosing failures easier. Test-information: After setting HAMCREST and JUNIT then running Make Test on OSX and Unix all tests pass and HTML output is generated. If HAMCREST is not set but JUNIT points to latest junit.jar (i.e one that requires hamcrest on class path) tests fail with error about not being able to find hamcrest classes. If HAMCREST not set but JUNIT points to an older junit.jar then tests run correctly. On Windows got the unit tests to run by calling ant directly, again with HAMCREST and JUNIT set tests run correctly. Change-Id: I272b1dbe1bde05593df15f22814b7882a494f2c8
2018-03-21Ensure JavaTimer.stop() cleans up any unresolved eventsAlex Clayton
The code for stop() in JavaTimer read: @Override public void stop() { timer_.stop(); //FIXME: This needs to clear any remaining events out of the EventLoop queue. } Where as the equivalent swiften code in BoostTimer was: void BoostTimer::stop() { { std::unique_lock<std::mutex> lockTimer(timerMutex); shuttingDown = true; timer->cancel(); eventLoop->removeEventsFromOwner(shared_from_this()); } } This patch updates the java code to bring it inline with the swiften code. In short to make sure it removes any remaining events from the event loop when it is stopped. Test-information: Code Inspection. Unit test still pass. Ran update stroke against M-Link Console it ran ok. Change-Id: Idf92e92d002b8404547702d1c34738165e331810
2017-11-15Allow affiliations on full jidsAlex Clayton
Allow affiliations to be set on full jids. This is so we can set affiliations for group (which use full JIDS to identify themselves). Test-information: Works with Gurmeen's group affiliation patch for MLC Change-Id: I74a4977a044bbb4ea031def0072c6c42b7c0c976
2017-04-06Implement Message Carbons enable requestAlan Young
Swift-Commit: b16a2d1483f59ad93a2171c6c286e12f4ebbf3be Change-Id: I8d5b5d9975651a2353909dea976f58e4bf12e014
2017-04-05Fix PresenceOracle initialization of PriorityQueue with initial size 0.Alan Young
Change-Id: I624ede83351e2901272173f775d4f098743183b3
2016-09-13Fix cut-n-paste typoAlan Young
Change-Id: Ie57f18aee639d6ba911cd95ac6b45d048462c105
2016-09-13Rework JID class internal representation of resource presence.Alan Young
Remove explicit hasResource_ boolean and use non-null status of resource_ instead. Mostly test this with isBare(). Tidy up compare() method. A JID is valid by default. Remove extraneous setting of valid_ and centralize testing of validity to nameprepAndSetComponents(). Ensure that resource_ is initialized to null by default so that it is correct when a JID instance is restored using some sort of serialization, including com.google.gson.Gson which is used by Swift. All JID test cases pass, including ones using invalid "x@y/" test string representations. Change-Id: Ib77a7cde03e8390c405633cddea5939aa9e0b576
2016-07-15Stop HostAddress constructor running DNS lookup.Alex Clayton
When running the latest stroke against harrier android a NetworkOnMainThread exception was encountered. This was traced to the new constructor HostAddress(String) that was been called by Connector.start() method. The issue was dues to difference between the java code in stroke and the c++ code in swiften. In swiften the equivalent conde calls boost::asio::ip::address::from_string, which parses a string that may be an ipv4 or ipv6 address into an IP address object. If the string is not one of these then the object is left invalid. In the java code InetAddress.getByName(String name) is used instead. If this is an ipv4 or ipv6 address then it parses it into an InetAddress object. However if is not one of these it does a DNS lookup on the address. This was what was causing the error. To match the C++ the java code should only create an InetAddress if the input is an IP address, if not it should be left null. This was done by copying the IPv4 and IPv6 regexes in the Regex class in isode lib. The input to HostAddress(String) is checked against these if it matches InetAddress.getByName is called, otherwise address is set to null. Test-information: Ran unit tests in stroke they all pass. Ran code against android harrier, no longer fails. Ran against MLC (with updates for other changes in stroke api) it still passes. Change-Id: I1945c7c3cdfece8feb45b9196483131c0d9c4e7c
2016-06-03XMPPRosterImpl.getItems() needs to do deep copy.Alan Young
And (therefore) XMPPRosterItem needs a copy constructor. Change-Id: I9c4d833e559cf70d0c125fc6d841f16b8c2ce5b9
2016-04-20Rework Signals for time and space optimizationsAlan Young
Each Signal* class extends BaseSignal. Each Slot* class extends BaseSlot. BaseSignal manages the set of binds associated with it via addBind() and getBinds() which are called from Signal*. It is optimized for the cases of zero or one bind, only allocating a HashMap to hold a larger set when needed. The interaction with SignalConnection to handle disconnection is effected via a callback interface rather than another Signal. Change-Id: Ifa44c1eb40b778c303db947a6e74fe20d1b41a90
2016-04-20Remove use of Java 7 SocketChannel.getRemoteAddress()Alan Young
Not supported on Android. Change-Id: I55551ceeed06ab1ff4ce9e5995f809466d0e69bd
2016-04-20Revert use of Java 7 'XXX' Time Pattern element.Alan Young
Not supported in Android. Was introduced in commit 8fe7526. Change-Id: I9fb396749c92b89cbaa7fac6cdeb047161ed0358
2016-03-22Tidy XEP-0141 codeAlex Clayton
As per swiften patch of the same name. This change addresses some feedback the previous XEP-0141 commit. Test-information: Unit tests stil pass. Change-Id: I3a9f9ec93b56352418f8288371bbd6874e01310d
2016-03-22Don't allow JIDs with explicitly empty resourcesAlex Clayton
As per swiften patch of same name (6159c580884583bad0e17d4e96ea9ffc7e0be29a). A JID may have no resource, but may not have an empty resource. Mark such JIDs as invalid. Test-information: New unit test passes. Change-Id: I66ec7810ac29cb3963470b08f0d9f4901d2307f3
2016-03-22Add signal for VCard Retrieval Error in VCardManager.Alex Clayton
As per patch 'improve profile editing UX when vCard is not supported' (4da2f1c85f2eeac9fb98d5dcc9097eeed9b34e8b). Test-information: Unit tests still pass. Change-Id: Ic5b0e24ac54eaf97c9a4cd1754219a05b59684e4
2016-03-22Try to fix possible race condition in Connector and ProxiedConnection.Alex Clayton
As per patch 'Fix possible race condition between Connection and Connectors' (7eec2000d72f8fa597398704121d0b73a84ca284). The issue occurs with ProxiedConnection that started connecting but do not have an external reference anymore. As soon as the handlers of the ProxiedConnection are disconnected from the signals of the connection_ object, the remaining references to a shared ProxiedConnection vanish and the ProxiedConnection is deleted, while it still requires access to its members in ProxiedConnection::handleConnectFinished(). Test-information: Unit tests pass ok. Change-Id: I6c81009262dd51cda17b1b93a15edf968f40e464
2016-03-16Support early IBB use in Jingle File TransferAlex Clayton
As per swiften patch of the same name (75703db2de5bbfb6622286600362016edb42dfb0). Previously Jingle File Transfer in Stroke only used IBB transport as fallback mechanism. With this patch Stroke will use IBB transport candidates directly in the first session-initate/session-accept message if the other party only supports IBB. Test-information: Unit tests all pass. Change-Id: Ice73a6028f10c63490bdb775a0a407fad48f587a
2016-03-16Add FileWriteBytestream class and test.Alex Clayton
Adds a FileWriteBytestream class plus a test for it. These had been missed out previously. Also as per patch 'Fix crash when saving a received file to non-writable location' changed WriteBytestream.write() method to return a boolean indicating success or failure. Test-information: Tests pass ok. Change-Id: I0c3676db8b67573142e8628f439cecf54f3f8f1a
2016-03-16Add JID.isValid() checks to the JIDTest unit tests.Alex Clayton
As per swiften patch 'Add more tests for JID validity' (59c64a11e0bceca4876ba69ef2f30519629b108c). Test-information: All unit tests pass. Change-Id: Iefb77fa089afd13c0f8b5f51f2a3115001a061e8
2016-03-16Allow null values for Message bodyAlex Clayton
As per patch swiften patch 'Change stanza body to boost::optional<std::string> type' (1b9ccc1fef6104eaf951153ddccdc6bb15899e9a) allow null values for body of a Message stanza for the case when it has no body. Test-information: Unit tests still pass. Change-Id: I487ecb14e4d915b7a903863d4378b8e2337d3b30
2016-03-16Add destroy methods to IncomingJingleFileTransfer and ↵Alex Clayton
OutgoingJingleFileTransfer. Add destroy methods to IncomingJingleFileTransfer and OutgoingJingeFlieTranser to match the destructors of the swiften code (as of patch 'Add missing Timer related cleanup code' - 52e685379436794cc0e4c2687c35f5e69a2f09a7). Test-information: Unit tests ran ok. Change-Id: Ie86c5fc74f66d9c62095045475eb6d9447c7699e
2016-03-15Add destroy method to WhitespacePingLayer.Alex Clayton
Add a destroy method to the WhitespacePingLayer to act like the destructor introduced in swiften patch 'Stop timer during clean up of WhitespacePingLayer' (f377207cb896679b4eab9f6773d9d071700852ad). Test-information: Unit tests still pass ok. Change-Id: I4fca19c3d3b5f120102727db10b046904da848a4
2016-03-15Add getRemoteAddress() method to Connection.Alex Clayton
Added a getRemoteAddress() method to connection as per patch 'Listen to IPv6 any address instead of only IPv4' (13801557b6664426cac26384441ab0b19ff9abb5). Also some modifications to SOCKS5BytestreamServerManager to use IPv6 address. Test-information: Unit tests pass ok. Change-Id: Ic0536745db9052ec1c5fc0832ed90eb5ec609429
2016-03-15Add description to FileTransferAlex Clayton
As per patch 'Show file-transfer description if provided' (523dbfb769069663eda19e381ad35f466b1ef27c) add a description field to the FileTransfer interface and its implementations. Test-information: Unit test still pass ok. Change-Id: I146e2adce67a491ae0381154e54d6d0e480026a2
2016-03-15Only calculate S5B candidates if supported by recipientAlex Clayton
As per swiften patch of the same name (e9ed818dac91e280eb8da86dc8494710f1da0624), some changes to FileTransferMangerImpl on how it creates an Outgoing File Transfer. Also added a copy constructor to FileTransferOption that had been in swiften but was not yet implemented in stroke. Change-Id: I314ac5ef7f8e082c7121ad89c012b84569f98d6c Test-information: Unit tests still pass.
2016-03-15Fix handling when client certificate is missingAlex Clayton
As per patch 'Fix swiften handling when client certificate is missing' (8405fa16b738b6ef6a5920cd9d0f5735f8b62369). Change-Id: Iec5036213d8432a3af78647470381485bfcc01e3 Test-information: Code inspection. Unit tests still pass.
2016-03-14Add getter for TLSContext in TLSConnection.Alex Clayton
As per patch 4a6950af0f324091553f7ab7271de45721b8667f (Rest of patch is for implementing TLS on OSX so no need to port). Test-information: Code inspection. Unit tests still all pass ok. Change-Id: I62b2f32f3cba0caa7db84f2806cd49b1a7a202e4
2016-03-14Add FileTransfer.getState methodAlex Clayton
As per swiften patch of same name (cb62de17d1e17fd3049a6bc8155a100574a42a85) add getState() method to FileTransfer interface. Test-information: Unit tests pass ok. Change-Id: I27db4e60c3a8df251b813c90fc4a2e029762082d
2016-03-14Add methods to PresenceOracle.Alex Clayton
As per swiften patch 'Change bare JID presence lookup code to ignore priorities' (0f5ef716a50c8d9761cafda12aacf818cdfd6353) add a couple of methods and a test for PresenceOracle. Test-information: Unit tests still pass. Change-Id: If3961f29be821a065ffa854faeab7f20da666d25
2016-03-14Add roster to PresenceOracle.Alex Clayton
As per patch 'Mark removed contacts as unavailable in Swift' (9e6ee0f262e7dc663f4c706b16a346a268f425aa) added an XMPPRoster to the member variables and constructor arguments for PresenceOracle. Test-information: Unit tests pass. Change-Id: I062d256c088a968e061d864fbd1386f850b614a7
2016-03-14Fix singal disconnections in DiscoServiceWalker.Alex Clayton
Fix how DiscoServiceWalker handles it disconnections from the discoInfoRequests and discoItemsRequest, as per swiften patch 'Fix memory leak warnings by Valgrind/LSAN' (b00c84574fc730eeeabb57df1f17b54855218193). Test-information: Unit tests pass ok. Change-Id: If47dca0f89822b0bf1da8dab1a3113a969f1c396
2016-03-14Do not flush VCard cache if IQ request returns an error.Alex Clayton
As per swiften patch of the same name (37aafcb4d693a0b4f5944a52e0c070e5aa384245) changes behaviour of VCard cache slightly, and updates test accordingly. Test-information: Unit tests pass. Change-Id: I933c8000b4cb73b43db28db94887a768d0272dd2
2016-03-14Add test for pre epoch dates in DateTimeTest.Alex Clayton
As per patch 'Stop throwing out of range exception from dateTimeToLocalStrin' (eed183fbd5d121049d5965d7c60abd65f44d0376). In swiften when DateTime.dateToLocalString was passed a pre 1970 date it could throw an out of range exception. Swiften code was fixed to return an empty string in this case. In java we do not see this error so no need to modify DateTime code. Instead I just added a test to verify we can cope with pre 1970 dates. Test-information: Unit tests pass. Change-Id: Ie1db328818d1457a17e68ab891f564d169912320
2016-03-10Fix BlockListImpl logic and add unit test.Alex Clayton
As per swiften patch 'Fix notification logic for signals in BlockListImpl' (4455c20085834098f6d9aa872db3115d466e7004). Fix the logic in the BlockListImpl class and add a unit test for it. Test-information: Unit tests pass ok. Change-Id: I739d1febb2cf728ff00c132a00adb2f7f144b739
2016-03-09Add Whiteboard FunctionalityAlex Clayton
Add the Whiteboard classes to stroke. Test-information: Unit tests all pass. Change-Id: Id409c09d0fc1f82864e5d706c413b9d984a7db82
2016-03-07Add missing TLS and Base classesAlex Clayton
Add missing methods and classes in the TLS and Base packages where possible. In the case of TLSContextFactory the methods could not be implemented in java so added a not saying they are not supported in java. Test-information: Unit tests still build and run ok. Change-Id: I9be2035f092875fcdc02644a3c0082739f26949a
2016-02-29Add BOSHSessionStream classAlex Clayton
Add the BOSHSessionStream class to stroke. Also tidy up PortingProgress.txt there were some files it was saying had not been imported when they had. Test-information: Code inspection as there are no unit tests for the new code. Sanity test all existing unit tests pass. Change-Id: Ia049a008f0d2c39c23f5752aa7740b10f48aa397
2016-02-29Add Parser and Serializer classesAlex Clayton
Add classes to the parser and serializer packages, including some tests. Update PortingProgress with info on the classes that could not be imported in this patch. Test-information: Unit tests pass ok. Change-Id: If42af9c0cecb68151cf817f1839b86b4d7c8967c
2016-02-29Finish porting on Network PackageAlex Clayton
As per PortingProgress.txt finsh porting all the classes I can from the network package. This involved some updates as the tests and code had changed since they existing classes had been imported. I have added notes for the classes I did not port in PortingProgress explaining why they were not ported. Test-information: All unit tests pass. Change-Id: Ibb52ae409f1da9b72a4c1e590cd22835a1be95eb
2016-02-29Add sort method for ServiceQuery and add TestsAlex Clayton
Add the sortResult static method to the DomainNameServiceQuery class. This required adding a few equivalances for C++ std library methods to the class. And add a test for the new method too. Test-information: All unit tests pass ok. Change-Id: Idee0888f7ea140d35a971414fc2fd3cbcdfc337f
2016-02-29Add Network Bosh ClassesAlex Clayton
Add the missing Bosh classes to the network packages (BoshConnection and BoshConnectionPool), plus tests for the classes and any other classes required by the new classes. Test-information: Units tests all pass ok. Change-Id: I5c2e05bae9e678ac10d2601c7fdbdccd68d66b71
2016-02-16Add the FileTransfer testsAlex Clayton
Add the missing FileTransfer tests to stroke. When porting the tests I found some of them were failing and required changes to the classes being tested to fix. Had to add a DummyNetworkEnvironment as well for the OutgoingJingleFileTransferTest. Test-information: All unit tests pass. Change-Id: Id511a556ef3a5d66e0e107f36f736db3bbb3a437
2016-02-10Remove duplicate classes.Alex Clayton
There ware duplicate copies of DummyFileTransferManager and DummyFileTransferTransporterFactory in both stroke src and stroke test directories (but within the same package). This was confusing and could cause problems when we come to update the files. This patch removes the copies in the test directory, leaving only the the src directory ones. Test-information: Ran 'make test' everything still builds ok and all tests pass. Change-Id: I112d2b21e1217dcacd619393f81ba008a097e83a
2016-02-09Finish porting S5BTransportSessionAlex Clayton
Finish porting S5BTransportSession to Stroke (previously a lot of it had been commented out). To do so had to introduce a heirachy to the SOCKS5BytestreamSession classes (which were being used as type parameters for the Transport Session) and refactor some of the onByteSent signals to insure they were all of the same type (Integer). Also update PortingProgress.txt to update to give status of some of the porting files. Test-information: Ran unit tests they all still pass. Change-Id: I4295b3a8829c208e65f5a46d19c35090f8c55865
2016-02-08Add IQTestAlex Clayton
Add the IQTest class. Test-information: All tests pass. Change-Id: I1fa14c275f9fbe19f4b21002b300024334d5a9da
2016-02-08Add CombinedAvatarProviderTestAlex Clayton
Adds the CombinedAvatarProviderTest class. When I was adding the test I noticed that testProviderUpdateWithAvatarDisappearingTriggersChange kept failing due to a bug in the CombinedAvatarProvider class and testRemoveProviderDisconnectsUpdates could not be implemented as the class was incomplete. I had to make some changes to CombinedAvatarProvider to fix these issues. Test-information: Ran unit tests they all pass. Change-Id: I0bfb68dd2b15df0f220f36c136aceadaf6545893
2016-02-04Update Porting NotesAlex Clayton
Update the porting notes in PortingProgress.txt to be inline with latest changes. Change-Id: I0e8d69c6795d75614077867b556eb530c7b5d144
2016-02-04Add Block Parser and SerializerAlex Clayton
Add BlockParser and BlockSerializer for the block payload classes. This required slightly different approach to the Swiften code as C++ templates are different to Java generics. In short needed to add a type hierachy to the Block payload classes and to the Parsers and Serilaizers associated with them. Test-information: Ran unit tests everything passed ok. Change-Id: I3ea2d66afd7cb3b5c4c3515be3a1ef99d7dbb566
2016-02-02Update FullPayloadSerializerCollectionAlex Clayton
Updates the FullPayloadSerializerCollection and FullPayloadParserSerializerCollection to bring it inline with the Swiften classes. This included reordering the elements so they are in the same order as the Swiften class (so its easier to see classes that are missing), and adding ones that were missing. For ones where no Java implemenation exits yet the line is added but commented out. Test-information: Sanity test, ran unit tests all test still pass. Change-Id: I318c8da577f638f4d799fabdfc09a3afa7fcb608
2016-02-01Add S5BProxyRequest Serializers and ParserAlex Clayton
Adds a S5BProxyRequestParser and a S5BProxyRequestSerializer to stroke based on the Swiften classes of the same name. These has been missed out previous stroke patches for some reason. Test-information: Code inspection against the Swifen classes. Sanity test ran the unit tests for stroke they still all pass (note I could not find any unit tests for this class to transfer from Swiften). Change-Id: Ic5463169ada33c72127e87a416d42a650aad6399