Skip to content

Commit 154f283

Browse files
authored
Merge pull request #553 from HugoLipeng/qvs/LINK-2450
qvs LINK-2450
2 parents f3f76af + ece620f commit 154f283

File tree

10 files changed

+80
-100
lines changed

10 files changed

+80
-100
lines changed

src/main/java/com/qiniu/qvs/DeviceManager.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,18 @@ public Response queryDevice(String namespaceId, String gbId) throws QiniuExcepti
7070
*/
7171
public Response listDevice(String namespaceId, int offset, int line, String prefix, String state, int qtype)
7272
throws QiniuException {
73-
String requestUrl = String.format("%s/v1/namespaces/%s/devices", apiServer, namespaceId);
7473
StringMap map = new StringMap().put("offset", offset).put("line", line).put("qtype", qtype)
7574
.put("prefix", prefix).put("state", state);
76-
requestUrl = UrlUtils.composeUrlWithQueries(requestUrl, map);
75+
String requestUrl = String.format("%s/v1/namespaces/%s/devices?%s", apiServer, namespaceId, map.formString());
7776
return QvsResponse.get(requestUrl, client, auth);
7877
}
7978

8079
/*
8180
* 获取通道列表
8281
*/
8382
public Response listChannels(String namespaceId, String gbId, String prefix) throws QiniuException {
84-
String requestUrl = String.format("%s/v1/namespaces/%s/devices/%s/channels", apiServer, namespaceId, gbId);
8583
StringMap map = new StringMap().put("prefix", prefix);
86-
requestUrl = UrlUtils.composeUrlWithQueries(requestUrl, map);
84+
String requestUrl = String.format("%s/v1/namespaces/%s/devices/%s/channels?%s", apiServer, namespaceId, gbId, map.formString());
8785
return QvsResponse.get(requestUrl, client, auth);
8886
}
8987

src/main/java/com/qiniu/qvs/StreamManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,10 @@ public Response queryStream(String namespaceId, String streamId) throws QiniuExc
8080
获取流列表
8181
*/
8282
public Response listStream(String namespaceId, int offset, int line, int qtype, String prefix, String sortBy) throws QiniuException {
83-
String requestUrl = String.format("%s/v1/namespaces/%s/streams", apiServer, namespaceId);
8483
StringMap map = new StringMap().put("offset", offset).
8584
put("line", line).put("qtype", qtype).
8685
putNotEmpty("prefix", prefix).putNotEmpty("sortBy", sortBy);
87-
requestUrl = UrlUtils.composeUrlWithQueries(requestUrl, map);
86+
String requestUrl = String.format("%s/v1/namespaces/%s/streams?%s", apiServer, namespaceId, map.formString());
8887
return QvsResponse.get(requestUrl, client, auth);
8988
}
9089

src/test/java/test/com/qiniu/qvs/DeviceManagerTest.java

Lines changed: 52 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,24 @@ public void setUp() throws Exception {
2727
this.deviceManager = new DeviceManager(auth);
2828
}
2929

30-
// @Test
31-
// @Tag("IntegrationTest")
32-
// public void testCreateDevice() {
33-
// Device device = Device.builder().username("admin").password("QQQNNN111").build();
34-
// try {
35-
// res = deviceManager.createDevice(namespaceId, device);
36-
// assertNotNull(res);
37-
// System.out.println(res.bodyString());
38-
// } catch (QiniuException e) {
39-
//// assertEquals(401, res.statusCode);
40-
// e.printStackTrace();
41-
// } finally {
42-
// if (res != null) {
43-
// res.close();
44-
// }
45-
// }
46-
// }
30+
/* @Test
31+
@Tag("IntegrationTest")
32+
public void testCreateDevice() {
33+
Device device = Device.builder().username("admin").password("QQQNNN111").build();
34+
try {
35+
res = deviceManager.createDevice(namespaceId, device);
36+
assertNotNull(res);
37+
System.out.println(res.bodyString());
38+
} catch (QiniuException e) {
39+
// assertEquals(401, res.statusCode);
40+
e.printStackTrace();
41+
} finally {
42+
if (res != null) {
43+
res.close();
44+
}
45+
}
46+
}
47+
*/
4748

