Search in sources :

Example 1 with TabletServer

use of org.apache.accumulo.tserver.TabletServer in project accumulo by apache.

the class TabletTest method correctValuesSetForProperties.

@Test
public void correctValuesSetForProperties() {
    TableConfiguration tableConf = EasyMock.createMock(TableConfiguration.class);
    CompactionPlan plan = EasyMock.createMock(CompactionPlan.class);
    WriteParameters writeParams = EasyMock.createMock(WriteParameters.class);
    plan.writeParameters = writeParams;
    DatafileManager dfm = EasyMock.createMock(DatafileManager.class);
    TabletTime time = EasyMock.createMock(TabletTime.class);
    TabletServer tserver = EasyMock.createMock(TabletServer.class);
    TabletResourceManager tserverResourceManager = EasyMock.createMock(TabletResourceManager.class);
    TabletMemory tabletMemory = EasyMock.createMock(TabletMemory.class);
    KeyExtent extent = EasyMock.createMock(KeyExtent.class);
    ConfigurationObserver obs = EasyMock.createMock(ConfigurationObserver.class);
    Tablet tablet = new Tablet(time, "", 0, new Path("/foo"), dfm, tserver, tserverResourceManager, tabletMemory, tableConf, extent, obs);
    long hdfsBlockSize = 10000l, blockSize = 5000l, indexBlockSize = 500l;
    int replication = 5;
    String compressType = "snappy";
    EasyMock.expect(tableConf.iterator()).andReturn(Collections.emptyIterator());
    EasyMock.expect(writeParams.getHdfsBlockSize()).andReturn(hdfsBlockSize).times(2);
    EasyMock.expect(writeParams.getBlockSize()).andReturn(blockSize).times(2);
    EasyMock.expect(writeParams.getIndexBlockSize()).andReturn(indexBlockSize).times(2);
    EasyMock.expect(writeParams.getCompressType()).andReturn(compressType).times(2);
    EasyMock.expect(writeParams.getReplication()).andReturn(replication).times(2);
    EasyMock.replay(tableConf, plan, writeParams);
    AccumuloConfiguration aConf = tablet.createTableConfiguration(tableConf, plan);
    EasyMock.verify(tableConf, plan, writeParams);
    Assert.assertEquals(hdfsBlockSize, Long.parseLong(aConf.get(Property.TABLE_FILE_BLOCK_SIZE)));
    Assert.assertEquals(blockSize, Long.parseLong(aConf.get(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE)));
    Assert.assertEquals(indexBlockSize, Long.parseLong(aConf.get(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX)));
    Assert.assertEquals(compressType, aConf.get(Property.TABLE_FILE_COMPRESSION_TYPE));
    Assert.assertEquals(replication, Integer.parseInt(aConf.get(Property.TABLE_FILE_REPLICATION)));
}
Also used : TabletResourceManager(org.apache.accumulo.tserver.TabletServerResourceManager.TabletResourceManager) Path(org.apache.hadoop.fs.Path) CompactionPlan(org.apache.accumulo.tserver.compaction.CompactionPlan) ConfigurationObserver(org.apache.accumulo.core.conf.ConfigurationObserver) TabletTime(org.apache.accumulo.server.tablets.TabletTime) KeyExtent(org.apache.accumulo.core.data.impl.KeyExtent) TabletServer(org.apache.accumulo.tserver.TabletServer) WriteParameters(org.apache.accumulo.tserver.compaction.WriteParameters) TableConfiguration(org.apache.accumulo.server.conf.TableConfiguration) AccumuloConfiguration(org.apache.accumulo.core.conf.AccumuloConfiguration) Test(org.junit.Test)

Aggregations

AccumuloConfiguration (org.apache.accumulo.core.conf.AccumuloConfiguration)1 ConfigurationObserver (org.apache.accumulo.core.conf.ConfigurationObserver)1 KeyExtent (org.apache.accumulo.core.data.impl.KeyExtent)1 TableConfiguration (org.apache.accumulo.server.conf.TableConfiguration)1 TabletTime (org.apache.accumulo.server.tablets.TabletTime)1 TabletServer (org.apache.accumulo.tserver.TabletServer)1 TabletResourceManager (org.apache.accumulo.tserver.TabletServerResourceManager.TabletResourceManager)1 CompactionPlan (org.apache.accumulo.tserver.compaction.CompactionPlan)1 WriteParameters (org.apache.accumulo.tserver.compaction.WriteParameters)1 Path (org.apache.hadoop.fs.Path)1 Test (org.junit.Test)1