GeoTools
  1. GeoTools
  2. GEOT-842

ArcSDEFeatureStoreTest method testFeatureWriterAutoCommit update instead insert

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2-RC2
    • Fix Version/s: 2.5-M1
    • Component/s: arcsde plugin
    • Labels:
      None
    • Environment:
      ArcSDE 9.1 Oracle 10g

      Description

      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]);*/
      }

        Issue Links

          Activity

          Hide
          Gabriel Roldan added a comment -
          reopening, commented on the wrong issue
          Show
          Gabriel Roldan added a comment - reopening, commented on the wrong issue
          Hide
          Gabriel Roldan added a comment -
          fixed. getFeatureWriterAutoCommit is the same than doing getFeatureWriter(typeName, Filter.EXCLUDE, transaction) now
          Show
          Gabriel Roldan added a comment - fixed. getFeatureWriterAutoCommit is the same than doing getFeatureWriter(typeName, Filter.EXCLUDE, transaction) now

            People

            • Assignee:
              Gabriel Roldan
              Reporter:
              Andreas Bartels
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: