ArcSDEFeatureStoreTest method testFeatureWriterAutoCommit update instead insert
-------------------------------------------------------------------------------

         Key: GEOT-842
         URL: http://jira.codehaus.org/browse/GEOT-842
     Project: GeoTools
        Type: Bug

  Components: arcsde  
    Versions: 2.2-RC2    
 Environment: ArcSDE 9.1 Oracle 10g
    Reporter: Andreas Bartels
 Assigned to: Gabriel Roldán 
    Priority: Minor
     Fix For: 2.2-RC2


The method testFeatureWriterAutoCommit udate first the existing 8 features 
before it insert 2 new features
The reason is that the code call a FeatureReader with Filter.NONE as default, 
but if you make the following call the method fired a NullPointerExceptio (see 
http://jira.codehaus.org/browse/GEOT-841).

        FeatureWriter writer = ds.getFeatureWriter(typeName,Filter.ALL, 
Transaction.AUTO_COMMIT);

The following method implementation works.

  private void testFeatureWriterAutoCommit(Class geometryClass) throws 
Exception {
    //the table created here is test friendly since it can hold
    //any kind of geometries.
    this.testData.createTemptTable(true);

    String typeName = this.testData.getTemp_table();
    FeatureCollection features = 
this.testData.createTestFeatures(geometryClass, 10);

    DataStore ds = this.testData.getDataStore();
    FeatureSource fsource = ds.getFeatureSource(typeName);
    if (!(fsource instanceof FeatureStore)) {
      throw new IOException("ArcSDEDataStore has no writeable DataSource");
    }
    FeatureStore featureStore = (FeatureStore) fsource;
    final int initialCount = fsource.getCount(Query.ALL);
    featureStore.addFeatures(features);
    //was the features really inserted?
    int fcount = fsource.getCount(Query.ALL);
    assertEquals(features.size() + initialCount, fcount);

    /*String msg = "a FEATURES_ADDED event should have been called "
     + features.size() + " times";
     assertEquals(msg, features.size(), featureAddedEventCount[0]);*/
  }


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to