Search in sources :

Example 1 with TitleAndNodeNameDefinitionBuilderImpl

use of com.adobe.acs.commons.util.datadefinitions.impl.TitleAndNodeNameDefinitionBuilderImpl in project acs-aem-commons by Adobe-Consulting-Services.

the class AssetFolderCreatorTest method setUp.

@Before
public void setUp() throws Exception {
    context.create().resource("/content/dam", JcrConstants.JCR_PRIMARYTYPE, "sling:Folder");
    context.resourceResolver().commit();
    final Map<String, ResourceDefinitionBuilder> resourceDefinitionBuilders = new HashMap<>();
    resourceDefinitionBuilders.put(AssetFolderCreator.AssetFolderBuilder.LOWERCASE_WITH_DASHES.name(), new LowercaseWithDashesDefinitionBuilderImpl());
    resourceDefinitionBuilders.put(AssetFolderCreator.AssetFolderBuilder.TITLE_AND_NODE_NAME.name(), new TitleAndNodeNameDefinitionBuilderImpl());
    resourceDefinitionBuilders.put(AssetFolderCreator.AssetFolderBuilder.TITLE_TO_NODE_NAME.name(), new JcrValidNameDefinitionBuilderImpl());
    assetFolderCreator = new AssetFolderCreator(resourceDefinitionBuilders);
    assetFolderCreator.excelFile = getClass().getResourceAsStream("/com/adobe/acs/commons/mcp/impl/processes/asset-folder-creator.xlsx");
    doAnswer(new Answer() {

        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            CheckedConsumer<ResourceResolver> method = (CheckedConsumer<ResourceResolver>) invocation.getArguments()[0];
            method.accept(context.resourceResolver());
            return null;
        }
    }).when(actionManager).withResolver(any(CheckedConsumer.class));
}
Also used : TitleAndNodeNameDefinitionBuilderImpl(com.adobe.acs.commons.util.datadefinitions.impl.TitleAndNodeNameDefinitionBuilderImpl) CheckedConsumer(com.adobe.acs.commons.functions.CheckedConsumer) HashMap(java.util.HashMap) LowercaseWithDashesDefinitionBuilderImpl(com.adobe.acs.commons.util.datadefinitions.impl.LowercaseWithDashesDefinitionBuilderImpl) Answer(org.mockito.stubbing.Answer) Mockito.doAnswer(org.mockito.Mockito.doAnswer) ResourceDefinitionBuilder(com.adobe.acs.commons.util.datadefinitions.ResourceDefinitionBuilder) JcrValidNameDefinitionBuilderImpl(com.adobe.acs.commons.util.datadefinitions.impl.JcrValidNameDefinitionBuilderImpl) InvocationOnMock(org.mockito.invocation.InvocationOnMock) ResourceResolver(org.apache.sling.api.resource.ResourceResolver) Before(org.junit.Before)

Aggregations

CheckedConsumer (com.adobe.acs.commons.functions.CheckedConsumer)1 ResourceDefinitionBuilder (com.adobe.acs.commons.util.datadefinitions.ResourceDefinitionBuilder)1 JcrValidNameDefinitionBuilderImpl (com.adobe.acs.commons.util.datadefinitions.impl.JcrValidNameDefinitionBuilderImpl)1 LowercaseWithDashesDefinitionBuilderImpl (com.adobe.acs.commons.util.datadefinitions.impl.LowercaseWithDashesDefinitionBuilderImpl)1 TitleAndNodeNameDefinitionBuilderImpl (com.adobe.acs.commons.util.datadefinitions.impl.TitleAndNodeNameDefinitionBuilderImpl)1 HashMap (java.util.HashMap)1 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)1 Before (org.junit.Before)1 Mockito.doAnswer (org.mockito.Mockito.doAnswer)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 Answer (org.mockito.stubbing.Answer)1