You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by cs...@apache.org on 2022/12/14 22:27:03 UTC

[accumulo] branch main updated: Clean up deprecated Constraint API (#3116)

This is an automated email from the ASF dual-hosted git repository.

cshannon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 9b7688efec Clean up deprecated Constraint API (#3116)
9b7688efec is described below

commit 9b7688efecf0587d8c90d2465ec8b9b1bbf806cc
Author: Christopher L. Shannon <ch...@gmail.com>
AuthorDate: Wed Dec 14 17:26:58 2022 -0500

    Clean up deprecated Constraint API (#3116)
    
    Issue #3115
---
 .../accumulo/core/constraints/Constraint.java      |  98 ---------------
 .../core/constraints/DefaultKeySizeConstraint.java |  80 -------------
 .../core/constraints/NoDeleteConstraint.java       |  60 ----------
 .../core/constraints/VisibilityConstraint.java     | 107 -----------------
 .../constraints/DefaultKeySizeConstraintTest.java  |  74 ------------
 .../DeprecatedConstraintExtendTest.java            | 133 ---------------------
 .../core/constraints/NoDeleteConstraintTest.java   |  50 --------
 .../core/constraints/VisibilityConstraintTest.java | 101 ----------------
 .../server/metadata/RootTabletMutatorImpl.java     |  11 +-
 .../accumulo/tserver/TservConstraintEnv.java       |  10 +-
 10 files changed, 4 insertions(+), 720 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/constraints/Constraint.java b/core/src/main/java/org/apache/accumulo/core/constraints/Constraint.java
deleted file mode 100644
index 110645214b..0000000000
--- a/core/src/main/java/org/apache/accumulo/core/constraints/Constraint.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.accumulo.core.constraints;
-
-import java.util.List;
-
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.dataImpl.KeyExtent;
-import org.apache.accumulo.core.security.AuthorizationContainer;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-/**
- * This class is replaced by {@link org.apache.accumulo.core.data.constraints.Constraint}
- *
- * @deprecated since 2.1.0 Use {@link org.apache.accumulo.core.data.constraints.Constraint}
- */
-@Deprecated(since = "2.1.0")
-@SuppressFBWarnings(value = "NM_SAME_SIMPLE_NAME_AS_INTERFACE",
-    justification = "Same name used for compatibility during deprecation cycle")
-public interface Constraint extends org.apache.accumulo.core.data.constraints.Constraint {
-
-  /**
-   * The environment within which a constraint exists.
-   */
-  interface Environment extends org.apache.accumulo.core.data.constraints.Constraint.Environment {
-    /**
-     * Gets the key extent of the environment.
-     *
-     * @return key extent
-     */
-    KeyExtent getExtent();
-
-    /**
-     * Gets the user within the environment.
-     *
-     * @return user
-     */
-    @Override
-    String getUser();
-
-    /**
-     * Gets the authorizations in the environment.
-     *
-     * @return authorizations
-     */
-    @Override
-    AuthorizationContainer getAuthorizationsContainer();
-  }
-
-  /**
-   * Gets a short, one-sentence description of what a given violation code means.
-   *
-   * @param violationCode numeric violation code
-   * @return matching violation description
-   */
-  @Override
-  String getViolationDescription(short violationCode);
-
-  /**
-   * Checks a mutation for constraint violations. If the mutation contains no violations, returns
-   * null. Otherwise, returns a list of violation codes.
-   *
-   * Violation codes must be non-negative. Negative violation codes are reserved for system use.
-   *
-   * @param env constraint environment
-   * @param mutation mutation to check
-   * @return list of violation codes, or null if none
-   */
-  List<Short> check(Environment env, Mutation mutation);
-
-  /**
-   * Implemented for backwards compatibility.
-   *
-   * @since 2.1.0
-   */
-  @Override
-  default List<Short> check(org.apache.accumulo.core.data.constraints.Constraint.Environment env,
-      Mutation mutation) {
-    return check((Environment) env, mutation);
-  }
-}
diff --git a/core/src/main/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraint.java b/core/src/main/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraint.java
deleted file mode 100644
index 0c09b4678f..0000000000
--- a/core/src/main/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraint.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.accumulo.core.constraints;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.accumulo.core.data.ColumnUpdate;
-import org.apache.accumulo.core.data.Mutation;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-/**
- * A constraints that limits the size of keys to 1mb.
- *
- * @deprecated since 2.1.0 Use
- *             {@link org.apache.accumulo.core.data.constraints.DefaultKeySizeConstraint}
- */
-@Deprecated(since = "2.1.0")
-@SuppressFBWarnings(value = "NM_SAME_SIMPLE_NAME_AS_SUPERCLASS",
-    justification = "Same name used for compatibility during deprecation cycle")
-public class DefaultKeySizeConstraint extends
-    org.apache.accumulo.core.data.constraints.DefaultKeySizeConstraint implements Constraint {
-
-  protected static final short MAX__KEY_SIZE_EXCEEDED_VIOLATION = 1;
-  protected static final long maxSize = 1048576; // 1MB default size
-
-  @Override
-  public String getViolationDescription(short violationCode) {
-
-    switch (violationCode) {
-      case MAX__KEY_SIZE_EXCEEDED_VIOLATION:
-        return "Key was larger than 1MB";
-    }
-
-    return null;
-  }
-
-  static final List<Short> NO_VIOLATIONS = new ArrayList<>();
-
-  @Override
-  public List<Short> check(Constraint.Environment env, Mutation mutation) {
-
-    // fast size check
-    if (mutation.numBytes() < maxSize) {
-      return NO_VIOLATIONS;
-    }
-
-    List<Short> violations = new ArrayList<>();
-
-    for (ColumnUpdate cu : mutation.getUpdates()) {
-      int size = mutation.getRow().length;
-      size += cu.getColumnFamily().length;
-      size += cu.getColumnQualifier().length;
-      size += cu.getColumnVisibility().length;
-
-      if (size > maxSize) {
-        violations.add(MAX__KEY_SIZE_EXCEEDED_VIOLATION);
-      }
-    }
-
-    return violations;
-  }
-}
diff --git a/core/src/main/java/org/apache/accumulo/core/constraints/NoDeleteConstraint.java b/core/src/main/java/org/apache/accumulo/core/constraints/NoDeleteConstraint.java
deleted file mode 100644
index f0f5db5153..0000000000
--- a/core/src/main/java/org/apache/accumulo/core/constraints/NoDeleteConstraint.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.accumulo.core.constraints;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.accumulo.core.data.ColumnUpdate;
-import org.apache.accumulo.core.data.Mutation;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-/**
- * This constraint ensures mutations do not have deletes.
- *
- * @since 2.0.0
- * @deprecated since 2.1.0 Use {@link org.apache.accumulo.core.data.constraints.NoDeleteConstraint}
- */
-@Deprecated(since = "2.1.0")
-@SuppressFBWarnings(value = "NM_SAME_SIMPLE_NAME_AS_SUPERCLASS",
-    justification = "Same name used for compatibility during deprecation cycle")
-public class NoDeleteConstraint extends org.apache.accumulo.core.data.constraints.NoDeleteConstraint
-    implements Constraint {
-
-  @Override
-  public String getViolationDescription(short violationCode) {
-    if (violationCode == 1) {
-      return "Deletes are not allowed";
-    }
-    return null;
-  }
-
-  @Override
-  public List<Short> check(Constraint.Environment env, Mutation mutation) {
-    List<ColumnUpdate> updates = mutation.getUpdates();
-    for (ColumnUpdate update : updates) {
-      if (update.isDeleted()) {
-        return Collections.singletonList((short) 1);
-      }
-    }
-    return null;
-  }
-
-}
diff --git a/core/src/main/java/org/apache/accumulo/core/constraints/VisibilityConstraint.java b/core/src/main/java/org/apache/accumulo/core/constraints/VisibilityConstraint.java
deleted file mode 100644
index 2233dffb2b..0000000000
--- a/core/src/main/java/org/apache/accumulo/core/constraints/VisibilityConstraint.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.accumulo.core.constraints;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-
-import org.apache.accumulo.core.data.ColumnUpdate;
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.security.ColumnVisibility;
-import org.apache.accumulo.core.security.VisibilityEvaluator;
-import org.apache.accumulo.core.security.VisibilityParseException;
-import org.apache.accumulo.core.util.BadArgumentException;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-/**
- * A constraint that checks the visibility of columns against the actor's authorizations. Violation
- * codes:
- * <ul>
- * <li>1 = failure to parse visibility expression</li>
- * <li>2 = insufficient authorization</li>
- * </ul>
- *
- * @deprecated since 2.1.0 Use
- *             {@link org.apache.accumulo.core.data.constraints.VisibilityConstraint}
- */
-@Deprecated(since = "2.1.0")
-@SuppressFBWarnings(value = "NM_SAME_SIMPLE_NAME_AS_SUPERCLASS",
-    justification = "Same name used for compatibility during deprecation cycle")
-public class VisibilityConstraint
-    extends org.apache.accumulo.core.data.constraints.VisibilityConstraint implements Constraint {
-
-  @Override
-  public String getViolationDescription(short violationCode) {
-    switch (violationCode) {
-      case 1:
-        return "Malformed column visibility";
-      case 2:
-        return "User does not have authorization on column visibility";
-    }
-
-    return null;
-  }
-
-  @Override
-  public List<Short> check(Constraint.Environment env, Mutation mutation) {
-    List<ColumnUpdate> updates = mutation.getUpdates();
-
-    HashSet<String> ok = null;
-    if (updates.size() > 1) {
-      ok = new HashSet<>();
-    }
-
-    VisibilityEvaluator ve = null;
-
-    for (ColumnUpdate update : updates) {
-
-      byte[] cv = update.getColumnVisibility();
-      if (cv.length > 0) {
-        String key = null;
-        if (ok != null && ok.contains(key = new String(cv, UTF_8))) {
-          continue;
-        }
-
-        try {
-
-          if (ve == null) {
-            ve = new VisibilityEvaluator(env.getAuthorizationsContainer());
-          }
-
-          if (!ve.evaluate(new ColumnVisibility(cv))) {
-            return Collections.singletonList((short) 2);
-          }
-
-        } catch (BadArgumentException | VisibilityParseException bae) {
-          return Collections.singletonList((short) 1);
-        }
-
-        if (ok != null) {
-          ok.add(key);
-        }
-      }
-    }
-
-    return null;
-  }
-}
diff --git a/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java b/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java
deleted file mode 100644
index 1e094c465f..0000000000
--- a/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.accumulo.core.constraints;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import java.util.Collections;
-
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.data.Value;
-import org.apache.hadoop.io.Text;
-import org.junit.jupiter.api.Test;
-
-@SuppressWarnings("deprecation")
-public class DefaultKeySizeConstraintTest {
-
-  Constraint constraint = new DefaultKeySizeConstraint();
-
-  byte[] oversized = new byte[1048577];
-  byte[] large = new byte[419430];
-
-  @Test
-  public void testConstraint() {
-
-    // pass constraints
-    Mutation m = new Mutation("rowId");
-    m.put("colf", "colq", new Value());
-    assertEquals(Collections.emptyList(), constraint.check(null, m));
-
-    // test with row id > 1mb
-    m = new Mutation(oversized);
-    m.put("colf", "colq", new Value());
-    assertEquals(
-        Collections.singletonList(DefaultKeySizeConstraint.MAX__KEY_SIZE_EXCEEDED_VIOLATION),
-        constraint.check(null, m));
-
-    // test with colf > 1mb
-    m = new Mutation("rowid");
-    m.put(new Text(oversized), new Text("colq"), new Value());
-    assertEquals(
-        Collections.singletonList(DefaultKeySizeConstraint.MAX__KEY_SIZE_EXCEEDED_VIOLATION),
-        constraint.check(null, m));
-
-    // test with colf > 1mb
-    m = new Mutation("rowid");
-    m.put(new Text(oversized), new Text("colq"), new Value());
-    assertEquals(
-        Collections.singletonList(DefaultKeySizeConstraint.MAX__KEY_SIZE_EXCEEDED_VIOLATION),
-        constraint.check(null, m));
-
-    // test sum of smaller sizes violates 1mb constraint
-    m = new Mutation(large);
-    m.put(new Text(large), new Text(large), new Value());
-    assertEquals(
-        Collections.singletonList(DefaultKeySizeConstraint.MAX__KEY_SIZE_EXCEEDED_VIOLATION),
-        constraint.check(null, m));
-  }
-}
diff --git a/core/src/test/java/org/apache/accumulo/core/constraints/DeprecatedConstraintExtendTest.java b/core/src/test/java/org/apache/accumulo/core/constraints/DeprecatedConstraintExtendTest.java
deleted file mode 100644
index e75bd160aa..0000000000
--- a/core/src/test/java/org/apache/accumulo/core/constraints/DeprecatedConstraintExtendTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.accumulo.core.constraints;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.accumulo.core.data.ColumnUpdate;
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.data.Value;
-import org.apache.hadoop.io.Text;
-import org.junit.jupiter.api.Test;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-/**
- * This tests the case where a user extended a Constraint class before it was deprecated to make
- * sure the old Constraint will still work with the API migration changes.
- *
- * @since 2.1.0
- */
-@SuppressWarnings("deprecation")
-public class DeprecatedConstraintExtendTest {
-
-  byte[] min = new byte[1024];
-  byte[] oversized = new byte[1048577];
-
-  @Test
-  public void testMinKeySizeConstraint() {
-    Constraint constraint = new MinKeySizeConstraint();
-
-    // pass constraints
-    Mutation m = new Mutation(min);
-    m.put("colf", "colq", new Value());
-    assertEquals(Collections.emptyList(), constraint.check(null, m));
-
-    // test with row id < 1KB
-    m = new Mutation("rowid");
-    m.put("colf", "colq", new Value());
-    assertEquals(Collections.singletonList(MinKeySizeConstraint.MIN_KEY_SIZE_EXCEEDED_VIOLATION),
-        constraint.check(null, m));
-
-    // test with colf > 1mb
-    m = new Mutation("rowid");
-    m.put(new Text(oversized), new Text("colq"), new Value());
-    assertEquals(
-        Collections.singletonList(DefaultKeySizeConstraint.MAX__KEY_SIZE_EXCEEDED_VIOLATION),
-        constraint.check(null, m));
-  }
-
-  @Test
-  public void testFoo() {
-    FooConstraint fc = new FooConstraint();
-    // pass constraints
-    Mutation m = new Mutation("blah");
-    m.put("colf", "colq", new Value());
-    assertEquals(null, fc.check(null, m));
-
-    // test fail constraint
-    m = new Mutation("foo");
-    m.put("colf", "colq", new Value());
-    assertEquals(Collections.singletonList(Short.valueOf("1")), fc.check(null, m));
-  }
-
-  /**
-   * Limit the size of 1mb but also a minimum of 1KB
-   */
-  @SuppressFBWarnings(value = "NM_WRONG_PACKAGE",
-      justification = "Same name used for compatibility during deprecation cycle")
-  private static class MinKeySizeConstraint extends DefaultKeySizeConstraint {
-    protected static final short MIN_KEY_SIZE_EXCEEDED_VIOLATION = 2;
-    protected static final long minSize = 1024; // 1MB default size
-
-    @Override
-    public List<Short> check(Constraint.Environment env, Mutation mutation) {
-      List<Short> violations = super.check(env, mutation);
-      if (!violations.isEmpty()) {
-        return violations;
-      }
-
-      for (ColumnUpdate cu : mutation.getUpdates()) {
-        int size = mutation.getRow().length;
-        size += cu.getColumnFamily().length;
-        size += cu.getColumnQualifier().length;
-        size += cu.getColumnVisibility().length;
-
-        if (size < minSize) {
-          violations.add(MIN_KEY_SIZE_EXCEEDED_VIOLATION);
-        }
-      }
-      return violations;
-    }
-  }
-
-  /**
-   * Test previously defined constraint.
-   */
-  public class FooConstraint implements Constraint {
-    public String getViolationDescription(short violationCode) {
-      switch (violationCode) {
-        case 1:
-          return "Contains foo";
-      }
-      throw new IllegalArgumentException();
-    }
-
-    public List<Short> check(Constraint.Environment env, Mutation mutation) {
-      if (new String(mutation.getRow()).contains("foo")) {
-        return Collections.singletonList(Short.valueOf("1"));
-      }
-      return null;
-    }
-  }
-
-}
diff --git a/core/src/test/java/org/apache/accumulo/core/constraints/NoDeleteConstraintTest.java b/core/src/test/java/org/apache/accumulo/core/constraints/NoDeleteConstraintTest.java
deleted file mode 100644
index b2bee5e424..0000000000
--- a/core/src/test/java/org/apache/accumulo/core/constraints/NoDeleteConstraintTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.accumulo.core.constraints;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
-import java.util.List;
-
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.data.Value;
-import org.junit.jupiter.api.Test;
-
-@SuppressWarnings("deprecation")
-public class NoDeleteConstraintTest {
-
-  @Test
-  public void testConstraint() {
-    Mutation m1 = new Mutation("r1");
-    m1.putDelete("f1", "q1");
-
-    NoDeleteConstraint ndc = new NoDeleteConstraint();
-
-    List<Short> results = ndc.check(null, m1);
-    assertEquals(1, results.size());
-    assertEquals(1, results.get(0).intValue());
-
-    Mutation m2 = new Mutation("r1");
-    m2.put("f1", "q1", new Value("v1"));
-
-    results = ndc.check(null, m2);
-    assertNull(results);
-  }
-}
diff --git a/core/src/test/java/org/apache/accumulo/core/constraints/VisibilityConstraintTest.java b/core/src/test/java/org/apache/accumulo/core/constraints/VisibilityConstraintTest.java
deleted file mode 100644
index e70b402cfd..0000000000
--- a/core/src/test/java/org/apache/accumulo/core/constraints/VisibilityConstraintTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.accumulo.core.constraints;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.accumulo.core.data.ArrayByteSequence;
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.security.AuthorizationContainer;
-import org.apache.accumulo.core.security.ColumnVisibility;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-@SuppressWarnings("deprecation")
-public class VisibilityConstraintTest {
-
-  VisibilityConstraint vc;
-  Constraint.Environment env;
-  Mutation mutation;
-
-  static final ColumnVisibility good = new ColumnVisibility("good");
-  static final ColumnVisibility bad = new ColumnVisibility("bad");
-
-  static final String D = "don't care";
-
-  static final List<Short> ENOAUTH = Arrays.asList((short) 2);
-
-  @BeforeEach
-  public void setUp() {
-    vc = new VisibilityConstraint();
-    mutation = new Mutation("r");
-
-    ArrayByteSequence bs = new ArrayByteSequence("good".getBytes(UTF_8));
-
-    AuthorizationContainer ac = createNiceMock(AuthorizationContainer.class);
-    expect(ac.contains(bs)).andReturn(true);
-    replay(ac);
-
-    env = createMock(Constraint.Environment.class);
-    expect(env.getAuthorizationsContainer()).andReturn(ac);
-    replay(env);
-  }
-
-  @Test
-  public void testNoVisibility() {
-    mutation.put(D, D, D);
-    assertNull(vc.check(env, mutation), "authorized");
-  }
-
-  @Test
-  public void testVisibilityNoAuth() {
-    mutation.put(D, D, bad, D);
-    assertEquals(ENOAUTH, vc.check(env, mutation), "unauthorized");
-  }
-
-  @Test
-  public void testGoodVisibilityAuth() {
-    mutation.put(D, D, good, D);
-    assertNull(vc.check(env, mutation), "authorized");
-  }
-
-  @Test
-  public void testCachedVisibilities() {
-    mutation.put(D, D, good, "v");
-    mutation.put(D, D, good, "v2");
-    assertNull(vc.check(env, mutation), "authorized");
-  }
-
-  @Test
-  public void testMixedVisibilities() {
-    mutation.put(D, D, bad, D);
-    mutation.put(D, D, good, D);
-    assertEquals(ENOAUTH, vc.check(env, mutation), "unauthorized");
-  }
-
-}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/metadata/RootTabletMutatorImpl.java b/server/base/src/main/java/org/apache/accumulo/server/metadata/RootTabletMutatorImpl.java
index 73f91b085f..4ec2c5d14c 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/metadata/RootTabletMutatorImpl.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/metadata/RootTabletMutatorImpl.java
@@ -24,7 +24,7 @@ import java.util.List;
 
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.TabletId;
-import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.core.data.constraints.Constraint;
 import org.apache.accumulo.core.dataImpl.TabletIdImpl;
 import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.metadata.schema.Ample;
@@ -41,9 +41,7 @@ public class RootTabletMutatorImpl extends TabletMutatorBase implements Ample.Ta
 
   private static final Logger log = LoggerFactory.getLogger(RootTabletMutatorImpl.class);
 
-  @SuppressWarnings("deprecation")
-  private static class RootEnv
-      implements SystemEnvironment, org.apache.accumulo.core.constraints.Constraint.Environment {
+  private static class RootEnv implements SystemEnvironment, Constraint.Environment {
 
     private final ServerContext context;
 
@@ -51,11 +49,6 @@ public class RootTabletMutatorImpl extends TabletMutatorBase implements Ample.Ta
       this.context = context;
     }
 
-    @Override
-    public KeyExtent getExtent() {
-      return RootTable.EXTENT;
-    }
-
     @Override
     public TabletId getTablet() {
       return new TabletIdImpl(RootTable.EXTENT);
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TservConstraintEnv.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TservConstraintEnv.java
index d307f725b0..d904a2e74c 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TservConstraintEnv.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TservConstraintEnv.java
@@ -22,6 +22,7 @@ import java.nio.ByteBuffer;
 import java.util.Collections;
 
 import org.apache.accumulo.core.data.TabletId;
+import org.apache.accumulo.core.data.constraints.Constraint;
 import org.apache.accumulo.core.dataImpl.KeyExtent;
 import org.apache.accumulo.core.dataImpl.TabletIdImpl;
 import org.apache.accumulo.core.security.AuthorizationContainer;
@@ -30,9 +31,7 @@ import org.apache.accumulo.server.ServerContext;
 import org.apache.accumulo.server.constraints.SystemEnvironment;
 import org.apache.accumulo.server.security.SecurityOperation;
 
-@SuppressWarnings("deprecation")
-public class TservConstraintEnv
-    implements SystemEnvironment, org.apache.accumulo.core.constraints.Constraint.Environment {
+public class TservConstraintEnv implements SystemEnvironment, Constraint.Environment {
 
   private final ServerContext context;
   private final TCredentials credentials;
@@ -49,11 +48,6 @@ public class TservConstraintEnv
     this.ke = ke;
   }
 
-  @Override
-  public KeyExtent getExtent() {
-    return ke;
-  }
-
   @Override
   public TabletId getTablet() {
     return new TabletIdImpl(ke);