Iterator iterCE = gC.listEffVals().iterator(); while (iterCE.hasNext()) { GrouperList lv = (GrouperList) iterCE.next(); if (lv.chain().size() == 1) { Assert.assertTrue("gC chain == 1", true); Assert.assertEquals("gC member() == m0", m0, lv.member()); if        (lv.via().equals(gA)) { Assert.assertTrue("gC via() == gA", true); Iterator iterVia = lv.chain().iterator(); while (iterVia.hasNext()) { MemberVia   mv  = (MemberVia) iterVia.next(); GrouperList lvv = mv.toList(s); Assert.assertTrue("gC via g == gC", lvv.group().equals(gC)); Assert.assertTrue( "gC via m == gA", lvv.member().toGroup().equals(gA) ); } } else if (lv.via().equals(gB)) { Assert.assertTrue("gC via() == gB", true); Iterator iterVia = lv.chain().iterator(); while (iterVia.hasNext()) { MemberVia   mv  = (MemberVia) iterVia.next(); GrouperList lvv = mv.toList(s); Assert.assertTrue("gC via g == gC", lvv.group().equals(gC)); Assert.assertTrue( "gC via m == gB", lvv.member().toGroup().equals(gB) ); } } else { Assert.fail("gC via != (gA, gB)"); } } else { Assert.fail("gC chain != 1"); } }
  public void testMoF() {    Subject subj = GrouperSubject.load(Constants.rootI, Constants.rootT);    GrouperSession s = GrouperSession.start(subj);    // Create ns0    GrouperStem ns0 = GrouperStem.create(                         s, Constants.ns0s, Constants.ns0e                       );    // Create ns1    GrouperStem ns1 = GrouperStem.create(                         s, Constants.ns1s, Constants.ns1e                       );    // Create gA    GrouperGroup gA  = GrouperGroup.create(                         s, Constants.gAs, Constants.gAe                       );    // Create gB    GrouperGroup gB  = GrouperGroup.create(                         s, Constants.gBs, Constants.gBe                       );    // Create gC    GrouperGroup gC  = GrouperGroup.create(                         s, Constants.gCs, Constants.gCe                       );    // Load m0    GrouperMember m0 = GrouperMember.load(                         s, Constants.mem0I, Constants.mem0T                       );    // Add m0 to gA's "members"    try {      gA.listAddVal(m0);    } catch (RuntimeException e) {      Assert.fail("add m0 to gA");    }    // Add m0 to gB's "members"    try {      gB.listAddVal(m0);    } catch (RuntimeException e) {      Assert.fail("add m0 to gB");    }    // Add gA to gC's "members"    try {      gC.listAddVal(gA.toMember());    } catch (RuntimeException e) {      Assert.fail("add gA to gC");    }    // Add gB to gC's "members"    try {      gC.listAddVal(gB.toMember());    } catch (RuntimeException e) {      Assert.fail("add gB to gC");    }    // Now inspect gA's, resulting list values    Assert.assertTrue(      "gA members == 1", gA.listVals("members").size() == 1    );    Assert.assertTrue(      "gA imm members == 1", gA.listImmVals("members").size() == 1    );    Assert.assertTrue(      "gA eff members == 0", gA.listEffVals("members").size() == 0    );    // Now inspect gB's, resulting list values    Assert.assertTrue(      "gB members == 1", gB.listVals("members").size() == 1    );    Assert.assertTrue(      "gB imm members == 1", gB.listImmVals("members").size() == 1    );    Assert.assertTrue(      "gB eff members == 0", gB.listEffVals("members").size() == 0    );    // Now inspect gC's, resulting list values    Assert.assertTrue(      "gC members == 4", gC.listVals("members").size() == 4    );    Assert.assertTrue(      "gC imm members == 2", gC.listImmVals("members").size() == 2    );    Assert.assertTrue(      "gC eff members == 2", gC.listEffVals("members").size() == 2    );    s.stop();  }