Skip to content

Commit f648715

Browse files
PubNub SDK v4.32.1 release.
1 parent cf6563b commit f648715

40 files changed

+6413
-84
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
* @kleewho @bartk @budgetpreneur
2+
.travis/* @parfeon @kleewho @bartk @budgetpreneur
3+

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ target
4848
build
4949
.gradle
5050
out
51-
gradlew.bat
51+
gradlew.bat
52+
53+
/src/integrationTest/resources/config.properties

.pubnub.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
name: java
2-
version: 4.32.0
2+
version: 4.32.1
33
schema: 1
44
scm: github.com/pubnub/java
55
files:
6-
- build/libs/pubnub-gson-4.32.0-all.jar
6+
- build/libs/pubnub-gson-4.32.1-all.jar
77
changelog:
8+
- version: v4.32.1
9+
date: 2020-08-24
10+
changes:
11+
- type: bug
12+
text: "Fix for subscription loop to prevent unexpected disconnections caused by unhandled HTTP statuses."
813
- version: v4.32.0
914
date: 2020-08-14
1015
changes:

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
## [v4.32.1](https://github.com/pubnub/java/releases/tag/v4.32.1)
2+
August-24-2020
3+
4+
[Full Changelog](https://github.com/pubnub/java/compare/v4.32.0...v4.32.1)
5+
6+
- 🐛 Fix for subscription loop to prevent unexpected disconnections caused by unhandled HTTP statuses.
7+
18
## [v4.32.0](https://github.com/pubnub/java/releases/tag/v4.32.0)
29
August-14-2020
310

4-
[Full Changelog](https://github.com/pubnub/java/compare/v4.31.3...v4.32.0)
5-
611
- 🌟️ Allows to upload files to channels, download them with optional encryption support.
712

813
## [v4.31.3](https://github.com/pubnub/java/releases/tag/v4.31.3)

build.gradle

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugins {
1111
}
1212
group = 'com.pubnub'
1313

14-
version = '4.32.0'
14+
version = '4.32.1'
1515

1616
description = """"""
1717

@@ -27,8 +27,17 @@ lombok {
2727

2828
repositories {
2929
mavenCentral()
30+
maven {
31+
url "https://plugins.gradle.org/m2/"
32+
}
3033
}
3134

35+
sourceSets {
36+
integrationTest {
37+
compileClasspath += sourceSets.test.runtimeClasspath
38+
runtimeClasspath += sourceSets.test.runtimeClasspath
39+
}
40+
}
3241

3342
dependencies {
3443
implementation group: 'com.squareup.retrofit2', name: 'retrofit', version: '2.6.2'
@@ -51,16 +60,25 @@ dependencies {
5160

5261
implementation 'org.jetbrains:annotations:17.0.0'
5362

63+
testCompile group: 'org.mockito', name: 'mockito-core', version: '3.3.3'
5464
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
5565
testImplementation group: 'ch.qos.logback', name: 'logback-core', version: '1.2.3'
5666
testImplementation group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
5767
testImplementation group: 'junit', name: 'junit', version: '4.12'
5868
testImplementation group: 'com.github.tomakehurst', name: 'wiremock', version: '2.25.0'
5969
testImplementation group: 'org.awaitility', name: 'awaitility', version: '4.0.1'
6070
testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.4.0'
71+
integrationTestImplementation group: 'org.aeonbits.owner', name: 'owner', version: '1.0.8'
72+
integrationTestImplementation group: 'junit', name: 'junit', version: '4.12'
6173
implementation group: 'org.json', name: 'json', version: '20190722'
6274
}
6375

76+
task integrationTest(type: Test) {
77+
group = "verification"
78+
testClassesDir = sourceSets.integrationTest.output.classesDir
79+
classpath += sourceSets.integrationTest.runtimeClasspath
80+
}
81+
6482
jacoco {
6583
toolVersion = "0.8.2"
6684
}
@@ -76,6 +94,7 @@ checkstyle {
7694
toolVersion = "8.14"
7795
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
7896
//configFile = new File(rootDir, "config/checkstyle/checkstyle.xml")
97+
sourceSets = [sourceSets.main]
7998
}
8099

81100
findbugs {
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
package com.pubnub.api.integration;
2+
3+
import com.pubnub.api.integration.util.BaseIntegrationTest;
4+
import org.junit.Test;
5+
6+
import java.util.Arrays;
7+
import java.util.Collections;
8+
import java.util.concurrent.CountDownLatch;
9+
10+
import static com.pubnub.api.integration.util.Utils.random;
11+
import static com.pubnub.api.integration.util.Utils.randomChannel;
12+
import static org.junit.Assert.*;
13+
14+
public class GroupManagementIntegrationTests extends BaseIntegrationTest {
15+
16+
private String mChannel1;
17+
private String mChannel2;
18+
private String mChannel3;
19+
20+
private String mGroup;
21+
22+
@Override
23+
protected void onBefore() {
24+
mChannel1 = randomChannel();
25+
mChannel2 = randomChannel();
26+
mChannel3 = randomChannel();
27+
mGroup = "cg_".concat(random());
28+
}
29+
30+
@Override
31+
protected void onAfter() {
32+
33+
}
34+
35+
@Test
36+
public void testRemoveChannelsFromGroup() throws InterruptedException {
37+
final CountDownLatch signal = new CountDownLatch(1);
38+
39+
addChannelsToGroup();
40+
41+
pubNub.removeChannelsFromChannelGroup()
42+
.channelGroup(mGroup)
43+
.channels(Arrays.asList(mChannel1, mChannel2, mChannel3))
44+
.async((result, status) -> {
45+
assertFalse(status.isError());
46+
assert status.getAffectedChannels() != null;
47+
assertEquals(3, status.getAffectedChannels().size());
48+
assertEquals(0, pubNub.getSubscribedChannels().size());
49+
assert status.getAffectedChannelGroups() != null;
50+
assertEquals(1, status.getAffectedChannelGroups().size());
51+
assertEquals(0, pubNub.getSubscribedChannelGroups().size());
52+
signal.countDown();
53+
});
54+
55+
signal.await();
56+
}
57+
58+
@Test
59+
public void testRemoveChannelFromGroup() throws InterruptedException {
60+
final CountDownLatch signal = new CountDownLatch(1);
61+
62+
addChannelsToGroup();
63+
64+
pubNub.removeChannelsFromChannelGroup()
65+
.channelGroup(mGroup)
66+
.channels(Collections.singletonList(mChannel1))
67+
.async((result, status) -> {
68+
assertFalse(status.isError());
69+
signal.countDown();
70+
});
71+
72+
signal.await();
73+
}
74+
75+
@Test
76+
public void testSubscribeToChannelGroup() throws InterruptedException {
77+
addChannelsToGroup();
78+
subscribeToChannelGroup(pubNub, mGroup);
79+
80+
boolean isGroupSubscribed = false;
81+
for (int i = 0; i < pubNub.getSubscribedChannelGroups().size(); i++) {
82+
if (pubNub.getSubscribedChannelGroups().get(i).equals(mGroup)) {
83+
isGroupSubscribed = true;
84+
}
85+
}
86+
87+
assertTrue(isGroupSubscribed);
88+
}
89+
90+
@Test
91+
public void testUnsubscribeFromChannelGroup() throws InterruptedException {
92+
addChannelsToGroup();
93+
subscribeToChannelGroup(pubNub, mGroup);
94+
95+
pubNub.unsubscribe()
96+
.channelGroups(Collections.singletonList(mGroup))
97+
.execute();
98+
99+
pause(1);
100+
101+
assertEquals(0, pubNub.getSubscribedChannelGroups().size());
102+
}
103+
104+
@Test
105+
public void testGetAllChannelsFromGroup() throws InterruptedException {
106+
final CountDownLatch signal = new CountDownLatch(1);
107+
108+
addChannelsToGroup();
109+
110+
pubNub.listChannelsForChannelGroup()
111+
.channelGroup(mGroup)
112+
.async((result, status) -> {
113+
assertFalse(status.isError());
114+
assert result != null;
115+
assertEquals(3, result.getChannels().size());
116+
signal.countDown();
117+
});
118+
119+
signal.await();
120+
}
121+
122+
@Test
123+
public void testAddChannelsToGroup() throws InterruptedException {
124+
final CountDownLatch signal = new CountDownLatch(1);
125+
126+
pubNub.addChannelsToChannelGroup()
127+
.channelGroup(mGroup)
128+
.channels(Arrays.asList(mChannel1, mChannel2, mChannel3))
129+
.async((result, status) -> {
130+
assertFalse(status.isError());
131+
assert status.getAffectedChannelGroups() != null;
132+
assertEquals(1, status.getAffectedChannelGroups().size());
133+
assert status.getAffectedChannels() != null;
134+
assertEquals(3, status.getAffectedChannels().size());
135+
signal.countDown();
136+
});
137+
138+
signal.await();
139+
}
140+
141+
private void addChannelsToGroup() throws InterruptedException {
142+
final CountDownLatch signal = new CountDownLatch(1);
143+
144+
pubNub.addChannelsToChannelGroup()
145+
.channelGroup(mGroup)
146+
.channels(Arrays.asList(mChannel1, mChannel2, mChannel3))
147+
.async((result, status) -> {
148+
assertFalse(status.isError());
149+
signal.countDown();
150+
});
151+
152+
signal.await();
153+
}
154+
155+
}

0 commit comments

Comments
 (0)