Skip to content

Commit b62d892

Browse files
author
Mofizur Rahman
authored
Merge pull request #213 from opentok/bump-dependencies
Update Gradle and workflow dependencies
2 parents 03f6a2a + 47e3e87 commit b62d892

File tree

11 files changed

+94
-106
lines changed

11 files changed

+94
-106
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,24 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
java: [ 8, 8.0.x, 9.0.x, 11.0.x, 14 ]
14+
java: [8, 11, 17]
1515
os: [ubuntu-latest, macos-latest, windows-latest]
1616

1717
steps:
1818
- name: Checkout the repo
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v3
2020

2121
- name: Setup Java
22-
uses: actions/setup-java@v1
22+
uses: actions/setup-java@v3
2323
with:
24-
java-version: ${{matrix.java}}
24+
java-version: ${{ matrix.java }}
25+
distribution: 'zulu'
2526

2627
- name: Grant execute permission for gradlew
2728
run: chmod +x gradlew
2829

2930
- name: Cache Gradle packages
30-
uses: actions/cache@v2
31+
uses: actions/cache@v3
3132
with:
3233
path: ~/.gradle/caches
3334
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
@@ -37,4 +38,4 @@ jobs:
3738
run: ./gradlew build
3839

3940
- name: Run Codecov
40-
uses: codecov/codecov-action@v1
41+
uses: codecov/codecov-action@v2

.github/workflows/publish.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Checkout the repo
10-
uses: actions/checkout@v2
10+
uses: actions/checkout@v3
1111
with:
1212
ref: ${{ github.event.release.target_commitish }}
1313
- name: Set up Python
14-
uses: actions/setup-python@v2
14+
uses: actions/setup-python@v3
1515
with:
1616
python-version: 3.8
1717
- name: Install bump2version
@@ -22,15 +22,18 @@ jobs:
2222
git config --global github.token ${{ secrets.GITHUB_TOKEN }}
2323
pip install bump2version
2424
- name: Bump Version
25-
run: bump2version --new-version ${{ github.event.release.tag_name }} patch && git tag ${{ github.event.release.tag_name }} -f && git push && git push --tags origin --force
25+
run: bump2version --new-version ${{ github.event.release.tag_name }} patch &&
26+
git tag ${{ github.event.release.tag_name }} -f &&
27+
git push && git push --tags origin --force
2628
- name: Setup Java
27-
uses: actions/setup-java@v1
29+
uses: actions/setup-java@v3
2830
with:
29-
java-version: 8
31+
java-version: 17
32+
distribution: 'temurin'
3033
- name: Grant execute permission for gradlew
3134
run: chmod +x gradlew
3235
- name: Cache Gradle packages
33-
uses: actions/cache@v2
36+
uses: actions/cache@v3
3437
with:
3538
path: ~/.gradle/caches
3639
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}

build.gradle

Lines changed: 48 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,42 @@
11
plugins {
2-
id "com.github.hierynomus.license" version "0.11.0"
2+
id 'java-library'
3+
id 'jacoco'
4+
id 'signing'
5+
id 'maven-publish'
6+
id "com.github.hierynomus.license" version "0.16.1"
37
}
48

5-
apply plugin: 'java'
6-
apply plugin: 'maven'
7-
apply plugin: 'signing'
8-
apply plugin: 'idea'
9-
apply plugin: 'eclipse'
10-
apply plugin: 'license'
11-
apply plugin: 'jacoco'
12-
apply plugin: 'maven-publish'
13-
149
group = 'com.tokbox'
1510
archivesBaseName = 'opentok-server-sdk'
1611
version = '4.6.0'
1712

13+
sourceCompatibility = "1.8"
14+
targetCompatibility = "1.8"
15+
16+
repositories {
17+
mavenCentral()
18+
}
19+
20+
dependencies {
21+
testImplementation 'junit:junit:4.13.2'
22+
testImplementation 'com.github.tomakehurst:wiremock:1.58'
23+
implementation 'commons-lang:commons-lang:2.6'
24+
implementation 'commons-validator:commons-validator:1.7'
25+
implementation 'org.asynchttpclient:async-http-client:2.12.3'
26+
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.2.2'
27+
implementation 'commons-codec:commons-codec:1.15'
28+
implementation 'org.bitbucket.b_c:jose4j:0.7.11'
29+
}
30+
31+
task sourcesJar(type: Jar) {
32+
archiveClassifier.set("sources")
33+
from sourceSets.main.allSource
34+
}
35+
36+
tasks.withType(JavaCompile) {
37+
options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
38+
}
39+
1840
task javadocJar(type: Jar) {
1941
archiveClassifier.set("javadoc")
2042
from javadoc
@@ -29,35 +51,16 @@ javadoc {
2951
}
3052
}
3153

