### Question:
RPCServiceImpl extends RemoteServiceServlet implements RPCService { public void removeWindowsEventData(String windowSession, String windowId) { String lookupKey = windowSession + ApplicationLocalStore.OBJECT_DELIMITER + windowId; ApplicationLocalStore.getInstance().deleteAll(lookupKey); }  UIVOCluster reload(Map<String,String> parameters); UIVOCluster activate(Map<String,String> parameters); UIVOCluster getUISFromApplicationContext(Map<String,String> parameters); UIGVO getUIFromApplicationContext(); UIGVO getUIVO(String xmlUI); String getUI(String xmlUI); String getXMLUIByUUID(String uuid); GDataObject executeEvent(EventDataGVO eventData); UIGVO getUIByUUID(String uuid); void removeUI(String uuid); InitState getMDIState(Map<String,String> parameters); List<DataContainerGVO> getDataForDatagridFromUpload(String uuid); String prepareForExport(List<DataContainerGVO> list, String exportCode, String header, boolean generateColumnHeader); void notify(String subject, String message); void removeWindowsEventData(String windowSession, String windowId); void removeFileFromLocalStore(String appUUID, String windowId, String uploadUUID); String generateTypedCSS(String rendererType, String applicationId); void removeGloballyStoredData(String windowSession, String applicationId); GEventItemDataObject executeEventItem(EventItemDataGVO eventItem); SerializableWhitelist whitelist(SerializableWhitelist value); final static Logger logger; }### Answer:
@Test public void testOnlyElementsInAWindowIsRemoved() { String windowSession = "windowSessionId"; String windowId1 = "windowId1"; String windowId2 = "windowId2"; String generatedKey1 = windowSession + ApplicationLocalStore.OBJECT_DELIMITER + windowId1; String generatedKey2 = windowSession + ApplicationLocalStore.OBJECT_DELIMITER + windowId2; ApplicationLocalStore.getInstance().store(generatedKey1, "key", "value1"); Object data = ApplicationLocalStore.getInstance().retrieve(generatedKey1, "key"); assertEquals("value1", data.toString()); ApplicationLocalStore.getInstance().store(generatedKey2, "key", "value2"); assertEquals("value2", ApplicationLocalStore.getInstance().retrieve(generatedKey2, "key")); RPCServiceImpl impl = new RPCServiceImpl(); impl.removeWindowsEventData(windowSession,windowId2); assertEquals(null, ApplicationLocalStore.getInstance().retrieve(generatedKey2, "key")); assertEquals("value1", ApplicationLocalStore.getInstance().retrieve(generatedKey1, "key")); }
@Test public void testOnlyElementsInAWindowSessionIsRemoved() { String windowSession1 = "windowSessionId1"; String windowSession2 = "windowSessionId2"; String windowId1 = "windowId1"; String generatedKey1 = windowSession1 + ApplicationLocalStore.OBJECT_DELIMITER + windowId1; String generatedKey2 = windowSession2 + ApplicationLocalStore.OBJECT_DELIMITER + windowId1; ApplicationLocalStore.getInstance().store(generatedKey1, "key", "value1"); ApplicationLocalStore.getInstance().store(generatedKey2, "key", "value2"); RPCServiceImpl impl = new RPCServiceImpl(); impl.removeWindowsEventData(windowSession1,windowId1); assertEquals(null, ApplicationLocalStore.getInstance().retrieve(generatedKey1, "key")); assertEquals("value2", ApplicationLocalStore.getInstance().retrieve(generatedKey2, "key")); }
@Test public void testAllElementsRemovedOnAWindowSessionOnAWindow() { String windowSession = "windowSessionId"; String windowId = "windowId"; String generatedKey = windowSession + ApplicationLocalStore.OBJECT_DELIMITER + windowId; ApplicationLocalStore.getInstance().store(generatedKey, "key1", "value1"); Object data = ApplicationLocalStore.getInstance().retrieve(generatedKey, "key1"); assertEquals("value1", data.toString()); ApplicationLocalStore.getInstance().store(generatedKey, "key2", "value2"); assertEquals("value2",ApplicationLocalStore.getInstance().retrieve(generatedKey, "key2")); RPCServiceImpl impl = new RPCServiceImpl(); impl.removeWindowsEventData(windowSession,windowId); assertEquals(null,ApplicationLocalStore.getInstance().retrieve(generatedKey, "key1")); assertEquals(null,ApplicationLocalStore.getInstance().retrieve(generatedKey, "key2")); }