/** * Displays the usages for the asset part identified by the resourPart parameter using a specific message instead of the default message.. * * @param headerMessage The message that will be shown instead of the default message * @param path Path for the given asset * @param resourceFQN Fully Qualified Name of the asset * @param resourcePart The name of the part to search. * @param partType The {@link PartType} that to search. * @param okCommand {@link Command} that is going to run when the user presses ok button. If there are no usages on the index the command will be automatically executed without opening the modal * @param cancelCommand {@link Command} that is going to run when the user presses Cancel button. */ public void showAssetPartUsages(final String headerMessage, final Path path, final String resourceFQN, final String resourcePart, final PartType partType, final Command okCommand, final Command cancelCommand) { PortablePreconditions.checkNotNull("headerMessage", headerMessage); HTMLElement messageContainer = view.getDefaultMessageContainer(); messageContainer.setInnerHTML(headerMessage); showAssetPartUsages(messageContainer, path, resourceFQN, resourcePart, partType, okCommand, cancelCommand); }
/** * Displays the usages for the asset identified by the resourceFQN using a specific message instead of the default message. * * @param headerMessage The message that will be shown instead of the default message * @param path Path for the given asset * @param resourceFQN Fully Qualified Name of the asset * @param resourceType The type of asset. * @param okCommand {@link Command} that is going to run when the user presses ok button. If there are no usages on the index the command will be automatically executed without opening the modal * @param cancelCommand {@link Command} that is going to run when the user presses Cancel button. */ public void showAssetUsages(final String headerMessage, final Path path, final String resourceFQN, final ResourceType resourceType, final Command okCommand, final Command cancelCommand) { PortablePreconditions.checkNotNull("headerMessage", headerMessage); HTMLElement messageContainer = view.getDefaultMessageContainer(); messageContainer.setInnerHTML(headerMessage); showAssetUsages(messageContainer, path, resourceFQN, resourceType, okCommand, cancelCommand); }
@Test public void testShowAssetUsagesWithoutResponse() { displayer.showAssetUsages(currentAssetPath, RESOURCE_FQN, ResourceType.JAVA, okCommand, cancelCommand); verify(translationService).format(anyString(), anyString()); verify(view).getDefaultMessageContainer(); verify(htmlElement).setInnerHTML(anyString()); verify(assetsUsageService).getAssetUsages(anyString(), any(), any()); verify(view, never()).show(htmlElement, queryResults); verify(okCommand).execute(); }
@Test public void testShowAssetPartUsagesWithoutResponse() { displayer.showAssetPartUsages(currentAssetPath, RESOURCE_FQN, RESOURCE_PART, PartType.FIELD, okCommand, cancelCommand); verify(translationService).format(anyString(), anyString()); verify(view).getDefaultMessageContainer(); verify(htmlElement).setInnerHTML(anyString()); verify(assetsUsageService).getAssetPartUsages(anyString(), anyString(), any(), any()); verify(view, never()).show(htmlElement, queryResults); verify(okCommand).execute(); }
protected void testAssetUsagesWithResponse(boolean pressOk) { queryResults.add(resultPath); displayer.showAssetUsages(currentAssetPath, RESOURCE_FQN, ResourceType.JAVA, okCommand, cancelCommand); verify(translationService).format(anyString(), anyString()); verify(view).getDefaultMessageContainer(); verify(htmlElement).setInnerHTML(anyString()); verify(assetsUsageService).getAssetUsages(anyString(), any(), any()); verify(view).show(htmlElement, queryResults); verify(okCommand, never()).execute(); if (pressOk) { displayer.onOk(); } else { displayer.onCancel(); } displayer.onClose(); verifyClose(pressOk); }
protected void testAssetPartUsagesWithResponse(boolean pressOk) { queryResults.add(resultPath); displayer.showAssetPartUsages(currentAssetPath, RESOURCE_FQN, RESOURCE_PART, PartType.FIELD, okCommand, cancelCommand); verify(translationService).format(anyString(), anyString()); verify(view).getDefaultMessageContainer(); verify(htmlElement).setInnerHTML(anyString()); verify(assetsUsageService).getAssetPartUsages(anyString(), anyString(), any(), any()); verify(view).show(htmlElement, queryResults); verify(okCommand, never()).execute(); if (pressOk) { displayer.onOk(); } else { displayer.onCancel(); } displayer.onClose(); verifyClose(pressOk); }