ErrorProto toPb() { ErrorProto errorPb = new ErrorProto(); if (reason != null) { errorPb.setReason(reason); } if (location != null) { errorPb.setLocation(location); } if (message != null) { errorPb.setMessage(message); } if (debugInfo != null) { errorPb.setDebugInfo(debugInfo); } return errorPb; }
ErrorProto toPb() { ErrorProto errorPb = new ErrorProto(); if (reason != null) { errorPb.setReason(reason); } if (location != null) { errorPb.setLocation(location); } if (message != null) { errorPb.setMessage(message); } if (debugInfo != null) { errorPb.setDebugInfo(debugInfo); } return errorPb; }
ErrorProto toPb() { ErrorProto errorPb = new ErrorProto(); if (reason != null) { errorPb.setReason(reason); } if (location != null) { errorPb.setLocation(location); } if (message != null) { errorPb.setMessage(message); } if (debugInfo != null) { errorPb.setDebugInfo(debugInfo); } return errorPb; }
ErrorProto toPb() { ErrorProto errorPb = new ErrorProto(); if (reason != null) { errorPb.setReason(reason); } if (location != null) { errorPb.setLocation(location); } if (message != null) { errorPb.setMessage(message); } if (debugInfo != null) { errorPb.setDebugInfo(debugInfo); } return errorPb; }
private TableDataInsertAllResponse.InsertErrors generateErrorAmongMany( int numErrors, String baseReason, String exceptionalReason) { // The retry policies are expected to search through the entire list of ErrorProtos to determine // whether to retry. Stick the exceptionalReason in a random position to exercise this. List<ErrorProto> errorProtos = Lists.newArrayListWithExpectedSize(numErrors); int exceptionalPosition = ThreadLocalRandom.current().nextInt(numErrors); for (int i = 0; i < numErrors; ++i) { ErrorProto error = new ErrorProto(); error.setReason((i == exceptionalPosition) ? exceptionalReason : baseReason); errorProtos.add(error); } TableDataInsertAllResponse.InsertErrors errors = new TableDataInsertAllResponse.InsertErrors(); errors.setErrors(errorProtos); return errors; } }
new InsertErrors() .setIndex(0L) .setErrors(ImmutableList.of(new ErrorProto().setReason("timeout"))), new InsertErrors() .setIndex(1L) .setErrors(ImmutableList.of(new ErrorProto().setReason("invalid"))))); new InsertErrors() .setIndex(0L) .setErrors(ImmutableList.of(new ErrorProto().setReason("timeout")))));
.setErrors(ImmutableList.of(new ErrorProto().setReason("timeout")));
@Test public void testDecodeEncodeEqual() throws Exception { BigQueryInsertError value = new BigQueryInsertError( new TableRow().setF(Collections.singletonList(new TableCell().setV("Value"))), new TableDataInsertAllResponse.InsertErrors() .setIndex(0L) .setErrors( Collections.singletonList( new ErrorProto() .setReason("a Reason") .setLocation("A location") .setMessage("A message") .setDebugInfo("The debug info"))), new TableReference() .setProjectId("dummy-project-id") .setDatasetId("dummy-dataset-id") .setTableId("dummy-table-id")); CoderProperties.coderDecodeEncodeEqual(TEST_CODER, value); } }