use of org.talend.mdm.repository.core.IRepositoryNodeLabelProvider in project tmdm-studio-se by Talend.
the class RecycleBinLabelProvider method getImage.
@Override
public Image getImage(Object element) {
if (element instanceof IRepositoryViewObject) {
IRepositoryViewObject viewObj = (IRepositoryViewObject) element;
ERepositoryObjectType type = viewObj.getRepositoryObjectType();
if (type == IServerObjectRepositoryType.TYPE_RECYCLE_BIN) {
if (viewObj instanceof FolderRepositoryObject) {
return ((FolderRepositoryObject) viewObj).getChildren().isEmpty() ? EMPTY_IMG : FULL_IMG;
}
}
IRepositoryNodeConfiguration configuration = RepositoryNodeConfigurationManager.getConfiguration(type);
if (configuration != null) {
IRepositoryNodeLabelProvider labelProvider = configuration.getLabelProvider();
return labelProvider.getImage(element);
}
}
return null;
}
use of org.talend.mdm.repository.core.IRepositoryNodeLabelProvider in project tmdm-studio-se by Talend.
the class RepositoryResourceUtilTest method testGetCategoryViewObject.
/**
* Test for: getCategoryViewObject(IRepositoryNodeConfiguration conf)
*/
@Test
public void testGetCategoryViewObject() throws Exception {
IRepositoryNodeConfiguration mockConfiguration = mock(IRepositoryNodeConfiguration.class);
IRepositoryNodeResourceProvider mockResourceProvider = mock(IRepositoryNodeResourceProvider.class);
when(mockConfiguration.getResourceProvider()).thenReturn(mockResourceProvider);
ERepositoryObjectType mockType = mock(ERepositoryObjectType.class);
when(mockConfiguration.getResourceProvider().getRepositoryObjectType(Mockito.any(Item.class))).thenReturn(mockType);
IRepositoryNodeLabelProvider mockLabelProvider = mock(IRepositoryNodeLabelProvider.class);
when(mockConfiguration.getLabelProvider()).thenReturn(mockLabelProvider);
when(mockLabelProvider.getCategoryLabel(Mockito.any(ERepositoryObjectType.class))).thenReturn("anystring");
PowerMockito.mockStatic(ContainerCacheService.class);
PowerMockito.doNothing().when(ContainerCacheService.class, "putContainer", Mockito.any(IRepositoryViewObject.class));
IRepositoryViewObject categoryViewObject = RepositoryResourceUtil.getCategoryViewObject(mockConfiguration);
assertNotNull(categoryViewObject);
}
Aggregations