HDDS-1010. ContainerSet#getContainerMap should be renamed. Contributed by Supratim Deka.
This commit is contained in:
parent
de804e53b9
commit
214112b2d7
@ -135,7 +135,8 @@ public Iterator<Map.Entry<Long, Container>> getContainerMapIterator() {
|
|||||||
* Return a copy of the containerMap.
|
* Return a copy of the containerMap.
|
||||||
* @return containerMap
|
* @return containerMap
|
||||||
*/
|
*/
|
||||||
public Map<Long, Container> getContainerMap() {
|
@VisibleForTesting
|
||||||
|
public Map<Long, Container> getContainerMapCopy() {
|
||||||
return ImmutableMap.copyOf(containerMap);
|
return ImmutableMap.copyOf(containerMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ public void testBlockDeletion() throws Exception {
|
|||||||
|
|
||||||
MetadataStore meta = BlockUtils.getDB(
|
MetadataStore meta = BlockUtils.getDB(
|
||||||
(KeyValueContainerData) containerData.get(0), conf);
|
(KeyValueContainerData) containerData.get(0), conf);
|
||||||
Map<Long, Container> containerMap = containerSet.getContainerMap();
|
Map<Long, Container> containerMap = containerSet.getContainerMapCopy();
|
||||||
// NOTE: this test assumes that all the container is KetValueContainer and
|
// NOTE: this test assumes that all the container is KetValueContainer and
|
||||||
// have DeleteTransactionId in KetValueContainerData. If other
|
// have DeleteTransactionId in KetValueContainerData. If other
|
||||||
// types is going to be added, this test should be checked.
|
// types is going to be added, this test should be checked.
|
||||||
|
@ -78,7 +78,7 @@ public void testRandomChoosingPolicy() throws IOException {
|
|||||||
KeyValueContainer container = new KeyValueContainer(data, conf);
|
KeyValueContainer container = new KeyValueContainer(data, conf);
|
||||||
containerSet.addContainer(container);
|
containerSet.addContainer(container);
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
containerSet.getContainerMap().containsKey(data.getContainerID()));
|
containerSet.getContainerMapCopy().containsKey(data.getContainerID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ContainerDeletionChoosingPolicy deletionPolicy =
|
ContainerDeletionChoosingPolicy deletionPolicy =
|
||||||
@ -138,7 +138,7 @@ public void testTopNOrderedChoosingPolicy() throws IOException {
|
|||||||
KeyValueContainer container = new KeyValueContainer(data, conf);
|
KeyValueContainer container = new KeyValueContainer(data, conf);
|
||||||
containerSet.addContainer(container);
|
containerSet.addContainer(container);
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
containerSet.getContainerMap().containsKey(containerId));
|
containerSet.getContainerMapCopy().containsKey(containerId));
|
||||||
}
|
}
|
||||||
|
|
||||||
ContainerDeletionChoosingPolicy deletionPolicy =
|
ContainerDeletionChoosingPolicy deletionPolicy =
|
||||||
|
@ -177,7 +177,7 @@ private Container addContainer(ContainerSet cSet, long cID)
|
|||||||
public void testCreateContainer() throws Exception {
|
public void testCreateContainer() throws Exception {
|
||||||
long testContainerID = getTestContainerID();
|
long testContainerID = getTestContainerID();
|
||||||
addContainer(containerSet, testContainerID);
|
addContainer(containerSet, testContainerID);
|
||||||
Assert.assertTrue(containerSet.getContainerMap()
|
Assert.assertTrue(containerSet.getContainerMapCopy()
|
||||||
.containsKey(testContainerID));
|
.containsKey(testContainerID));
|
||||||
KeyValueContainerData kvData =
|
KeyValueContainerData kvData =
|
||||||
(KeyValueContainerData) containerSet.getContainer(testContainerID)
|
(KeyValueContainerData) containerSet.getContainer(testContainerID)
|
||||||
@ -226,14 +226,14 @@ public void testDeleteContainer() throws Exception {
|
|||||||
|
|
||||||
Container container2 = addContainer(containerSet, testContainerID2);
|
Container container2 = addContainer(containerSet, testContainerID2);
|
||||||
|
|
||||||
Assert.assertTrue(containerSet.getContainerMap()
|
Assert.assertTrue(containerSet.getContainerMapCopy()
|
||||||
.containsKey(testContainerID1));
|
.containsKey(testContainerID1));
|
||||||
Assert.assertTrue(containerSet.getContainerMap()
|
Assert.assertTrue(containerSet.getContainerMapCopy()
|
||||||
.containsKey(testContainerID2));
|
.containsKey(testContainerID2));
|
||||||
|
|
||||||
container1.delete();
|
container1.delete();
|
||||||
containerSet.removeContainer(testContainerID1);
|
containerSet.removeContainer(testContainerID1);
|
||||||
Assert.assertFalse(containerSet.getContainerMap()
|
Assert.assertFalse(containerSet.getContainerMapCopy()
|
||||||
.containsKey(testContainerID1));
|
.containsKey(testContainerID1));
|
||||||
|
|
||||||
// Adding block to a deleted container should fail.
|
// Adding block to a deleted container should fail.
|
||||||
@ -254,7 +254,7 @@ public void testDeleteContainer() throws Exception {
|
|||||||
exception.expectMessage(
|
exception.expectMessage(
|
||||||
"Container cannot be deleted because it is not empty.");
|
"Container cannot be deleted because it is not empty.");
|
||||||
container2.delete();
|
container2.delete();
|
||||||
Assert.assertTrue(containerSet.getContainerMap()
|
Assert.assertTrue(containerSet.getContainerMapCopy()
|
||||||
.containsKey(testContainerID1));
|
.containsKey(testContainerID1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -762,8 +762,8 @@ public void testUpdateContainer() throws IOException {
|
|||||||
|
|
||||||
container.update(newMetadata, false);
|
container.update(newMetadata, false);
|
||||||
|
|
||||||
Assert.assertEquals(1, containerSet.getContainerMap().size());
|
Assert.assertEquals(1, containerSet.getContainerMapCopy().size());
|
||||||
Assert.assertTrue(containerSet.getContainerMap()
|
Assert.assertTrue(containerSet.getContainerMapCopy()
|
||||||
.containsKey(testContainerID));
|
.containsKey(testContainerID));
|
||||||
|
|
||||||
// Verify in-memory map
|
// Verify in-memory map
|
||||||
|
Loading…
Reference in New Issue
Block a user