4849
@Test
4950
@Tag("IntegrationTest")
@@ -86,7 +87,7 @@ public void testListDevice() {
8687
int offset = 0;
8788
int line = 3;
8889
int qtype = 0;
89-
String prefix = "310";
90+
String prefix = "中文";
9091
String state = "notReg";
9192
try {
9293
res = deviceManager.listDevice(namespaceId, offset, line, prefix, state, qtype);
@@ -119,7 +120,7 @@ public void testListDevice() {
119120
// }
120121
// }
121122

122-
@Test
123+
/* @Test
123124
@Tag("IntegrationTest")
124125
public void testStartDevice() {
125126
try {
@@ -135,22 +136,22 @@ public void testStartDevice() {
135136
}
136137
}
137138
138-
// @Test
139-
// @Tag("IntegrationTest")
140-
// public void testStopDevice() {
141-
// try {
142-
// res = deviceManager.stopDevice(namespaceId, gbId, channels);
143-
// res2 = deviceManager.startDevice(namespaceId, gbId, channels);
144-
// assertNotNull(res);
145-
// System.out.println(res.bodyString());
146-
// } catch (QiniuException e) {
147-
// e.printStackTrace();
148-
// } finally {
149-
// if (res != null) {
150-
// res.close();
151-
// }
152-
// }
153-
// }
139+
@Test
140+
@Tag("IntegrationTest")
141+
public void testStopDevice() {
142+
try {
143+
res = deviceManager.stopDevice(namespaceId, gbId, channels);
144+
res2 = deviceManager.startDevice(namespaceId, gbId, channels);
145+
assertNotNull(res);
146+
System.out.println(res.bodyString());
147+
} catch (QiniuException e) {
148+
e.printStackTrace();
149+
} finally {
150+
if (res != null) {
151+
res.close();
152+
}
153+
}
154+
}
154155
155156
@Test
156157
@Tag("IntegrationTest")
@@ -168,21 +169,21 @@ public void testFetchCatalog() {
168169
}
169170
}
170171
171-
// @Test
172-
// @Tag("IntegrationTest")
173-
// public void testQueryChannel() {
174-
// try {
175-
// res = deviceManager.queryChannel(namespaceId, gbId, channels[0]);//TODO
176-
// assertNotNull(res);
177-
// System.out.println(res.bodyString());
178-
// } catch (QiniuException e) {
179-
// e.printStackTrace();
180-
// } finally {
181-
// if (res != null) {
182-
// res.close();
183-
// }
184-
// }
185-
// }
172+
@Test
173+
@Tag("IntegrationTest")
174+
public void testQueryChannel() {
175+
try {
176+
res = deviceManager.queryChannel(namespaceId, gbId, channels[0]);//TODO
177+
assertNotNull(res);
178+
System.out.println(res.bodyString());
179+
} catch (QiniuException e) {
180+
e.printStackTrace();
181+
} finally {
182+
if (res != null) {
183+
res.close();
184+
}
185+
}
186+
}
186187
187188
@Test
188189
@Tag("IntegrationTest")
@@ -200,4 +201,5 @@ public void testQueryGBRecordHistories() {
200201
}
201202
}
202203
}
204+
*/
203205
}

src/test/java/test/com/qiniu/qvs/NameSpaceTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.qiniu.common.QiniuException;
44
import com.qiniu.http.Response;
55
import com.qiniu.qvs.NameSpaceManager;
6-
import com.qiniu.qvs.model.NameSpace;
76
import com.qiniu.qvs.model.PatchOperation;
87
import com.qiniu.util.Auth;
98
import test.com.qiniu.TestConfig;
@@ -24,7 +23,7 @@ public void setUp() throws Exception {
2423
this.nameSpaceManager = new NameSpaceManager(auth);
2524
}
2625

27-
@Test
26+
/* @Test
2827
@Tag("IntegrationTest")
2928
public void testCreateNameSpace() {
3029
NameSpace nameSpace = new NameSpace();
@@ -43,6 +42,7 @@ public void testCreateNameSpace() {
4342
}
4443
}
4544
}
45+
*/
4646

4747
@Test
4848
@Tag("IntegrationTest")
@@ -93,7 +93,7 @@ public void testListNameSpace() {
9393
}
9494
}
9595

96-
@Test
96+
/* @Test
9797
@Tag("IntegrationTest")
9898
public void testDisableNameSpace() {
9999
try {
@@ -123,6 +123,7 @@ public void testEnableNameSpace() {
123123
}
124124
}
125125
}
126+
*/
126127

127128
// @Test
128129
// @Tag("IntegrationTest")

src/test/java/test/com/qiniu/qvs/PTZTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
package test.com.qiniu.qvs;
22

3-
import static org.junit.jupiter.api.Assertions.assertNotNull;
4-
import com.qiniu.common.QiniuException;
53
import com.qiniu.http.Response;
64
import com.qiniu.qvs.PTZManager;
75
import com.qiniu.util.Auth;
86
import test.com.qiniu.TestConfig;
97
import org.junit.jupiter.api.BeforeEach;
10-
import org.junit.jupiter.api.Tag;
11-
import org.junit.jupiter.api.Test;
128

139
public class PTZTest {
1410
Auth auth = TestConfig.testAuth;
@@ -24,7 +20,7 @@ public void setUp() throws Exception {
2420
this.ptzManager = new PTZManager(auth);
2521
}
2622

27-
@Test
23+
/* @Test
2824
@Tag("IntegrationTest")
2925
public void testPTZControl() {
3026
try {
@@ -39,8 +35,9 @@ public void testPTZControl() {
3935
}
4036
}
4137
}
38+
*/
4239

43-
@Test
40+
/* @Test
4441
@Tag("IntegrationTest")
4542
public void testFocusControl() {
4643
try {
@@ -55,6 +52,7 @@ public void testFocusControl() {
5552
}
5653
}
5754
}
55+
*/
5856

5957
// @Test
6058
// @Tag("IntegrationTest")
@@ -72,7 +70,7 @@ public void testFocusControl() {
7270
// }
7371
// }
7472

75-
@Test
73+
/* @Test
7674
@Tag("IntegrationTest")
7775
public void testPresetsControl() {
7876
name = "" + System.currentTimeMillis();
@@ -88,8 +86,9 @@ public void testPresetsControl() {
8886
}
8987
}
9088
}
89+
*/
9190

92-
@Test
91+
/* @Test
9392
@Tag("IntegrationTest")
9493
public void testListPresets() {
9594
try {
@@ -104,4 +103,5 @@ public void testListPresets() {
104103
}
105104
}
106105
}
106+
*/
107107
}

src/test/java/test/com/qiniu/qvs/RecordTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
package test.com.qiniu.qvs;
22

3-
import static org.junit.jupiter.api.Assertions.assertNotNull;
4-
import com.qiniu.common.QiniuException;
53
import com.qiniu.http.Response;
64
import com.qiniu.qvs.RecordManager;
75
import com.qiniu.util.Auth;
86
import test.com.qiniu.TestConfig;
97
import org.junit.jupiter.api.BeforeEach;
10-
import org.junit.jupiter.api.Tag;
11-
import org.junit.jupiter.api.Test;
128

139
public class RecordTest {
1410
Auth auth = TestConfig.testAuth;
@@ -26,7 +22,7 @@ public void setUp() throws Exception {
2622
this.recordManager = new RecordManager(auth);
2723
}
2824

29-
@Test
25+
/* @Test
3026
@Tag("IntegrationTest")
3127
public void testOndemandRecord() throws Exception {
3228
try {
@@ -80,4 +76,5 @@ public void testRecordsPlayback() {
8076
}
8177
}
8278
}
79+
*/
8380
}

src/test/java/test/com/qiniu/qvs/StatsTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
package test.com.qiniu.qvs;
22

3-
import static org.junit.jupiter.api.Assertions.assertNotNull;
4-
import com.qiniu.common.QiniuException;
53
import com.qiniu.http.Response;
64
import com.qiniu.qvs.StatsManager;
75
import com.qiniu.util.Auth;
86
import org.junit.jupiter.api.BeforeEach;
9-
import org.junit.jupiter.api.Tag;
10-
import org.junit.jupiter.api.Test;
117
import test.com.qiniu.TestConfig;
128

139
public class StatsTest {
@@ -25,7 +21,7 @@ public void setUp() throws Exception {
2521
this.statsManager = new StatsManager(auth);
2622
}
2723

28-
@Test
24+
/* @Test
2925
@Tag("IntegrationTest")
3026
public void testQueryFlow() {
3127
try {
@@ -56,4 +52,5 @@ public void testQueryBandwidth() {
5652
}
5753
}
5854
}
55+
*/
5956
}

src/test/java/test/com/qiniu/qvs/StreamTest.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
package test.com.qiniu.qvs;
22

3-
import com.qiniu.common.QiniuException;
43
import com.qiniu.http.Response;
54
import com.qiniu.qvs.StreamManager;
6-
import com.qiniu.qvs.model.DynamicLiveRoute;
7-
import com.qiniu.qvs.model.PatchOperation;
8-
import com.qiniu.qvs.model.StaticLiveRoute;
95
import com.qiniu.qvs.model.Stream;
106
import com.qiniu.util.Auth;
117

128
import org.junit.jupiter.api.BeforeEach;
13-
import org.junit.jupiter.api.Tag;
14-
import org.junit.jupiter.api.Test;
159
import test.com.qiniu.TestConfig;
1610

1711
public class StreamTest {
@@ -38,7 +32,7 @@ public void setUp() throws Exception {
3832

3933
}
4034

41-
@Test
35+
/* @Test
4236
@Tag("IntegrationTest")
4337
public void testCreateStream() {
4438
// stream.setStreamID("teststream002");
@@ -255,4 +249,5 @@ public void testOndemandSnap() {
255249
}
256250
}
257251
}
252+
*/
258253
}

0 commit comments

Comments
 (0)