Examples of CSVFileState


Examples of org.geoserver.importer.csv.CSVFileState

public class CSVLatLonStrategyTest {

    @Test
    public void testBuildFeatureType() {
        String input = CSVTestStrategySupport.buildInputString("lat,lon,quux,morx\n");
        CSVFileState fileState = new CSVFileState(input, "foo");
        CSVLatLonStrategy strategy = new CSVLatLonStrategy(fileState);
        SimpleFeatureType featureType = strategy.getFeatureType();

        assertEquals("Invalid attribute count", 3, featureType.getAttributeCount());
        assertEquals("Invalid featuretype name", "foo", featureType.getName().getLocalPart());
View Full Code Here

Examples of org.geoserver.importer.csv.CSVFileState

    @Test
    public void testBuildFeature() throws IOException {
        String input = CSVTestStrategySupport.buildInputString("lat,lon,fleem,zoo", "3,4,car,cdr",
                "8,9,blub,frob");
        CSVFileState fileState = new CSVFileState(input, "bar");
        CSVLatLonStrategy strategy = new CSVLatLonStrategy(fileState);

        CSVIterator iterator = strategy.iterator();

        assertTrue("next value not read", iterator.hasNext());
View Full Code Here

Examples of org.geoserver.importer.csv.CSVFileState

    @Test
    public void testBuildFeatureDifferentTypes() throws IOException {
        String input = CSVTestStrategySupport.buildInputString(
                "doubleval,intval,lat,stringval,lon", "3.8,7,73.28,foo,-14.39",
                "9.12,-38,0,bar,29", "-37,0,49,baz,0");
        CSVFileState fileState = new CSVFileState(input, "typename");
        CSVLatLonStrategy strategy = new CSVLatLonStrategy(fileState);
        CSVIterator iterator = strategy.iterator();

        SimpleFeatureType featureType = strategy.getFeatureType();
        assertEquals("invalid attribute count", 4, featureType.getAttributeCount());
View Full Code Here

Examples of org.geoserver.importer.csv.CSVFileState

    }

    @Test
    public void testNoGeometry() throws IOException {
        String input = CSVTestStrategySupport.buildInputString("a,b", "foo,bar");
        CSVFileState fileState = new CSVFileState(input, "typename");
        CSVLatLonStrategy strategy = new CSVLatLonStrategy(fileState);
        SimpleFeatureType featureType = strategy.getFeatureType();

        assertEquals("Invalid number of attributes", 2, featureType.getAttributeCount());
        assertNull("Expected no geometry in feature type", featureType.getGeometryDescriptor());
View Full Code Here

Examples of org.geoserver.importer.csv.CSVFileState

    }

    @Test
    public void testOnlyLat() throws IOException {
        String input = CSVTestStrategySupport.buildInputString("lat,quux", "foo,morx");
        CSVFileState fileState = new CSVFileState(input, "typename");
        CSVLatLonStrategy strategy = new CSVLatLonStrategy(fileState);
        SimpleFeatureType featureType = strategy.getFeatureType();
        assertEquals("Invalid number of attributes", 2, featureType.getAttributeCount());
        assertNull("Unexpected geometry", featureType.getGeometryDescriptor());
        assertEquals("Invalid attribute type", "java.lang.String",
View Full Code Here

Examples of org.geoserver.importer.csv.CSVFileState

    @Test
    public void testDataDoesNotContainAllFields() throws IOException {
        String input = CSVTestStrategySupport.buildInputString("lat,lon,foo,bar",
                "-72.3829,42.29,quux");
        CSVFileState fileState = new CSVFileState(input, "typename");
        CSVLatLonStrategy strategy = new CSVLatLonStrategy(fileState);
        SimpleFeatureType featureType = strategy.getFeatureType();
        assertEquals("Invalid attribute count", 3, featureType.getAttributeCount());
        CSVIterator iterator = strategy.iterator();
        SimpleFeature feature = iterator.next();
View Full Code Here

Examples of org.geoserver.importer.csv.CSVFileState

    @Test
    public void testDataContainsMoreFields() throws IOException {
        String input = CSVTestStrategySupport.buildInputString("lat,lon,foo",
                "-72.3829,42.29,quux,morx");
        CSVFileState fileState = new CSVFileState(input, "typename");
        CSVLatLonStrategy strategy = new CSVLatLonStrategy(fileState);
        SimpleFeatureType featureType = strategy.getFeatureType();
        assertEquals("Invalid attribute count", 2, featureType.getAttributeCount());
        CSVIterator iterator = strategy.iterator();
        SimpleFeature feature = iterator.next();
View Full Code Here

Examples of org.geoserver.importer.csv.CSVFileState

    @Test
    public void testDataDifferentTypes() throws IOException {
        String input = CSVTestStrategySupport.buildInputString("lat,lon,foo", "-72.3829,42.29,38",
                "12,-13.21,9", "foo,2.5,7.8");
        CSVFileState fileState = new CSVFileState(input, "typename");
        CSVLatLonStrategy strategy = new CSVLatLonStrategy(fileState);
        SimpleFeatureType featureType = strategy.getFeatureType();
        assertEquals("Invalid attribute count", 3, featureType.getAttributeCount());
        assertEquals("Invalid attribute type", "java.lang.String",
                getBindingName(featureType, "lat"));
View Full Code Here

Examples of org.geoserver.importer.csv.CSVFileState

    }

    @Test
    public void testDataFewerRowsDifferentType() throws IOException {
        String input = CSVTestStrategySupport.buildInputString("a,b", "foo");
        CSVFileState fileState = new CSVFileState(input, "typename");
        CSVLatLonStrategy strategy = new CSVLatLonStrategy(fileState);
        SimpleFeatureType featureType = strategy.getFeatureType();
        assertEquals("Invalid attribute count", 2, featureType.getAttributeCount());
        assertEquals("Invalid attribute type", "java.lang.String", getBindingName(featureType, "a"));
        assertEquals("Invalid attribute type", "java.lang.Integer",
View Full Code Here

Examples of org.geoserver.importer.csv.CSVFileState

    @Test
    public void testLngColumnSpelling() throws IOException {
        String input = CSVTestStrategySupport.buildInputString("lat,lng,fleem",
                "73.239,-42.389,morx");
        CSVFileState fileState = new CSVFileState(input, "typename");
        CSVLatLonStrategy strategy = new CSVLatLonStrategy(fileState);
        SimpleFeatureType featureType = strategy.getFeatureType();
        assertNotNull("No geometry found", featureType.getGeometryDescriptor());
        assertEquals("Invalid attribute count", 2, featureType.getAttributeCount());
        CSVIterator iterator = strategy.iterator();
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.