@Test public void testGetChildrenWhenRequestFailure() throws Exception { String path = "path"; AsyncCallback asyncCallback = mock(AsyncCallback.class); projectNode.getChildren(path, asyncCallback); verify(projectServiceClient).getChildren(eq(path), asyncRequestCallbackCaptor.capture()); AsyncRequestCallback<Array<ItemReference>> requestCallback = asyncRequestCallbackCaptor.getValue(); GwtReflectionUtils.callOnFailure(requestCallback, mock(Throwable.class)); verify(asyncCallback).onFailure(Matchers.<Throwable>anyObject()); }
protected void getChildren(String path, final AsyncCallback<Array<ItemReference>> callback) { final Array<ItemReference> children = Collections.createArray(); final Unmarshallable<Array<ItemReference>> unmarshaller = dtoUnmarshallerFactory.newArrayUnmarshaller(ItemReference.class); projectServiceClient.getChildren(path, new AsyncRequestCallback<Array<ItemReference>>(unmarshaller) { @Override protected void onSuccess(Array<ItemReference> result) { final boolean isShowHiddenItems = getTreeStructure().getSettings().isShowHiddenItems(); for (ItemReference item : result.asIterable()) { if (!isShowHiddenItems && item.getName().startsWith(".")) { continue; } children.add(item); } callback.onSuccess(children); } @Override protected void onFailure(Throwable exception) { callback.onFailure(exception); } }); }
ProjectNode extends AbstractTreeNode<ProjectDescriptor> implements StorableNode<ProjectDescriptor>, Openable,
                                                                                ProjectDescriptorChangedHandler { protected void getChildren(String path, final AsyncCallback<Array<ItemReference>> callback) { final Array<ItemReference> children = Collections.createArray(); final Unmarshallable<Array<ItemReference>> unmarshaller = dtoUnmarshallerFactory.newArrayUnmarshaller(ItemReference.class); projectServiceClient.getChildren(path, new AsyncRequestCallback<Array<ItemReference>>(unmarshaller) { @Override protected void onSuccess(Array<ItemReference> result) { final boolean isShowHiddenItems = getTreeStructure().getSettings().isShowHiddenItems(); for (ItemReference item : result.asIterable()) { if (!isShowHiddenItems && item.getName().startsWith(".")) { continue; } children.add(item); } callback.onSuccess(children); } @Override protected void onFailure(Throwable exception) { callback.onFailure(exception); } }); } }
ProjectNode extends AbstractTreeNode<ProjectDescriptor> implements StorableNode<ProjectDescriptor>, Openable,
                                                                                ProjectDescriptorChangedHandler { protected void getChildren(String path, final AsyncCallback<Array<ItemReference>> callback) { final Array<ItemReference> children = Collections.createArray(); final Unmarshallable<Array<ItemReference>> unmarshaller = dtoUnmarshallerFactory.newArrayUnmarshaller(ItemReference.class); projectServiceClient.getChildren(path, new AsyncRequestCallback<Array<ItemReference>>(unmarshaller) { @Override protected void onSuccess(Array<ItemReference> result) { final boolean isShowHiddenItems = getTreeStructure().getSettings().isShowHiddenItems(); for (ItemReference item : result.asIterable()) { if (!isShowHiddenItems && item.getName().startsWith(".")) { continue; } children.add(item); } callback.onSuccess(children); } @Override protected void onFailure(Throwable exception) { callback.onFailure(exception); } }); } @Inject  ProjectNode(@Assisted TreeNode<?> parent,
                       @Assisted ProjectDescriptor data,
                       @Assisted GenericTreeStructure treeStructure,
                       EventBus eventBus,
                       ProjectServiceClient projectServiceClient,
                       DtoUnmarshallerFactory dtoUnmarshallerFactory); }
