summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/common-yang/utils/src/test
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2023-03-02 12:06:07 +0530
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2023-03-10 10:46:55 +0530
commit6b8e4f12fc66a64fa5c5498d06891f1f5f1189ac (patch)
tree6414988944a78393509923a5ace70d66db0b29bd /sdnr/wt/common-yang/utils/src/test
parentd944abfab1a53a462868ae805ab5372935f854ef (diff)
Upgrade parents to 2.5.4-SNAPSHOT
Code changes as a result of changes induced by ODL Chlorine SR1 Issue-ID: CCSDK-3856 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> Change-Id: Ic08786f050e58bdb8371c8f8c25fb0db9f258cd4 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/common-yang/utils/src/test')
-rw-r--r--sdnr/wt/common-yang/utils/src/test/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/TestYangToolsMapper.java30
-rw-r--r--sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/HostBuilder.java25
-rw-r--r--sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressBuilder.java25
-rw-r--r--sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressNoZoneBuilder.java25
-rw-r--r--sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpPrefixBuilder.java25
-rw-r--r--sdnr/wt/common-yang/utils/src/test/yang/test-yang-utils.yang35
6 files changed, 46 insertions, 119 deletions
diff --git a/sdnr/wt/common-yang/utils/src/test/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/TestYangToolsMapper.java b/sdnr/wt/common-yang/utils/src/test/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/TestYangToolsMapper.java
index 2e51e8404..81df00789 100644
--- a/sdnr/wt/common-yang/utils/src/test/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/TestYangToolsMapper.java
+++ b/sdnr/wt/common-yang/utils/src/test/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/TestYangToolsMapper.java
@@ -34,7 +34,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.
import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.AddressLocation;
import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.AddressLocationBuilder;
import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.AddressType;
-import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.ItemCode;
+import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.ItemCodeIdentity;
import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.address.location.entity.ItemList;
import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.address.location.entity.ItemListBuilder;
import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.address.location.entity.ItemListKey;
@@ -47,7 +47,29 @@ public class TestYangToolsMapper {
public void init() {
MAPPER.addKeyDeserializer(ItemListKey.class, new IdentifierDeserializer());
}
+ @Test
+ public void testYangMapperDeser2() {
+ AddressLocation al = null;
+ try {
+ al = MAPPER.readValue(
+ "{\n"
+ + " \"address-type\": \"OFFICE\",\n"
+ + " \"delivery-date-time\": \"2022-03-15T11:12:13.890Z\",\n"
+ + " \"delivery-url\": \"delivery.uri\",\n"
+ + " \"test-id\": \"org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.ItemCodeIdentity\""
+ + "}",
+ AddressLocation.class);
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ }
+ assertEquals(AddressType.OFFICE, al.getAddressType());
+ assertEquals("2022-03-15T11:12:13.890Z", al.getDeliveryDateTime().getValue());
+ assertEquals(ItemCodeIdentity.VALUE, al.getTestId());
+ System.out.println("Delivery Date = " + al.getDeliveryDateTime().getValue());
+ System.out.println(al.getItemList());
+ System.out.println(al.getDeliveryUrl().getValue());
+ }
@Test
public void testYangMapperDeser() {
AddressLocation al = null;
@@ -60,7 +82,7 @@ public class TestYangToolsMapper {
+ " \"delivery-url\": \"delivery.uri\",\n"
+ " \"item-list\": [\n"
+ " {\n"
- + " \"item-key\": \"org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.ItemCode\"\n"
+ + " \"item-key\": \"org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.ItemCodeIdentity\"\n"
+ " }\n"
+ " ]\n"
+ "}",
@@ -78,8 +100,8 @@ public class TestYangToolsMapper {
@Test
public void testYangMapperSer() {
Map<ItemListKey, ItemList> items = new HashMap<ItemListKey, ItemList>();
- ItemList il = new ItemListBuilder().setItemKey(ItemCode.class).build();
- items.put(new ItemListKey(ItemCode.class), il);
+ ItemList il = new ItemListBuilder().setItemKey(ItemCodeIdentity.VALUE).build();
+ items.put(new ItemListKey(ItemCodeIdentity.VALUE), il);
Uri uri = new Uri("delivery.uri");
diff --git a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/HostBuilder.java b/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/HostBuilder.java
deleted file mode 100644
index 3d859e8b5..000000000
--- a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/HostBuilder.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715;
-import java.lang.String;
-import java.lang.UnsupportedOperationException;
-import javax.annotation.processing.Generated;
-
-/**
- * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
- * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32).
- *
- * The reason behind putting it under src/main/java is:
- * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent
- * loss of user code.
- *
- */
-@Generated("mdsal-binding-generator")
-public class HostBuilder {
- private HostBuilder() {
- //Exists only to defeat instantiation.
- }
-
- public static Host getDefaultInstance(String defaultValue) {
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
-}
diff --git a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressBuilder.java b/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressBuilder.java
deleted file mode 100644
index 62771f669..000000000
--- a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressBuilder.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715;
-import java.lang.String;
-import java.lang.UnsupportedOperationException;
-import javax.annotation.processing.Generated;
-
-/**
- * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
- * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32).
- *
- * The reason behind putting it under src/main/java is:
- * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent
- * loss of user code.
- *
- */
-@Generated("mdsal-binding-generator")
-public class IpAddressBuilder {
- private IpAddressBuilder() {
- //Exists only to defeat instantiation.
- }
-
- public static IpAddress getDefaultInstance(String defaultValue) {
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
-}
diff --git a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressNoZoneBuilder.java b/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressNoZoneBuilder.java
deleted file mode 100644
index d7b295263..000000000
--- a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressNoZoneBuilder.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715;
-import java.lang.String;
-import java.lang.UnsupportedOperationException;
-import javax.annotation.processing.Generated;
-
-/**
- * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
- * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32).
- *
- * The reason behind putting it under src/main/java is:
- * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent
- * loss of user code.
- *
- */
-@Generated("mdsal-binding-generator")
-public class IpAddressNoZoneBuilder {
- private IpAddressNoZoneBuilder() {
- //Exists only to defeat instantiation.
- }
-
- public static IpAddressNoZone getDefaultInstance(String defaultValue) {
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
-}
diff --git a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpPrefixBuilder.java b/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpPrefixBuilder.java
deleted file mode 100644
index d5fff3db4..000000000
--- a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpPrefixBuilder.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715;
-import java.lang.String;
-import java.lang.UnsupportedOperationException;
-import javax.annotation.processing.Generated;
-
-/**
- * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
- * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32).
- *
- * The reason behind putting it under src/main/java is:
- * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent
- * loss of user code.
- *
- */
-@Generated("mdsal-binding-generator")
-public class IpPrefixBuilder {
- private IpPrefixBuilder() {
- //Exists only to defeat instantiation.
- }
-
- public static IpPrefix getDefaultInstance(String defaultValue) {
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
-}
diff --git a/sdnr/wt/common-yang/utils/src/test/yang/test-yang-utils.yang b/sdnr/wt/common-yang/utils/src/test/yang/test-yang-utils.yang
index eb62a859a..a43a151e1 100644
--- a/sdnr/wt/common-yang/utils/src/test/yang/test-yang-utils.yang
+++ b/sdnr/wt/common-yang/utils/src/test/yang/test-yang-utils.yang
@@ -3,52 +3,52 @@ module test-yang-utils {
yang-version 1.1;
namespace "urn:test:yang:utils";
prefix tesyangutils;
-
+
import ietf-yang-types {
prefix yang;
reference
"RFC 6991: Common YANG Data Types.";
}
-
+
import ietf-inet-types {
prefix inet;
}
-
+
typedef AddressType {
type enumeration {
enum OFFICE {
- description
+ description
"Office Address";
}
enum HOME {
- description
+ description
"Home Address";
}
}
}
-
- identity item-code {
+
+ identity item-code-identity {
description
"Base identity";
}
typedef item-code {
type identityref {
- base item-code;
+ base item-code-identity;
}
description
"Item code - Could be bar code, QR code or any other code to uniquely identify an item";
}
-
+
grouping address-location-entity {
leaf id {
type string;
- description
+ description
"Unique ID of the address";
}
leaf address-type {
type AddressType;
- description
+ description
"Type of Address";
}
leaf delivery-date-time {
@@ -58,7 +58,7 @@ module test-yang-utils {
}
leaf delivery-url {
type inet:uri;
- description
+ description
"Delivery URL";
}
list item-list {
@@ -66,13 +66,18 @@ module test-yang-utils {
leaf item-key {
type item-code;
}
- description
+ description
"Unique code of the ordered item";
}
+ leaf test-id {
+ type item-code;
+ description "test identity leaf";
+ }
+
}
-
+
container address-location {
- description
+ description
"builder";
uses address-location-entity;
}