Package org.geotools.data.efeature

Examples of org.geotools.data.efeature.EFeatureDataStore


        Map<String,Serializable> params = eParams.createParams(null, null);
        assertFalse("Invalid parameters can be processed",eStoreFactory.canProcess(params));
        params = eParams.createParams(eResourceURI.toString(), null);
        assertTrue("Valid parameters can not be processed",eStoreFactory.canProcess(params));
        try {
            EFeatureDataStore eStore = eStoreFactory.createDataStore(params);
            String[] typeNames = eStore.getTypeNames();
            for(String it : typeNames) {
                assertTrue("EFeatureDataStore does not contain type ["+it+"]",TYPE_NAMES.contains(it));               
                Name name = new NameImpl(it);
                SimpleFeatureType eTypeI = eStore.eStructure().eGetFeatureInfo(it).getFeatureType();
                SimpleFeatureType eTypeN = eStore.getSchema(name);
                assertTrue("SimpleFeatureTypes are not same instance (Name)",eTypeI==eTypeN);
                SimpleFeatureType eTypeL = eStore.getSchema(it);
                assertTrue("SimpleFeatureTypes are not same instance (Local)",eTypeI==eTypeL);
            }
            eStore.dispose();
        } catch (Exception e) {
            fail(e);
        }
    }
View Full Code Here


    //  Tests
    // -----------------------------------------------------

    @org.junit.Test
    public void testFeatureWriter() {
        EFeatureDataStore eStore;
        Map<String,Serializable> params;
        try {
            //
            // Get a EFeatureDataStore instance
            //
            params = eParams.createParams(eResourceURI.toString(), null);
            eStore = eStoreFactory.createDataStore(params);
            //
            // Looping over all EFeature types
            //           
            for(Object[] it : eTypeData) {
                //
                // Reset difference time stamp
                //
                dTime();
//                //
//                // Collect type information
//                //
//                int count = 0;
//                String eType = it[0].toString();
//                //
//                // Get writer for given type
//                //
//                FeatureWriter<SimpleFeatureType, SimpleFeature> eWriter = eStore.getEFeatureWriterUpdate(eType, filter, null);
//                //
//                // Update all items
//                //
//                while(eWriter.hasNext()) {
//                    //
//                    // Get next SimpleFeature and EFeature
//                    //
//                    SimpleFeature feature = eWriter.next();
//                    //
//                    // Modify all attributes
//                    //
//                    List<Object> eNewValues = modify(feature.getAttributes());
//                    feature.setAttributes(eNewValues);
//                }
//                //
//                // Notify progress
//                //
//                trace("Count["+eType+"]: " + count, TIME_DELTA);
                
            }
            //
            // Finished
            //
            eStore.dispose();
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
            fail(e);
        }
    }
View Full Code Here

    //  Tests
    // -----------------------------------------------------

    @org.junit.Test
    public void testFeatureReader() {
        EFeatureDataStore eStore;
        Map<String,Serializable> params;
        try {
            params = eParams.createParams(eResourceURI.toString(), null);
            eStore = eStoreFactory.createDataStore(params);
            dTime();
            for(Object[] it : eTypeData) {
                //
                // Assert structure
                //
                String eType = it[0].toString();               
                Class<?> cls = (Class<?>)it[1];
                int count = 0;
                int icount = Integer.valueOf(it[2].toString());
                EFeatureReader eReader = eStore.getFeatureReader(eType);
                while(eReader.hasNext()) {
                    SimpleFeature feature = eReader.next();
                    assertTrue("Feature[" + count + "]: does not implement ESimpleFeature",feature instanceof ESimpleFeature);
                    EObject eObject = ((ESimpleFeature)feature).eObject();
                    assertNotNull("Feature[" + count + "]: is not contained by an EObject",eObject);                   
                    assertTrue("EObject[" + count + "]: returned by ESimpleFeature is not an " + eType + " instance",cls.isInstance(eObject));
                    EFeature eFeature = ((ESimpleFeature)feature).eFeature();
                    assertNotNull("Feature[" + count + "]: is not contained by an EFeature",eFeature);
                    //assertTrue("EFeature data and Feature are not identical",feature==eFeature.getData());
                    Object n = feature.getAttribute("attribute");
                    assertNotNull("Attribute[" + count + "]: data is null",n);
                    Object g = feature.getAttribute("geometry");
                    assertNotNull("Geometry[" + count + "]: data is null",g);
                    count++;
                }
                assertEquals("Feature count mismatch",icount,count);
                trace("Count["+eType+"]: " + count,TIME_DELTA);
                //
                // Assert validation optimization
                //
                //eReader.reset();
                //while(eReader.hasNext());
                
            }
            eStore.dispose();
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
            fail(e);
        }
    }
View Full Code Here

        try {
            //
            // Prepare common objects
            //
            Map<String,Serializable> params = eParams.createParams(eResourceURI.toString(), null);
            EFeatureDataStore eStore = eStoreFactory.createDataStore(params);

            EAttribute eAttribute = EFeaturePackage.eINSTANCE.getEFeature_ID();
            EObjectCondition eCondition = newIsEqual(eAttribute, "F1");
            WHERE where = new WHERE(eCondition);
            eAttribute = EFeatureTestsPackage.eINSTANCE.getEFeatureData_Attribute();
View Full Code Here

TOP

Related Classes of org.geotools.data.efeature.EFeatureDataStore

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.