Skip to content

Commit 58050a5

Browse files
committed
test reactive testcase
1 parent a7135bd commit 58050a5

File tree

1 file changed

+9
-4
lines changed
  • demo/demo-spring-boot-transport/demo-spring-boot-springmvc-client/src/main/java/org/apache/servicecomb/springboot/springmvc/client

1 file changed

+9
-4
lines changed

demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestReactiveStream.java renamed to demo/demo-spring-boot-transport/demo-spring-boot-springmvc-client/src/main/java/org/apache/servicecomb/springboot/springmvc/client/TestReactiveStream.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package org.apache.servicecomb.demo.springmvc.client;
17+
package org.apache.servicecomb.springboot.springmvc.client;
1818

1919
import java.util.concurrent.CountDownLatch;
2020
import java.util.concurrent.TimeUnit;
@@ -46,24 +46,28 @@ public void testRestTransport() throws Exception {
4646
}
4747

4848
private void testSseStringWithParam() throws Exception {
49+
System.out.println("=============start testSseStringWithParam==================");
4950
Publisher<SseEventResponseEntity<?>> result
5051
= restTemplate.getForObject(SERVER + "/sseStringWithParam?name=d", Publisher.class);
5152
TestMgr.check("abcd", buildStringBuffer(result));
5253
}
5354

5455
private void testSseString() throws Exception {
56+
System.out.println("=============start testSseString==================");
5557
Publisher<SseEventResponseEntity<?>> result
5658
= restTemplate.getForObject(SERVER + "/sseString", Publisher.class);
5759
TestMgr.check("abc", buildStringBuffer(result));
5860
}
5961

6062
private void testSseResponseEntity() throws Exception {
63+
System.out.println("=============start testSseResponseEntity==================");
6164
Publisher<SseEventResponseEntity<?>> result
6265
= restTemplate.getForObject(SERVER + "/sseResponseEntity", Publisher.class);
6366
TestMgr.check("test0jack0test1jack1test2jack2", buildStringBuffer(result));
6467
}
6568

6669
private void testSseModel() throws Exception {
70+
System.out.println("=============start testSseModel==================");
6771
Publisher<SseEventResponseEntity<?>> result
6872
= restTemplate.getForObject(SERVER + "/sseModel", Publisher.class);
6973
TestMgr.check("jack0jack1jack2jack3jack4", buildStringBuffer(result));
@@ -84,14 +88,14 @@ public void onSubscribe(Subscription s) {
8488
@Override
8589
public void onNext(SseEventResponseEntity<?> responseEntity) {
8690
if (responseEntity.getData() instanceof String) {
91+
System.out.println("=========onNext=============>" + responseEntity.getData());
8792
buffer.append(responseEntity.getData());
8893
}
8994
if (responseEntity.getData() instanceof Model model) {
9095
if (!StringUtils.isEmpty(responseEntity.getEvent())) {
9196
buffer.append(responseEntity.getEvent());
9297
}
93-
buffer.append(model.getName())
94-
.append(model.getAge());
98+
buffer.append(model.getName()).append(model.getAge());
9599
}
96100
subscription.request(1);
97101
}
@@ -107,7 +111,8 @@ public void onComplete() {
107111
countDownLatch.countDown();
108112
}
109113
});
110-
countDownLatch.await(10, TimeUnit.SECONDS);
114+
countDownLatch.await(20, TimeUnit.SECONDS);
115+
System.out.println("=========result=============>" + buffer.toString());
111116
return buffer.toString();
112117
}
113118
}

0 commit comments

Comments
 (0)