use of com.adobe.granite.ui.components.ds.DataSource in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ElementsDataSourceServletTest method testComponentPathStructured.
@Test
void testComponentPathStructured() throws ServletException, IOException {
DataSource dataSource = getDataSource(servlet, DS_COMPONENT_PATH_STRUCTURED);
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 testComponentPathInvalid.
@Test
void testComponentPathInvalid() throws ServletException, IOException {
DataSource dataSource = getDataSource(servlet, DS_COMPONENT_PATH_INVALID);
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 AllowedEmbeddablesDataSourceServletTest method testAllowedEmbeddablesDesignDataSourceServlet.
@Test
public void testAllowedEmbeddablesDesignDataSourceServlet() {
Designer designer = mock(Designer.class);
context.registerAdapter(ResourceResolver.class, Designer.class, (Function<ResourceResolver, Designer>) input -> designer);
Resource styleResource = context.resourceResolver().getResource("/apps/etc/designs/embed");
MockStyle mockStyle = new MockStyle(styleResource, styleResource.getValueMap());
when(designer.getStyle(any(Resource.class))).thenReturn(mockStyle);
context.request().setAttribute(Value.CONTENTPATH_ATTRIBUTE, CURRENT_PATH);
dataSourceServlet.doGet(context.request(), context.response());
DataSource dataSource = (DataSource) context.request().getAttribute(DataSource.class.getName());
assertNotNull(dataSource);
validateAllowedEmbeddables(dataSource, getExpectedAllowedEmbeddables(new String[][] { { "Select", "" }, { "Chatbot", "/apps/my-app/chatbot" }, { "Social", "/apps/my-app/social" } }));
}
use of com.adobe.granite.ui.components.ds.DataSource in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class EmbeddablesDataSourceServletTest method testEmbeddablesDataSourceServlet.
@Test
public void testEmbeddablesDataSourceServlet() {
context.currentResource("/apps/embeddablesdatasource");
EmbeddablesDataSourceServlet dataSourceServlet = new EmbeddablesDataSourceServlet();
dataSourceServlet.doGet(request, context.response());
DataSource dataSource = (com.adobe.granite.ui.components.ds.DataSource) request.getAttribute(DataSource.class.getName());
assertNotNull(dataSource);
Resource resource = dataSource.iterator().next();
ValueMap valueMap = resource.getValueMap();
assertEquals("YouTube", valueMap.get(TextValueDataResourceSource.PN_TEXT, String.class));
assertEquals("my-app/youtube", valueMap.get(TextValueDataResourceSource.PN_VALUE, String.class));
EmbeddableDescription embed1 = new EmbeddableDescription(null, embeddableResources.get(1).getName(), embeddableResources.get(1).getValueMap());
EmbeddableDescription embed2 = new EmbeddableDescription(null, embeddableResources.get(0).getName(), embeddableResources.get(0).getValueMap());
assertNotEquals(embed2, embed1);
assertNotNull(embed1.hashCode());
}
use of com.adobe.granite.ui.components.ds.DataSource in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class VariationsDataSourceServletTest method testFragmentPathStructured.
@Test
void testFragmentPathStructured() throws ServletException, IOException {
DataSource dataSource = getDataSource(servlet, DS_FRAGMENT_PATH_STRUCTURED);
assertDataSource(dataSource, VARIATION_NAMES, VARIATION_TITLES);
}
Aggregations