diff options
Diffstat (limited to 'sdnr/wt/common-yang')
21 files changed, 30 insertions, 277 deletions
diff --git a/sdnr/wt/common-yang/iana-crypt-hash/pom.xml b/sdnr/wt/common-yang/iana-crypt-hash/pom.xml index 939c4bad1..ff16ba07b 100755 --- a/sdnr/wt/common-yang/iana-crypt-hash/pom.xml +++ b/sdnr/wt/common-yang/iana-crypt-hash/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.4</version> + <version>2.6.0</version> <relativePath/> </parent> diff --git a/sdnr/wt/common-yang/ietf-alarms/pom.xml b/sdnr/wt/common-yang/ietf-alarms/pom.xml index 0fcd71ea2..a07f11acd 100755 --- a/sdnr/wt/common-yang/ietf-alarms/pom.xml +++ b/sdnr/wt/common-yang/ietf-alarms/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.4</version> + <version>2.6.0</version> <relativePath/> </parent> diff --git a/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java b/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java deleted file mode 100644 index 7e8327a09..000000000 --- a/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * 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. - * - */ -public class OperatorStateBuilder { - private OperatorStateBuilder() { - //Exists only to defeat instantiation. - } - - public static OperatorState getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java b/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java deleted file mode 100644 index 7c4a63d2b..000000000 --- a/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * 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. - * - */ -public class ResourceBuilder { - private ResourceBuilder() { - //Exists only to defeat instantiation. - } - - public static Resource getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java b/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java deleted file mode 100644 index 282a6a26d..000000000 --- a/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * 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. - * - */ -public class ResourceMatchBuilder { - private ResourceMatchBuilder() { - //Exists only to defeat instantiation. - } - - public static ResourceMatch getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java b/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java deleted file mode 100644 index 81391922d..000000000 --- a/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * 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. - * - */ -public class SeverityWithClearBuilder { - private SeverityWithClearBuilder() { - //Exists only to defeat instantiation. - } - - public static SeverityWithClear getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java b/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java deleted file mode 100644 index 9f10ae87f..000000000 --- a/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911.alarms; -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * 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. - * - */ -public class ControlMaxAlarmStatusChangesBuilder { - private ControlMaxAlarmStatusChangesBuilder() { - //Exists only to defeat instantiation. - } - - public static Control.MaxAlarmStatusChanges getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/common-yang/openroadm-pm-types/pom.xml b/sdnr/wt/common-yang/openroadm-pm-types/pom.xml index df3667d7b..db09daf91 100755 --- a/sdnr/wt/common-yang/openroadm-pm-types/pom.xml +++ b/sdnr/wt/common-yang/openroadm-pm-types/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.4</version> + <version>2.6.0</version> <relativePath/> </parent> diff --git a/sdnr/wt/common-yang/pom.xml b/sdnr/wt/common-yang/pom.xml index 7c040e8b9..04ac1d8b8 100755 --- a/sdnr/wt/common-yang/pom.xml +++ b/sdnr/wt/common-yang/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.4</version> + <version>2.6.0</version> <relativePath/> </parent> diff --git a/sdnr/wt/common-yang/rfc7317-ietf-system/pom.xml b/sdnr/wt/common-yang/rfc7317-ietf-system/pom.xml index ce98d4cd8..6145bc7cc 100755 --- a/sdnr/wt/common-yang/rfc7317-ietf-system/pom.xml +++ b/sdnr/wt/common-yang/rfc7317-ietf-system/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.4</version> + <version>2.6.0</version> <relativePath/> </parent> diff --git a/sdnr/wt/common-yang/rfc8341/pom.xml b/sdnr/wt/common-yang/rfc8341/pom.xml index c1c1b3c0c..3f606f77a 100755 --- a/sdnr/wt/common-yang/rfc8341/pom.xml +++ b/sdnr/wt/common-yang/rfc8341/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.4</version> + <version>2.6.0</version> <relativePath/> </parent> diff --git a/sdnr/wt/common-yang/rfc8341/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/acm/rev180214/nacm/RuleListGroupBuilder.java b/sdnr/wt/common-yang/rfc8341/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/acm/rev180214/nacm/RuleListGroupBuilder.java deleted file mode 100644 index 31142806f..000000000 --- a/sdnr/wt/common-yang/rfc8341/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/acm/rev180214/nacm/RuleListGroupBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.acm.rev180214.nacm; -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * 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. - * - */ -public class RuleListGroupBuilder { - private RuleListGroupBuilder() { - //Exists only to defeat instantiation. - } - - public static RuleList.Group getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/common-yang/rfc8341/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/acm/rev180214/nacm/rule/list/RuleAccessOperationsBuilder.java b/sdnr/wt/common-yang/rfc8341/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/acm/rev180214/nacm/rule/list/RuleAccessOperationsBuilder.java deleted file mode 100644 index 91ae639c6..000000000 --- a/sdnr/wt/common-yang/rfc8341/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/acm/rev180214/nacm/rule/list/RuleAccessOperationsBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.acm.rev180214.nacm.rule.list; -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * 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. - * - */ -public class RuleAccessOperationsBuilder { - private RuleAccessOperationsBuilder() { - //Exists only to defeat instantiation. - } - - public static Rule.AccessOperations getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/common-yang/rfc8341/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/acm/rev180214/nacm/rule/list/RuleModuleNameBuilder.java b/sdnr/wt/common-yang/rfc8341/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/acm/rev180214/nacm/rule/list/RuleModuleNameBuilder.java deleted file mode 100644 index acf011231..000000000 --- a/sdnr/wt/common-yang/rfc8341/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/acm/rev180214/nacm/rule/list/RuleModuleNameBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.acm.rev180214.nacm.rule.list; -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * 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. - * - */ -public class RuleModuleNameBuilder { - private RuleModuleNameBuilder() { - //Exists only to defeat instantiation. - } - - public static Rule.ModuleName getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/common-yang/rfc8341/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/acm/rev180214/nacm/rule/list/rule/rule/type/NotificationNotificationNameBuilder.java b/sdnr/wt/common-yang/rfc8341/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/acm/rev180214/nacm/rule/list/rule/rule/type/NotificationNotificationNameBuilder.java deleted file mode 100644 index 7aca26b8c..000000000 --- a/sdnr/wt/common-yang/rfc8341/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/acm/rev180214/nacm/rule/list/rule/rule/type/NotificationNotificationNameBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.acm.rev180214.nacm.rule.list.rule.rule.type; -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * 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. - * - */ -public class NotificationNotificationNameBuilder { - private NotificationNotificationNameBuilder() { - //Exists only to defeat instantiation. - } - - public static Notification.NotificationName getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/common-yang/rfc8341/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/acm/rev180214/nacm/rule/list/rule/rule/type/ProtocolOperationRpcNameBuilder.java b/sdnr/wt/common-yang/rfc8341/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/acm/rev180214/nacm/rule/list/rule/rule/type/ProtocolOperationRpcNameBuilder.java deleted file mode 100644 index 3610df21f..000000000 --- a/sdnr/wt/common-yang/rfc8341/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/acm/rev180214/nacm/rule/list/rule/rule/type/ProtocolOperationRpcNameBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.acm.rev180214.nacm.rule.list.rule.rule.type; -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * 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. - * - */ -public class ProtocolOperationRpcNameBuilder { - private ProtocolOperationRpcNameBuilder() { - //Exists only to defeat instantiation. - } - - public static ProtocolOperation.RpcName getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/common-yang/test-yang/pom.xml b/sdnr/wt/common-yang/test-yang/pom.xml index cf1949a78..d4a3f0ae6 100644 --- a/sdnr/wt/common-yang/test-yang/pom.xml +++ b/sdnr/wt/common-yang/test-yang/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.4</version> + <version>2.6.0</version> <relativePath/> </parent> diff --git a/sdnr/wt/common-yang/utils/pom.xml b/sdnr/wt/common-yang/utils/pom.xml index 06e9eb403..d9996eca7 100644 --- a/sdnr/wt/common-yang/utils/pom.xml +++ b/sdnr/wt/common-yang/utils/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.4</version> + <version>2.6.0</version> <relativePath/> </parent> @@ -105,31 +105,6 @@ </excludes> </configuration> </plugin> - <plugin> - <groupId>org.opendaylight.yangtools</groupId> - <artifactId>yang-maven-plugin</artifactId> - <version>9.0.1</version> - <executions> - <execution> - <id>binding</id> - <goals> - <goal>generate-sources</goal> - </goals> - <configuration> - <yangFilesRootDir>src/test/yang</yangFilesRootDir> - <inspectDependencies>true</inspectDependencies> - </configuration> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>org.opendaylight.mdsal</groupId> - <artifactId>mdsal-binding-java-api-generator</artifactId> - <version>10.0.2</version> - <scope>compile</scope> - </dependency> - </dependencies> - </plugin> </plugins> </build> </project> diff --git a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/BaseIdentityDeserializer.java b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/BaseIdentityDeserializer.java index 1c4226322..9e72e5652 100644 --- a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/BaseIdentityDeserializer.java +++ b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/BaseIdentityDeserializer.java @@ -25,14 +25,10 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; - +import com.google.common.reflect.ClassPath; import java.io.IOException; -import java.lang.reflect.Type; import java.util.List; import java.util.stream.Collectors; - -import com.google.common.reflect.ClassPath; -import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapper; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapperHelper; import org.opendaylight.yangtools.yang.binding.BaseIdentity; import org.slf4j.Logger; @@ -63,13 +59,24 @@ public class BaseIdentityDeserializer<T> extends JsonDeserializer<T> { int lastDot = clazzToSearch.lastIndexOf("."); if (lastDot > -1) { simpleName = clazzToSearch.substring(lastDot + 1); + String finalSimpleName; + if(simpleName.endsWith("Identity")){ + finalSimpleName = simpleName.substring(0, simpleName.length()-8); + } + else{ + finalSimpleName=simpleName; + } clazz = getTypesInNamespace(clazzToSearch.substring(0, lastDot)).stream() - .filter(e -> e.getSimpleName().equals(simpleName)).findFirst().orElse(null); + .filter(e -> e.getSimpleName().equals(finalSimpleName)).findFirst().orElse(null); if (clazz != null) return (T) YangToolsMapperHelper.getIdentityValueFromClass(clazz); } else { simpleName = clazzToSearch.substring(0, 1).toUpperCase() + clazzToSearch.substring(1); + if(simpleName.endsWith("Identity")){ + simpleName = simpleName.substring(0, simpleName.length()-8); + } } + try { clazz = (Class<? extends BaseIdentity>) YangToolsMapperHelper.findClass(simpleName); if (clazz != null) diff --git a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/EnumSerializer.java b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/EnumSerializer.java index 8959e913a..ea07c5d05 100644 --- a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/EnumSerializer.java +++ b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/EnumSerializer.java @@ -25,7 +25,8 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import java.io.IOException; -import org.opendaylight.yangtools.yang.binding.Enumeration; +import org.opendaylight.yangtools.yang.binding.EnumTypeObject; + @SuppressWarnings("rawtypes") public class EnumSerializer extends JsonSerializer<Enum> { @@ -33,8 +34,8 @@ public class EnumSerializer extends JsonSerializer<Enum> { @Override public void serialize(Enum value, JsonGenerator gen, SerializerProvider serializers) throws IOException { //sadly a seperate serializer for class Enumeration doesn't work, so we have to catch it here - if(value instanceof Enumeration) { - gen.writeString(((Enumeration)value).getName()); + if(value instanceof EnumTypeObject) { + gen.writeString(((EnumTypeObject)value).getName()); } else { gen.writeString(value.name()); 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 81df00789..f2fd89176 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 @@ -21,11 +21,11 @@ */ package org.onap.ccsdk.features.sdnr.wt.yang.mapper; -import static org.junit.Assert.assertEquals; import com.fasterxml.jackson.core.JsonProcessingException; import java.util.HashMap; import java.util.Map; import org.json.JSONObject; +import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.serialize.IdentifierDeserializer; @@ -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.ItemCodeIdentity; +import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.ItemCode; 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; @@ -65,7 +65,7 @@ public class TestYangToolsMapper { } assertEquals(AddressType.OFFICE, al.getAddressType()); assertEquals("2022-03-15T11:12:13.890Z", al.getDeliveryDateTime().getValue()); - assertEquals(ItemCodeIdentity.VALUE, al.getTestId()); + //TODO assertEquals(ItemCode.VALUE, al.getItemList().ke); System.out.println("Delivery Date = " + al.getDeliveryDateTime().getValue()); System.out.println(al.getItemList()); System.out.println(al.getDeliveryUrl().getValue()); @@ -100,8 +100,8 @@ public class TestYangToolsMapper { @Test public void testYangMapperSer() { Map<ItemListKey, ItemList> items = new HashMap<ItemListKey, ItemList>(); - ItemList il = new ItemListBuilder().setItemKey(ItemCodeIdentity.VALUE).build(); - items.put(new ItemListKey(ItemCodeIdentity.VALUE), il); + ItemList il = new ItemListBuilder().setItemKey(ItemCode.VALUE).build(); + items.put(new ItemListKey(ItemCode.VALUE), il); Uri uri = new Uri("delivery.uri"); |