ProjectNode extends AbstractTreeNode<ProjectDescriptor> implements StorableNode<ProjectDescriptor>, Openable,
                                                                                ProjectDescriptorChangedHandler { protected void getChildren(String path, final AsyncCallback<Array<ItemReference>> callback) { final Array<ItemReference> children = Collections.createArray(); final Unmarshallable<Array<ItemReference>> unmarshaller = dtoUnmarshallerFactory.newArrayUnmarshaller(ItemReference.class); projectServiceClient.getChildren(path, new AsyncRequestCallback<Array<ItemReference>>(unmarshaller) { @Override protected void onSuccess(Array<ItemReference> result) { final boolean isShowHiddenItems = getTreeStructure().getSettings().isShowHiddenItems(); for (ItemReference item : result.asIterable()) { if (!isShowHiddenItems && item.getName().startsWith(".")) { continue; } children.add(item); } callback.onSuccess(children); } @Override protected void onFailure(Throwable exception) { callback.onFailure(exception); } }); } @Inject  ProjectNode(@Assisted TreeNode<?> parent,
                       @Assisted ProjectDescriptor data,
                       @Assisted GenericTreeStructure treeStructure,
                       EventBus eventBus,
                       ProjectServiceClient projectServiceClient,
                       DtoUnmarshallerFactory dtoUnmarshallerFactory); @Override String getName(); @Override String getPath(); @Override boolean canContainsFolder(); @Nonnull @Override String getId(); @Nonnull @Override ProjectNode getProject(); @Nonnull @Override String getDisplayName(); @Nonnull GenericTreeStructure getTreeStructure(); @Override boolean isLeaf(); @Override void refreshChildren(final AsyncCallback<TreeNode<?>> callback); @Override boolean isRenamable(); @Override void rename(String newName, RenameCallback callback); @Override boolean isDeletable(); @Override void delete(final DeleteCallback callback); String getProjectTypeId(); @Nullable String getAttributeValue(String attributeName); @Nullable List<String> getAttributeValues(String attributeName); @Override void close(); @Override boolean isOpened(); @Override void open(); @Override void onProjectDescriptorChanged(ProjectDescriptorChangedEvent event); }
ProjectNode extends AbstractTreeNode<ProjectDescriptor> implements StorableNode<ProjectDescriptor>, Openable,
                                                                                ProjectDescriptorChangedHandler { protected void getChildren(String path, final AsyncCallback<Array<ItemReference>> callback) { final Array<ItemReference> children = Collections.createArray(); final Unmarshallable<Array<ItemReference>> unmarshaller = dtoUnmarshallerFactory.newArrayUnmarshaller(ItemReference.class); projectServiceClient.getChildren(path, new AsyncRequestCallback<Array<ItemReference>>(unmarshaller) { @Override protected void onSuccess(Array<ItemReference> result) { final boolean isShowHiddenItems = getTreeStructure().getSettings().isShowHiddenItems(); for (ItemReference item : result.asIterable()) { if (!isShowHiddenItems && item.getName().startsWith(".")) { continue; } children.add(item); } callback.onSuccess(children); } @Override protected void onFailure(Throwable exception) { callback.onFailure(exception); } }); } @Inject  ProjectNode(@Assisted TreeNode<?> parent,
                       @Assisted ProjectDescriptor data,
                       @Assisted GenericTreeStructure treeStructure,
                       EventBus eventBus,
                       ProjectServiceClient projectServiceClient,
                       DtoUnmarshallerFactory dtoUnmarshallerFactory); @Override String getName(); @Override String getPath(); @Override boolean canContainsFolder(); @Nonnull @Override String getId(); @Nonnull @Override ProjectNode getProject(); @Nonnull @Override String getDisplayName(); @Nonnull GenericTreeStructure getTreeStructure(); @Override boolean isLeaf(); @Override void refreshChildren(final AsyncCallback<TreeNode<?>> callback); @Override boolean isRenamable(); @Override void rename(String newName, RenameCallback callback); @Override boolean isDeletable(); @Override void delete(final DeleteCallback callback); String getProjectTypeId(); @Nullable String getAttributeValue(String attributeName); @Nullable List<String> getAttributeValues(String attributeName); @Override void close(); @Override boolean isOpened(); @Override void open(); @Override void onProjectDescriptorChanged(ProjectDescriptorChangedEvent event);  }