FormActionTypeDataSourceServlet extends SlingSafeMethodsServlet { @Override protected void doGet(@NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response) throws ServletException, IOException { SimpleDataSource actionTypeDataSource = new SimpleDataSource(getActionTypeResources( request.getResourceResolver()).iterator()); request.setAttribute(DataSource.class.getName(), actionTypeDataSource); }   final static String RESOURCE_TYPE; }
@Test public void testDataSource() throws Exception { context.currentResource("/apps/actiontypedatasource"); FormActionTypeDataSourceServlet dataSourceServlet = new FormActionTypeDataSourceServlet(); dataSourceServlet.doGet(context.request(), context.response()); DataSource dataSource = (com.adobe.granite.ui.components.ds.DataSource) context.request().getAttribute( DataSource.class.getName()); assertNotNull(dataSource); Resource resource = dataSource.iterator().next(); assertEquals("Form Action", resource.getValueMap().get(PN_TEXT, String.class)); assertEquals("form/action", resource.getValueMap().get(PN_VALUE, String.class)); }