diff options
author | Benjamin, Max <max.benjamin@att.com> | 2019-08-16 10:59:18 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2019-08-16 10:59:19 -0400 |
commit | d91fdcbe5ff3a09d6b8f444a563dd6135e14c9e6 (patch) | |
tree | 57f3b8157e6a64666505e6e813c9aab49868f55c /common/src/test | |
parent | 89973876dbbf8ad910420d60f8dcbb0c89bf6c62 (diff) |
fixed dsl builder to correctly add output
fixed dsl builder to correctly add output
look for lambda key rather than parent class null
Issue-ID: SO-2233
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I251b9b8b4c391354b9759ee16a2462df43c188f9
Diffstat (limited to 'common/src/test')
-rw-r--r-- | common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java | 27 |
1 files changed, 27 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 590e83827b..fb45652d53 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 @@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; import org.onap.so.client.graphinventory.entities.DSLNode; +import org.onap.so.client.graphinventory.entities.DSLNodeKey; import org.onap.so.client.graphinventory.entities.DSLQueryBuilder; import org.onap.so.client.graphinventory.entities.__; @@ -118,4 +119,30 @@ public class DSLQueryBuilderTest { assertTrue(builder.equals( "cloud-region('cloud-owner', 'owner')('cloud-region-id', 'id') > vlan-tag*('vlan-id-outer', 167)('my-boolean', true)")); } + + @Test + public void outputOnNodeLambdasTest() { + DSLQueryBuilder<DSLNode, DSLNode> builder = + new DSLQueryBuilder<>(new DSLNode(AAIObjectType.L_INTERFACE, new DSLNodeKey("interface-id", "myId"))); + + builder.to(AAIObjectType.VSERVER, __.key("vserver-name", "myName")).output().to(AAIObjectType.P_INTERFACE) + .output(); + assertEquals("l-interface('interface-id', 'myId') > vserver*('vserver-name', 'myName') > p-interface*", + builder.build()); + } + + @Test + public void skipOutputOnUnionTest() { + DSLQueryBuilder<DSLNode, DSLNode> builder = + new DSLQueryBuilder<>(new DSLNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output()); + + builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()), + __.node(AAIObjectType.VSERVER) + .to(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()))) + .output(); + + assertEquals( + "generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]", + builder.build()); + } } |