コード例 #1
0
 @Test
 public void testGetFieldInheritor() {
   String className = "TestClassName";
   List<String> docList = new ArrayList<String>();
   docList.add("my.Doc");
   docList.add("my.Doc2");
   FieldInheritor inheritor = _factory.getFieldInheritor(className, docList, _context);
   XObjectIterator iterator = inheritor.getIteratorFactory().createIterator();
   assertEquals(className, iterator.getClassName());
   assertEquals(docList, iterator.getDocListCopy());
 }
コード例 #2
0
 @Test
 public void testGetPageLayoutInheritor() {
   String className = "Celements2.PageType";
   String fullName = "mySpace.myDoc";
   List<String> docList = new ArrayList<String>();
   docList.add(fullName);
   docList.add("mySpace.WebPreferences");
   docList.add("XWiki.XWikiPreferences");
   FieldInheritor inheritor = _factory.getPageLayoutInheritor(fullName, _context);
   XObjectIterator iterator = inheritor.getIteratorFactory().createIterator();
   assertEquals(className, iterator.getClassName());
   assertEquals(docList, iterator.getDocListCopy());
 }
コード例 #3
0
 @Test
 public void testGetNavigationFieldInheritor() {
   String className = "Tools.Banner";
   String fullName = "mySpace.myDoc";
   List<String> docList = new ArrayList<String>();
   docList.add(fullName);
   docList.add("myparent.Doc");
   docList.add("myparent.Doc2");
   expect(_mockWebUtils.getDocumentParentsList(eq(fullName), eq(true), same(_context)))
       .andReturn(docList);
   replayAll();
   FieldInheritor inheritor = _factory.getNavigationFieldInheritor(className, fullName, _context);
   XObjectIterator iterator = inheritor.getIteratorFactory().createIterator();
   assertEquals(className, iterator.getClassName());
   assertEquals(docList, iterator.getDocListCopy());
   verifyAll();
 }
コード例 #4
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());
 }
コード例 #5
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());
 }