use of org.apache.hadoop.hbase.CoprocessorEnvironment in project hbase by apache.
the class TestCoprocessorConfiguration method testReadOnlyConfiguration.
/**
* Rough test that Coprocessor Environment is Read-Only.
* Just check a random CP and see that it returns a read-only config.
*/
@Test
public void testReadOnlyConfiguration() throws Exception {
Configuration conf = new Configuration(CONF);
HRegion region = mock(HRegion.class);
when(region.getRegionInfo()).thenReturn(REGIONINFO);
when(region.getTableDescriptor()).thenReturn(TABLEDESC);
RegionServerServices rsServices = mock(RegionServerServices.class);
RegionCoprocessorHost rcp = new RegionCoprocessorHost(region, rsServices, conf);
boolean found = false;
for (String cpStr : rcp.getCoprocessors()) {
CoprocessorEnvironment cpenv = rcp.findCoprocessorEnvironment(cpStr);
if (cpenv != null) {
found = true;
}
Configuration c = cpenv.getConfiguration();
thrown.expect(UnsupportedOperationException.class);
c.set("one.two.three", "four.five.six");
}
assertTrue("Should be at least one CP found", found);
}
Aggregations