use of org.kie.workbench.common.screens.explorer.model.FolderListing in project kie-wb-common by kiegroup.
the class ProjectExplorerContentResolverDefaultSelectionsTest method setUp.
@Before
public void setUp() throws Exception {
// Ensure URLs use the default:// scheme
fs.forceAsDefault();
final KieModuleService moduleService = mock(KieModuleService.class);
final ExplorerServiceHelper helper = mock(ExplorerServiceHelper.class);
final ExplorerServiceHelper explorerServiceHelper = mock(ExplorerServiceHelper.class);
repository1 = getGitRepository("repo1");
repository2 = getGitRepository("repo2");
repository1Module1 = createModule("master", "r1p1");
repository1Modules = new HashSet<Module>() {
{
add(repository1Module1);
}
};
repository2Module1 = createModule("master", "r2p1");
repository2Modules = new HashSet<Module>() {
{
add(repository2Module1);
}
};
userExplorerData = new UserExplorerData();
helperWrapper = new HelperWrapper(helper);
when(helper.getLastContent()).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
return helperWrapper.getUserExplorerLastData();
}
});
when(helper.loadUserContent()).thenReturn(userExplorerData);
when(helper.getFolderListing(any(FolderItem.class), any(Module.class), any(Package.class), any(ActiveOptions.class))).thenReturn(new FolderListing(createFileItem(), Collections.EMPTY_LIST, Collections.EMPTY_LIST));
when(moduleService.getAllModules(repository1.getDefaultBranch().get())).thenReturn(repository1Modules);
when(moduleService.getAllModules(repository2.getDefaultBranch().get())).thenReturn(repository2Modules);
doReturn(createPackage("master", repository1Module1.getModuleName())).when(moduleService).resolveDefaultPackage(repository1Module1);
doReturn(createPackage("master", repository2Module1.getModuleName())).when(moduleService).resolveDefaultPackage(repository2Module1);
resolver = new ProjectExplorerContentResolver(moduleService, helper, explorerServiceHelper, projectService);
}
use of org.kie.workbench.common.screens.explorer.model.FolderListing in project kie-wb-common by kiegroup.
the class ProjectExplorerContentResolverTest method setUp.
@Before
public void setUp() throws Exception {
// Ensure URLs use the default:// scheme
fs.forceAsDefault();
final KieModuleService moduleService = mock(KieModuleService.class);
final ExplorerServiceHelper helper = mock(ExplorerServiceHelper.class);
space = new Space("test-realm");
repository = getGitRepository();
final UserExplorerData userExplorerData = new UserExplorerData();
masterModules = new HashSet<>();
masterModules.add(createModule("master", masterBranch, "module 1"));
masterModules.add(createModule("master", masterBranch, "module 2"));
devModules = new HashSet<>();
devModules.add(createModule("dev-1.0.0", devBranch, "module 1"));
devModules.add(createModule("dev-1.0.0", devBranch, "module 2"));
helperWrapper = new HelperWrapper(helper);
when(helper.getLastContent()).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
return helperWrapper.getUserExplorerLastData();
}
});
when(helper.loadUserContent()).thenReturn(userExplorerData);
when(helper.getFolderListing(any(FolderItem.class), any(Module.class), any(Package.class), any(ActiveOptions.class))).thenReturn(new FolderListing(getFileItem(), Collections.EMPTY_LIST, Collections.EMPTY_LIST));
when(moduleService.getAllModules(masterBranch)).thenReturn(masterModules);
when(moduleService.getAllModules(devBranch)).thenReturn(devModules);
when(moduleService.resolveDefaultPackage(any(Module.class))).thenReturn(new Package());
resolver = spy(new ProjectExplorerContentResolver(moduleService, helper, explorerServiceHelper, projectService));
}
use of org.kie.workbench.common.screens.explorer.model.FolderListing in project kie-wb-common by kiegroup.
the class BaseViewPresenter method filterByTag.
protected void filterByTag(String tag) {
currentTag = tag;
List<FolderItem> filteredItems = new ArrayList<FolderItem>();
for (FolderItem item : activeContextItems.getActiveContent().getContent()) {
if (tag == null || item.getTags().contains(tag) || item.getType().equals(FolderItemType.FOLDER)) {
filteredItems.add(item);
}
}
FolderListing filteredContent = new FolderListing(activeContextItems.getActiveContent().getItem(), filteredItems, activeContextItems.getActiveContent().getSegments());
baseView.renderItems(filteredContent);
}
use of org.kie.workbench.common.screens.explorer.model.FolderListing in project kie-wb-common by kiegroup.
the class BaseBreadcrumbNavigatorTest method testLoadContentOnlyFile.
@Test
public void testLoadContentOnlyFile() {
final BreadcrumbNavigator navigator = spy(new BreadcrumbNavigator(activeOptions, hiddenTypeDef, user));
final FolderItem item = new FolderItem(path, "item1", FolderItemType.FILE);
final List<FolderItem> content = new ArrayList<FolderItem>() {
{
add(new FolderItem(mock(Path.class), "File1", FolderItemType.FILE));
}
};
final List<FolderItem> segments = new ArrayList<FolderItem>();
final FolderListing listing = new FolderListing(item, content, segments);
navigator.loadContent(listing);
verify(navigator).setupBreadcrumb(listing);
verify(navigator).setupUpFolder(listing);
verify(navigator).setupContent(listing);
verifyNavigatorPanelVisibility(navigator);
}
use of org.kie.workbench.common.screens.explorer.model.FolderListing in project kie-wb-common by kiegroup.
the class BaseBreadcrumbNavigatorTest method testLoadContentEmpty.
@Test
public void testLoadContentEmpty() {
final BreadcrumbNavigator navigator = spy(new BreadcrumbNavigator(activeOptions, hiddenTypeDef, user));
final FolderItem item = new FolderItem(path, "item1", FolderItemType.FILE);
final List<FolderItem> content = new ArrayList<FolderItem>();
final List<FolderItem> segments = new ArrayList<FolderItem>();
final FolderListing listing = new FolderListing(item, content, segments);
navigator.loadContent(listing);
verify(navigator).setupBreadcrumb(listing);
verify(navigator).setupUpFolder(listing);
verify(navigator).setupContent(listing);
verifyNavigatorPanelVisibility(navigator);
}
Aggregations