@Test public void testAppliesToWebappMatch() { final IPortletDescriptorKey portletDescriptorKey = mock(IPortletDescriptorKey.class); when(portletDescriptorKey.getPortletName()).thenAnswer(invocation -> NOT_A_MATCH); when(portletDescriptorKey.getWebAppName()).thenAnswer(invocation -> WEBAPP_NAME); final IPortletDefinition portletDefinition = mock(IPortletDefinition.class); when(portletDefinition.getPortletDescriptorKey()) .thenAnswer(invocation -> portletDescriptorKey); when(portletDefinition.getPortletPreferences()) .thenAnswer(invocation -> Collections.emptyList()); assertFalse(EXTRACTOR.appliesTo(portletDefinition)); }
@Override public boolean appliesTo(IPortletDefinition portlet) { final boolean portletMatch = portletName.equalsIgnoreCase(portlet.getPortletDescriptorKey().getPortletName()); final boolean webappMatch = webappName.equalsIgnoreCase(portlet.getPortletDescriptorKey().getWebAppName()); final boolean preferenceMatch = portlet.getPortletPreferences().stream() .anyMatch( preference -> preference.getName().equalsIgnoreCase(preferenceName)); return portletMatch && webappMatch && preferenceMatch; }
HtmlPortletPreferenceSearchContentExtractor implements ISearchContentExtractor { @Override public boolean appliesTo(IPortletDefinition portlet) { final boolean portletMatch = portletName.equalsIgnoreCase(portlet.getPortletDescriptorKey().getPortletName()); final boolean webappMatch = webappName.equalsIgnoreCase(portlet.getPortletDescriptorKey().getWebAppName()); final boolean preferenceMatch = portlet.getPortletPreferences().stream() .anyMatch( preference -> preference.getName().equalsIgnoreCase(preferenceName)); return portletMatch && webappMatch && preferenceMatch; } }
HtmlPortletPreferenceSearchContentExtractor implements ISearchContentExtractor { @Override public boolean appliesTo(IPortletDefinition portlet) { final boolean portletMatch = portletName.equalsIgnoreCase(portlet.getPortletDescriptorKey().getPortletName()); final boolean webappMatch = webappName.equalsIgnoreCase(portlet.getPortletDescriptorKey().getWebAppName()); final boolean preferenceMatch = portlet.getPortletPreferences().stream() .anyMatch( preference -> preference.getName().equalsIgnoreCase(preferenceName)); return portletMatch && webappMatch && preferenceMatch; } HtmlPortletPreferenceSearchContentExtractor(
            String portletName, String webappName, String preferenceName); }
HtmlPortletPreferenceSearchContentExtractor implements ISearchContentExtractor { @Override public boolean appliesTo(IPortletDefinition portlet) { final boolean portletMatch = portletName.equalsIgnoreCase(portlet.getPortletDescriptorKey().getPortletName()); final boolean webappMatch = webappName.equalsIgnoreCase(portlet.getPortletDescriptorKey().getWebAppName()); final boolean preferenceMatch = portlet.getPortletPreferences().stream() .anyMatch( preference -> preference.getName().equalsIgnoreCase(preferenceName)); return portletMatch && webappMatch && preferenceMatch; } HtmlPortletPreferenceSearchContentExtractor(
            String portletName, String webappName, String preferenceName); @Override boolean appliesTo(IPortletDefinition portlet); @Override String extractContent(IPortletDefinition portlet); }
HtmlPortletPreferenceSearchContentExtractor implements ISearchContentExtractor { @Override public boolean appliesTo(IPortletDefinition portlet) { final boolean portletMatch = portletName.equalsIgnoreCase(portlet.getPortletDescriptorKey().getPortletName()); final boolean webappMatch = webappName.equalsIgnoreCase(portlet.getPortletDescriptorKey().getWebAppName()); final boolean preferenceMatch = portlet.getPortletPreferences().stream() .anyMatch( preference -> preference.getName().equalsIgnoreCase(preferenceName)); return portletMatch && webappMatch && preferenceMatch; } HtmlPortletPreferenceSearchContentExtractor(
            String portletName, String webappName, String preferenceName); @Override boolean appliesTo(IPortletDefinition portlet); @Override String extractContent(IPortletDefinition portlet);  }