|
43 | 43 |
|
44 | 44 | import javax.crypto.Mac; |
45 | 45 | import javax.crypto.spec.SecretKeySpec; |
| 46 | +import java.io.ByteArrayInputStream; |
46 | 47 | import java.net.URI; |
47 | 48 | import java.text.DateFormat; |
48 | 49 | import java.text.SimpleDateFormat; |
@@ -108,6 +109,27 @@ public void run() { |
108 | 109 | Assert.assertEquals("at least one task failed", 100, successCount.intValue()); |
109 | 110 | } |
110 | 111 |
|
| 112 | + @Test |
| 113 | + public void testPutJsonStream() throws Exception { |
| 114 | + String endpointStr = TestConfig.getPropertyNotEmpty(PROP_ATMOS_ENDPOINTS); |
| 115 | + String[] endpoints = endpointStr.split(","); |
| 116 | + List<Host> initialHosts = new ArrayList<Host>(); |
| 117 | + for (String endpoint : endpoints) { |
| 118 | + initialHosts.add(new Host(new URI(endpoint).getHost())); |
| 119 | + } |
| 120 | + byte[] data = "JSON Stream Test".getBytes(); |
| 121 | + |
| 122 | + SmartConfig smartConfig = new SmartConfig(initialHosts); |
| 123 | + Client client = SmartClientFactory.createSmartClient(smartConfig); |
| 124 | + |
| 125 | + // this is an illegal use of this resource, but we just want to make sure the request is sent |
| 126 | + // (no exception when finding a MessageBodyWriter) |
| 127 | + ClientResponse response = client.resource(endpoints[0]).path("/rest/service").type("application/json") |
| 128 | + .put(ClientResponse.class, new ByteArrayInputStream(data)); |
| 129 | + |
| 130 | + Assert.assertEquals(403, response.getStatus()); |
| 131 | + } |
| 132 | + |
111 | 133 | @Test |
112 | 134 | public void testConnTimeout() throws Exception { |
113 | 135 | int CONNECTION_TIMEOUT_MILLIS = 10000; // 10 seconds |
|
0 commit comments