use of org.apache.hadoop.hive.metastore.api.LockRequest in project hive by apache.
the class TestLockRequestBuilder method testSRExPart.
// Test that existing shared_read partition with new exclusive coalesces to
// exclusive
@Test
public void testSRExPart() {
LockRequestBuilder bldr = new LockRequestBuilder();
LockComponent comp = new LockComponent(LockType.SHARED_READ, LockLevel.DB, "mydb");
comp.setTablename("mytable");
comp.setPartitionname("mypart");
bldr.addLockComponent(comp);
comp = new LockComponent(LockType.EXCLUSIVE, LockLevel.DB, "mydb");
comp.setTablename("mytable");
comp.setPartitionname("mypart");
bldr.addLockComponent(comp).setUser("fred");
LockRequest req = bldr.build();
List<LockComponent> locks = req.getComponent();
Assert.assertEquals(1, locks.size());
Assert.assertEquals(LockType.EXCLUSIVE, locks.get(0).getType());
}
use of org.apache.hadoop.hive.metastore.api.LockRequest in project hive by apache.
the class TestLockRequestBuilder method testSRExTable.
// Test that existing shared_read table with new exclusive coalesces to
// exclusive
@Test
public void testSRExTable() {
LockRequestBuilder bldr = new LockRequestBuilder();
LockComponent comp = new LockComponent(LockType.SHARED_READ, LockLevel.DB, "mydb");
comp.setTablename("mytable");
bldr.addLockComponent(comp);
comp = new LockComponent(LockType.EXCLUSIVE, LockLevel.DB, "mydb");
comp.setTablename("mytable");
bldr.addLockComponent(comp).setUser("fred");
LockRequest req = bldr.build();
List<LockComponent> locks = req.getComponent();
Assert.assertEquals(1, locks.size());
Assert.assertEquals(LockType.EXCLUSIVE, locks.get(0).getType());
}
use of org.apache.hadoop.hive.metastore.api.LockRequest in project hive by apache.
the class TestLockRequestBuilder method testSWSRDb.
// Test that existing shared_write db with new shared_read coalesces to
// shared_write
@Test
public void testSWSRDb() {
LockRequestBuilder bldr = new LockRequestBuilder();
LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.DB, "mydb");
bldr.addLockComponent(comp);
comp = new LockComponent(LockType.SHARED_READ, LockLevel.DB, "mydb");
bldr.addLockComponent(comp).setUser("fred");
LockRequest req = bldr.build();
List<LockComponent> locks = req.getComponent();
Assert.assertEquals(1, locks.size());
Assert.assertEquals(LockType.SHARED_WRITE, locks.get(0).getType());
}
use of org.apache.hadoop.hive.metastore.api.LockRequest in project hive by apache.
the class TestLockRequestBuilder method testSRSWPart.
// Test that existing shared_read partition with new shared_write coalesces to
// shared_write
@Test
public void testSRSWPart() {
LockRequestBuilder bldr = new LockRequestBuilder();
LockComponent comp = new LockComponent(LockType.SHARED_READ, LockLevel.DB, "mydb");
comp.setTablename("mytable");
comp.setPartitionname("mypart");
bldr.addLockComponent(comp);
comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.DB, "mydb");
comp.setTablename("mytable");
comp.setPartitionname("mypart");
bldr.addLockComponent(comp).setUser("fred");
LockRequest req = bldr.build();
List<LockComponent> locks = req.getComponent();
Assert.assertEquals(1, locks.size());
Assert.assertEquals(LockType.SHARED_WRITE, locks.get(0).getType());
}
use of org.apache.hadoop.hive.metastore.api.LockRequest in project hive by apache.
the class TestLockRequestBuilder method testSWSRTable.
// Test that existing shared_write table with new shared_read coalesces to
// shared_write
@Test
public void testSWSRTable() {
LockRequestBuilder bldr = new LockRequestBuilder();
LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.DB, "mydb");
comp.setTablename("mytable");
bldr.addLockComponent(comp);
comp = new LockComponent(LockType.SHARED_READ, LockLevel.DB, "mydb");
comp.setTablename("mytable");
bldr.addLockComponent(comp).setUser("fred");
LockRequest req = bldr.build();
List<LockComponent> locks = req.getComponent();
Assert.assertEquals(1, locks.size());
Assert.assertEquals(LockType.SHARED_WRITE, locks.get(0).getType());
}
Aggregations