Skip to content

Commit 5959910

Browse files
author
Damian Staszewski
authored
Merge pull request #8 from stachu540/dev
1.1 Release
2 parents 739577e + c5e4c32 commit 5959910

File tree

9 files changed

+83
-90
lines changed

9 files changed

+83
-90
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ crashlytics.properties
3939
crashlytics-build.properties
4040
fabric.properties
4141

42-
deploying/hirezapi.asc
42+
deploying/deploy.asc

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ before_install:
1212
- chmod +x $TRAVIS_BUILD_DIR/deploying/*.sh
1313
- $TRAVIS_BUILD_DIR/deploying/pre-deploy.sh
1414
install:
15-
- mvn install -P !build-extras -DskipTests=true -Dmaven.javadoc.skip=true -B
16-
- mvn dependency:go-offline -P !build-extras -DskipTests=true -Dmaven.javadoc.skip=true -B
15+
- mvn install -P !build-extras -Dmaven.javadoc.skip=true -B
16+
- mvn dependency:go-offline -P !build-extras -Dmaven.javadoc.skip=true -B
1717
script:
18-
- mvn test -P !build-extras -B
18+
- mvn test -DskipTest=false -P !build-extras -B
1919

2020
after_success:
2121
- $TRAVIS_BUILD_DIR/deploying/deploy.sh

deploying/deploy.asc.enc

9.33 KB
Binary file not shown.

deploying/deploy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
REPO_VERSION=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
3-
if [ ! -z $TRAVIS_TAG ] && [ $REPO_VERSION != '*-SNAPSHOT' ] && [ "$TRAVIS_BRANCH" != 'dev' ]; then
3+
if [[ ! -z $TRAVIS_TAG ]] && [[ $REPO_VERSION != *-SNAPSHOT ]] && [[ "$TRAVIS_BRANCH" == 'master' ]]; then
44
mvn deploy -P sign,build-extras --settings $TRAVIS_BUILD_DIR/deploying/settings.xml
5-
elif [ $REPO_VERSION == *-SNAPSHOT ] && [ "$TRAVIS_BRANCH" == 'dev' ]; then
5+
elif [[ $REPO_VERSION == *-SNAPSHOT ]] && [[ "$TRAVIS_BRANCH" == 'dev' ]]; then
66
mvn deploy -P sign,build-extras --settings $TRAVIS_BUILD_DIR/deploying/settings.xml
77
fi

deploying/hirezapi.asc.enc

-9.33 KB
Binary file not shown.

deploying/pre-deploy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
2-
openssl aes-256-cbc -K $encrypted_b20503c2b955_key -iv $encrypted_b20503c2b955_iv -in $TRAVIS_BUILD_DIR/deploying/hirezapi.asc.enc -out $TRAVIS_BUILD_DIR/deploying/hirezapi.asc -d
3-
gpg --fast-import $TRAVIS_BUILD_DIR/deploying/hirezapi.asc
2+
openssl aes-256-cbc -K $encrypted_a15d794d685b_key -iv $encrypted_a15d794d685b_iv -in $TRAVIS_BUILD_DIR/deploying/deploy.asc.enc -out $TRAVIS_BUILD_DIR/deploying/deploy.asc -d
3+
gpg --fast-import $TRAVIS_BUILD_DIR/deploying/deploy.asc

pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>pl.stachuofficial</groupId>
88
<artifactId>HiRezAPI</artifactId>
9-
<version>1.0</version>
9+
<version>1.1</version>
1010
<packaging>jar</packaging>
1111

1212
<name>Hi-Rez API</name>
@@ -37,6 +37,7 @@
3737

3838
<properties>
3939
<projec.build.sourceEncodingt>UTF-8</projec.build.sourceEncodingt>
40+
<skipTest>true</skipTest>
4041
</properties>
4142

4243
<distributionManagement>
@@ -136,6 +137,9 @@
136137
<groupId>org.apache.maven.plugins</groupId>
137138
<artifactId>maven-surefire-plugin</artifactId>
138139
<version>2.19.1</version>
140+
<configuration>
141+
<skipTests>${skipTest}</skipTests>
142+
</configuration>
139143
<dependencies>
140144
<dependency>
141145
<groupId>org.junit.platform</groupId>

src/main/java/pl/stachuofficial/hirezstudios/HiRezGames.java

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,39 @@ public StringData getItems() {
121121

122122
/**
123123
* Getting match details.
124+
* <i><b>NOTE</b> There is a byte limit to the amount of data returned; please limit the CSV parameter to 5 to 10 matches because of this and for Hi-Rez DB Performance reasons.</i>
124125
* @param match_id The id of the match. Can be obtained from <b>{@link #getMatchHistory(String)}</b>, <b>{@link #getTopMatches()}</b> &amp; <b>{@link #getMatchIDsByQueue}</b>.
125126
* @return Returns the statistics for a particular completed match.
126127
*/
127-
public StringData getMatchDetails(String match_id) {
128-
return get("getmatchdetails", match_id);
128+
public StringData getMatchDetails(String... match_id) {
129+
if (match_id.length <= 10 && match_id.length > 1) {
130+
return get("getmatchdetailsbatch", String.join(",", match_id));
131+
} else if (match_id.length == 1) return getMatchDetails(match_id[0]);
132+
else return new StringData("You cannot batching more than 10 matches.");
129133
}
130134

135+
/**
136+
* Getting match details.
137+
* <i><b>NOTE</b> There is a byte limit to the amount of data returned; please limit the CSV parameter to 5 to 10 matches because of this and for Hi-Rez DB Performance reasons.</i>
138+
* @param match_id The id of the match. Can be obtained from <b>{@link #getMatchHistory(String)}</b>, <b>{@link #getTopMatches()}</b> &amp; <b>{@link #getMatchIDsByQueue}</b>.
139+
* @return Returns the statistics for a particular completed match.
140+
*/
141+
public StringData getMatchDetails(int... match_id) {
142+
String[] ids = new String[match_id.length];
143+
for (int id = 0; id < match_id.length; id++) {
144+
ids[id] = Integer.toString(match_id[id]);
145+
}
146+
return getMatchDetails(ids);
147+
}
148+
149+
150+
/**
151+
* Getting match details.
152+
* @param match_id The id of the match. Can be obtained from <b>{@link #getMatchHistory(String)}</b>, <b>{@link #getTopMatches()}</b> &amp; <b>{@link #getMatchIDsByQueue}</b>.
153+
* @return Returns the statistics for a particular completed match.
154+
*/
155+
public StringData getMatchDetails(String match_id) { return get("getmatchdetails", match_id); }
156+
131157
/**
132158
* Getting match details.
133159
* @param match_id The id of the match. Can be obtained from <b>{@link #getMatchHistory(String)}</b>, <b>{@link #getTopMatches()}</b> &amp; <b>{@link #getMatchIDsByQueue}</b>.

src/test/java/pl/stachuofficial/HiRezAPITest.java

Lines changed: 42 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,16 @@ static class HiRezTest extends HiRezAPI{
1717
StringData ping(Smite.Platform platform) {
1818
return new StringData(smite(platform).ping());
1919
}
20+
StringData ping(Paladins.Platform platform) { return new StringData(paladins(platform).ping()); }
2021

21-
StringData test(Smite.Platform platform) {
22-
return new StringData(smite(platform).testSession());
23-
}
24-
25-
StringData patch(Smite.Platform platform) {
26-
return smite(platform).getPatchInfo();
27-
}
28-
29-
StringData ping(Paladins.Platform platform) {
30-
return new StringData(paladins(platform).ping());
31-
}
22+
StringData patch(Smite.Platform platform) { return smite(platform).getPatchInfo(); }
23+
StringData patch(Paladins.Platform platform) { return paladins(platform).getPatchInfo(); }
3224

33-
StringData test(Paladins.Platform platform) {
34-
return new StringData(paladins(platform).testSession());
35-
}
36-
37-
StringData patch(Paladins.Platform platform) {
38-
return paladins(platform).getPatchInfo();
39-
}
25+
StringData test(Paladins.Platform platform) { return new StringData(paladins(platform).testSession()); }
26+
StringData test(Smite.Platform platform) { return new StringData(smite(platform).testSession()); }
4027
}
4128

42-
static HiRezTest apitest;
29+
private static HiRezTest apitest;
4330

4431
@BeforeAll
4532
static void setUp() {
@@ -50,28 +37,29 @@ static void setUp() {
5037
apitest = new HiRezTest(dev_id, auth_key);
5138
}
5239

40+
void testData(boolean condition, String title) {
41+
if (condition) System.out.println(title+": OK");
42+
else System.err.println(title+": ERROR");
43+
Assertions.assertTrue(condition, title);
44+
}
45+
5346
@Test
5447
@DisplayName("Smite PC")
5548
void smitePc() {
5649
Assertions.assertAll(
5750
() -> {
5851
String data = apitest.ping(Smite.Platform.PC).toString();
59-
Assertions.assertTrue(data.contains("Ping successful."), "Ping API");
60-
System.out.println(data);
52+
testData(data.contains("Ping successful."), "Smite PC - Ping API");
6153
},
6254
() -> {
6355
String data = apitest.test(Smite.Platform.PC).toString();
64-
Assertions.assertTrue(
65-
data.contains("This was a successful test with the following parameters added:"),
66-
"Session Test");
67-
System.out.println(data);
56+
testData(data.contains("This was a successful test with the following parameters added:"),
57+
"Smite PC - Session Test");
6858
},
6959
() -> {
7060
StringData data = apitest.patch(Smite.Platform.PC);
71-
Assertions.assertTrue(
72-
data.toJsonObject().get("ret_msg").equals(null) && !data.toJsonObject().getString("version_string").isEmpty(),
73-
"Patch Notes Test");
74-
System.out.println(data.toJsonObject().toString());
61+
testData(data.toJsonObject().get("ret_msg").equals(null) && !data.toJsonObject().getString("version_string").isEmpty(),
62+
"Smite PC - Patch Notes Test");
7563
});
7664
}
7765
@Test
@@ -80,22 +68,17 @@ void smiteXbox() {
8068
Assertions.assertAll(
8169
() -> {
8270
String data = apitest.ping(Smite.Platform.XBOX).toString();
83-
Assertions.assertTrue(data.contains("Ping successful."), "Ping API");
84-
System.out.println(data);
71+
testData(data.contains("Ping successful."), "Smite XBOX - Ping API");
8572
},
8673
() -> {
8774
String data = apitest.test(Smite.Platform.XBOX).toString();
88-
Assertions.assertTrue(
89-
data.contains("This was a successful test with the following parameters added:"),
90-
"Session Test");
91-
System.out.println(data);
75+
testData(data.contains("This was a successful test with the following parameters added:"),
76+
"Smite XBOX - Session Test");
9277
},
9378
() -> {
9479
StringData data = apitest.patch(Smite.Platform.XBOX);
95-
Assertions.assertTrue(
96-
data.toJsonObject().get("ret_msg").equals(null) && !data.toJsonObject().getString("version_string").isEmpty(),
97-
"Patch Notes Test");
98-
System.out.println(data.toJsonObject().toString());
80+
testData(data.toJsonObject().get("ret_msg").equals(null) && !data.toJsonObject().getString("version_string").isEmpty(),
81+
"Smite XBOX - Patch Notes Test");
9982
});
10083
}
10184
@Test
@@ -104,22 +87,17 @@ void smitePs4() {
10487
Assertions.assertAll(
10588
() -> {
10689
String data = apitest.ping(Smite.Platform.PS4).toString();
107-
Assertions.assertTrue(data.contains("Ping successful."), "Ping API");
108-
System.out.println(data);
90+
testData(data.contains("Ping successful."), "Smite PS4 - Ping API");
10991
},
11092
() -> {
11193
String data = apitest.test(Smite.Platform.PS4).toString();
112-
Assertions.assertTrue(
113-
data.contains("This was a successful test with the following parameters added:"),
114-
"Session Test");
115-
System.out.println(data);
94+
testData(data.contains("This was a successful test with the following parameters added:"),
95+
"Smite PS4 - Session Test");
11696
},
11797
() -> {
11898
StringData data = apitest.patch(Smite.Platform.PS4);
119-
Assertions.assertTrue(
120-
data.toJsonObject().get("ret_msg").equals(null) && !data.toJsonObject().getString("version_string").isEmpty(),
121-
"Patch Notes Test");
122-
System.out.println(data.toJsonObject().toString());
99+
testData(data.toJsonObject().get("ret_msg").equals(null) && !data.toJsonObject().getString("version_string").isEmpty(),
100+
"Smite PS4 - Patch Notes Test");
123101
});
124102
}
125103

@@ -129,22 +107,17 @@ void paladinsPc() {
129107
Assertions.assertAll(
130108
() -> {
131109
String data = apitest.ping(Paladins.Platform.PC).toString();
132-
Assertions.assertTrue(data.contains("Ping successful."), "Ping API");
133-
System.out.println(data);
110+
testData(data.contains("Ping successful."), "Paladins PC - Ping API");
134111
},
135112
() -> {
136113
String data = apitest.test(Paladins.Platform.PC).toString();
137-
Assertions.assertTrue(
138-
data.contains("This was a successful test with the following parameters added:"),
139-
"Session Test");
140-
System.out.println(data);
114+
testData(data.contains("This was a successful test with the following parameters added:"),
115+
"Paladins PC - Session Test");
141116
},
142117
() -> {
143118
StringData data = apitest.patch(Paladins.Platform.PC);
144-
Assertions.assertTrue(
145-
data.toJsonObject().get("ret_msg").equals(null) && !data.toJsonObject().getString("version_string").isEmpty(),
146-
"Patch Notes Test");
147-
System.out.println(data.toJsonObject().toString());
119+
testData(data.toJsonObject().get("ret_msg").equals(null) && !data.toJsonObject().getString("version_string").isEmpty(),
120+
"Paladins PC - Patch Notes Test");
148121
});
149122
}
150123
@Test
@@ -153,22 +126,17 @@ void paladinsXbox() {
153126
Assertions.assertAll(
154127
() -> {
155128
String data = apitest.ping(Paladins.Platform.XBOX).toString();
156-
Assertions.assertTrue(data.contains("Ping successful."), "Ping API");
157-
System.out.println(data);
129+
testData(data.contains("Ping successful."), "Paladins XBOX - Ping API");
158130
},
159131
() -> {
160132
String data = apitest.test(Paladins.Platform.XBOX).toString();
161-
Assertions.assertTrue(
162-
data.contains("This was a successful test with the following parameters added:"),
163-
"Session Test");
164-
System.out.println(data);
133+
testData(data.contains("This was a successful test with the following parameters added:"),
134+
"Paladins XBOX - Session Test");
165135
},
166136
() -> {
167137
StringData data = apitest.patch(Paladins.Platform.XBOX);
168-
Assertions.assertTrue(
169-
data.toJsonObject().get("ret_msg").equals(null) && !data.toJsonObject().getString("version_string").isEmpty(),
170-
"Patch Notes Test");
171-
System.out.println(data.toJsonObject().toString());
138+
testData(data.toJsonObject().get("ret_msg").equals(null) && !data.toJsonObject().getString("version_string").isEmpty(),
139+
"Paladins XBOX - Patch Notes Test");
172140
});
173141
}
174142
@Test
@@ -177,22 +145,17 @@ void paladinsPs4() {
177145
Assertions.assertAll(
178146
() -> {
179147
String data = apitest.ping(Paladins.Platform.PS4).toString();
180-
Assertions.assertTrue(data.contains("Ping successful."), "Ping API");
181-
System.out.println(data);
148+
testData(data.contains("Ping successful."), "Paladins PS4 - Ping API");
182149
},
183150
() -> {
184151
String data = apitest.test(Paladins.Platform.PS4).toString();
185-
Assertions.assertTrue(
186-
data.contains("This was a successful test with the following parameters added:"),
187-
"Session Test");
188-
System.out.println(data);
152+
testData(data.contains("This was a successful test with the following parameters added:"),
153+
"Paladins PS4 - Session Test");
189154
},
190155
() -> {
191156
StringData data = apitest.patch(Paladins.Platform.PS4);
192-
Assertions.assertTrue(
193-
data.toJsonObject().get("ret_msg").equals(null) && !data.toJsonObject().getString("version_string").isEmpty(),
194-
"Patch Notes Test");
195-
System.out.println(data.toJsonObject().toString());
157+
testData(data.toJsonObject().get("ret_msg").equals(null) && !data.toJsonObject().getString("version_string").isEmpty(),
158+
"Paladins PS4 - Patch Notes Test");
196159
});
197160
}
198161

0 commit comments

Comments
 (0)