Package com.socrata.builders

Examples of com.socrata.builders.ExternalDatasetBuilder


        final String name = "Name" + UUID.randomUUID();
        final String description = "Description" + name;


        final ExternalDataset    dataset1 = new ExternalDatasetBuilder()
                .setMetadata(new Metadata())
                .addAccessPoint("html", "http://www.google.com")
                .setName(name)
                .setDescription(description)
                .build();

        final ExternalDataset fileDataset = (ExternalDataset) importer.createDataset(dataset1);

        try {
            TestCase.assertNotNull(fileDataset);
            TestCase.assertEquals(name, fileDataset.getName());
            TestCase.assertEquals(description, fileDataset.getDescription());
            TestCase.assertEquals("http://www.google.com", fileDataset.getMetadata().getAccessPoints().get("html"));
            TestCase.assertEquals("unpublished", fileDataset.getPublicationStage());

            importer.publish(fileDataset.getId());
            importer.makePublic(fileDataset.getId());

            final ExternalDataset fileDatasetLoaded = (ExternalDataset) importer.loadDatasetInfo(fileDataset.getId());
            TestCase.assertNotNull(fileDatasetLoaded);
            TestCase.assertEquals(name, fileDatasetLoaded.getName());
            TestCase.assertEquals(description, fileDatasetLoaded.getDescription());
            TestCase.assertEquals("http://www.google.com", fileDatasetLoaded.getMetadata().getAccessPoints().get("html"));
            TestCase.assertEquals("published", fileDatasetLoaded.getPublicationStage());

            final ExternalDatasetBuilder externalDatasetBuilder = new ExternalDatasetBuilder(fileDatasetLoaded)
                    .addTag("TestFile")
                    .setLicenseId("CC_30_BY_NC")
                    .setLicense(new License("Creative Commons Attribution-Noncommercial 3.0 Unported", "images/licenses/cc30bync.png", "http://creativecommons.org/licenses/by-nc/3.0/legalcode"))
                    .setAttribution("Socrata Test")
                    .setAttributionLink("https://www.socrata.com");

            final ExternalDataset fileDatasetLoaded2 = (ExternalDataset) importer.updateDatasetInfo(externalDatasetBuilder.build());
            TestCase.assertEquals("CC_30_BY_NC", fileDatasetLoaded2.getLicenseId());
            TestCase.assertEquals("Socrata Test", fileDatasetLoaded2.getAttribution());
            TestCase.assertEquals("https://www.socrata.com", fileDatasetLoaded2.getAttributionLink());
            TestCase.assertEquals(name, fileDatasetLoaded2.getName());
            TestCase.assertEquals(description, fileDatasetLoaded2.getDescription());
View Full Code Here

TOP

Related Classes of com.socrata.builders.ExternalDatasetBuilder

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.