@Override
  protected Object defaultTypeDataFromBinary(final byte[] bytes) {
    final ByteBuffer buf = ByteBuffer.wrap(bytes);
    final int initialBytes = buf.getInt();
    // temporary hack for backward compatibility
    final boolean skipConfig = (initialBytes > 0);
    final byte[] typeNameBytes = skipConfig ? new byte[initialBytes] : new byte[buf.getInt()];
    final byte[] visibilityManagementClassNameBytes = new byte[buf.getInt()];
    final byte[] attrBytes = skipConfig ? new byte[0] : new byte[buf.getInt()];
    final byte[] encodedTypeBytes = new byte[buf.getInt()];
    final byte[] adapterIdBytes = new byte[buf.getInt()];
    buf.get(typeNameBytes);
    buf.get(visibilityManagementClassNameBytes); // ignore...old release
    buf.get(attrBytes);
    buf.get(encodedTypeBytes);
    buf.get(adapterIdBytes);
    adapterId = new ByteArrayId(adapterIdBytes);

    final String typeName = StringUtils.stringFromBinary(typeNameBytes);

    final String encodedType = StringUtils.stringFromBinary(encodedTypeBytes);
    try {
      final SimpleFeatureType myType = DataUtilities.createType(typeName, encodedType);

      featureType = myType;
      return featureType;
    } catch (final SchemaException e) {
      LOGGER.error("Unable to deserialized feature type", e);
    }

    final SimpleFeatureUserDataConfigurationSet userDataConfiguration =
        new SimpleFeatureUserDataConfigurationSet();
    userDataConfiguration.addConfigurations(typeName, new TimeDescriptorConfiguration(featureType));
    userDataConfiguration.addConfigurations(
        typeName, new SimpleFeatureStatsConfigurationCollection(featureType));
    userDataConfiguration.addConfigurations(
        typeName, new SimpleFeaturePrimaryIndexConfiguration(featureType));
    try {
      userDataConfiguration.fromJsonString(StringUtils.stringFromBinary(attrBytes), featureType);

    } catch (final IOException e) {
      LOGGER.error("Failure to decode simple feature user data configuration", e);
    }

    return null;
  }
  @Test
  public void testLocalityGroups() throws IOException {

    final PrimaryIndex index = new SpatialDimensionalityTypeProvider().createPrimaryIndex();
    final WritableDataAdapter<TestGeometry> adapter = new TestGeometryAdapter();

    final String tableName = StringUtils.stringFromBinary(index.getId().getBytes());
    final byte[] adapterId = adapter.getAdapterId().getBytes();

    accumuloOptions.setUseLocalityGroups(false);

    try (IndexWriter indexWriter =
        mockDataStore.createIndexWriter(index, DataStoreUtils.DEFAULT_VISIBILITY)) {
      final ByteArrayId rowId1 =
          indexWriter
              .write(
                  adapter,
                  new TestGeometry(factory.createPoint(new Coordinate(25, 32)), "test_pt_1"))
              .get(0);

      try {
        // as we are not using locality groups, we expect that this will
        // return false
        assertEquals(false, accumuloOperations.localityGroupExists(tableName, adapterId));
      } catch (final AccumuloException | TableNotFoundException e) {
        LOGGER.error("Locality Group check failed", e);
      }

      final TestGeometry geom1 =
          (TestGeometry)
              mockDataStore
                  .query(new QueryOptions(), new RowIdQuery(Collections.singletonList(rowId1)))
                  .next();

      // of course, the point is actually stored in this case
      assertEquals("test_pt_1", geom1.id);
    }

    accumuloOptions.setUseLocalityGroups(true);

    try (IndexWriter indexWriter =
        mockDataStore.createIndexWriter(index, DataStoreUtils.DEFAULT_VISIBILITY)) {
      final ByteArrayId rowId2 =
          indexWriter
              .write(
                  adapter,
                  new TestGeometry(factory.createPoint(new Coordinate(25, 32)), "test_pt_2"))
              .get(0);

      try {
        // now that locality groups are turned on, we expect this to
        // return
        // true
        assertEquals(true, accumuloOperations.localityGroupExists(tableName, adapterId));
      } catch (final AccumuloException | TableNotFoundException e) {
        LOGGER.error("Locality Group check failed", e);
      }
      final TestGeometry geom2 =
          (TestGeometry)
              mockDataStore
                  .query(new QueryOptions(), new RowIdQuery(Collections.singletonList(rowId2)))
                  .next();

      // of course, the point is actually stored in this case
      assertEquals("test_pt_2", geom2.id);
    }
  }