[
https://issues.jboss.org/browse/SHRINKDESC-84?page=com.atlassian.jira.plu...
]
Andrew Rubinger commented on SHRINKDESC-84:
-------------------------------------------
Specified behaviour of GetQuery:
Given:
{code}web-app
servlets
servlet
servlet-name{code}
The following function calls and return values should hold:
{code}Get(servlets,"servlet") > servlet
Get(web-app,"servlet") > null
Get(servlet,"servlet") > null
Get(servlets,"servlet/servlet-name") > servlet-name
Get(web-app,"web-app/servlets") > null
Get(web-app,"servlets/servlet") > servlet{code}
Let's get a simple working algorithm now. The use case is for searching in spec XSDs,
so the trees aren't likely to get more than 4 or 5 levels deep; I don't think we
need to start engineering anything faster at the moment. Already because we have a slim
object model for the XML (instead of carrying around DOM or bothering with XB parsing)
we're well ahead of the speed game in design.
Node.get(Patterns) matches recursive down the whole tree
--------------------------------------------------------
Key: SHRINKDESC-84
URL:
https://issues.jboss.org/browse/SHRINKDESC-84
Project: ShrinkWrap Descriptors
Issue Type: Bug
Components: spi
Affects Versions: 1.1.0-alpha-3
Reporter: Aslak Knutsen
Assignee: Bartosz Majsak
Priority: Blocker
Node.get should only try to match the first level.
{code}
@Test
public void shouldNotMatchAChildsChildrenOnGet()
{
// /root/child1/child2
Node root = new Node(ROOT_NAME)
.createChild(CHILD_1_NAME)
.createChild(CHILD_2_NAME).getRoot();
Assert.assertNull(root.get(CHILD_2_NAME));
}
@Test
public void shouldNotMatchAChildsChildrenOnGetSingle()
{
// /root/child1/child2
Node root = new Node(ROOT_NAME)
.createChild(CHILD_1_NAME)
.createChild(CHILD_2_NAME).getRoot();
Assert.assertNull(root.getSingle(CHILD_2_NAME));
}
@Test
public void shouldNotMatchAChildsChildrenOnGetOrCreate()
{
// /root/child1/child2
Node root = new Node(ROOT_NAME);
Node child1 = root.createChild(CHILD_1_NAME);
Node child2 = child1.createChild(CHILD_2_NAME);
Node createdChild = root.getOrCreate(CHILD_2_NAME);
Assert.assertNotSame(createdChild, child2);
}
@Test
public void shouldNotMatchAChildsChildrenOnRemoveChild()
{
// /root/child1/child2
Node root = new Node(ROOT_NAME)
.createChild(CHILD_1_NAME)
.createChild(CHILD_2_NAME).getRoot();
Assert.assertNull(root.removeChild(CHILD_2_NAME));
}
@Test
public void shouldNotMatchAChildsChildrenOnRemoveChildren()
{
// /root/child1/child2
Node root = new Node(ROOT_NAME)
.createChild(CHILD_1_NAME)
.createChild(CHILD_2_NAME).getRoot();
List<Node> removed = root.removeChildren(CHILD_2_NAME);
Assert.assertNotNull(removed);
Assert.assertEquals(0, removed.size());
}
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira