Package com.day.cq.workflow.exec

Examples of com.day.cq.workflow.exec.WorkflowData


    @Test
    public void test_with_rendition_arg_getting_no_rendition_is_noop() throws Exception {
        String path = "/content/dam/some/path.ext";

        WorkItem workItem = mock(WorkItem.class);
        WorkflowData data = mock(WorkflowData.class);
        when(workItem.getWorkflowData()).thenReturn(data);
        when(data.getPayloadType()).thenReturn(AbstractAssetWorkflowProcess.TYPE_JCR_PATH);
        when(data.getPayload()).thenReturn(path);

        Resource resource = mock(Resource.class);
        Asset asset = mock(Asset.class);
        when(resource.adaptTo(Asset.class)).thenReturn(asset);
        when(resource.getResourceType()).thenReturn(DamConstants.NT_DAM_ASSET);
View Full Code Here


    @Test
    public void test_with_rendition_arg_getting_real_rendition() throws Exception {
        String path = "/content/dam/some/path.ext";

        WorkItem workItem = mock(WorkItem.class);
        WorkflowData data = mock(WorkflowData.class);
        when(workItem.getWorkflowData()).thenReturn(data);
        when(data.getPayloadType()).thenReturn(AbstractAssetWorkflowProcess.TYPE_JCR_PATH);
        when(data.getPayload()).thenReturn(path);

        Resource resource = mock(Resource.class);
        Asset asset = mock(Asset.class);
        Rendition rendition = mock(Rendition.class);
        when(resource.adaptTo(Asset.class)).thenReturn(asset);
View Full Code Here

    }

    @Test
    public void test_with_payload_notJcrPath_is_noop() throws Exception {
        WorkflowData workflowData = mock(WorkflowData.class);
        when(workItem.getWorkflowData()).thenReturn(workflowData);
        when(workflowData.getPayloadType()).thenReturn("");
        MetaDataMap metaData = new SimpleMetaDataMap();

        process.execute(workItem, workflowSession, metaData);

        verifyZeroInteractions(harness);
View Full Code Here

        verifyZeroInteractions(harness);
    }

    @Test
    public void test_with_no_template_args_is_noop() throws Exception {
        WorkflowData workflowData = mock(WorkflowData.class);
        when(workItem.getWorkflowData()).thenReturn(workflowData);
        when(workflowData.getPayloadType()).thenReturn("JCR_PATH");
        MetaDataMap metaData = new SimpleMetaDataMap();
        metaData.put("PROCESS_ARGS", "");
        process.execute(workItem, workflowSession, metaData);

        verifyZeroInteractions(harness);
View Full Code Here

        Map<String, String> expectedEmailParams = new HashMap<String, String>();
        expectedEmailParams.put(SendTemplatedEmailConstants.JCR_PATH, DAM_PAYLOAD_PATH);
        expectedEmailParams.put(SendTemplatedEmailConstants.AUTHOR_LINK, editAssetUrl);
        expectedEmailParams.put(SendTemplatedEmailConstants.PUBLISH_LINK, publishUrl);

        WorkflowData workflowData = mock(WorkflowData.class);
        when(workItem.getWorkflowData()).thenReturn(workflowData);
        when(workflowData.getPayloadType()).thenReturn("JCR_PATH");
        MetaDataMap metaData = new SimpleMetaDataMap();
        metaData.put("PROCESS_ARGS", "sendTo:" + GROUP_PATH + ",emailTemplate:" + EMAIL_TEMPLATE);

        // expected build args
        String[] expectedBuildArgs = new String[] { "sendTo:" + GROUP_PATH, "emailTemplate:" + EMAIL_TEMPLATE };
        Object payload = mock(Object.class);
        when(workflowData.getPayload()).thenReturn(payload);
        when(payload.toString()).thenReturn(DAM_PAYLOAD_PATH);

        // mock payload resource
        Resource payloadRes = mock(Resource.class);
        when(resourceResolver.getResource(DAM_PAYLOAD_PATH)).thenReturn(payloadRes);
View Full Code Here

        Map<String, String> expectedEmailParams = new HashMap<String, String>();
        expectedEmailParams.put(SendTemplatedEmailConstants.JCR_PATH, WCM_PAYLOAD_PATH);
        expectedEmailParams.put(SendTemplatedEmailConstants.AUTHOR_LINK, editPageUrl + ".html");
        expectedEmailParams.put(SendTemplatedEmailConstants.PUBLISH_LINK, publishUrl + ".html");

        WorkflowData workflowData = mock(WorkflowData.class);
        when(workItem.getWorkflowData()).thenReturn(workflowData);
        when(workflowData.getPayloadType()).thenReturn("JCR_PATH");
        MetaDataMap metaData = new SimpleMetaDataMap();
        metaData.put("PROCESS_ARGS", "sendTo:" + GROUP_PATH + ",emailTemplate:" + EMAIL_TEMPLATE);

        // expected build args
        String[] expectedBuildArgs = new String[] { "sendTo:" + GROUP_PATH, "emailTemplate:" + EMAIL_TEMPLATE };
        Object payload = mock(Object.class);
        when(workflowData.getPayload()).thenReturn(payload);
        when(payload.toString()).thenReturn(WCM_PAYLOAD_PATH);

        // mock payload resource
        Resource payloadRes = mock(Resource.class);
        when(resourceResolver.getResource(WCM_PAYLOAD_PATH)).thenReturn(payloadRes);
View Full Code Here

    @Override
    public final void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaData)
            throws WorkflowException {

        final WorkflowData workflowData = workItem.getWorkflowData();
        final String type = workflowData.getPayloadType();

        // Check if the payload is a path in the JCR
        if (!StringUtils.equals(type, "JCR_PATH")) {
            return;
        }

        String[] args = buildArguments(metaData);

        // process arguments
        String emailTemplate = getValueFromArgs(Arguments.TEMPLATE.getArgumentName(), args);

        if (emailTemplate == null) {
            log.warn("Invalid process arguments, returning");
            return;
        }

        // set date format to be used in emails
        String sdfParam = getValueFromArgs(Arguments.DATE_FORMAT.getArgumentName(), args);
        SimpleDateFormat sdf = getSimpleDateFormat(sdfParam);

        // Get the path to the JCR resource from the payload
        final String payloadPath = workflowData.getPayload().toString();

        // Get ResourceResolver
        final Map<String, Object> authInfo = new HashMap<String, Object>();
        authInfo.put(JcrResourceConstants.AUTHENTICATION_INFO_SESSION, workflowSession.getSession());
        final ResourceResolver resourceResolver;
View Full Code Here

    private WorkflowPackageManager workflowPackageManager;

    @Override
    public final void execute(WorkItem workItem, WorkflowSession workflowSession,
                         MetaDataMap args) throws WorkflowException {
        final WorkflowData workflowData = workItem.getWorkflowData();

        final String type = workflowData.getPayloadType();

        // Check if the payload is a path in the JCR
        if (!StringUtils.equals(type, "JCR_PATH")) {
            return;
        }
        // Get the path to the JCR resource from the payload
        final String payloadPath = workflowData.getPayload().toString();

        // Get ResourceResolver
        final Map<String, Object> authInfo = new HashMap<String, Object>();
        authInfo.put(AUTHENTICATION_INFO_SESSION, workflowSession.getSession());
        final ResourceResolver resourceResolver;
View Full Code Here

TOP

Related Classes of com.day.cq.workflow.exec.WorkflowData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.