use of com.xpn.xwiki.objects.classes.DBListClass in project xwiki-platform by xwiki.
the class UsedValuesListQueryBuilderTest method configure.
@Before
public void configure() throws Exception {
this.queryManager = this.mocker.getInstance(QueryManager.class);
this.authorization = this.mocker.getInstance(ContextualAuthorizationManager.class);
this.documentReferenceResolver = this.mocker.getInstance(DocumentReferenceResolver.TYPE_STRING, "current");
DocumentReference oneReference = new DocumentReference("wiki", "Page", "one");
when(this.documentReferenceResolver.resolve("alice")).thenReturn(oneReference);
when(this.authorization.hasAccess(Right.VIEW, oneReference)).thenReturn(false);
DocumentReference twoReference = new DocumentReference("wiki", "Page", "two");
when(this.documentReferenceResolver.resolve("alice")).thenReturn(twoReference);
when(this.authorization.hasAccess(Right.VIEW, twoReference)).thenReturn(true);
BaseClass xclass = new BaseClass();
xclass.setDocumentReference(new DocumentReference("apps", "Blog", "BlogPostClass"));
PropertyMetaClass metaClass = mock(PropertyMetaClass.class);
when(metaClass.getName()).thenReturn("Blog.BlogPostClass");
this.listClass = new DBListClass();
this.listClass.setName("category");
this.listClass.setObject(xclass);
this.listClass.setxWikiClass(metaClass);
}
use of com.xpn.xwiki.objects.classes.DBListClass in project xwiki-platform by xwiki.
the class PropertyConverterTest method singleToMultipleSelectOnDBList.
@Test
public void singleToMultipleSelectOnDBList() throws Exception {
// The Database List property that was switched from single select to multiple select.
DBListClass dbListClass = mock(DBListClass.class);
when(dbListClass.isMultiSelect()).thenReturn(true);
StringListProperty stringListProperty = mock(StringListProperty.class);
when(dbListClass.newProperty()).thenReturn(stringListProperty);
StringProperty stringProperty = mock(StringProperty.class);
when(stringProperty.getValue()).thenReturn("one");
assertEquals(stringListProperty, this.mocker.getComponentUnderTest().convertProperty(stringProperty, dbListClass));
verify(stringListProperty).setValue(Arrays.asList("one"));
}
use of com.xpn.xwiki.objects.classes.DBListClass in project xwiki-platform by xwiki.
the class PropertyConverterTest method singleToMultipleSelectOnUnsetDBList.
@Test
public void singleToMultipleSelectOnUnsetDBList() throws Exception {
// The Database List property that was switched from single select to multiple select.
DBListClass dbListClass = mock(DBListClass.class);
when(dbListClass.isMultiSelect()).thenReturn(true);
StringProperty stringProperty = mock(StringProperty.class);
when(stringProperty.getValue()).thenReturn(null);
assertNull(this.mocker.getComponentUnderTest().convertProperty(stringProperty, dbListClass));
}
Aggregations