Package org.locationtech.udig.document.source

Examples of org.locationtech.udig.document.source.ShpDocPropertyParser


        setHotlinkPropsEnablements(resource, monitor);
    }
   
    private void setShpPropertyParser(IGeoResource resource) {
        if (resource.canResolve(ShpGeoResourceImpl.class)) {
            propParser = new ShpDocPropertyParser(resource.getIdentifier());
        }
    }
View Full Code Here


public class ShpDocPropertyParserTest extends AbstractShpDocTest {
   
    @Test
    public void testHasProperties() throws MalformedURLException {
       
        ShpDocPropertyParser parser = new ShpDocPropertyParser(url);
        assertTrue("Property file does not exist.", parser.hasProperties());
       
        final URL url = new File(new File(DIRECTORY), "dummy.shp").toURI().toURL();
        parser = new ShpDocPropertyParser(url);
        assertFalse("Property file exist.", parser.hasProperties());
       
    }
View Full Code Here

    }
   
    @Test
    public void testSetGetShapeDocInfos() {
       
        final ShpDocPropertyParser parser = new ShpDocPropertyParser(url);

        List<DocumentInfo> inInfos = new ArrayList<DocumentInfo>();
        parser.setShapeDocmentInfos(inInfos);

        List<DocumentInfo> outInfos = parser.getShapeDocumentInfos();
        assertNull("Info list is not null.", outInfos);

        inInfos.add(fileDocInfo1);
        inInfos.add(webDocInfo1);
        parser.setShapeDocmentInfos(inInfos);

        outInfos = parser.getShapeDocumentInfos();
        assertNotNull("Info list is null.", outInfos);
        assertEquals("Info count is not expected.", 2, outInfos.size());

        inInfos.remove(fileDocInfo1);
        parser.setShapeDocmentInfos(inInfos);

        outInfos = parser.getShapeDocumentInfos();
        assertNotNull("Info list is null.", outInfos);
        assertEquals("Info count is not expected.", 1, outInfos.size());

        inInfos.add(fileDocInfo1);
        inInfos.add(fileDocInfo2);
        inInfos.add(webDocInfo2);
        parser.setShapeDocmentInfos(inInfos);

        outInfos = parser.getShapeDocumentInfos();
        assertNotNull("Info list is null.", outInfos);
        assertEquals("Info count is not expected.", 4, outInfos.size());
       
        inInfos.clear();
        parser.setShapeDocmentInfos(inInfos);

        outInfos = parser.getShapeDocumentInfos();
        assertNull("Info list is not null.", outInfos);
       
    }
View Full Code Here

        SimpleFeatureTypeBuilder fb = new SimpleFeatureTypeBuilder();
        fb.setName("feature");
        SimpleFeature feature1 = SimpleFeatureBuilder.build(fb.buildFeatureType(),
                Collections.EMPTY_LIST, "feature.1");
       
        final ShpDocPropertyParser parser = new ShpDocPropertyParser(url);
       
        List<DocumentInfo> inInfos = new ArrayList<DocumentInfo>();
        parser.setFeatureDocumentInfos(feature1, inInfos);

        List<DocumentInfo> outInfos = parser.getFeatureDocumentInfos(feature1);
        assertNull("Info list is not null.", outInfos);

        inInfos.add(fileDocInfo1);
        inInfos.add(webDocInfo1);
        parser.setFeatureDocumentInfos(feature1, inInfos);

        outInfos = parser.getFeatureDocumentInfos(feature1);
        assertNotNull("Info list is null.", outInfos);
        assertEquals("Info count is not expected.", 2, outInfos.size());

        inInfos.remove(fileDocInfo1);
        parser.setFeatureDocumentInfos(feature1, inInfos);

        outInfos = parser.getFeatureDocumentInfos(feature1);
        assertNotNull("Info list is null.", outInfos);
        assertEquals("Info count is not expected.", 1, outInfos.size());
       
    }
View Full Code Here

    }
   
    @Test
    public void testSetGetFeatureHotlinkDescriptors() {
       
        final ShpDocPropertyParser parser = new ShpDocPropertyParser(url);
       
        List<HotlinkDescriptor> inInfos = new ArrayList<HotlinkDescriptor>();
        parser.setHotlinkDescriptors(inInfos);

        List<HotlinkDescriptor> outInfos = parser.getHotlinkDescriptors();
        assertNull("Info list is not null.", outInfos);

        inInfos.add(descriptor1);
        inInfos.add(descriptor2);
        parser.setHotlinkDescriptors(inInfos);

        outInfos = parser.getHotlinkDescriptors();
        assertNotNull("Info list is null.", outInfos);
        assertEquals("Info count is not expected.", 2, outInfos.size());
       
        inInfos.add(descriptor3);
        parser.setHotlinkDescriptors(inInfos);

        outInfos = parser.getHotlinkDescriptors();
        assertNotNull("Info list is null.", outInfos);
        assertEquals("Info count is not expected.", 3, outInfos.size());
       
    }
View Full Code Here

        geoResource = new ShpGeoResourceImpl(service, "");
        final Filter filter = CommonFactoryFinder.getFilterFactory2()
                .id(new FeatureIdImpl(FEATURE));
        feature = getFeature(geoResource, filter);
       
        final ShpDocPropertyParser parser = new ShpDocPropertyParser(url);
        parser.setFeatureDocumentInfos(feature, new ArrayList<DocumentInfo>());
        parser.writeProperties();
       
        attachDir = parser.getFeatureAttachDir(FEATURE);
        attachSource = new ShpAttachmentSource(geoResource);
       
        cleaupAttachDir();
       
    }
View Full Code Here

    protected void setUpInternal() {
        super.setUpInternal();
       
        monitor = new NullProgressMonitor();
       
        parser = new ShpDocPropertyParser(url);
        attachDir = parser.getShapefileAttachDir();
       
        final Map<String, Serializable> params = new HashMap<String, Serializable>();
        params.put(ShapefileDataStoreFactory.CREATE_SPATIAL_INDEX.key, false);
        params.put(ShapefileDataStoreFactory.DBFCHARSET.key, "P_DEFAULT_CHARSET");
View Full Code Here

TOP

Related Classes of org.locationtech.udig.document.source.ShpDocPropertyParser

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.