コード例 #1
0
 @Test
 public void testGetConfigFieldInheritor_docRef() throws Exception {
   PageLayoutCommand mockPageLayoutCmd = createMock(PageLayoutCommand.class);
   _factory.injectPageLayoutCmd(mockPageLayoutCmd);
   String className = "mySpace.myClassName";
   String fullName = "mySpace.myDocName";
   DocumentReference docRef =
       new DocumentReference(_context.getDatabase(), "mySpace", "myDocName");
   DocumentReference classDocRef =
       new DocumentReference(_context.getDatabase(), "mySpace", "myClassName");
   List<String> docList = new ArrayList<String>();
   docList.add("xwikidb:" + fullName);
   docList.add("xwikidb:mySpace.WebPreferences");
   docList.add("xwikidb:XWiki.XWikiPreferences");
   replayAll(mockPageLayoutCmd);
   FieldInheritor fieldInheritor = _factory.getConfigFieldInheritor(classDocRef, docRef);
   XObjectIterator iterator = fieldInheritor.getIteratorFactory().createIterator();
   verifyAll(mockPageLayoutCmd);
   assertEquals("xwikidb:" + className, iterator.getClassName());
   assertEquals(docList, iterator.getDocListCopy());
 }
コード例 #2
0
 @Test
 public void testGetConfigDocFieldInheritor_fullnames() throws Exception {
   PageLayoutCommand mockPageLayoutCmd = createMock(PageLayoutCommand.class);
   _factory.injectPageLayoutCmd(mockPageLayoutCmd);
   String className = "mySpace.myClassName";
   String fullName = "mySpace.myDocName";
   List<String> docList = new ArrayList<String>();
   docList.add("mySpace.WebPreferences");
   docList.add("XWiki.XWikiPreferences");
   DocumentReference webHomeDocRef =
       new DocumentReference(_context.getDatabase(), "mySpace", "WebHome");
   expect(_xwiki.exists(eq(webHomeDocRef), same(_context))).andReturn(false).anyTimes();
   expect(mockPageLayoutCmd.getPageLayoutForDoc(eq(fullName), same(_context))).andReturn(null);
   expect(_xwiki.getSpacePreference(eq("skin"), same(_context))).andReturn(null);
   replayAll(mockPageLayoutCmd);
   FieldInheritor fieldInheritor =
       _factory.getConfigDocFieldInheritor(className, fullName, _context);
   XObjectIterator iterator = fieldInheritor.getIteratorFactory().createIterator();
   verifyAll(mockPageLayoutCmd);
   assertEquals(className, iterator.getClassName());
   assertEquals(docList, iterator.getDocListCopy());
 }