Package com.socrata.datasync.config.controlfile

Examples of com.socrata.datasync.config.controlfile.ControlFile


                    columns = new String[]{DatasetUtils.getRowIdentifierName(datasetInfo)};
                else
                    columns = DatasetUtils.getFieldNamesArray(datasetInfo);
            }

            ControlFile control = ControlFile.generateControlFile(fileToPublish, publishMethod, columns, useGeocoding);
            ObjectMapper mapper = new ObjectMapper().configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
            return mapper.writeValueAsString(control);
        }
View Full Code Here


    @Test
    public void testReadHeadersFromFile() throws IOException {
        File testFile1 = new File("src/test/resources/datasync_unit_test_three_rows.csv");
        ObjectMapper mapper = new ObjectMapper().enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
        File controlFile = new File("src/test/resources/datasync_complex_control.json");
        ControlFile cf = mapper.readValue(controlFile, ControlFile.class);

        String[] expectedHeaders1 = new String[] {"ID", "Name", "Another Name", "Date"};
        String[] actualHeaders1 = Utils.pullHeadersFromFile(testFile1, cf.csv, 0);
        for(int i=0; i<Math.max(expectedHeaders1.length, actualHeaders1.length); i++)
            TestCase.assertEquals(expectedHeaders1[i], actualHeaders1[i]);
View Full Code Here

        try {
            schema = DatasetUtils.getDatasetInfo(connectionInfo.getUrl(), job.getDatasetID());

            if(job.getPublishViaDi2Http() || job.getPublishViaFTP()) {

                ControlFile control = job.getControlFile();
                FileTypeControl fileControl = null;
                switch (fileExtension) {
                    case "csv": fileControl = control.csv; break;
                    case "tsv": fileControl = control.tsv; break;
                }
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)
View Full Code Here

TOP

Related Classes of com.socrata.datasync.config.controlfile.ControlFile

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.