use of com.adobe.granite.ui.components.ds.DataSource in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class AbstractContentFragmentDataSourceServletTest method getDataSource.
/**
* Calls the servlet with the specified datasource resource and returns the resulting datasource.
*/
DataSource getDataSource(AbstractContentFragmentDataSourceServlet servlet, String name) throws ServletException, IOException {
// get datasource resource
ResourceResolver resolver = context.resourceResolver();
Resource dataSource = resolver.getResource(DATASOURCES_PATH + "/" + name);
// mock the request and request resource
Resource resource = mock(Resource.class);
when(resource.getChild(Config.DATASOURCE)).thenReturn(dataSource);
MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(resolver, context.bundleContext());
request.setResource(resource);
// call the servlet
servlet.doGet(request, new MockSlingHttpServletResponse());
// return the resulting datasource
return (DataSource) request.getAttribute(DataSource.class.getName());
}
use of com.adobe.granite.ui.components.ds.DataSource in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ElementsDataSourceServletTest method testComponentPathStructuredDisplayModeSingle.
@Test
void testComponentPathStructuredDisplayModeSingle() throws ServletException, IOException {
DataSource dataSource = getDataSource(servlet, DS_COMPONENT_PATH_STRUCTURED_DISPLAY_MODE_SINGLE);
assertDataSource(dataSource, ELEMENT_NAMES_MULTILINE_TEXT_ONLY, ELEMENT_TITLES_MULTILINE_TEXT_ONLY);
}
use of com.adobe.granite.ui.components.ds.DataSource in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ElementsDataSourceServletTest method testFragmentPathOverride.
@Test
void testFragmentPathOverride() throws ServletException, IOException {
DataSource dataSource = getDataSource(servlet, DS_FRAGMENT_PATH_OVERRIDE);
assertDataSource(dataSource, ELEMENT_NAMES, ELEMENT_TITLES);
}
use of com.adobe.granite.ui.components.ds.DataSource in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ElementsDataSourceServletTest method testComponentPathInvalidFragmentPath.
@Test
void testComponentPathInvalidFragmentPath() throws ServletException, IOException {
DataSource dataSource = getDataSource(servlet, DS_COMPONENT_PATH_INVALID_FRAGMENT_PATH);
assertDataSource(dataSource, new String[0], new String[0]);
}
use of com.adobe.granite.ui.components.ds.DataSource in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ElementsDataSourceServletTest method testFragmentPathInvalid.
@Test
void testFragmentPathInvalid() throws ServletException, IOException {
DataSource dataSource = getDataSource(servlet, DS_FRAGMENT_PATH_INVALID);
assertDataSource(dataSource, new String[0], new String[0]);
}
Aggregations