1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.rest;
19
20 import static org.junit.Assert.assertEquals;
21
22 import com.fasterxml.jackson.databind.ObjectMapper;
23 import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
24
25 import java.io.ByteArrayInputStream;
26 import java.io.IOException;
27 import java.io.StringWriter;
28 import java.util.*;
29
30 import javax.ws.rs.core.MediaType;
31 import javax.xml.bind.JAXBContext;
32 import javax.xml.bind.JAXBException;
33 import javax.xml.bind.Marshaller;
34 import javax.xml.bind.Unmarshaller;
35
36 import org.apache.hadoop.conf.Configuration;
37 import org.apache.hadoop.hbase.HBaseTestingUtility;
38 import org.apache.hadoop.hbase.HColumnDescriptor;
39 import org.apache.hadoop.hbase.HTableDescriptor;
40 import org.apache.hadoop.hbase.TableName;
41 import org.apache.hadoop.hbase.client.Admin;
42 import org.apache.hadoop.hbase.rest.client.Client;
43 import org.apache.hadoop.hbase.rest.client.Cluster;
44 import org.apache.hadoop.hbase.rest.client.Response;
45 import org.apache.hadoop.hbase.rest.model.CellModel;
46 import org.apache.hadoop.hbase.rest.model.CellSetModel;
47 import org.apache.hadoop.hbase.rest.model.RowModel;
48 import org.apache.hadoop.hbase.rest.provider.JacksonProvider;
49 import org.apache.hadoop.hbase.util.Bytes;
50 import org.junit.After;
51 import org.junit.AfterClass;
52 import org.junit.Before;
53 import org.junit.BeforeClass;
54
55 public class RowResourceBase {
56
57 protected static final String TABLE = "TestRowResource";
58 protected static final String CFA = "a";
59 protected static final String CFB = "b";
60 protected static final String COLUMN_1 = CFA + ":1";
61 protected static final String COLUMN_2 = CFB + ":2";
62 protected static final String COLUMN_3 = CFA + ":";
63 protected static final String ROW_1 = "testrow1";
64 protected static final String VALUE_1 = "testvalue1";
65 protected static final String ROW_2 = "testrow2";
66 protected static final String VALUE_2 = "testvalue2";
67 protected static final String ROW_3 = "testrow3";
68 protected static final String VALUE_3 = "testvalue3";
69 protected static final String ROW_4 = "testrow4";
70 protected static final String VALUE_4 = "testvalue4";
71 protected static final String VALUE_5 = "5";
72 protected static final String VALUE_6 = "6";
73
74 protected static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
75 protected static final HBaseRESTTestingUtility REST_TEST_UTIL =
76 new HBaseRESTTestingUtility();
77 protected static Client client;
78 protected static JAXBContext context;
79 protected static Marshaller xmlMarshaller;
80 protected static Unmarshaller xmlUnmarshaller;
81 protected static Configuration conf;
82 protected static ObjectMapper jsonMapper;
83
84 @BeforeClass
85 public static void setUpBeforeClass() throws Exception {
86 conf = TEST_UTIL.getConfiguration();
87 TEST_UTIL.startMiniCluster(3);
88 REST_TEST_UTIL.startServletContainer(conf);
89 context = JAXBContext.newInstance(
90 CellModel.class,
91 CellSetModel.class,
92 RowModel.class);
93 xmlMarshaller = context.createMarshaller();
94 xmlUnmarshaller = context.createUnmarshaller();
95 jsonMapper = new JacksonProvider()
96 .locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE);
97 client = new Client(new Cluster().add("localhost",
98 REST_TEST_UTIL.getServletPort()));
99 }
100
101 @AfterClass
102 public static void tearDownAfterClass() throws Exception {
103 REST_TEST_UTIL.shutdownServletContainer();
104 TEST_UTIL.shutdownMiniCluster();
105 }
106
107 @Before
108 public void beforeMethod() throws Exception {
109 Admin admin = TEST_UTIL.getHBaseAdmin();
110 if (admin.tableExists(TableName.valueOf(TABLE))) {
111 TEST_UTIL.deleteTable(Bytes.toBytes(TABLE));
112 }
113 HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE));
114 htd.addFamily(new HColumnDescriptor(CFA));
115 htd.addFamily(new HColumnDescriptor(CFB));
116 admin.createTable(htd);
117 }
118
119 @After
120 public void afterMethod() throws Exception {
121 Admin admin = TEST_UTIL.getHBaseAdmin();
122 if (admin.tableExists(TableName.valueOf(TABLE))) {
123 TEST_UTIL.deleteTable(Bytes.toBytes(TABLE));
124 }
125 }
126
127 static Response putValuePB(String table, String row, String column,
128 String value) throws IOException {
129 StringBuilder path = new StringBuilder();
130 path.append('/');
131 path.append(table);
132 path.append('/');
133 path.append(row);
134 path.append('/');
135 path.append(column);
136 return putValuePB(path.toString(), table, row, column, value);
137 }
138
139 static Response putValuePB(String url, String table, String row,
140 String column, String value) throws IOException {
141 RowModel rowModel = new RowModel(row);
142 rowModel.addCell(new CellModel(Bytes.toBytes(column),
143 Bytes.toBytes(value)));
144 CellSetModel cellSetModel = new CellSetModel();
145 cellSetModel.addRow(rowModel);
146 Response response = client.put(url, Constants.MIMETYPE_PROTOBUF,
147 cellSetModel.createProtobufOutput());
148 Thread.yield();
149 return response;
150 }
151
152 protected static void checkValueXML(String url, String table, String row,
153 String column, String value) throws IOException, JAXBException {
154 Response response = getValueXML(url);
155 assertEquals(200, response.getCode());
156 assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
157 CellSetModel cellSet = (CellSetModel)
158 xmlUnmarshaller.unmarshal(new ByteArrayInputStream(response.getBody()));
159 RowModel rowModel = cellSet.getRows().get(0);
160 CellModel cell = rowModel.getCells().get(0);
161 assertEquals(Bytes.toString(cell.getColumn()), column);
162 assertEquals(Bytes.toString(cell.getValue()), value);
163 }
164
165 protected static void checkValueXML(String table, String row, String column,
166 String value) throws IOException, JAXBException {
167 Response response = getValueXML(table, row, column);
168 assertEquals(200, response.getCode());
169 assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
170 CellSetModel cellSet = (CellSetModel)
171 xmlUnmarshaller.unmarshal(new ByteArrayInputStream(response.getBody()));
172 RowModel rowModel = cellSet.getRows().get(0);
173 CellModel cell = rowModel.getCells().get(0);
174 assertEquals(Bytes.toString(cell.getColumn()), column);
175 assertEquals(Bytes.toString(cell.getValue()), value);
176 }
177
178 protected static void checkIncrementValueXML(String table, String row, String column,
179 long value) throws IOException, JAXBException {
180 Response response = getValueXML(table, row, column);
181 assertEquals(200, response.getCode());
182 assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
183 CellSetModel cellSet = (CellSetModel)
184 xmlUnmarshaller.unmarshal(new ByteArrayInputStream(response.getBody()));
185 RowModel rowModel = cellSet.getRows().get(0);
186 CellModel cell = rowModel.getCells().get(0);
187 assertEquals(Bytes.toString(cell.getColumn()), column);
188 assertEquals(Bytes.toLong(cell.getValue()), value);
189 }
190
191 protected static Response getValuePB(String url) throws IOException {
192 Response response = client.get(url, Constants.MIMETYPE_PROTOBUF);
193 return response;
194 }
195
196 protected static Response putValueXML(String table, String row, String column,
197 String value) throws IOException, JAXBException {
198 StringBuilder path = new StringBuilder();
199 path.append('/');
200 path.append(table);
201 path.append('/');
202 path.append(row);
203 path.append('/');
204 path.append(column);
205 return putValueXML(path.toString(), table, row, column, value);
206 }
207
208 protected static Response putValueXML(String url, String table, String row,
209 String column, String value) throws IOException, JAXBException {
210 RowModel rowModel = new RowModel(row);
211 rowModel.addCell(new CellModel(Bytes.toBytes(column),
212 Bytes.toBytes(value)));
213 CellSetModel cellSetModel = new CellSetModel();
214 cellSetModel.addRow(rowModel);
215 StringWriter writer = new StringWriter();
216 xmlMarshaller.marshal(cellSetModel, writer);
217 Response response = client.put(url, Constants.MIMETYPE_XML,
218 Bytes.toBytes(writer.toString()));
219 Thread.yield();
220 return response;
221 }
222
223 protected static Response getValuePB(String table, String row, String column)
224 throws IOException {
225 StringBuilder path = new StringBuilder();
226 path.append('/');
227 path.append(table);
228 path.append('/');
229 path.append(row);
230 path.append('/');
231 path.append(column);
232 return getValuePB(path.toString());
233 }
234
235 protected static void checkValuePB(String table, String row, String column,
236 String value) throws IOException {
237 Response response = getValuePB(table, row, column);
238 assertEquals(200, response.getCode());
239 assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
240 CellSetModel cellSet = new CellSetModel();
241 cellSet.getObjectFromMessage(response.getBody());
242 RowModel rowModel = cellSet.getRows().get(0);
243 CellModel cell = rowModel.getCells().get(0);
244 assertEquals(Bytes.toString(cell.getColumn()), column);
245 assertEquals(Bytes.toString(cell.getValue()), value);
246 }
247
248 protected static void checkIncrementValuePB(String table, String row, String column,
249 long value) throws IOException {
250 Response response = getValuePB(table, row, column);
251 assertEquals(200, response.getCode());
252 assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
253 CellSetModel cellSet = new CellSetModel();
254 cellSet.getObjectFromMessage(response.getBody());
255 RowModel rowModel = cellSet.getRows().get(0);
256 CellModel cell = rowModel.getCells().get(0);
257 assertEquals(Bytes.toString(cell.getColumn()), column);
258 assertEquals(Bytes.toLong(cell.getValue()), value);
259 }
260
261 protected static Response checkAndPutValuePB(String url, String table,
262 String row, String column, String valueToCheck, String valueToPut, HashMap<String,String> otherCells)
263 throws IOException {
264 RowModel rowModel = new RowModel(row);
265 rowModel.addCell(new CellModel(Bytes.toBytes(column),
266 Bytes.toBytes(valueToPut)));
267
268 if(otherCells != null) {
269 for (Map.Entry<String,String> entry :otherCells.entrySet()) {
270 rowModel.addCell(new CellModel(Bytes.toBytes(entry.getKey()), Bytes.toBytes(entry.getValue())));
271 }
272 }
273
274
275 rowModel.addCell(new CellModel(Bytes.toBytes(column),
276 Bytes.toBytes(valueToCheck)));
277
278 CellSetModel cellSetModel = new CellSetModel();
279 cellSetModel.addRow(rowModel);
280 Response response = client.put(url, Constants.MIMETYPE_PROTOBUF,
281 cellSetModel.createProtobufOutput());
282 Thread.yield();
283 return response;
284 }
285
286 protected static Response checkAndPutValuePB(String table, String row,
287 String column, String valueToCheck, String valueToPut) throws IOException {
288 return checkAndPutValuePB(table,row,column,valueToCheck,valueToPut,null);
289 }
290 protected static Response checkAndPutValuePB(String table, String row,
291 String column, String valueToCheck, String valueToPut, HashMap<String,String> otherCells) throws IOException {
292 StringBuilder path = new StringBuilder();
293 path.append('/');
294 path.append(table);
295 path.append('/');
296 path.append(row);
297 path.append("?check=put");
298 return checkAndPutValuePB(path.toString(), table, row, column,
299 valueToCheck, valueToPut, otherCells);
300 }
301
302 protected static Response checkAndPutValueXML(String url, String table,
303 String row, String column, String valueToCheck, String valueToPut, HashMap<String,String> otherCells)
304 throws IOException, JAXBException {
305 RowModel rowModel = new RowModel(row);
306 rowModel.addCell(new CellModel(Bytes.toBytes(column),
307 Bytes.toBytes(valueToPut)));
308
309 if(otherCells != null) {
310 for (Map.Entry<String,String> entry :otherCells.entrySet()) {
311 rowModel.addCell(new CellModel(Bytes.toBytes(entry.getKey()), Bytes.toBytes(entry.getValue())));
312 }
313 }
314
315
316 rowModel.addCell(new CellModel(Bytes.toBytes(column),
317 Bytes.toBytes(valueToCheck)));
318 CellSetModel cellSetModel = new CellSetModel();
319 cellSetModel.addRow(rowModel);
320 StringWriter writer = new StringWriter();
321 xmlMarshaller.marshal(cellSetModel, writer);
322 Response response = client.put(url, Constants.MIMETYPE_XML,
323 Bytes.toBytes(writer.toString()));
324 Thread.yield();
325 return response;
326 }
327
328 protected static Response checkAndPutValueXML(String table, String row,
329 String column, String valueToCheck, String valueToPut)
330 throws IOException, JAXBException {
331 return checkAndPutValueXML(table,row,column,valueToCheck,valueToPut, null);
332 }
333
334 protected static Response checkAndPutValueXML(String table, String row,
335 String column, String valueToCheck, String valueToPut, HashMap<String,String> otherCells)
336 throws IOException, JAXBException {
337 StringBuilder path = new StringBuilder();
338 path.append('/');
339 path.append(table);
340 path.append('/');
341 path.append(row);
342 path.append("?check=put");
343 return checkAndPutValueXML(path.toString(), table, row, column,
344 valueToCheck, valueToPut, otherCells);
345 }
346
347 protected static Response checkAndDeleteXML(String url, String table,
348 String row, String column, String valueToCheck, HashMap<String,String> cellsToDelete)
349 throws IOException, JAXBException {
350 RowModel rowModel = new RowModel(row);
351
352 if(cellsToDelete != null) {
353 for (Map.Entry<String,String> entry :cellsToDelete.entrySet()) {
354 rowModel.addCell(new CellModel(Bytes.toBytes(entry.getKey()), Bytes.toBytes(entry.getValue())));
355 }
356 }
357
358 rowModel.addCell(new CellModel(Bytes.toBytes(column),
359 Bytes.toBytes(valueToCheck)));
360 CellSetModel cellSetModel = new CellSetModel();
361 cellSetModel.addRow(rowModel);
362 StringWriter writer = new StringWriter();
363 xmlMarshaller.marshal(cellSetModel, writer);
364 Response response = client.put(url, Constants.MIMETYPE_XML,
365 Bytes.toBytes(writer.toString()));
366 Thread.yield();
367 return response;
368 }
369
370 protected static Response checkAndDeleteXML(String table, String row,
371 String column, String valueToCheck) throws IOException, JAXBException {
372 return checkAndDeleteXML(table, row, column, valueToCheck, null);
373 }
374 protected static Response checkAndDeleteXML(String table, String row,
375 String column, String valueToCheck, HashMap<String,String> cellsToDelete) throws IOException, JAXBException {
376 StringBuilder path = new StringBuilder();
377 path.append('/');
378 path.append(table);
379 path.append('/');
380 path.append(row);
381 path.append("?check=delete");
382 return checkAndDeleteXML(path.toString(), table, row, column, valueToCheck, cellsToDelete);
383 }
384
385 protected static Response checkAndDeleteJson(String table, String row,
386 String column, String valueToCheck) throws IOException, JAXBException {
387 return checkAndDeleteJson(table, row, column, valueToCheck, null);
388 }
389
390 protected static Response checkAndDeleteJson(String table, String row,
391 String column, String valueToCheck, HashMap<String,String> cellsToDelete) throws IOException, JAXBException {
392 StringBuilder path = new StringBuilder();
393 path.append('/');
394 path.append(table);
395 path.append('/');
396 path.append(row);
397 path.append("?check=delete");
398 return checkAndDeleteJson(path.toString(), table, row, column, valueToCheck, cellsToDelete);
399 }
400
401 protected static Response checkAndDeleteJson(String url, String table,
402 String row, String column, String valueToCheck, HashMap<String,String> cellsToDelete)
403 throws IOException, JAXBException {
404 RowModel rowModel = new RowModel(row);
405
406 if(cellsToDelete != null) {
407 for (Map.Entry<String,String> entry :cellsToDelete.entrySet()) {
408 rowModel.addCell(new CellModel(Bytes.toBytes(entry.getKey()), Bytes.toBytes(entry.getValue())));
409 }
410 }
411
412 rowModel.addCell(new CellModel(Bytes.toBytes(column),
413 Bytes.toBytes(valueToCheck)));
414 CellSetModel cellSetModel = new CellSetModel();
415 cellSetModel.addRow(rowModel);
416 String jsonString = jsonMapper.writeValueAsString(cellSetModel);
417 Response response = client.put(url, Constants.MIMETYPE_JSON,
418 Bytes.toBytes(jsonString));
419 Thread.yield();
420 return response;
421 }
422
423 protected static Response checkAndDeletePB(String table, String row,
424 String column, String value) throws IOException {
425
426 return checkAndDeletePB(table, row, column, value, null);
427 }
428
429 protected static Response checkAndDeletePB(String table, String row,
430 String column, String value, HashMap<String,String> cellsToDelete) throws IOException {
431 StringBuilder path = new StringBuilder();
432 path.append('/');
433 path.append(table);
434 path.append('/');
435 path.append(row);
436 path.append("?check=delete");
437 return checkAndDeleteValuePB(path.toString(), table, row, column, value, cellsToDelete);
438 }
439 protected static Response checkAndDeleteValuePB(String url, String table,
440 String row, String column, String valueToCheck, HashMap<String,String> cellsToDelete)
441 throws IOException {
442 RowModel rowModel = new RowModel(row);
443
444 if(cellsToDelete != null) {
445 for (Map.Entry<String,String> entry :cellsToDelete.entrySet()) {
446 rowModel.addCell(new CellModel(Bytes.toBytes(entry.getKey()), Bytes.toBytes(entry.getValue())));
447 }
448 }
449
450 rowModel.addCell(new CellModel(Bytes.toBytes(column), Bytes
451 .toBytes(valueToCheck)));
452 CellSetModel cellSetModel = new CellSetModel();
453 cellSetModel.addRow(rowModel);
454 Response response = client.put(url, Constants.MIMETYPE_PROTOBUF,
455 cellSetModel.createProtobufOutput());
456 Thread.yield();
457 return response;
458 }
459
460 protected static Response getValueXML(String table, String startRow,
461 String endRow, String column) throws IOException {
462 StringBuilder path = new StringBuilder();
463 path.append('/');
464 path.append(table);
465 path.append('/');
466 path.append(startRow);
467 path.append(",");
468 path.append(endRow);
469 path.append('/');
470 path.append(column);
471 return getValueXML(path.toString());
472 }
473
474 protected static Response getValueXML(String url) throws IOException {
475 Response response = client.get(url, Constants.MIMETYPE_XML);
476 return response;
477 }
478
479 protected static Response getValueJson(String url) throws IOException {
480 Response response = client.get(url, Constants.MIMETYPE_JSON);
481 return response;
482 }
483
484 protected static Response deleteValue(String table, String row, String column)
485 throws IOException {
486 StringBuilder path = new StringBuilder();
487 path.append('/');
488 path.append(table);
489 path.append('/');
490 path.append(row);
491 path.append('/');
492 path.append(column);
493 Response response = client.delete(path.toString());
494 Thread.yield();
495 return response;
496 }
497
498 protected static Response getValueXML(String table, String row, String column)
499 throws IOException {
500 StringBuilder path = new StringBuilder();
501 path.append('/');
502 path.append(table);
503 path.append('/');
504 path.append(row);
505 path.append('/');
506 path.append(column);
507 return getValueXML(path.toString());
508 }
509
510 protected static Response deleteRow(String table, String row)
511 throws IOException {
512 StringBuilder path = new StringBuilder();
513 path.append('/');
514 path.append(table);
515 path.append('/');
516 path.append(row);
517 Response response = client.delete(path.toString());
518 Thread.yield();
519 return response;
520 }
521
522 protected static Response getValueJson(String table, String row,
523 String column) throws IOException {
524 StringBuilder path = new StringBuilder();
525 path.append('/');
526 path.append(table);
527 path.append('/');
528 path.append(row);
529 path.append('/');
530 path.append(column);
531 return getValueJson(path.toString());
532 }
533
534 protected static void checkValueJSON(String table, String row, String column,
535 String value) throws IOException, JAXBException {
536 Response response = getValueJson(table, row, column);
537 assertEquals(200, response.getCode());
538 assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
539 ObjectMapper mapper = new JacksonProvider()
540 .locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE);
541 CellSetModel cellSet = mapper.readValue(response.getBody(), CellSetModel.class);
542 RowModel rowModel = cellSet.getRows().get(0);
543 CellModel cell = rowModel.getCells().get(0);
544 assertEquals(Bytes.toString(cell.getColumn()), column);
545 assertEquals(Bytes.toString(cell.getValue()), value);
546 }
547
548 protected static void checkIncrementValueJSON(String table, String row, String column,
549 long value) throws IOException, JAXBException {
550 Response response = getValueJson(table, row, column);
551 assertEquals(200, response.getCode());
552 assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
553 ObjectMapper mapper = new JacksonJaxbJsonProvider()
554 .locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE);
555 CellSetModel cellSet = mapper.readValue(response.getBody(), CellSetModel.class);
556 RowModel rowModel = cellSet.getRows().get(0);
557 CellModel cell = rowModel.getCells().get(0);
558 assertEquals(Bytes.toString(cell.getColumn()), column);
559 assertEquals(Bytes.toLong(cell.getValue()), value);
560 }
561
562 protected static Response putValueJson(String table, String row, String column,
563 String value) throws IOException, JAXBException {
564 StringBuilder path = new StringBuilder();
565 path.append('/');
566 path.append(table);
567 path.append('/');
568 path.append(row);
569 path.append('/');
570 path.append(column);
571 return putValueJson(path.toString(), table, row, column, value);
572 }
573
574 protected static Response putValueJson(String url, String table, String row, String column,
575 String value) throws IOException, JAXBException {
576 RowModel rowModel = new RowModel(row);
577 rowModel.addCell(new CellModel(Bytes.toBytes(column),
578 Bytes.toBytes(value)));
579 CellSetModel cellSetModel = new CellSetModel();
580 cellSetModel.addRow(rowModel);
581 String jsonString = jsonMapper.writeValueAsString(cellSetModel);
582 Response response = client.put(url, Constants.MIMETYPE_JSON,
583 Bytes.toBytes(jsonString));
584 Thread.yield();
585 return response;
586 }
587
588 protected static Response appendValueXML(String table, String row, String column,
589 String value) throws IOException, JAXBException {
590 StringBuilder path = new StringBuilder();
591 path.append('/');
592 path.append(table);
593 path.append('/');
594 path.append(row);
595 path.append("?check=append");
596 return putValueXML(path.toString(), table, row, column, value);
597 }
598
599 protected static Response appendValuePB(String table, String row, String column,
600 String value) throws IOException, JAXBException {
601 StringBuilder path = new StringBuilder();
602 path.append('/');
603 path.append(table);
604 path.append('/');
605 path.append(row);
606 path.append("?check=append");
607 return putValuePB(path.toString(), table, row, column, value);
608 }
609
610 protected static Response appendValueJson(String table, String row, String column,
611 String value) throws IOException, JAXBException {
612 StringBuilder path = new StringBuilder();
613 path.append('/');
614 path.append(table);
615 path.append('/');
616 path.append(row);
617 path.append("?check=append");
618 return putValueJson(path.toString(), table, row, column, value);
619 }
620
621 protected static Response incrementValueXML(String table, String row, String column,
622 String value) throws IOException, JAXBException {
623 StringBuilder path = new StringBuilder();
624 path.append('/');
625 path.append(table);
626 path.append('/');
627 path.append(row);
628 path.append("?check=increment");
629 return putValueXML(path.toString(), table, row, column, value);
630 }
631
632 protected static Response incrementValuePB(String table, String row, String column,
633 String value) throws IOException, JAXBException {
634 StringBuilder path = new StringBuilder();
635 path.append('/');
636 path.append(table);
637 path.append('/');
638 path.append(row);
639 path.append("?check=increment");
640 return putValuePB(path.toString(), table, row, column, value);
641 }
642
643 protected static Response incrementValueJson(String table, String row, String column,
644 String value) throws IOException, JAXBException {
645 StringBuilder path = new StringBuilder();
646 path.append('/');
647 path.append(table);
648 path.append('/');
649 path.append(row);
650 path.append("?check=increment");
651 return putValueJson(path.toString(), table, row, column, value);
652 }
653 }