diff options
author | ruilin cai <ruilin.cai@huawei.com> | 2023-05-26 15:06:59 -0400 |
---|---|---|
committer | Ruilin Cai <ruilin.cai@huawei.com> | 2023-06-20 18:02:42 +0000 |
commit | fe6bab8436064f0b1f6b2376452ca1d2ee41854f (patch) | |
tree | 17c84c60c2cecc1cafe0e0faaaad6ed04e3d32ec /sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncUtils.java | |
parent | 13005406337c998f07d1b450d3ff6aa3d01b7ced (diff) |
[actn-interface-tools] Added test files in sample-apps module. Modified some model classes in sample-apps moduleHEADmaster
The test files are used to do the unit tests for each functions inside OSS ACTN sdk including get/set/delete/update otnnetwork/otnTunnel/EthernetService.
Change-Id: I3e8a5cac16d0b7359414c4af1c87f0da0421a045
Signed-off-by: ruilin cai <ruilin.cai@huawei.com>
Issue-ID: INT-2213
Signed-off-by: ruilin cai <ruilin.cai@huawei.com>
Diffstat (limited to 'sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncUtils.java')
-rw-r--r-- | sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncUtils.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncUtils.java b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncUtils.java index 3d92d4c..17f2b87 100644 --- a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncUtils.java +++ b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncUtils.java @@ -23,6 +23,8 @@ package org.onap.integration.actninterfacetools.sampleapp.mpiconverter.converter import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.nio.ByteBuffer; + public class PncUtils { private static final Logger log = LoggerFactory.getLogger(PncUtils.class); @@ -97,4 +99,32 @@ public class PncUtils { } throw new IllegalArgumentException("PncUtils: setBits: Illegal Argument"); } + public static long byteArray2Long(byte[] bytes) + { + long value = 0l; + + // Iterating through for loop + for (byte b : bytes) { + // Shifting previous value 8 bits to right and + // add it with next value + value = (value << 8) + (b & 255); + } + + return value; + } + public static short byteArray2Short(byte[] array) { +// ByteBuffer buffer = ByteBuffer.wrap(array); +// return buffer.getShort(); + short value = 0; + + // Iterating through for loop + for (byte b : array) { + // Shifting previous value 8 bits to right and + // add it with next value + value = (short) ((value << 8) + (b & 255)); + } + + return value; + + } } |