Package com.socrata.datasync.deltaimporter2

Examples of com.socrata.datasync.deltaimporter2.CommitMessage


   @Test
    public void testDeserializationReturnIds() throws IOException {

        String typicalBlobJson = "{\"blobId\":\"xxxx-xxxx\"}";
        BlobId id1 = mapper.readValue(typicalBlobJson, BlobId.class);
        TestCase.assertEquals("xxxx-xxxx", id1.blobId);

        String typicalJobJson = "{\"jobId\":\"yyyyyy\"}";
        JobId id2 = mapper.readValue(typicalJobJson, JobId.class);
        TestCase.assertEquals("yyyyyy", id2.jobId);

        String emptyJson = "{}";
        BlobId id3 = mapper.readValue(emptyJson, BlobId.class);
        JobId id4 = mapper.readValue(emptyJson, JobId.class);
        TestCase.assertNull(id3.blobId);
        TestCase.assertNull(id4.jobId);

        String extraStuffJson = "{\"blobId\":\"some-4by4\", \"junk\":0}";
        BlobId id5 = mapper.readValue(extraStuffJson, BlobId.class);
        TestCase.assertEquals("some-4by4", id5.blobId);
    }
View Full Code Here


    @Test
    public void testSerializationFullCommitMessage() throws IOException {
        FileTypeControl ftc = new FileTypeControl().floatingTimestampFormat(new String[]{"ISO8601"});
        ControlFile cf = new ControlFile("Replace", null, ftc, null);
        CommitMessage commit = new CommitMessage()
                .filename("hoo-ya.csv")
                .relativeTo("datasync/id/some-4by4/completed/2014/6/2/hoo-ya.csv")
                .chunks(Arrays.asList("1234", "2345"))
                .control(cf)
                .expectedSize(11001001L);
View Full Code Here

        TestCase.assertEquals(expectedJson, mapper.writeValueAsString(commit));
    }

    @Test
    public void testSerializationIncompleteCommitMessage() throws IOException {
        CommitMessage commit = new CommitMessage()
                .filename("hoo-ya.csv")
                .chunks(Arrays.asList("1234", "2345"));
        String expectedJson = "{" +
                "\"chunks\":[\"1234\",\"2345\"]," +
                "\"filename\":\"hoo-ya.csv\"," +
View Full Code Here

    DatasyncDirectory dd;

    @Before
    public void setUp() throws Exception {
        http = new HttpUtility(getUserPrefs(), false);
        dd = new DatasyncDirectory(http, "test.socrata.com", "some-4by4");
    }
View Full Code Here

        String typicalBlobJson = "{\"blobId\":\"xxxx-xxxx\"}";
        BlobId id1 = mapper.readValue(typicalBlobJson, BlobId.class);
        TestCase.assertEquals("xxxx-xxxx", id1.blobId);

        String typicalJobJson = "{\"jobId\":\"yyyyyy\"}";
        JobId id2 = mapper.readValue(typicalJobJson, JobId.class);
        TestCase.assertEquals("yyyyyy", id2.jobId);

        String emptyJson = "{}";
        BlobId id3 = mapper.readValue(emptyJson, BlobId.class);
        JobId id4 = mapper.readValue(emptyJson, JobId.class);
        TestCase.assertNull(id3.blobId);
        TestCase.assertNull(id4.jobId);

        String extraStuffJson = "{\"blobId\":\"some-4by4\", \"junk\":0}";
        BlobId id5 = mapper.readValue(extraStuffJson, BlobId.class);
View Full Code Here

TOP

Related Classes of com.socrata.datasync.deltaimporter2.CommitMessage

Copyright © 2018 www.massapicom. 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.