refactor(renderer): Replace 'add' method with 'put' in RendererWorkingSet interface and implementations
This commit is contained in:
@@ -51,7 +51,7 @@ public class RendererWorkingSetImplTest {
|
||||
void addSingleAddsToUncommittedWork() {
|
||||
final RenderingBo bo1 = mock(RenderingBo.class);
|
||||
when(bo1.getId()).thenReturn("bo1");
|
||||
this.workingSet.add(this.moduleA.getId(), bo1);
|
||||
this.workingSet.put(this.moduleA.getId(), bo1);
|
||||
|
||||
final var uncommitted = this.workingSet.getUncommittedWork(this.moduleA.getId());
|
||||
assertNotNull(uncommitted);
|
||||
@@ -65,7 +65,7 @@ public class RendererWorkingSetImplTest {
|
||||
final RenderingBo bo2 = mock(RenderingBo.class);
|
||||
when(bo2.getId()).thenReturn("bo2");
|
||||
|
||||
this.workingSet.add(this.moduleA.getId(), List.of(bo1, bo2));
|
||||
this.workingSet.put(this.moduleA.getId(), List.of(bo1, bo2));
|
||||
|
||||
final var uncommitted = this.workingSet.getUncommittedWork(this.moduleA.getId());
|
||||
assertEquals(Map.of("bo1", bo1, "bo2", bo2), uncommitted);
|
||||
@@ -78,8 +78,8 @@ public class RendererWorkingSetImplTest {
|
||||
final RenderingBo bo2 = mock(RenderingBo.class);
|
||||
when(bo2.getId()).thenReturn("bo2");
|
||||
|
||||
this.workingSet.add(this.moduleA.getId(), bo1);
|
||||
this.workingSet.add(this.moduleA.getId(), bo2);
|
||||
this.workingSet.put(this.moduleA.getId(), bo1);
|
||||
this.workingSet.put(this.moduleA.getId(), bo2);
|
||||
|
||||
final var returnedUncommitted = this.workingSet.commit(this.moduleA.getId(), false);
|
||||
final var currentUncommitted = this.workingSet.getUncommittedWork(this.moduleA.getId());
|
||||
@@ -102,8 +102,8 @@ public class RendererWorkingSetImplTest {
|
||||
final RenderingBo bo3 = mock(RenderingBo.class);
|
||||
when(bo3.getId()).thenReturn("bo3");
|
||||
|
||||
this.workingSet.add(this.moduleA.getId(), bo1);
|
||||
this.workingSet.add(this.moduleA.getId(), bo2);
|
||||
this.workingSet.put(this.moduleA.getId(), bo1);
|
||||
this.workingSet.put(this.moduleA.getId(), bo2);
|
||||
|
||||
final var returnedUncommitted = this.workingSet.commit(this.moduleA.getId(), true);
|
||||
final var currentUncommitted = this.workingSet.getUncommittedWork(this.moduleA.getId());
|
||||
@@ -116,7 +116,7 @@ public class RendererWorkingSetImplTest {
|
||||
assertEquals(2, live.size());
|
||||
assertTrue(live.containsAll(List.of(bo1, bo2)));
|
||||
|
||||
this.workingSet.add(this.moduleA.getId(), bo3);
|
||||
this.workingSet.put(this.moduleA.getId(), bo3);
|
||||
final List<RenderingBo> liveAfterAdd = new ArrayList<>();
|
||||
this.workingSet.getLiveSet(liveAfterAdd, null);
|
||||
assertEquals(2, liveAfterAdd.size());
|
||||
@@ -132,9 +132,9 @@ public class RendererWorkingSetImplTest {
|
||||
final RenderingBo bo3 = mock(RenderingBo.class);
|
||||
when(bo3.getId()).thenReturn("bo3");
|
||||
|
||||
this.workingSet.add(this.moduleA.getId(), bo1);
|
||||
this.workingSet.add(this.moduleA.getId(), bo2);
|
||||
this.workingSet.add(this.moduleB.getId(), bo3);
|
||||
this.workingSet.put(this.moduleA.getId(), bo1);
|
||||
this.workingSet.put(this.moduleA.getId(), bo2);
|
||||
this.workingSet.put(this.moduleB.getId(), bo3);
|
||||
|
||||
this.workingSet.commit(this.moduleA.getId(), false);
|
||||
this.workingSet.commit(this.moduleB.getId(), false);
|
||||
@@ -163,9 +163,9 @@ public class RendererWorkingSetImplTest {
|
||||
final var bo2 = new TestBoB();
|
||||
bo2.setId("bo2");
|
||||
|
||||
this.workingSet.add(this.moduleA.getId(), bo1);
|
||||
this.workingSet.put(this.moduleA.getId(), bo1);
|
||||
this.workingSet.commit(this.moduleA.getId(), false);
|
||||
this.workingSet.add(this.moduleA.getId(), bo2);
|
||||
this.workingSet.put(this.moduleA.getId(), bo2);
|
||||
|
||||
// Before clear
|
||||
final List<RenderingBo> liveBefore = new ArrayList<>();
|
||||
@@ -193,7 +193,7 @@ public class RendererWorkingSetImplTest {
|
||||
void clearOnUnknownProducerDoesNothing() {
|
||||
final RenderingBo bo1 = mock(RenderingBo.class);
|
||||
when(bo1.getId()).thenReturn("bo1");
|
||||
this.workingSet.add(this.moduleA.getId(), bo1);
|
||||
this.workingSet.put(this.moduleA.getId(), bo1);
|
||||
this.workingSet.commit(this.moduleA.getId(), false);
|
||||
|
||||
this.workingSet.clear(this.moduleC.getId());
|
||||
@@ -211,13 +211,13 @@ public class RendererWorkingSetImplTest {
|
||||
final var bo2 = new TestBoA();
|
||||
bo2.setId("bo2");
|
||||
|
||||
this.workingSet.add(this.moduleA.getId(), bo1);
|
||||
this.workingSet.add(this.moduleA.getId(), bo2);
|
||||
this.workingSet.put(this.moduleA.getId(), bo1);
|
||||
this.workingSet.put(this.moduleA.getId(), bo2);
|
||||
this.workingSet.commit(this.moduleA.getId(), false);
|
||||
|
||||
final var bo3 = new TestBoB();
|
||||
bo3.setId("bo3");
|
||||
this.workingSet.add(this.moduleA.getId(), bo3);
|
||||
this.workingSet.put(this.moduleA.getId(), bo3);
|
||||
this.workingSet.commit(this.moduleA.getId(), false);
|
||||
|
||||
verify(this.renderingBoPool, times(1)).release(bo1);
|
||||
@@ -236,8 +236,8 @@ public class RendererWorkingSetImplTest {
|
||||
final RenderingBo bo2 = mock(RenderingBo.class);
|
||||
when(bo2.getId()).thenReturn("bo2");
|
||||
|
||||
this.workingSet.add(this.moduleA.getId(), bo1);
|
||||
this.workingSet.add(this.moduleA.getId(), bo2);
|
||||
this.workingSet.put(this.moduleA.getId(), bo1);
|
||||
this.workingSet.put(this.moduleA.getId(), bo2);
|
||||
|
||||
final var retrieved1 = this.workingSet.get(this.moduleA.getId(), "bo1");
|
||||
final var retrieved2 = this.workingSet.get(this.moduleA.getId(), "bo2");
|
||||
@@ -255,8 +255,8 @@ public class RendererWorkingSetImplTest {
|
||||
final RenderingBo bo2 = mock(RenderingBo.class);
|
||||
when(bo2.getId()).thenReturn("bo2");
|
||||
|
||||
this.workingSet.add(this.moduleA.getId(), bo1);
|
||||
this.workingSet.add(this.moduleA.getId(), bo2);
|
||||
this.workingSet.put(this.moduleA.getId(), bo1);
|
||||
this.workingSet.put(this.moduleA.getId(), bo2);
|
||||
final var committedWork = this.workingSet.commit(this.moduleA.getId(), false);
|
||||
|
||||
// After commit without clone, the uncommitted work should be empty
|
||||
@@ -277,12 +277,12 @@ public class RendererWorkingSetImplTest {
|
||||
final RenderingBo bo1_replacement = mock(RenderingBo.class);
|
||||
when(bo1_replacement.getId()).thenReturn("bo1");
|
||||
|
||||
this.workingSet.add(this.moduleA.getId(), bo1);
|
||||
this.workingSet.put(this.moduleA.getId(), bo1);
|
||||
final var uncommittedBefore = this.workingSet.getUncommittedWork(this.moduleA.getId());
|
||||
assertEquals(1, uncommittedBefore.size());
|
||||
assertSame(bo1, uncommittedBefore.get("bo1"));
|
||||
|
||||
this.workingSet.add(this.moduleA.getId(), bo1_replacement);
|
||||
this.workingSet.put(this.moduleA.getId(), bo1_replacement);
|
||||
final var uncommittedAfter = this.workingSet.getUncommittedWork(this.moduleA.getId());
|
||||
assertEquals(1, uncommittedAfter.size());
|
||||
assertSame(bo1_replacement, uncommittedAfter.get("bo1"));
|
||||
@@ -297,9 +297,9 @@ public class RendererWorkingSetImplTest {
|
||||
final var boA2 = new TestBoA();
|
||||
boA2.setId("boA2");
|
||||
|
||||
this.workingSet.add(this.moduleA.getId(), boA1);
|
||||
this.workingSet.add(this.moduleB.getId(), boB1);
|
||||
this.workingSet.add(this.moduleA.getId(), boA2);
|
||||
this.workingSet.put(this.moduleA.getId(), boA1);
|
||||
this.workingSet.put(this.moduleB.getId(), boB1);
|
||||
this.workingSet.put(this.moduleA.getId(), boA2);
|
||||
|
||||
this.workingSet.commit(this.moduleA.getId(), false);
|
||||
this.workingSet.commit(this.moduleB.getId(), false);
|
||||
|
||||
Reference in New Issue
Block a user