Ejemplo n.º 1
0
 @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);
 }
Ejemplo n.º 2
0
 /**
  * tests if the minimal node structure of the model page is there and correct.
  *
  * @throws ClientException if a request to the server fails for any reason
  */
 @Category(SmokeTest.class)
 @Test
 public void testDefaultModelPageStructure() throws ClientException {
   // check if model and flow node exist
   Assert.assertFalse(
       "The flow node is missing on the model page!",
       modelPageAdmin.getFlowNode().isMissingNode());
   Assert.assertFalse(
       "The model node is missing on the model page!",
       modelPageAdmin.getModelNode().isMissingNode());
   // there should be a default participant step
   // get the root flow par system
   ParSys flow = modelPageAdmin.getFlow();
   // get the first child by default there is always a first participant step
   Participant p = flow.getFirstChild();
   Assert.assertNotNull("There is no default participant step on new Workflow Page!", p);
   // the model should have a node and transitions sub section
   Assert.assertFalse(
       "The model is missing the 'nodes' section!",
       modelPageAdmin.getModelNode().get("nodes").isMissingNode());
   Assert.assertFalse(
       "The model is missing the 'transitions' section!",
       modelPageAdmin.getModelNode().get("transitions").isMissingNode());
 }