@Test @UseVersion(ANY_BUT_5_5) public void testAddNewWorkflowStep() throws Exception { // get the root flow par system ParSys flow = modelPageAdmin.getFlow(); // add a new participant step Participant p = cAdminClient.addComponent( Participant.class, flow.getPagePath(), "/jcr:content/flow/", null, null); // set a user p.setProperty(Participant.PROP_PARTICIPANT, wUserId1); // save the component p.save(); // save the edited flow so model gets updated modelPageAdmin.save(); // after this change there should be 4 nodes (start, participant 1, participant 2, end) and 3 // transitions // node,1->2,2-3,3-4 String ref = ResourceUtil.readResourceAsString(JSON_ADD_NEW_STEP); // workflow returns specific model json when requesting the model node. String test = wAdminClient .http .doGet(modelPageAdmin.getModelPagePath() + "/jcr:content/model.json") .getContent(); ArrayList<String> ignore = new ArrayList<String>(); ignore.add("cq:lastModifiedBy"); ignore.add("cq:lastModified"); ignore.add("version"); // compare the reference with the returned json GraniteAssert.assertJsonEquals(ref, test, ignore); }
@Before public void registerWorkflowModelComponents() throws ClientException { // default test model page testModelPath = wAdminClient.createNewModelPage(wModelName, wModelTitle).getPath(); wAdminClient.saveModel(testModelPath); // prepare a wrapper for admin user modelPageAdmin = new WorkflowModelPage(testModelPath, wAdminClient); // register workflow model components cAdminClient = wAdminClient.getClient(ComponentClient.class); cAdminClient.registerComponent(Participant.RESOURCE_TYPE, Participant.class); }