@Test public void testBuildFeatureType() { String input = CSVTestStrategySupport.buildInputString("quux,morx\n"); CSVFileState fileState = new CSVFileState(input, "foo"); CSVStrategy strategy = new CSVAttributesOnlyStrategy(fileState); SimpleFeatureType featureType = strategy.getFeatureType(); assertEquals("Invalid attribute count", 2, featureType.getAttributeCount()); assertEquals("Invalid featuretype name", "foo", featureType.getName().getLocalPart()); assertEquals("Invalid name", "foo", featureType.getTypeName()); List<AttributeDescriptor> attrs = featureType.getAttributeDescriptors(); assertEquals("Invalid number of attributes", 2, attrs.size()); List<String> attrNames = new ArrayList<>(2); for (AttributeDescriptor attr : attrs) { if (!(attr instanceof GeometryDescriptor)) { attrNames.add(attr.getName().getLocalPart()); } } Collections.sort(attrNames); assertEquals("Invalid property descriptor", "morx", attrNames.get(0)); assertEquals("Invalid property descriptor", "quux", attrNames.get(1)); }
@Override protected SimpleFeatureType buildFeatureType() { SimpleFeatureTypeBuilder builder = createBuilder(csvFileState); return builder.buildFeatureType(); }
CSVAttributesOnlyStrategy extends CSVStrategy { @Override protected SimpleFeatureType buildFeatureType() { SimpleFeatureTypeBuilder builder = createBuilder(csvFileState); return builder.buildFeatureType(); } }
CSVAttributesOnlyStrategy extends CSVStrategy { @Override protected SimpleFeatureType buildFeatureType() { SimpleFeatureTypeBuilder builder = createBuilder(csvFileState); return builder.buildFeatureType(); } CSVAttributesOnlyStrategy(CSVFileState csvFileState); }
CSVAttributesOnlyStrategy extends CSVStrategy { @Override protected SimpleFeatureType buildFeatureType() { SimpleFeatureTypeBuilder builder = createBuilder(csvFileState); return builder.buildFeatureType(); } CSVAttributesOnlyStrategy(CSVFileState csvFileState); @Override void createSchema(SimpleFeatureType featureType); @Override String[] encode(SimpleFeature feature); @Override SimpleFeature decode(String recordId, String[] csvRecord); }
CSVAttributesOnlyStrategy extends CSVStrategy { @Override protected SimpleFeatureType buildFeatureType() { SimpleFeatureTypeBuilder builder = createBuilder(csvFileState); return builder.buildFeatureType(); } CSVAttributesOnlyStrategy(CSVFileState csvFileState); @Override void createSchema(SimpleFeatureType featureType); @Override String[] encode(SimpleFeature feature); @Override SimpleFeature decode(String recordId, String[] csvRecord);  }