diff options
author | Steve Smokowski <ss835w@att.com> | 2019-03-07 15:18:56 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-03-07 15:18:56 +0000 |
commit | c81bb5111f7c73cba81e36c4e13fa3da1c19e0ec (patch) | |
tree | 08292091ba37c0fb3848d813b360e5bb09c35925 /common/src/test | |
parent | 7faa8287dcff4f51c4ac127e25342a366c8b525f (diff) | |
parent | f4bdeee0c31a3624d4f050a058681634260ae76e (diff) |
Merge "add equals and hashcode support to dslquerybuilder"
Diffstat (limited to 'common/src/test')
-rw-r--r-- | common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java b/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java index a156e3c158..a5bbc64eb9 100644 --- a/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java +++ b/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java @@ -21,6 +21,7 @@ package org.onap.so.client.aai; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import org.junit.Test; import org.onap.so.client.graphinventory.entities.DSLNode; @@ -89,4 +90,23 @@ public class DSLQueryBuilderTest { builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id")); assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')", builder.build()); } + + @Test + public void limitTest() { + DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.PSERVER, + __.key("hostname", "my-hostname")).output()); + + builder.to(AAIObjectType.P_INTERFACE).limit(2).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id")); + assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id') LIMIT 2", builder.build()); + } + + @Test + public void equalsTest() { + DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.PSERVER, + __.key("hostname", "my-hostname")).output()); + + builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id")); + assertTrue(builder.equals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')")); + assertTrue(builder.equals(builder)); + } } |