@Test
  public void testGetWriters() {

    // get the query writers set of "paymentInfo" for "AssignE"
    Activity act = MyBPELUtils.resolveActivity("AssignE", process);
    Variable var = MyBPELUtils.resolveVariable("paymentInfo", process);
    QueryWriterSet assignEAndPaymentInfo = AnalysisResultParser.parse(act, var, analysis);

    // get the writers union
    Set<Activity> writers = assignEAndPaymentInfo.getAllWriters();

    assertNotNull(writers);
    assertEquals(3, writers.size());

    // the 3 writers are "AssignB", "AssignC", "AssignD"
    List<String> wrtNames = Arrays.asList(new String[] {"AssignB", "AssignC", "AssignD"});
    for (Activity actWriter : writers) {
      assertTrue(wrtNames.contains(actWriter.getName()));
    }
  }
 public void mergeQuerySet(Map<Set<String>, Set<Activity>> qws) {
   super.mergeQuerySet(qws);
 }
  @Test
  public void testGetQueryWriterSetForNode() {
    Set<String> qs1 = new HashSet<String>();
    Set<String> qs2 = new HashSet<String>();
    Set<String> qs3 = new HashSet<String>();
    Set<String> qs4 = new HashSet<String>();
    Set<String> qs5 = new HashSet<String>();
    Set<String> qs6 = new HashSet<String>();
    Set<Activity> as1 = new HashSet<Activity>();
    Set<Activity> as2 = new HashSet<Activity>();
    Set<Activity> as3 = new HashSet<Activity>();
    Set<Activity> as4 = new HashSet<Activity>();
    Set<Activity> as5 = new HashSet<Activity>();
    Set<Activity> as6 = new HashSet<Activity>();
    Activity A = BPELFactory.eINSTANCE.createActivity();
    Activity B = BPELFactory.eINSTANCE.createActivity();
    Activity C = BPELFactory.eINSTANCE.createActivity();
    Activity D = BPELFactory.eINSTANCE.createActivity();
    Activity E = BPELFactory.eINSTANCE.createActivity();
    Activity F = BPELFactory.eINSTANCE.createActivity();

    A.setName("A");
    B.setName("B");
    C.setName("C");
    D.setName("D");
    E.setName("E");
    F.setName("F");
    qs1.add(".a");
    qs2.add(".b");
    qs3.add(".c");
    qs4.add(".d");
    qs5.add(".e");
    qs6.add(".f");
    as1.add(A);
    as1.add(D);
    as2.add(A);
    as2.add(E);
    as3.add(A);
    as4.add(B);
    as4.add(D);
    as5.add(B);
    as5.add(E);
    as6.add(C);

    Map<Set<String>, Set<Activity>> qs2wsMap = new HashMap<Set<String>, Set<Activity>>();
    qs2wsMap.put(qs1, as1);
    qs2wsMap.put(qs2, as2);
    qs2wsMap.put(qs3, as3);
    qs2wsMap.put(qs4, as4);
    qs2wsMap.put(qs5, as5);
    qs2wsMap.put(qs6, as6);
    // now we have the tuples (query set: writer set) - {x.a}:{A,D},
    // {x.b}:{A,E}, {x.c}:{A}, {x.d}:{B, D},
    // {x.e}:{B,E}, {x.f}:{C}

    // create a queryWriterSet
    Activity a = BPELFactory.eINSTANCE.createActivity();
    Variable x = BPELFactory.eINSTANCE.createVariable();
    MyQueryWriterSet myqws = new MyQueryWriterSet(a, x, qs2wsMap);
    // now create a pwdg node
    PWDGNode node = new PWDGNode();
    WDGNode wnode1 = new WDGNode(A);
    WDGNode wnode2 = new WDGNode(B);
    node.add(wnode1);
    node.add(wnode2);
    // now we try the getQuerywriterSetFor the pwdgNode
    QueryWriterSet qwsForNode = myqws.getQueryWriterSetFor(node);
    assertNotNull(qwsForNode);
    assertEquals(qwsForNode.getActivity(), myqws.getActivity());
    assertEquals(qwsForNode.getVariable(), myqws.getVariable());
    // the writer set now is {A, B}
    assertEquals(qwsForNode.getAllWriters().size(), 2);
    assertTrue(qwsForNode.getAllWriters().contains(A));
    assertTrue(qwsForNode.getAllWriters().contains(B));
    // the node filtered queryWriterSet should contain {x.a, x.b, x.c}:{A}
    Set<String> expectedQs = new HashSet<String>();
    expectedQs.add(".a");
    expectedQs.add(".b");
    expectedQs.add(".c");
    Set<Activity> expectedWs = new HashSet<Activity>();
    expectedWs.add(A);
    Set<Activity> actualWs = qwsForNode.get(expectedQs);
    assertNotNull(actualWs);
    assertTrue(expectedWs.equals(actualWs));
    // the node filtered queryWriterSet should contain {x.d, x.e}:{B}
    expectedQs.clear();
    expectedQs.add(".d");
    expectedQs.add(".e");
    expectedWs.clear();
    expectedWs.add(B);
    actualWs = qwsForNode.get(expectedQs);
    assertNotNull(actualWs);
    assertTrue(expectedWs.equals(actualWs));

    // for pwdg node {F}, the query writer set is empty
    WDGNode wdgNodeF = new WDGNode(F);
    PWDGNode node2 = new PWDGNode();
    node2.add(wdgNodeF);
    QueryWriterSet qwsForNodeF = myqws.getQueryWriterSetFor(node2);
    assertNotNull(qwsForNodeF);
    assertTrue(qwsForNodeF.isEmpty());
  }