54+
jacoco {
55+
toolVersion = "0.8.8"
56+
}
3257
jacocoTestReport {
3358
reports {
34-
xml.enabled true
35-
html.enabled false
59+
xml.getRequired().set(true)
60+
html.getRequired().set(true)
3661
}
3762
}
38-
39-
task sourcesJar(type: Jar) {
40-
archiveClassifier.set("sources")
41-
from sourceSets.main.allSource
42-
}
43-
44-
repositories {
45-
mavenCentral()
46-
}
47-
48-
dependencies {
49-
testCompile group: 'junit', name: 'junit', version: '[4.3,5.0]'
50-
testCompile group: 'com.github.tomakehurst', name: 'wiremock', version: '[1.45,2.0]'
51-
compile group: 'commons-lang', name: 'commons-lang', version: '[2.6,3.0]'
52-
compile group: 'org.asynchttpclient', name: 'async-http-client', version: '[2.0,2.99999)'
53-
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '[2.3.1,2.99999)'
54-
compile group: 'commons-validator', name: 'commons-validator', version: '[1.4.0,1.99999)'
55-
compile group: 'commons-codec', name: 'commons-codec', version: '[1.9,1.99999]'
56-
compile group: 'org.bitbucket.b_c', name: 'jose4j', version: '[0.7,1.0)'
57-
// TODO: find out how to initialize these dependencies properly, or remove them
58-
//compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.5'
59-
//compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.5'
60-
}
63+
check.dependsOn jacocoTestReport
6164

