Skip to content

Commit

Permalink
PubNub SDK v4.32.1 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
client-engineering-bot committed Aug 24, 2020
1 parent cf6563b commit f648715
Show file tree
Hide file tree
Showing 40 changed files with 6,413 additions and 84 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
* @kleewho @bartk @budgetpreneur
.travis/* @parfeon @kleewho @bartk @budgetpreneur

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ target
build
.gradle
out
gradlew.bat
gradlew.bat

/src/integrationTest/resources/config.properties
9 changes: 7 additions & 2 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
name: java
version: 4.32.0
version: 4.32.1
schema: 1
scm: github.com/pubnub/java
files:
- build/libs/pubnub-gson-4.32.0-all.jar
- build/libs/pubnub-gson-4.32.1-all.jar
changelog:
- version: v4.32.1
date: 2020-08-24
changes:
- type: bug
text: "Fix for subscription loop to prevent unexpected disconnections caused by unhandled HTTP statuses."
- version: v4.32.0
date: 2020-08-14
changes:
Expand Down
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
## [v4.32.1](https://github.com/pubnub/java/releases/tag/v4.32.1)
August-24-2020

[Full Changelog](https://github.com/pubnub/java/compare/v4.32.0...v4.32.1)

- 🐛 Fix for subscription loop to prevent unexpected disconnections caused by unhandled HTTP statuses.

## [v4.32.0](https://github.com/pubnub/java/releases/tag/v4.32.0)
August-14-2020

[Full Changelog](https://github.com/pubnub/java/compare/v4.31.3...v4.32.0)

- 🌟️ Allows to upload files to channels, download them with optional encryption support.

## [v4.31.3](https://github.com/pubnub/java/releases/tag/v4.31.3)
Expand Down
21 changes: 20 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
}
group = 'com.pubnub'

version = '4.32.0'
version = '4.32.1'

description = """"""

Expand All @@ -27,8 +27,17 @@ lombok {

repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}

sourceSets {
integrationTest {
compileClasspath += sourceSets.test.runtimeClasspath
runtimeClasspath += sourceSets.test.runtimeClasspath
}
}

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

implementation 'org.jetbrains:annotations:17.0.0'

testCompile group: 'org.mockito', name: 'mockito-core', version: '3.3.3'
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
testImplementation group: 'ch.qos.logback', name: 'logback-core', version: '1.2.3'
testImplementation group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'com.github.tomakehurst', name: 'wiremock', version: '2.25.0'
testImplementation group: 'org.awaitility', name: 'awaitility', version: '4.0.1'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.4.0'
integrationTestImplementation group: 'org.aeonbits.owner', name: 'owner', version: '1.0.8'
integrationTestImplementation group: 'junit', name: 'junit', version: '4.12'
implementation group: 'org.json', name: 'json', version: '20190722'
}

task integrationTest(type: Test) {
group = "verification"
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath += sourceSets.integrationTest.runtimeClasspath
}

jacoco {
toolVersion = "0.8.2"
}
Expand All @@ -76,6 +94,7 @@ checkstyle {
toolVersion = "8.14"
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
//configFile = new File(rootDir, "config/checkstyle/checkstyle.xml")
sourceSets = [sourceSets.main]
}

findbugs {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
package com.pubnub.api.integration;

import com.pubnub.api.integration.util.BaseIntegrationTest;
import org.junit.Test;

import java.util.Arrays;
import java.util.Collections;
import java.util.concurrent.CountDownLatch;

import static com.pubnub.api.integration.util.Utils.random;
import static com.pubnub.api.integration.util.Utils.randomChannel;
import static org.junit.Assert.*;

public class GroupManagementIntegrationTests extends BaseIntegrationTest {

private String mChannel1;
private String mChannel2;
private String mChannel3;

private String mGroup;

@Override
protected void onBefore() {
mChannel1 = randomChannel();
mChannel2 = randomChannel();
mChannel3 = randomChannel();
mGroup = "cg_".concat(random());
}

@Override
protected void onAfter() {

}

@Test
public void testRemoveChannelsFromGroup() throws InterruptedException {
final CountDownLatch signal = new CountDownLatch(1);

addChannelsToGroup();

pubNub.removeChannelsFromChannelGroup()
.channelGroup(mGroup)
.channels(Arrays.asList(mChannel1, mChannel2, mChannel3))
.async((result, status) -> {
assertFalse(status.isError());
assert status.getAffectedChannels() != null;
assertEquals(3, status.getAffectedChannels().size());
assertEquals(0, pubNub.getSubscribedChannels().size());
assert status.getAffectedChannelGroups() != null;
assertEquals(1, status.getAffectedChannelGroups().size());
assertEquals(0, pubNub.getSubscribedChannelGroups().size());
signal.countDown();
});

signal.await();
}

@Test
public void testRemoveChannelFromGroup() throws InterruptedException {
final CountDownLatch signal = new CountDownLatch(1);

addChannelsToGroup();

pubNub.removeChannelsFromChannelGroup()
.channelGroup(mGroup)
.channels(Collections.singletonList(mChannel1))
.async((result, status) -> {
assertFalse(status.isError());
signal.countDown();
});

signal.await();
}

@Test
public void testSubscribeToChannelGroup() throws InterruptedException {
addChannelsToGroup();
subscribeToChannelGroup(pubNub, mGroup);

boolean isGroupSubscribed = false;
for (int i = 0; i < pubNub.getSubscribedChannelGroups().size(); i++) {
if (pubNub.getSubscribedChannelGroups().get(i).equals(mGroup)) {
isGroupSubscribed = true;
}
}

assertTrue(isGroupSubscribed);
}

@Test
public void testUnsubscribeFromChannelGroup() throws InterruptedException {
addChannelsToGroup();
subscribeToChannelGroup(pubNub, mGroup);

pubNub.unsubscribe()
.channelGroups(Collections.singletonList(mGroup))
.execute();

pause(1);

assertEquals(0, pubNub.getSubscribedChannelGroups().size());
}

@Test
public void testGetAllChannelsFromGroup() throws InterruptedException {
final CountDownLatch signal = new CountDownLatch(1);

addChannelsToGroup();

pubNub.listChannelsForChannelGroup()
.channelGroup(mGroup)
.async((result, status) -> {
assertFalse(status.isError());
assert result != null;
assertEquals(3, result.getChannels().size());
signal.countDown();
});

signal.await();
}

@Test
public void testAddChannelsToGroup() throws InterruptedException {
final CountDownLatch signal = new CountDownLatch(1);

pubNub.addChannelsToChannelGroup()
.channelGroup(mGroup)
.channels(Arrays.asList(mChannel1, mChannel2, mChannel3))
.async((result, status) -> {
assertFalse(status.isError());
assert status.getAffectedChannelGroups() != null;
assertEquals(1, status.getAffectedChannelGroups().size());
assert status.getAffectedChannels() != null;
assertEquals(3, status.getAffectedChannels().size());
signal.countDown();
});

signal.await();
}

private void addChannelsToGroup() throws InterruptedException {
final CountDownLatch signal = new CountDownLatch(1);

pubNub.addChannelsToChannelGroup()
.channelGroup(mGroup)
.channels(Arrays.asList(mChannel1, mChannel2, mChannel3))
.async((result, status) -> {
assertFalse(status.isError());
signal.countDown();
});

signal.await();
}

}
Loading

0 comments on commit f648715

Please sign in to comment.