@Test public void testConfigurationPreserved() throws Throwable { Configuration conf = new Configuration(); conf.setBoolean("_ENABLED", false); conf.setLong("_PRIORITY", 10); HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(name.getMethodName())); Constraints.add(desc, AlsoWorks.class, conf); Constraints.add(desc, WorksConstraint.class); assertFalse(Constraints.enabled(desc, AlsoWorks.class)); List<? extends Constraint> constraints = Constraints.getConstraints(desc, this.getClass().getClassLoader()); for (Constraint c : constraints) { Configuration storedConf = c.getConf(); if (c instanceof AlsoWorks) assertEquals(10, storedConf.getLong("_PRIORITY", -1)); // its just a worksconstraint else assertEquals(2, storedConf.getLong("_PRIORITY", -1)); } }
@Test public void testConfigurationPreserved() throws Throwable { Configuration conf = new Configuration(); conf.setBoolean("_ENABLED", false); conf.setLong("_PRIORITY", 10); HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(name.getMethodName())); Constraints.add(desc, AlsoWorks.class, conf); Constraints.add(desc, WorksConstraint.class); assertFalse(Constraints.enabled(desc, AlsoWorks.class)); List<? extends Constraint> constraints = Constraints.getConstraints(desc, this.getClass().getClassLoader()); for (Constraint c : constraints) { Configuration storedConf = c.getConf(); if (c instanceof AlsoWorks) assertEquals(10, storedConf.getLong("_PRIORITY", -1)); // its just a worksconstraint else assertEquals(2, storedConf.getLong("_PRIORITY", -1)); } }