6265
license {
6366
header rootProject.file('codequality/HEADER')
@@ -69,7 +72,6 @@ artifacts {
6972
}
7073

7174
ext.isReleaseVersion = hasProperty('isReleaseVersion') ? isReleaseVersion : false
72-
7375
ext.ossrhUsername = hasProperty('ossrhUsername') ? ossrhUsername : 'dummyuser'
7476
ext.ossrhPassword = hasProperty('ossrhPassword') ? ossrhPassword : 'dummypass'
7577

@@ -107,28 +109,34 @@ publishing {
107109
email = 'aoberoi@gmail.com'
108110
organization = 'Vonage'
109111
}
110-
developer{
112+
developer {
111113
id = 'slorello89'
112114
name = 'Steve Lorello'
113115
email = 'steve.lorello@vonage.com'
114116
organization = 'Vonage'
115117
}
118+
developer {
119+
id = 'SMadani'
120+
name = 'Sina Madani'
121+
email = 'sina.madani@vonage.com'
122+
organization = 'Vonage'
123+
}
116124
}
117125
scm {
118126
connection = "scm:git@github.com/opentok/opentok-java-sdk"
119127
developerConnection = "scm:git@github.com/opentok/opentok-java-sdk"
120128
url = "http://github.com/opentok/opentok-java-sdk"
121129
}
122130

123-
issueManagement{
131+
issueManagement {
124132
system = "GitHub"
125133
url = "https://http://github.com/opentok/opentok-java-sdk"
126134
}
127135
}
128136
}
129137
}
130-
repositories{
131-
maven{
138+
repositories {
139+
maven {
132140
def releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
133141
def snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
134142
credentials.username(System.getenv("OSS_USERNAME"))
@@ -144,20 +152,3 @@ signing {
144152
useInMemoryPgpKeys(signingKey, signingPassword)
145153
sign publishing.publications.mavenJava
146154
}
147-
148-
test {
149-
maxHeapSize = "1024m"
150-
}
151-
152-
sourceCompatibility = 1.8
153-
// credit: http://stackoverflow.com/a/22681854/305340
154-
tasks.withType(JavaCompile) {
155-
options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
156-
doFirst {
157-
if (System.env.JDK8_HOME != null) {
158-
options.bootClasspath = "$System.env.JDK8_HOME/jre/lib/rt.jar"
159-
options.bootClasspath += "$File.pathSeparator$System.env.JDK8_HOME/jre/lib/jce.jar"
160-
// and other specific JDK jars
161-
}
162-
}
163-
}

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Mon Apr 05 14:22:26 EDT 2021
2-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
2+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
33
distributionBase=GRADLE_USER_HOME
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists

sample/Archiving/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ repositories {
66
}
77

88
dependencies {
9-
compile project(':')
10-
compile group: 'com.github.codingricky', name: 'spark-core-16', version: '1.1'
11-
compile group: 'org.freemarker', name: 'freemarker', version: '2.3.19'
12-
compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.6'
9+
implementation project(':')
10+
implementation 'com.github.codingricky:spark-core-16:1.1'
11+
implementation 'org.freemarker:freemarker:2.3.19'
12+
implementation 'org.slf4j:slf4j-simple:1.7.6'
1313
}
1414

1515
run.systemProperty 'API_KEY', ''

sample/HelloWorld/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
apply plugin:'application'
1+
apply plugin: 'application'
22
mainClassName = "com.example.HelloWorldServer"
33

44
repositories {
55
mavenCentral()
66
}
77

88
dependencies {
9-
compile project(':')
10-
compile group: 'com.github.codingricky', name: 'spark-core-16', version: '1.1'
11-
compile group: 'org.freemarker', name: 'freemarker', version: '2.3.19'
12-
compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.6'
9+
implementation project(':')
10+
implementation 'com.github.codingricky:spark-core-16:1.1'
11+
implementation 'org.freemarker:freemarker:2.3.19'
12+
implementation 'org.slf4j:slf4j-simple:1.7.6'
1313
}
1414

1515
run.systemProperty 'API_KEY', ''

src/main/java/com/opentok/Broadcast.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import com.fasterxml.jackson.databind.ObjectMapper;
1515

1616
import java.util.ArrayList;
17+
import java.util.Collection;
1718
import java.util.List;
1819
import java.util.Map;
1920

@@ -125,12 +126,13 @@ public String getStatus() {
125126
* stream's status.
126127
*/
127128
@JsonProperty("broadcastUrls")
129+
@SuppressWarnings("unchecked")
128130
private void unpack(Map<String,Object> broadcastUrls) {
129131
if (broadcastUrls == null) return;
130-
hls = (String)broadcastUrls.get("hls");
131-
ArrayList<Map<String,String>> rtmpResponse = (ArrayList<Map<String,String>>)broadcastUrls.get("rtmp");
132-
if (rtmpResponse == null || rtmpResponse.size() == 0) return;
133-
for ( Map<String,String> element : rtmpResponse) {
132+
hls = (String) broadcastUrls.get("hls");
133+
Iterable<Map<String,String>> rtmpResponse = (Iterable<Map<String,String>>)broadcastUrls.get("rtmp");
134+
if (rtmpResponse == null) return;
135+
for (Map<String,String> element : rtmpResponse) {
134136
Rtmp rtmp = new Rtmp();
135137
rtmp.setId(element.get("id"));
136138
rtmp.setServerUrl(element.get("serverUrl"));

src/main/java/com/opentok/OpenTok.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,6 @@ public ArchiveList listArchives(String sessionId, int offset, int count) throws
424424
return archiveListReader.readValue(archives);
425425
} catch (JsonProcessingException e) {
426426
throw new RequestException("Exception mapping json: " + e.getMessage());
427-
} catch (IOException e) {
428-
throw new RequestException("Exception mapping json: " + e.getMessage());
429427
}
430428
}
431429

@@ -842,8 +840,6 @@ public StreamList listStreams(String sessionId) throws OpenTokException {
842840
return streamListReader.readValue(streams);
843841
} catch (JsonProcessingException e) {
844842
throw new RequestException("Exception mapping json: " + e.getMessage());
845-
} catch (IOException e) {
846-
throw new RequestException("Exception mapping json: " + e.getMessage());
847843
}
848844
}
849845

@@ -871,8 +867,6 @@ public Sip dial(String sessionId, String token, SipProperties properties) throws
871867
return sipReader.readValue(sip);
872868
} catch (JsonProcessingException e) {
873869
throw new RequestException("Exception mapping json: " + e.getMessage());
874-
} catch (IOException e) {
875-
throw new RequestException("Exception mapping json: " + e.getMessage());
876870
}
877871
}
878872

src/main/java/com/opentok/Session.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public String generateToken(TokenOptions tokenOptions) throws OpenTokException {
117117
Role role = tokenOptions.getRole();
118118
double expireTime = tokenOptions.getExpireTime(); // will be 0 if nothing was explicitly set
119119
String data = tokenOptions.getData(); // will be null if nothing was explicitly set
120-
Long create_time = new Long(System.currentTimeMillis() / 1000).longValue();
120+
long create_time = System.currentTimeMillis() / 1000;
121121

122122
StringBuilder dataStringBuilder = new StringBuilder();
123123
Random random = new Random();

src/main/java/com/opentok/util/HttpClient.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,8 +1215,7 @@ public HttpClient build() {
12151215

12161216
config = configBuilder.build();
12171217
// NOTE: not thread-safe, config could be modified by another thread here?
1218-
HttpClient client = new HttpClient(this);
1219-
return client;
1218+
return new HttpClient(this);
12201219
}
12211220

12221221
// credit: https://github.com/AsyncHttpClient/async-http-client/blob/b52a8de5d6a862b5d1652d62f87ce774cbcff156/src/main/java/com/ning/http/client/ProxyServer.java#L99-L127
@@ -1284,9 +1283,10 @@ public TokenAuthRequestFilter(int apiKey, String apiSecret) {
12841283
public <T> FilterContext<T> filter(FilterContext<T> ctx) throws FilterException {
12851284
try {
12861285
return new FilterContext.FilterContextBuilder<T>(ctx)
1287-
.request(new RequestBuilder(ctx.getRequest())
1288-
.addHeader(authHeader, TokenGenerator.generateToken(apiKey, apiSecret))
1289-
.build())
1286+
.request(ctx.getRequest().toBuilder()
1287+
.addHeader(authHeader, TokenGenerator.generateToken(apiKey, apiSecret))
1288+
.build()
1289+
)
12901290
.build();
12911291
} catch (OpenTokException e) {
12921292
e.printStackTrace();

0 commit comments

Comments
 (0)