use of com.adobe.cq.wcm.core.components.internal.servlets.TextValueDataResourceSource in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class AllowedEmbeddablesDataSourceServletTest method validateAllowedEmbeddables.
private void validateAllowedEmbeddables(DataSource dataSource, TextValueDataResourceSource... textValueDataResourceSources) {
Iterator<Resource> iterator = dataSource.iterator();
int items = 0;
while (iterator.hasNext()) {
TextValueDataResourceSource textValueDataResourceSource = (TextValueDataResourceSource) iterator.next();
assertEquals(textValueDataResourceSources[items].getValue(), textValueDataResourceSource.getValue());
assertEquals(textValueDataResourceSources[items].getText(), textValueDataResourceSource.getText());
items++;
}
assertEquals(textValueDataResourceSources.length, items);
}
use of com.adobe.cq.wcm.core.components.internal.servlets.TextValueDataResourceSource in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class AllowedEmbeddablesDataSourceServletTest method getExpectedAllowedEmbeddables.
private TextValueDataResourceSource[] getExpectedAllowedEmbeddables(String[][] expectedAllowedEmbeddables) {
TextValueDataResourceSource[] textValueDataResourceSources = new TextValueDataResourceSource[expectedAllowedEmbeddables.length];
for (int i = 0; i < expectedAllowedEmbeddables.length; i++) {
final int index = i;
textValueDataResourceSources[i] = new TextValueDataResourceSource(context.resourceResolver(), "", "") {
@Override
public String getText() {
return expectedAllowedEmbeddables[index][0];
}
@Override
public String getValue() {
return expectedAllowedEmbeddables[index][1];
}
};
}
return textValueDataResourceSources;
}
Aggregations