summaryrefslogtreecommitdiffstats
path: root/tests/server-side/com/vaadin/data/util/TestHierarchicalContainer.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-08-30 15:27:50 +0300
committerArtur Signell <artur@vaadin.com>2012-08-30 16:08:05 +0300
commit876182aaa34682503338a4dcdd119b3ebc256f97 (patch)
tree8e54b81cfcbecb5c54b725ca3a612b6e18e228cd /tests/server-side/com/vaadin/data/util/TestHierarchicalContainer.java
parent691220a5b24370d56f7c15d5a05c57a6c76dcb83 (diff)
downloadvaadin-framework-876182aaa34682503338a4dcdd119b3ebc256f97.tar.gz
vaadin-framework-876182aaa34682503338a4dcdd119b3ebc256f97.zip
Moved server tests from tests/server-side to server/tests/src (#9299)
Diffstat (limited to 'tests/server-side/com/vaadin/data/util/TestHierarchicalContainer.java')
-rw-r--r--tests/server-side/com/vaadin/data/util/TestHierarchicalContainer.java263
1 files changed, 0 insertions, 263 deletions
diff --git a/tests/server-side/com/vaadin/data/util/TestHierarchicalContainer.java b/tests/server-side/com/vaadin/data/util/TestHierarchicalContainer.java
deleted file mode 100644
index 10bc71c3a7..0000000000
--- a/tests/server-side/com/vaadin/data/util/TestHierarchicalContainer.java
+++ /dev/null
@@ -1,263 +0,0 @@
-package com.vaadin.data.util;
-
-import com.vaadin.data.Container.Filter;
-import com.vaadin.data.Item;
-
-public class TestHierarchicalContainer extends
- AbstractHierarchicalContainerTest {
-
- public void testBasicOperations() {
- testBasicContainerOperations(new HierarchicalContainer());
- }
-
- public void testFiltering() {
- testContainerFiltering(new HierarchicalContainer());
- }
-
- public void testSorting() {
- testContainerSorting(new HierarchicalContainer());
- }
-
- public void testOrdered() {
- testContainerOrdered(new HierarchicalContainer());
- }
-
- public void testHierarchicalSorting() {
- testHierarchicalSorting(new HierarchicalContainer());
- }
-
- public void testSortingAndFiltering() {
- testContainerSortingAndFiltering(new HierarchicalContainer());
- }
-
- public void testRemovingItemsFromFilteredContainer() {
- HierarchicalContainer container = new HierarchicalContainer();
- initializeContainer(container);
- container.setIncludeParentsWhenFiltering(true);
- container.addContainerFilter(FULLY_QUALIFIED_NAME, "ab", false, false);
- Object p1 = container.getParent("com.vaadin.ui.TabSheet");
- assertEquals("com.vaadin.ui", p1);
-
- container.removeItem("com.vaadin.ui.TabSheet");
- // Parent for the removed item must be null because the item is no
- // longer in the container
- p1 = container.getParent("com.vaadin.ui.TabSheet");
- assertNull("Parent should be null, is " + p1, p1);
-
- container.removeAllItems();
- p1 = container.getParent("com.vaadin.client.Focusable");
- assertNull("Parent should be null, is " + p1, p1);
-
- }
-
- public void testParentWhenRemovingFilterFromContainer() {
- HierarchicalContainer container = new HierarchicalContainer();
- initializeContainer(container);
- container.setIncludeParentsWhenFiltering(true);
- container.addContainerFilter(FULLY_QUALIFIED_NAME, "ab", false, false);
- Object p1 = container.getParent("com.vaadin.ui.TabSheet");
- assertEquals("com.vaadin.ui", p1);
- p1 = container.getParent("com.vaadin.client.ui.VPopupCalendar");
- assertNull(p1);
- container.removeAllContainerFilters();
- p1 = container.getParent("com.vaadin.client.ui.VPopupCalendar");
- assertEquals("com.vaadin.client.ui", p1);
-
- }
-
- public void testChangeParentInFilteredContainer() {
- HierarchicalContainer container = new HierarchicalContainer();
- initializeContainer(container);
- container.setIncludeParentsWhenFiltering(true);
- container.addContainerFilter(FULLY_QUALIFIED_NAME, "Tab", false, false);
-
- // Change parent of filtered item
- Object p1 = container.getParent("com.vaadin.ui.TabSheet");
- assertEquals("com.vaadin.ui", p1);
- container.setParent("com.vaadin.ui.TabSheet", "com.vaadin");
- p1 = container.getParent("com.vaadin.ui.TabSheet");
- assertEquals("com.vaadin", p1);
- container.setParent("com.vaadin.ui.TabSheet", "com");
- p1 = container.getParent("com.vaadin.ui.TabSheet");
- assertEquals("com", p1);
- container.setParent("com.vaadin.ui.TabSheet", null);
- p1 = container.getParent("com.vaadin.ui.TabSheet");
- assertNull(p1);
-
- // root -> non-root
- container.setParent("com.vaadin.ui.TabSheet", "com");
- p1 = container.getParent("com.vaadin.ui.TabSheet");
- assertEquals("com", p1);
-
- }
-
- public void testHierarchicalFilteringWithParents() {
- HierarchicalContainer container = new HierarchicalContainer();
- initializeContainer(container);
- container.setIncludeParentsWhenFiltering(true);
-
- // Filter by "contains ab"
- container.addContainerFilter(FULLY_QUALIFIED_NAME, "ab", false, false);
-
- // 20 items match the filters and the have 8 parents that should also be
- // included
- // only one root "com" should exist
- // filtered
- int expectedSize = 29;
- int expectedRoots = 1;
-
- validateHierarchicalContainer(container, "com",
- "com.vaadin.ui.TabSheet", "com.vaadin.client.Focusable",
- "blah", true, expectedSize, expectedRoots, true);
-
- // only include .gwt.client classes
- container.removeAllContainerFilters();
- container.addContainerFilter(FULLY_QUALIFIED_NAME, ".gwt.client.",
- false, false);
-
- int packages = 6;
- int classes = 112;
-
- expectedSize = packages + classes;
- expectedRoots = 1;
-
- validateHierarchicalContainer(container, "com",
- "com.vaadin.client.WidgetSet",
- "com.vaadin.client.ui.VSplitPanelVertical", "blah", true,
- expectedSize, expectedRoots, true);
-
- // Additionally remove all without 'm' in the simple name.
- container.addContainerFilter(SIMPLE_NAME, "m", false, false);
-
- expectedSize = 7 + 18;
- expectedRoots = 1;
-
- validateHierarchicalContainer(container, "com",
- "com.vaadin.client.ui.VUriFragmentUtility",
- "com.vaadin.client.ui.layout.ChildComponentContainer", "blah",
- true, expectedSize, expectedRoots, true);
-
- }
-
- public void testRemoveLastChild() {
- HierarchicalContainer c = new HierarchicalContainer();
-
- c.addItem("root");
- assertEquals(false, c.hasChildren("root"));
-
- c.addItem("child");
- c.setParent("child", "root");
- assertEquals(true, c.hasChildren("root"));
-
- c.removeItem("child");
- assertFalse(c.containsId("child"));
- assertNull(c.getChildren("root"));
- assertNull(c.getChildren("child"));
- assertFalse(c.hasChildren("child"));
- assertFalse(c.hasChildren("root"));
- }
-
- public void testRemoveLastChildFromFiltered() {
- HierarchicalContainer c = new HierarchicalContainer();
-
- c.addItem("root");
- assertEquals(false, c.hasChildren("root"));
-
- c.addItem("child");
- c.setParent("child", "root");
- assertEquals(true, c.hasChildren("root"));
-
- // Dummy filter that does not remove any items
- c.addContainerFilter(new Filter() {
-
- @Override
- public boolean passesFilter(Object itemId, Item item)
- throws UnsupportedOperationException {
- return true;
- }
-
- @Override
- public boolean appliesToProperty(Object propertyId) {
- return true;
- }
- });
- c.removeItem("child");
-
- assertFalse(c.containsId("child"));
- assertNull(c.getChildren("root"));
- assertNull(c.getChildren("child"));
- assertFalse(c.hasChildren("child"));
- assertFalse(c.hasChildren("root"));
- }
-
- public void testHierarchicalFilteringWithoutParents() {
- HierarchicalContainer container = new HierarchicalContainer();
-
- initializeContainer(container);
- container.setIncludeParentsWhenFiltering(false);
-
- // Filter by "contains ab"
- container.addContainerFilter(SIMPLE_NAME, "ab", false, false);
-
- // 20 items match the filter.
- // com.vaadin.data.BufferedValidatable
- // com.vaadin.data.Validatable
- // com.vaadin.client.Focusable
- // com.vaadin.client.Paintable
- // com.vaadin.client.ui.Table
- // com.vaadin.client.ui.VLabel
- // com.vaadin.client.ui.VScrollTable
- // com.vaadin.client.ui.VTablePaging
- // com.vaadin.client.ui.VTabsheet
- // com.vaadin.client.ui.VTabsheetBase
- // com.vaadin.client.ui.VTabsheetPanel
- // com.vaadin.server.ChangeVariablesErrorEvent
- // com.vaadin.server.Paintable
- // com.vaadin.server.Scrollable
- // com.vaadin.server.Sizeable
- // com.vaadin.server.VariableOwner
- // com.vaadin.ui.Label
- // com.vaadin.ui.Table
- // com.vaadin.ui.TableFieldFactory
- // com.vaadin.ui.TabSheet
- // all become roots.
- int expectedSize = 20;
- int expectedRoots = 20;
-
- validateHierarchicalContainer(container,
- "com.vaadin.data.BufferedValidatable",
- "com.vaadin.ui.TabSheet", "com.vaadin.client.ui.VTabsheetBase",
- "blah", true, expectedSize, expectedRoots, false);
-
- // only include .gwt.client classes
- container.removeAllContainerFilters();
- container.addContainerFilter(FULLY_QUALIFIED_NAME, ".gwt.client.",
- false, false);
-
- int packages = 3;
- int classes = 110;
-
- expectedSize = packages + classes;
- expectedRoots = 35 + 1; // com.vaadin.client.ui +
- // com.vaadin.client.*
-
- // Sorting is case insensitive
- validateHierarchicalContainer(container,
- "com.vaadin.client.ApplicationConfiguration",
- "com.vaadin.client.WidgetSet",
- "com.vaadin.client.ui.VOptionGroup", "blah", true,
- expectedSize, expectedRoots, false);
-
- // Additionally remove all without 'P' in the simple name.
- container.addContainerFilter(SIMPLE_NAME, "P", false, false);
-
- expectedSize = 13;
- expectedRoots = expectedSize;
-
- validateHierarchicalContainer(container, "com.vaadin.client.Paintable",
- "com.vaadin.client.ui.VTabsheetPanel",
- "com.vaadin.client.ui.VPopupCalendar", "blah", true,
- expectedSize, expectedRoots, false);
-
- }
-}