Compare commits

..

30 Commits

Author SHA1 Message Date
norm-traxler
8a0faff455 Merge pull request #23 from Telecominfraproject/WIFI-4415
[Wifi 4415] remove unnecessary code
2021-09-27 15:24:04 -04:00
Thomas-Leung2021
b7d396c6ce [WIFI-4415] remove unnecessary code 2021-09-27 13:25:06 -04:00
norm-traxler
92b97c832a Merge pull request #22 from Telecominfraproject/WIFI-4415
[WIFI-4415] Add Gateway and backend support to turn LED on/off
2021-09-27 10:56:37 -04:00
Thomas Leung
e8dd8724fb Merged in NETEXP-2959 (pull request #3)
[NETEXP-2959] update LedStatus to pass tests

Approved-by: mike.hansen
2021-09-24 16:53:44 -04:00
norm-traxler
3fb4dd16b8 Merge pull request #21 from Telecominfraproject/WIFI-3471
WIFI-3471 Update SDK master to use image tag 1.3.0-SNAPSHOT
2021-08-17 16:34:20 -04:00
norm-traxler
caa99afda1 Merge pull request #20 from Telecominfraproject/WIFI-3416-Remove-RestOperationsWithMetrics
WIFI-3416  Remove RestOperationsWithMetrics
2021-08-16 16:59:33 -04:00
Akshay Jagadish
e531cb8597 WIFI-3471 Update SDK master to use image tag 1.3.0-SNAPSHOT 2021-08-13 13:02:33 -04:00
Thomas Currie
b38393ec20 remove unused import 2021-08-12 14:12:11 -04:00
Thomas Currie
b14f57887f replace our custom RestTemplate class with the default one from Spring. 2021-08-12 10:27:29 -04:00
norm-traxler
267fb477a3 Merge pull request #19 from Telecominfraproject/WIFI-3224-Remote-client-mediatype
[WIFI-3224] change BaseRemoteClient from json contentType from UTF-8 …
2021-07-23 11:54:14 -04:00
Norm Traxler
04c844c2e2 [WIFI-3224] change BaseRemoteClient from json contentType from UTF-8 to UTF-16 (default) 2021-07-23 11:42:19 -04:00
Mike Hansen
72da490a3b Merge pull request #18 from Telecominfraproject/WIFI-3022
[WIFI-3022] fix for getting 00:00:00:00:00:00 mac address
2021-07-14 14:21:48 -04:00
Thomas-Leung2021
bb9c3ba1eb [WIFI-3022] add null checks convertMacStringToLongValue() 2021-07-14 13:53:49 -04:00
Thomas-Leung2021
7dd594644e [WIFI-3022] fix for getting 00:00:00:00:00:00 mac address 2021-07-13 17:33:46 -04:00
Mike Hansen
4c15a9650b Merge pull request #17 from Telecominfraproject/add-http-client-exception-to-tip-error-handler
add basePackes property back to CommonControllerAdvice. Add HttpClien…
2021-06-15 10:22:20 -04:00
Thomas Currie
5c3bf48780 add basePackes property back to CommonControllerAdvice. Add HttpClientErrorException to ExceptionPropogatingErrorHandler. 2021-06-14 18:16:21 -04:00
Mike Hansen
be09681087 Merge pull request #16 from Telecominfraproject/revert-15-WIFI-2633-Change-scope-of-CommonControllerAdvice
Revert "WIFI-2633  Change scope of CommonControllerAdvice"
2021-06-14 17:08:32 -04:00
Mike Hansen
a7076e523b Revert "WIFI-2633 Change scope of CommonControllerAdvice" 2021-06-14 17:04:37 -04:00
norm-traxler
6232b8db7b Merge pull request #15 from Telecominfraproject/WIFI-2633-Change-scope-of-CommonControllerAdvice
WIFI-2633  Change scope of CommonControllerAdvice
2021-06-14 11:06:46 -04:00
Thomas Currie
2bfab69a3a add 'basePackage' attribute to @ControllerAdvice 2021-06-11 09:59:39 -04:00
Mike Hansen
fef03f4bbe AP: ON_CHANNEL survey report sometimes has no information
Signed-off-by: Mike Hansen <mike.hansen@connectus.ai>
2021-06-02 09:07:24 -04:00
norm-traxler
b6a02439b8 Merge pull request #14 from Telecominfraproject/WIFI-2434
WIFI 2434: Update SDK master to use image tag 1.2.0-SNAPSHOT
2021-05-26 21:04:06 -04:00
Akshay Jagadish
789e153519 Update SDK master to use image tag 1.2.0-SNAPSHOT 2021-05-26 18:00:32 -04:00
norm-traxler
c2c67e188c Merge pull request #13 from Telecominfraproject/WIFI-2150-json--parsing-error-message-on-ap-details-save
add null safety check to setAddressAsString in MacAddress.
2021-05-11 10:33:47 -04:00
Thomas Currie
9f5e093ea5 revert to setting address field as null when null is provided to construct / setter. 2021-05-11 09:51:03 -04:00
Thomas Currie
d1bc55745e add assertions to 2 unit tests to appease sonar 2021-05-10 16:13:41 -04:00
Thomas Currie
e185ccaef6 add test coverage MacAddress of old codeand new null check in order to appease sonar 2021-05-10 16:06:08 -04:00
Thomas Currie
92fcaaa0bb Sonar changes based on 'code smell' 2021-05-10 14:40:47 -04:00
Thomas Currie
1bcf2860df add null check to convertMacStringToLongValue to prevent NPE 2021-05-10 14:29:48 -04:00
Thomas Currie
e005180f9f add null safety check to setAddressAsString in MacAdress. 2021-05-10 14:15:35 -04:00
34 changed files with 209 additions and 932 deletions

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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,20 +20,15 @@ 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");
}
@Autowired
private void setRestTemplate(RestOperations restTemplate) {
//build user-friendly metrics Id - remove $$EnhancedByCGlib... at the end of the class name
String metricsId = this.getClass().getSimpleName();
int idx = metricsId.indexOf('$');
if(idx>0){
metricsId = metricsId.substring(0, idx);
}
this.restTemplate = new RestOperationsWithMetrics(restTemplate, metricsId);
this.restTemplate = restTemplate;
}
protected String getBaseUrlFromEnvironment(String urlPropName, String defaultUrlPropName) {

View File

@@ -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

View File

@@ -1,842 +0,0 @@
package com.telecominfraproject.wlan.core.client;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RequestCallback;
import org.springframework.web.client.ResponseExtractor;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestOperations;
import com.netflix.servo.DefaultMonitorRegistry;
import com.netflix.servo.monitor.BasicCounter;
import com.netflix.servo.monitor.BasicTimer;
import com.netflix.servo.monitor.Counter;
import com.netflix.servo.monitor.MonitorConfig;
import com.netflix.servo.monitor.Stopwatch;
import com.netflix.servo.monitor.Timer;
import com.netflix.servo.tag.TagList;
import com.telecominfraproject.wlan.cloudmetrics.CloudMetricsTags;
public class RestOperationsWithMetrics implements RestOperations{
final RestOperations delegate;
private final TagList tags = CloudMetricsTags.commonTags;
private final Counter getsExecuted;
private final Counter postsExecuted;
private final Counter putsExecuted;
private final Counter deletesExecuted;
private final Counter exchangesExecuted;
private final Counter headsExecuted;
private final Counter optionsExecuted;
private final Counter execsExecuted;
private final Counter patchesExecuted;
private final Counter getsErrors;
private final Counter postsErrors;
private final Counter putsErrors;
private final Counter deletesErrors;
private final Counter exchangesErrors;
private final Counter headsErrors;
private final Counter optionsErrors;
private final Counter execsErrors;
private final Counter patchesErrors;
private final Timer getsTimer;
private final Timer postsTimer;
private final Timer putsTimer;
private final Timer deletesTimer;
private final Timer exchangesTimer;
private final Timer headsTimer;
private final Timer optionsTimer;
private final Timer execsTimer;
private final Timer patchesTimer;
public RestOperationsWithMetrics(RestOperations delegate, String metricsId){
this.delegate = delegate;
//Monitors.registerObject("RestTemplate-"+metricsId, this);
getsExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-getsExecuted").withTags(tags).build());
postsExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-postsExecuted").withTags(tags).build());
putsExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-putsExecuted").withTags(tags).build());
deletesExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-deletesExecuted").withTags(tags).build());
exchangesExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-exchangesExecuted").withTags(tags).build());
headsExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-headsExecuted").withTags(tags).build());
optionsExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-optionsExecuted").withTags(tags).build());
execsExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-execsExecuted").withTags(tags).build());
patchesExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-patchesExecuted").withTags(tags).build());
getsErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-getsErrors").withTags(tags).build());
postsErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-postsErrors").withTags(tags).build());
putsErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-putsErrors").withTags(tags).build());
deletesErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-deletesErrors").withTags(tags).build());
exchangesErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-exchangesErrors").withTags(tags).build());
headsErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-headsErrors").withTags(tags).build());
optionsErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-optionsErrors").withTags(tags).build());
execsErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-execsErrors").withTags(tags).build());
patchesErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-patchesErrors").withTags(tags).build());
getsTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-getsTimer").withTags(tags).build());
postsTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-postsTimer").withTags(tags).build());
putsTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-putsTimer").withTags(tags).build());
deletesTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-deletesTimer").withTags(tags).build());
exchangesTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-exchangesTimer").withTags(tags).build());
headsTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-headsTimer").withTags(tags).build());
optionsTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-optionsTimer").withTags(tags).build());
execsTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-execsTimer").withTags(tags).build());
patchesTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-patchesTimer").withTags(tags).build());
DefaultMonitorRegistry.getInstance().register(getsExecuted);
DefaultMonitorRegistry.getInstance().register(postsExecuted);
DefaultMonitorRegistry.getInstance().register(putsExecuted);
DefaultMonitorRegistry.getInstance().register(deletesExecuted);
DefaultMonitorRegistry.getInstance().register(exchangesExecuted);
DefaultMonitorRegistry.getInstance().register(headsExecuted);
DefaultMonitorRegistry.getInstance().register(optionsExecuted);
DefaultMonitorRegistry.getInstance().register(execsExecuted);
DefaultMonitorRegistry.getInstance().register(getsErrors);
DefaultMonitorRegistry.getInstance().register(postsErrors);
DefaultMonitorRegistry.getInstance().register(putsErrors);
DefaultMonitorRegistry.getInstance().register(deletesErrors);
DefaultMonitorRegistry.getInstance().register(exchangesErrors);
DefaultMonitorRegistry.getInstance().register(headsErrors);
DefaultMonitorRegistry.getInstance().register(optionsErrors);
DefaultMonitorRegistry.getInstance().register(execsErrors);
DefaultMonitorRegistry.getInstance().register(getsTimer);
DefaultMonitorRegistry.getInstance().register(postsTimer);
DefaultMonitorRegistry.getInstance().register(putsTimer);
DefaultMonitorRegistry.getInstance().register(deletesTimer);
DefaultMonitorRegistry.getInstance().register(exchangesTimer);
DefaultMonitorRegistry.getInstance().register(headsTimer);
DefaultMonitorRegistry.getInstance().register(optionsTimer);
DefaultMonitorRegistry.getInstance().register(execsTimer);
}
public <T> T getForObject(String url, Class<T> responseType, Object... uriVariables) throws RestClientException {
getsExecuted.increment();
Stopwatch s = getsTimer.start();
boolean success = false;
try{
T ret = delegate.getForObject(url, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
getsErrors.increment();
}
}
}
public <T> T getForObject(String url, Class<T> responseType, Map<String, ?> uriVariables)
throws RestClientException {
getsExecuted.increment();
Stopwatch s = getsTimer.start();
boolean success = false;
try{
T ret = delegate.getForObject(url, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
getsErrors.increment();
}
}
}
public <T> T getForObject(URI url, Class<T> responseType) throws RestClientException {
getsExecuted.increment();
Stopwatch s = getsTimer.start();
boolean success = false;
try{
T ret = delegate.getForObject(url, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
getsErrors.increment();
}
}
}
public <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Object... uriVariables)
throws RestClientException {
getsExecuted.increment();
Stopwatch s = getsTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.getForEntity(url, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
getsErrors.increment();
}
}
}
public <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Map<String, ?> uriVariables)
throws RestClientException {
getsExecuted.increment();
Stopwatch s = getsTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.getForEntity(url, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
getsErrors.increment();
}
}
}
public <T> ResponseEntity<T> getForEntity(URI url, Class<T> responseType) throws RestClientException {
getsExecuted.increment();
Stopwatch s = getsTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.getForEntity(url, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
getsErrors.increment();
}
}
}
public HttpHeaders headForHeaders(String url, Object... uriVariables) throws RestClientException {
headsExecuted.increment();
Stopwatch s = headsTimer.start();
boolean success = false;
try{
HttpHeaders ret = delegate.headForHeaders(url, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
headsErrors.increment();
}
}
}
public HttpHeaders headForHeaders(String url, Map<String, ?> uriVariables) throws RestClientException {
headsExecuted.increment();
Stopwatch s = headsTimer.start();
boolean success = false;
try{
HttpHeaders ret = delegate.headForHeaders(url, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
headsErrors.increment();
}
}
}
public HttpHeaders headForHeaders(URI url) throws RestClientException {
headsExecuted.increment();
Stopwatch s = headsTimer.start();
boolean success = false;
try{
HttpHeaders ret = delegate.headForHeaders(url);
success = true;
return ret;
}finally{
s.stop();
if(!success){
headsErrors.increment();
}
}
}
public URI postForLocation(String url, Object request, Object... uriVariables) throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
URI ret = delegate.postForLocation(url, request, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public URI postForLocation(String url, Object request, Map<String, ?> uriVariables) throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
URI ret = delegate.postForLocation(url, request, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public URI postForLocation(URI url, Object request) throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
URI ret = delegate.postForLocation(url, request);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public <T> T postForObject(String url, Object request, Class<T> responseType, Object... uriVariables)
throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
T ret = delegate.postForObject(url, request, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public <T> T postForObject(String url, Object request, Class<T> responseType, Map<String, ?> uriVariables)
throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
T ret = delegate.postForObject(url, request, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public <T> T postForObject(URI url, Object request, Class<T> responseType) throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
T ret = delegate.postForObject(url, request, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public <T> ResponseEntity<T> postForEntity(String url, Object request, Class<T> responseType,
Object... uriVariables) throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.postForEntity(url, request, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public <T> ResponseEntity<T> postForEntity(String url, Object request, Class<T> responseType,
Map<String, ?> uriVariables) throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.postForEntity(url, request, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public <T> ResponseEntity<T> postForEntity(URI url, Object request, Class<T> responseType)
throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.postForEntity(url, request, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public void put(String url, Object request, Object... uriVariables) throws RestClientException {
putsExecuted.increment();
Stopwatch s = putsTimer.start();
boolean success = false;
try{
delegate.put(url, request, uriVariables);
success = true;
}finally{
s.stop();
if(!success){
putsErrors.increment();
}
}
}
public void put(String url, Object request, Map<String, ?> uriVariables) throws RestClientException {
putsExecuted.increment();
Stopwatch s = putsTimer.start();
boolean success = false;
try{
delegate.put(url, request, uriVariables);
success = true;
}finally{
s.stop();
if(!success){
putsErrors.increment();
}
}
}
public void put(URI url, Object request) throws RestClientException {
putsExecuted.increment();
Stopwatch s = putsTimer.start();
boolean success = false;
try{
delegate.put(url, request);
success = true;
}finally{
s.stop();
if(!success){
putsErrors.increment();
}
}
}
public void delete(String url, Object... uriVariables) throws RestClientException {
deletesExecuted.increment();
Stopwatch s = deletesTimer.start();
boolean success = false;
try{
delegate.delete(url, uriVariables);
success = true;
}finally{
s.stop();
if(!success){
deletesErrors.increment();
}
}
}
public void delete(String url, Map<String, ?> uriVariables) throws RestClientException {
deletesExecuted.increment();
Stopwatch s = deletesTimer.start();
boolean success = false;
try{
delegate.delete(url, uriVariables);
success = true;
}finally{
s.stop();
if(!success){
deletesErrors.increment();
}
}
}
public void delete(URI url) throws RestClientException {
deletesExecuted.increment();
Stopwatch s = deletesTimer.start();
boolean success = false;
try{
delegate.delete(url);
success = true;
}finally{
s.stop();
if(!success){
deletesErrors.increment();
}
}
}
public Set<HttpMethod> optionsForAllow(String url, Object... uriVariables) throws RestClientException {
optionsExecuted.increment();
Stopwatch s = optionsTimer.start();
boolean success = false;
try{
Set<HttpMethod> ret = delegate.optionsForAllow(url, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
optionsErrors.increment();
}
}
}
public Set<HttpMethod> optionsForAllow(String url, Map<String, ?> uriVariables) throws RestClientException {
optionsExecuted.increment();
Stopwatch s = optionsTimer.start();
boolean success = false;
try{
Set<HttpMethod> ret = delegate.optionsForAllow(url, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
optionsErrors.increment();
}
}
}
public Set<HttpMethod> optionsForAllow(URI url) throws RestClientException {
optionsExecuted.increment();
Stopwatch s = optionsTimer.start();
boolean success = false;
try{
Set<HttpMethod> ret = delegate.optionsForAllow(url);
success = true;
return ret;
}finally{
s.stop();
if(!success){
optionsErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> requestEntity,
Class<T> responseType, Object... uriVariables) throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(url, method, requestEntity, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> requestEntity,
Class<T> responseType, Map<String, ?> uriVariables) throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(url, method, requestEntity, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(URI url, HttpMethod method, HttpEntity<?> requestEntity,
Class<T> responseType) throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(url, method, requestEntity, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> requestEntity,
ParameterizedTypeReference<T> responseType, Object... uriVariables) throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(url, method, requestEntity, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> requestEntity,
ParameterizedTypeReference<T> responseType, Map<String, ?> uriVariables) throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(url, method, requestEntity, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(URI url, HttpMethod method, HttpEntity<?> requestEntity,
ParameterizedTypeReference<T> responseType) throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(url, method, requestEntity, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(RequestEntity<?> requestEntity, Class<T> responseType)
throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(requestEntity, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(RequestEntity<?> requestEntity, ParameterizedTypeReference<T> responseType)
throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(requestEntity, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
ResponseExtractor<T> responseExtractor, Object... uriVariables) throws RestClientException {
execsExecuted.increment();
Stopwatch s = execsTimer.start();
boolean success = false;
try{
T ret = delegate.execute(url, method, requestCallback, responseExtractor, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
execsErrors.increment();
}
}
}
public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
ResponseExtractor<T> responseExtractor, Map<String, ?> uriVariables) throws RestClientException {
execsExecuted.increment();
Stopwatch s = execsTimer.start();
boolean success = false;
try{
T ret = delegate.execute(url, method, requestCallback, responseExtractor, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
execsErrors.increment();
}
}
}
public <T> T execute(URI url, HttpMethod method, RequestCallback requestCallback,
ResponseExtractor<T> responseExtractor) throws RestClientException {
execsExecuted.increment();
Stopwatch s = execsTimer.start();
boolean success = false;
try{
T ret = delegate.execute(url, method, requestCallback, responseExtractor);
success = true;
return ret;
}finally{
s.stop();
if(!success){
execsErrors.increment();
}
}
}
@Override
public <T> T patchForObject(String url, Object request, Class<T> responseType, Object... uriVariables)
throws RestClientException {
patchesExecuted.increment();
Stopwatch s = patchesTimer.start();
boolean success = false;
try{
T ret = delegate.patchForObject(url, request, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
patchesErrors.increment();
}
}
}
@Override
public <T> T patchForObject(String url, Object request, Class<T> responseType, Map<String, ?> uriVariables)
throws RestClientException {
patchesExecuted.increment();
Stopwatch s = patchesTimer.start();
boolean success = false;
try{
T ret = delegate.patchForObject(url, request, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
patchesErrors.increment();
}
}
}
@Override
public <T> T patchForObject(URI url, Object request, Class<T> responseType) throws RestClientException {
patchesExecuted.increment();
Stopwatch s = patchesTimer.start();
boolean success = false;
try{
T ret = delegate.patchForObject(url, request, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
patchesErrors.increment();
}
}
}
}

View File

@@ -8,7 +8,7 @@ import org.springframework.core.env.Environment;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.web.client.RestOperations;
import org.springframework.web.client.RestTemplate;
import java.net.URI;
@@ -18,7 +18,7 @@ public class PingClientTest {
PingClient pingClient = mock(PingClient.class, CALLS_REAL_METHODS);
RestOperations restTemplate = mock(RestOperationsWithMetrics.class);
RestTemplate restTemplate = mock(RestTemplate.class);
Environment env = mock(Environment.class);

View File

@@ -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 -->

View File

@@ -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);

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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 -->

View File

@@ -0,0 +1,9 @@
package com.telecominfraproject.wlan.core.model.equipment;
public enum LedStatus {
led_on,
led_off,
led_blink,
UNKNOWN;
}

View File

@@ -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;
}

View File

@@ -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();
}

View File

@@ -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));
}
}

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>