@@ -0,0 +1,1356 @@
+package org.opennms.netmgt.dao;%0A%0Aimport java.util.Collection;%0A%0Aimport org.hibernate.criterion.Restrictions;%0Aimport org.opennms.netmgt.model.OnmsCriteria;%0Aimport org.opennms.netmgt.model.OnmsNode;%0A%0Apublic class CriteriaTestCase extends AbstractDaoTestCase %7B%0A%0A    public void testSimple() %7B%0A        OnmsCriteria crit = new OnmsCriteria(OnmsNode.class);%0A        crit.add(Restrictions.eq(%22label%22, %22node1%22));%0A        %0A        Collection%3COnmsNode%3E matching = getNodeDao().findMatching(crit);%0A        %0A        assertEquals(%22Expect a single node with label node1%22, 1, matching.size());%0A        %0A        OnmsNode node = matching.iterator().next();%0A        assertEquals(%22node1%22, node.getLabel());%0A        assertEquals(3, node.getIpInterfaces().size());%0A    %7D%0A    %0A    public void testComplicated() %7B%0A        OnmsCriteria crit = %0A            new OnmsCriteria(OnmsNode.class)%0A            .createAlias(%22ipInterfaces%22, %22iface%22)%0A            .add(Restrictions.eq(%22iface.ipAddress%22, %22192.168.2.1%22));%0A        %0A        Collection%3COnmsNode%3E matching = getNodeDao().findMatching(crit);%0A        %0A        assertEquals(%22Expect a single node with an interface 192.168.2.1%22, 1, matching.size());%0A        %0A        OnmsNode node = matching.iterator().next();%0A        assertEquals(%22node2%22, node.getLabel());%0A        assertEquals(3, node.getIpInterfaces().size());%0A            %0A    %7D%0A%7D%0A

Test case for new OnmsCriteria