Package com.socrata.model

Examples of com.socrata.model.UpsertResult.errorCount()


        TestCase.assertEquals(1, errors1.getRowsCreated());
        TestCase.assertEquals(2, errors1.getRowsUpdated());
        TestCase.assertEquals(3, errors1.getRowsDeleted());

        UpsertResult errors2 = Soda2Producer.deserializeUpsertResult(new ByteArrayInputStream(UPSERT_RESULT_2.getBytes("utf-8")));
        TestCase.assertEquals(2, errors2.errorCount());
        TestCase.assertEquals(1, errors2.getErrors().get(0).getIndex());
        TestCase.assertEquals("Error1", errors2.getErrors().get(0).getError());
        TestCase.assertEquals("key1", errors2.getErrors().get(0).getPrimaryKey());
        TestCase.assertEquals(2, errors2.getErrors().get(1).getIndex());
        TestCase.assertEquals("Error2", errors2.getErrors().get(1).getError());
View Full Code Here


    @Test
    public void testParsingSodaServerUpsertResults() throws IOException
    {

        UpsertResult noErrors = Soda2Producer.deserializeUpsertResult(new ByteArrayInputStream(SODA_SERVER_UPSERT_RESULT_NO_ERRORS.getBytes("utf-8")));
        TestCase.assertEquals(0, noErrors.errorCount());
        TestCase.assertEquals(3, noErrors.getRowsCreated());
        TestCase.assertEquals(0, noErrors.getRowsUpdated());
        TestCase.assertEquals(0, noErrors.getRowsDeleted());

        UpsertResult errors1 = Soda2Producer.deserializeUpsertResult(new ByteArrayInputStream(SODA_SERVER_UPSERT_RESULT_1.getBytes("utf-8")));
View Full Code Here

        TestCase.assertEquals(3, noErrors.getRowsCreated());
        TestCase.assertEquals(0, noErrors.getRowsUpdated());
        TestCase.assertEquals(0, noErrors.getRowsDeleted());

        UpsertResult errors1 = Soda2Producer.deserializeUpsertResult(new ByteArrayInputStream(SODA_SERVER_UPSERT_RESULT_1.getBytes("utf-8")));
        TestCase.assertEquals(1, errors1.errorCount());
        TestCase.assertEquals("error3", errors1.getErrors().get(0).getError());
        TestCase.assertEquals("key3", errors1.getErrors().get(0).getPrimaryKey());
        TestCase.assertEquals(0, errors1.getRowsCreated());
        TestCase.assertEquals(2, errors1.getRowsUpdated());
        TestCase.assertEquals(0, errors1.getRowsDeleted());
View Full Code Here

        TestCase.assertEquals(0, errors1.getRowsCreated());
        TestCase.assertEquals(2, errors1.getRowsUpdated());
        TestCase.assertEquals(0, errors1.getRowsDeleted());

        UpsertResult errors2 = Soda2Producer.deserializeUpsertResult(new ByteArrayInputStream(SODA_SERVER_UPSERT_RESULT_2.getBytes("utf-8")));
        TestCase.assertEquals(2, errors2.errorCount());
        TestCase.assertEquals("error2", errors2.getErrors().get(0).getError());
        TestCase.assertEquals("key2", errors2.getErrors().get(0).getPrimaryKey());
        TestCase.assertEquals("error3", errors2.getErrors().get(1).getError());
        TestCase.assertEquals("key3", errors2.getErrors().get(1).getPrimaryKey());
        TestCase.assertEquals(0, errors2.getRowsCreated());
View Full Code Here

        }

        if (publishExceptions.length() > 0) {
            runStatus = JobStatus.PUBLISH_ERROR;
            runStatus.setMessage(publishExceptions);
        } else if (result != null && result.errorCount() > 0) {  // Check for [row-level] SODA 2 errors
            runStatus = craftSoda2PublishError(result);
        }

        String logPublishingErrorMessage = logRunResults(runStatus, result);
        emailAdmin(runStatus, logPublishingErrorMessage);
View Full Code Here

            }
            if(upsertObjectsChunk.size() == numRowsPerChunk || currLine == null) {
                UpsertResult chunkResult = producer.upsert(id, upsertObjectsChunk);
                totalRowsDeleted += chunkResult.getRowsDeleted();

                if(chunkResult.errorCount() > 0) {
                    // TODO find a better way to suppress these errors (which are really not errors anyway)
                    for(UpsertError err : chunkResult.getErrors()) {
                        if(!err.getError().contains("no record is found")) {
                            deleteErrors.add(err);
                        }
View Full Code Here

                    totalRowsCreated += chunkResult.getRowsCreated();
                    totalRowsUpdated += chunkResult.getRowsUpdated();
                    totalRowsDeleted += chunkResult.getRowsDeleted();
                    numUploadedChunks += 1;

                    if(chunkResult.errorCount() > 0) {
                        if(numRowsPerChunk != 0) {
                            for (UpsertError upsertErr : chunkResult.getErrors()) {
                                int lineIndexOffset = (containsHeaderRow) ? 2 : 1;
                                System.err.println("Error uploading chunk " + numUploadedChunks + ": " +
                                        upsertErr.getError() + " (line " +
View Full Code Here

                    }

                    if(numRowsPerChunk != 0) {
                        System.out.println("Chunk " + numUploadedChunks + " uploaded: " + chunkResult.getRowsCreated() + " rows created; " +
                                chunkResult.getRowsUpdated() + " rows updated; " + chunkResult.getRowsDeleted() +
                                " rows deleted; " + chunkResult.errorCount() + " rows omitted");
                    }

                    upsertObjectsChunk.clear();
                }
            } while(currLine != null);
View Full Code Here

        final SodaDdl ddl = createSodaDdl();

        File twoRowsFile = new File("src/test/resources/datasync_unit_test_two_rows.csv");
        UpsertResult result = Soda2Publisher.replaceNew(producer, ddl, UNITTEST_DATASET_ID, twoRowsFile, true);

        TestCase.assertEquals(0, result.errorCount());
        TestCase.assertEquals(2, result.getRowsCreated());
        TestCase.assertEquals(2, getTotalRows(UNITTEST_DATASET_ID));
    }

    @Test
View Full Code Here

        final SodaDdl ddl = createSodaDdl();

        File twoRowsFile = new File("src/test/resources/datasync_unit_test_three_rows_no_header.csv");
        UpsertResult result = Soda2Publisher.replaceNew(producer, ddl, UNITTEST_DATASET_ID, twoRowsFile, false);

        TestCase.assertEquals(0, result.errorCount());
        TestCase.assertEquals(3, result.getRowsCreated());
        TestCase.assertEquals(3, getTotalRows(UNITTEST_DATASET_ID));
    }

    @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.