Skip to content

Commit 7fa2fc4

Browse files
author
Devendra
committed
Merge branch 'develop' of github.com:pubnub/java into develop
2 parents f7a0d25 + f520d9f commit 7fa2fc4

File tree

9 files changed

+22
-16
lines changed

9 files changed

+22
-16
lines changed

java/srcPubnubApi/com/pubnub/api/PubnubCore.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ public void publish(String channel, JSONObject message, boolean storeInHistory,
631631
Hashtable args = new Hashtable();
632632
args.put("channel", channel);
633633
args.put("message", message);
634+
args.put("callback", callback);
634635
args.put("storeInHistory", (storeInHistory)?"":"0");
635636
publish(args);
636637
}
@@ -2374,10 +2375,11 @@ private void _subscribe_base(boolean fresh, boolean dar, Worker worker) {
23742375
String[] channelsArray = channelSubscriptions.getItemNames();
23752376
String[] groupsArray = channelGroupSubscriptions.getItemNames();
23762377

2377-
if (channelsArray.length <= 0) {
2378+
if (channelsArray.length <= 0 && groupsArray.length <= 0) {
23782379
subscribeManager.resetHttpManager();
23792380
return;
2380-
}
2381+
}
2382+
23812383
if (channelString == null) {
23822384
callErrorCallbacks(channelsArray,
23832385
PubnubError.PNERROBJ_PARSING_ERROR);

java/srcTest/com/pubnub/api/ChannelGroupPAMTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public void setUp() throws InterruptedException {
2424
auth_key = "user-ak";
2525

2626
pubnub = new Pubnub("demo-36", "demo-36", "demo-36");
27-
pubnub.setOrigin("dara24.devbuild");
2827
pubnub.setCacheBusting(false);
2928
}
3029

@@ -60,6 +59,7 @@ public void testGrantAllNonNamespacedChannelGroup()
6059
pubnub.pamGrantChannelGroup(group, true, true, cb3);
6160
latch3.await(10, TimeUnit.SECONDS);
6261

62+
Thread.sleep(5000);
6363
pubnub.pamAuditChannelGroup(group, cb4);
6464
latch4.await(10, TimeUnit.SECONDS);
6565

@@ -105,6 +105,7 @@ public void testGrantUserNonNamespacedChannelGroup()
105105
pubnub.pamGrantChannelGroup(group, auth_key, true, true, cb3);
106106
latch3.await(10, TimeUnit.SECONDS);
107107

108+
Thread.sleep(5000);
108109
pubnub.pamAuditChannelGroup(group, auth_key, cb4);
109110
latch4.await(10, TimeUnit.SECONDS);
110111

@@ -150,6 +151,7 @@ public void testGrantAllNamespacedChannelGroup()
150151
pubnub.pamGrantChannelGroup(namespace + ":" + group, true, true, cb3);
151152
latch3.await(10, TimeUnit.SECONDS);
152153

154+
Thread.sleep(5000);
153155
pubnub.pamAuditChannelGroup(namespace + ":" + group, cb4);
154156
latch4.await(10, TimeUnit.SECONDS);
155157

@@ -195,6 +197,7 @@ public void testGrantUserNamespacedChannelGroup()
195197
pubnub.pamGrantChannelGroup(namespace + ":" + group, auth_key, true, true, cb3);
196198
latch3.await(10, TimeUnit.SECONDS);
197199

200+
Thread.sleep(5000);
198201
pubnub.pamAuditChannelGroup(namespace + ":" + group, auth_key, cb4);
199202
latch4.await(10, TimeUnit.SECONDS);
200203

@@ -240,6 +243,7 @@ public void testGrantAllNamespace()
240243
pubnub.pamGrantChannelGroup(namespace + ":", true, true, cb3);
241244
latch3.await(10, TimeUnit.SECONDS);
242245

246+
Thread.sleep(5000);
243247
pubnub.pamAuditChannelGroup(namespace + ":", cb4);
244248
latch4.await(10, TimeUnit.SECONDS);
245249

@@ -285,6 +289,7 @@ public void testGrantUserNamespace()
285289
pubnub.pamGrantChannelGroup(namespace + ":", auth_key, true, true, cb3);
286290
latch3.await(10, TimeUnit.SECONDS);
287291

292+
Thread.sleep(5000);
288293
pubnub.pamAuditChannelGroup(namespace + ":", auth_key, cb4);
289294
latch4.await(10, TimeUnit.SECONDS);
290295

@@ -328,6 +333,7 @@ public void testGrantAllGlobalNamespace()
328333
pubnub.pamGrantChannelGroup(":", true, true, cb3);
329334
latch3.await(10, TimeUnit.SECONDS);
330335

336+
Thread.sleep(5000);
331337
pubnub.pamAuditChannelGroup(":", cb4);
332338
latch4.await(10, TimeUnit.SECONDS);
333339

@@ -371,6 +377,7 @@ public void testGrantUserGlobalNamespace()
371377
pubnub.pamGrantChannelGroup(":", auth_key, true, true, cb3);
372378
latch3.await(10, TimeUnit.SECONDS);
373379

380+
Thread.sleep(5000);
374381
pubnub.pamAuditChannelGroup(":", auth_key, cb4);
375382
latch4.await(10, TimeUnit.SECONDS);
376383

java/srcTest/com/pubnub/api/ChannelGroupTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public static void cleanup() throws InterruptedException, JSONException {
2929

3030
@Before
3131
public void setUp() {
32-
pubnub.setOrigin("dara24.devbuild");
3332
pubnub.setCacheBusting(false);
3433
channelGroup = UUID.randomUUID().toString().substring(0, 8);
3534
channelNamespace = "jtest-namespace";
@@ -345,6 +344,7 @@ public void testRemoveGroup() throws InterruptedException, JSONException {
345344

346345
pubnub.channelGroupAddChannel(group, "ch1", cb1);
347346
latch1.await(10, TimeUnit.SECONDS);
347+
Thread.sleep(1000);
348348

349349
pubnub.channelGroupListGroups(cb2);
350350
latch2.await(10, TimeUnit.SECONDS);
@@ -355,6 +355,7 @@ public void testRemoveGroup() throws InterruptedException, JSONException {
355355

356356
pubnub.channelGroupRemoveGroup(group, cb3);
357357
latch3.await(10, TimeUnit.SECONDS);
358+
Thread.sleep(1000);
358359

359360
pubnub.channelGroupListGroups(cb4);
360361
latch4.await(10, TimeUnit.SECONDS);
@@ -383,6 +384,7 @@ public void testRemoveNamespacedGroup() throws InterruptedException, JSONExcepti
383384

384385
pubnub.channelGroupAddChannel(channelNamespace + ":" + group, "ch1", cb1);
385386
latch1.await(10, TimeUnit.SECONDS);
387+
Thread.sleep(1000);
386388

387389
pubnub.channelGroupListGroups(channelNamespace, cb2);
388390
latch2.await(10, TimeUnit.SECONDS);
@@ -394,6 +396,7 @@ public void testRemoveNamespacedGroup() throws InterruptedException, JSONExcepti
394396

395397
pubnub.channelGroupRemoveGroup(channelNamespace + ":" + group, cb3);
396398
latch3.await(10, TimeUnit.SECONDS);
399+
Thread.sleep(1000);
397400

398401
pubnub.channelGroupListGroups(channelNamespace, cb4);
399402
latch4.await(10, TimeUnit.SECONDS);

java/srcTest/com/pubnub/api/HereNowTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public void setUp() throws InterruptedException {
2424
random = UUID.randomUUID().toString().substring(0, 8);
2525

2626
pubnub = new Pubnub("demo", "demo", "demo");
27-
pubnub.setOrigin("dara24.devbuild");
2827
pubnub.setCacheBusting(false);
2928

3029
group = "jtest-" + random;
@@ -158,7 +157,6 @@ public void testHereNowGlobal() throws JSONException, InterruptedException, Pubn
158157
final String[] channels = new String[]{"ch1-" + random, "ch2-" + random};
159158

160159
Pubnub pubnub2 = new Pubnub("demo", "demo");
161-
pubnub2.setOrigin("dara24.devbuild");
162160
pubnub2.setCacheBusting(false);
163161

164162
final CountDownLatch latch3 = new CountDownLatch(1);

java/srcTest/com/pubnub/api/NamespaceTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public class NamespaceTest {
2121

2222
@Before
2323
public void setUp() {
24-
pubnub.setOrigin("dara24.devbuild");
2524
pubnub.setCacheBusting(false);
2625

2726
random = UUID.randomUUID().toString().substring(0, 8);
@@ -76,6 +75,8 @@ public void testGetAllNamespacesAndRemoveThem() throws InterruptedException, JSO
7675

7776
latch3.await(10, TimeUnit.SECONDS);
7877

78+
Thread.sleep(1000);
79+
7980
// get again
8081
pubnub.channelGroupListNamespaces(cb4);
8182
latch4.await(10, TimeUnit.SECONDS);

java/srcTest/com/pubnub/api/StateTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public void setUp() throws InterruptedException {
2323
random = UUID.randomUUID().toString().substring(0, 8);
2424

2525
pubnub = new Pubnub("demo", "demo");
26-
pubnub.setOrigin("dara24.devbuild");
2726
pubnub.setCacheBusting(false);
2827

2928
group = "jtest-" + random;

java/srcTest/com/pubnub/api/SubscribeGroupTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public class SubscribeGroupTest {
2020

2121
@Before
2222
public void setUp() throws PubnubException {
23-
pubnub.setOrigin("dara24.devbuild");
2423
pubnub.setCacheBusting(false);
2524

2625
pubnub.channelGroupRemoveGroup("jtest", new TestHelper.SimpleCallback());

java/srcTest/com/pubnub/api/TestHelper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ public void errorCallback(String channel, PubnubError error) {
115115

116116
public static void cleanup() throws InterruptedException, JSONException {
117117
Pubnub pubnub = new Pubnub("demo", "demo");
118-
pubnub.setOrigin("dara24.devbuild");
119118
pubnub.setCacheBusting(false);
120119

121120
final CountDownLatch latch1 = new CountDownLatch(1);

java/srcTest/com/pubnub/api/UnsubscribeTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ public class UnsubscribeTest {
3030
@Before
3131
public void setUp() {
3232
pubnub = new Pubnub("demo", "demo");
33-
pubnub.setOrigin("dara24.devbuild");
3433
pubnub.setCacheBusting(false);
3534

3635
pubnub2 = new Pubnub("demo", "demo");
37-
pubnub2.setOrigin("dara24.devbuild");
3836
pubnub2.setCacheBusting(false);
3937

4038
random = UUID.randomUUID().toString().substring(0, 8);
@@ -80,7 +78,7 @@ public void testUnsubscribeAllForGroup()
8078

8179
// check offline
8280
pubnub2.unsubscribeAll();
83-
Thread.sleep(1000);
81+
Thread.sleep(3000);
8482

8583
pubnub.channelGroupHereNow(group, cb1);
8684
latch1.await(10, TimeUnit.SECONDS);
@@ -101,7 +99,7 @@ public void testUnsubscribeAllGroupsForGroup() throws PubnubException, Interrupt
10199

102100
// check offline
103101
pubnub2.channelGroupUnsubscribeAllGroups();
104-
Thread.sleep(1000);
102+
Thread.sleep(3000);
105103

106104
pubnub.channelGroupHereNow(group, cb1);
107105
latch1.await(10, TimeUnit.SECONDS);
@@ -123,7 +121,7 @@ public void testUnsubscribeGroupForGroup()
123121

124122
// check offline
125123
pubnub2.channelGroupUnsubscribe(group);
126-
Thread.sleep(1000);
124+
Thread.sleep(3000);
127125

128126
pubnub.channelGroupHereNow(group, cb1);
129127
latch1.await(10, TimeUnit.SECONDS);
@@ -145,7 +143,7 @@ public void testUnsubscribeGroupsForGroup()
145143

146144
// check offline
147145
pubnub2.channelGroupUnsubscribe(new String[]{group});
148-
Thread.sleep(1000);
146+
Thread.sleep(3000);
149147

150148
pubnub.channelGroupHereNow(group, cb1);
151149
latch1.await(10, TimeUnit.SECONDS);

0 commit comments

Comments
 (0)