mirror of
https://github.com/Telecominfraproject/wlan-cloud-base.git
synced 2026-03-20 21:39:06 +00:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e531cb8597 | ||
|
|
267fb477a3 | ||
|
|
04c844c2e2 | ||
|
|
72da490a3b | ||
|
|
bb9c3ba1eb | ||
|
|
7dd594644e | ||
|
|
4c15a9650b | ||
|
|
5c3bf48780 | ||
|
|
be09681087 | ||
|
|
a7076e523b | ||
|
|
6232b8db7b | ||
|
|
2bfab69a3a | ||
|
|
fef03f4bbe | ||
|
|
b6a02439b8 | ||
|
|
789e153519 | ||
|
|
c2c67e188c | ||
|
|
9f5e093ea5 | ||
|
|
d1bc55745e | ||
|
|
e185ccaef6 | ||
|
|
92fcaaa0bb | ||
|
|
1bcf2860df | ||
|
|
e005180f9f | ||
|
|
b1cc93b9df |
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-cassandra-tests</artifactId>
|
||||
@@ -14,7 +14,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-cassandra</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-cassandra</artifactId>
|
||||
@@ -14,7 +14,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>cloud-metrics</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-client</artifactId>
|
||||
@@ -14,25 +14,25 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-container</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-exceptions</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>cloud-metrics</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.telecominfraproject.wlan.core.client;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -22,7 +20,8 @@ public abstract class BaseRemoteClient {
|
||||
protected HttpHeaders headers = new HttpHeaders();
|
||||
|
||||
{
|
||||
headers.setContentType(new MediaType("application", "json", StandardCharsets.UTF_8));
|
||||
// Note: APPLICATION_JSON_UTF8 is deprecated
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
//Accept-Encoding: gzip,deflate
|
||||
headers.set("Accept-Encoding", "gzip,deflate");
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.springframework.core.task.TaskRejectedException;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.web.client.DefaultResponseErrorHandler;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.HttpServerErrorException;
|
||||
import org.springframework.web.client.ResponseErrorHandler;
|
||||
|
||||
@@ -38,7 +39,7 @@ public class ExceptionPropagatingErrorHandler extends DefaultResponseErrorHandle
|
||||
public void handleError(ClientHttpResponse response) throws IOException {
|
||||
try {
|
||||
super.handleError(response);
|
||||
} catch (HttpServerErrorException e) {
|
||||
} catch (HttpServerErrorException | HttpClientErrorException e) {
|
||||
// look in the response object, and if it contains any of the
|
||||
// exceptions we recognize - throw that exception instead of the
|
||||
// HttpServerErrorException
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-container</artifactId>
|
||||
@@ -18,7 +18,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
@@ -32,7 +32,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>cloud-metrics</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Auth0 dependencies -->
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.telecominfraproject.wlan.core.model.json.JsonSerializedException;
|
||||
/**
|
||||
* @author dtoptygin
|
||||
*/
|
||||
@ControllerAdvice
|
||||
@ControllerAdvice(basePackages = "com.telecominfraproject")
|
||||
public class CommonControllerAdvice {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CommonControllerAdvice.class);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-datastore-inmemory</artifactId>
|
||||
@@ -13,7 +13,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-exceptions</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-elasticsearch</artifactId>
|
||||
@@ -14,12 +14,12 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-exceptions</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- ElasticSearch dependencies -->
|
||||
<dependency>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-exceptions</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-hazelcast-client</artifactId>
|
||||
@@ -21,12 +21,12 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>common-hazelcast</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-hierarchical-datastore</artifactId>
|
||||
@@ -13,17 +13,17 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-hazelcast-client</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>cloud-metrics</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-jdbc-tests</artifactId>
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-jdbc</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-jdbc</artifactId>
|
||||
@@ -41,7 +41,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>cloud-metrics</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-models</artifactId>
|
||||
@@ -14,20 +14,20 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-exceptions</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>json-patch-tip</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- this is used to register all subclasses of BaseJsonModel for deserialization -->
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>reflections-tip</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math3 -->
|
||||
|
||||
@@ -58,7 +58,7 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
if(address.length >= 6)
|
||||
{
|
||||
long mac = 0;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (var i = 0; i < 6; i++) {
|
||||
long t = (address[i] & 0xffL) << ((5 - i) * 8);
|
||||
mac |= t;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
}
|
||||
|
||||
public String getAddressAsString() {
|
||||
StringBuilder sb = new StringBuilder(124);
|
||||
var sb = new StringBuilder(124);
|
||||
|
||||
if(address != null)
|
||||
{
|
||||
@@ -82,14 +82,15 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
}
|
||||
|
||||
sb.setLength(sb.length() - 1);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
return null;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getAsLowerCaseString() {
|
||||
StringBuilder sb = new StringBuilder(124);
|
||||
var sb = new StringBuilder(124);
|
||||
for (byte single : address) {
|
||||
sb.append(String.format("%02x", single));
|
||||
}
|
||||
@@ -131,8 +132,8 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
final var prime = 31;
|
||||
var result = 1;
|
||||
result = prime * result + Arrays.hashCode(address);
|
||||
return result;
|
||||
}
|
||||
@@ -163,12 +164,16 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
|
||||
|
||||
private static byte[] stringToByteArray(String str) {
|
||||
byte[] ret = new byte[6];
|
||||
if (str == null || str.equals(""))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var ret = new byte[6];
|
||||
|
||||
String octets[] = str.split(":");
|
||||
if(octets.length == 1 && octets[0].length() == str.length() && str.length()<=12) {
|
||||
// hex string without colon
|
||||
for(int i = 0; i< str.length(); i+=2) {
|
||||
for(var i = 0; i< str.length(); i+=2) {
|
||||
Integer hex = Integer.parseInt(str.substring(i, i==str.length()-1?i+1:i+2), 16);
|
||||
ret[i/2] = hex.byteValue();
|
||||
}
|
||||
@@ -178,7 +183,7 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
}
|
||||
else {
|
||||
try {
|
||||
for (int i = 0; i < octets.length; i++) {
|
||||
for (var i = 0; i < octets.length; i++) {
|
||||
Integer hex = Integer.parseInt(octets[i], 16);
|
||||
ret[i] = hex.byteValue();
|
||||
}
|
||||
@@ -210,8 +215,8 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
else
|
||||
{
|
||||
String[] value = lowercaseValue.split(":");
|
||||
StringBuilder sb = new StringBuilder(6);
|
||||
for(int i=0; i<3; i++)
|
||||
var sb = new StringBuilder(6);
|
||||
for(var i=0; i<3; i++)
|
||||
{
|
||||
sb.append(value[i].toLowerCase());
|
||||
}
|
||||
@@ -221,11 +226,11 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
}
|
||||
|
||||
public String toOuiString() {
|
||||
if(address == null) {
|
||||
if(address == null || address.length == 0) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(6);
|
||||
for (int i = 0; i< 3; i++) {
|
||||
var sb = new StringBuilder(6);
|
||||
for (var i = 0; i< 3; i++) {
|
||||
sb.append(String.format("%02x", address[i]));
|
||||
}
|
||||
return sb.toString();
|
||||
@@ -288,11 +293,17 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
* @return
|
||||
*/
|
||||
public static Long convertMacStringToLongValue(String macStr) {
|
||||
|
||||
if (macStr == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] bval = stringToByteArray(macStr);
|
||||
|
||||
if (bval.length >= 6) {
|
||||
if (bval != null && bval.length >= 6) {
|
||||
long mac = 0;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (var i = 0; i < 6; i++) {
|
||||
long t = (bval[i] & 0xffL) << ((5 - i) * 8);
|
||||
mac |= t;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.telecominfraproject.wlan.core.model.json.interfaces;
|
||||
/**
|
||||
* Marker interface that tells if current object can provide a timestamp from its source data (i.e. timestamp for stats report used to generate a ServiceMetric)
|
||||
* @author mikehansen1970
|
||||
*
|
||||
*/
|
||||
public interface HasSourceTimestamp {
|
||||
|
||||
/**
|
||||
* @return the timestamp of the source data for this object (i.e. for the stats that were used for a ServiceMetric)
|
||||
*/
|
||||
public long getSourceTimestampMs();
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.HashMap;
|
||||
@@ -14,8 +16,6 @@ import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
||||
|
||||
public class MacAddressTest {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MacAddressTest.class);
|
||||
|
||||
@@ -145,5 +145,97 @@ public class MacAddressTest {
|
||||
assertEquals(first, equalToFirst);
|
||||
assertNotEquals(first, notEqualToFirst);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetAddress() {
|
||||
MacAddress nullCheck = new MacAddress();
|
||||
nullCheck.setAddress(null);
|
||||
assertNull(nullCheck.getAddress());
|
||||
|
||||
MacAddress realValue = new MacAddress();
|
||||
realValue.setAddress(new byte[] { 1, 2, 3, 4, 5, 6 });
|
||||
assertNotNull(realValue.getAddress());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAddressAsLong()
|
||||
{
|
||||
MacAddress macAddress = new MacAddress("00:2a:f7:7a:1e:a0");
|
||||
assertNotNull(macAddress.getAddressAsLong());
|
||||
|
||||
MacAddress otherMacAddress = new MacAddress(new byte[] { 1, 2, 3, 4, 5});
|
||||
assertNull(otherMacAddress.getAddressAsLong());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAddressAsString() {
|
||||
MacAddress macAddress = new MacAddress("00:2a:f7:7a:1e:a0");
|
||||
assertNotNull(macAddress.getAddressAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAsLowerCaseString() {
|
||||
MacAddress macAddress = new MacAddress("00:2a:f7:7a:1e:a0");
|
||||
assertNotNull(macAddress.getAsLowerCaseString().toCharArray());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHashCode()
|
||||
{
|
||||
MacAddress macAddress = new MacAddress("00:2a:f7:7a:1e:a0");
|
||||
|
||||
assertNotEquals(macAddress.hashCode(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStringToByteArray()
|
||||
{
|
||||
MacAddress macAddress = new MacAddress();
|
||||
macAddress.setAddressAsString(null);
|
||||
assertNull(macAddress.getAddress());
|
||||
|
||||
macAddress.setAddressAsString("00:2a:f7:7a:1e:a0");
|
||||
assertNotNull(macAddress.getAddress());
|
||||
|
||||
try {
|
||||
macAddress.setAddressAsString("00:2a:f7:7a:1e:a0:b0:f1");
|
||||
fail("expected exception.");
|
||||
} catch (IllegalArgumentException e)
|
||||
{
|
||||
//expected it
|
||||
}
|
||||
try {
|
||||
macAddress.setAddressAsString("00:2a:f7:7a:1esdafsat:a0");
|
||||
fail("expected exception.");
|
||||
} catch (IllegalArgumentException e)
|
||||
{
|
||||
//expected it
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOuiFromLowerCaseString()
|
||||
{
|
||||
assertNotNull(MacAddress.ouiFromLowerCaseString("00:2a:f7:7a:1e:a0", true));
|
||||
assertNotNull(MacAddress.ouiFromLowerCaseString("00:2a:f7:7a:1e:a0", false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToOuiString()
|
||||
{
|
||||
MacAddress macAddress = new MacAddress("00:2a:f7:7a:1e:a0");
|
||||
assertNotNull(macAddress.toOuiString());
|
||||
|
||||
MacAddress nullCheck = new MacAddress();
|
||||
nullCheck.setAddressAsString(null);
|
||||
assertNull(nullCheck.toOuiString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvertMacStringToLongValue()
|
||||
{
|
||||
assertNotNull(MacAddress.convertMacStringToLongValue("00:2a:f7:7a:1e:a0"));
|
||||
assertNull(MacAddress.convertMacStringToLongValue(null));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-partitioner</artifactId>
|
||||
@@ -13,7 +13,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-hazelcast-client</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-remote-tests</artifactId>
|
||||
@@ -14,7 +14,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-tx-tests</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-scheduler</artifactId>
|
||||
@@ -14,7 +14,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-stream-consumer</artifactId>
|
||||
@@ -14,13 +14,13 @@
|
||||
<dependency>
|
||||
<artifactId>base-models</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>cloud-metrics</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-stream-interface</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-tx-tests</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>cloud-metrics</artifactId>
|
||||
@@ -13,18 +13,18 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-exceptions</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-elasticsearch</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>common-hazelcast</artifactId>
|
||||
@@ -19,7 +19,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>reflections-tip</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>webtoken-auth-service</artifactId>
|
||||
@@ -14,13 +14,13 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-container</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-client</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
Reference in New Issue
Block a user