/** Creates some attachments and assigns them to the test workflow. */ @Test public void testAttachments() { final PK workflowPk = testWorkflow.getPK(); // create product attachment final Product product = jaloSession.getProductManager().createProduct("sabbers"); assertNotNull("Product not null", product); Map<String, Object> map = new HashMap<String, Object>(); map.put(WorkflowItemAttachment.CODE, "productTest"); map.put(WorkflowItemAttachment.ITEM, product); map.put(WorkflowItemAttachment.WORKFLOW, testWorkflow); final WorkflowItemAttachment attachProduct = WorkflowManager.getInstance().createWorkflowItemAttachment(map); assertNotNull("Attachment not null", attachProduct); // create category attachment final Category category = CategoryManager.getInstance().createCategory(PK.createUUIDPK(0).getHex()); assertNotNull("Category not null", category); map = new HashMap<String, Object>(); map.put(WorkflowItemAttachment.CODE, "categoryTest"); map.put(WorkflowItemAttachment.ITEM, category); map.put(WorkflowItemAttachment.WORKFLOW, testWorkflow); final WorkflowItemAttachment attachCategory = WorkflowManager.getInstance().createWorkflowItemAttachment(map); assertNotNull("Attachment not null", attachCategory); final WorkflowAction action1 = getAction(ACTIONCODES.ACTION1.name()); action1.setAttachments( Arrays.asList(new WorkflowItemAttachment[] {attachProduct, attachCategory})); // restart Registry.getCurrentTenant().getCache(); // check attachments final Workflow found = JaloSession.getCurrentSession().getItem(workflowPk); assertEquals("Excpected number of attachments", 2, found.getAttachments().size()); final WorkflowAction foundAction = getAction(ACTIONCODES.ACTION1.name()); assertEquals( "Excpected number of attachments of action 1", 2, foundAction.getAttachments().size()); }