aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/aaf/AafConnection.java3
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/aaf/AafLurService.java4
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/authentication/AafLurAndFish.java8
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/authentication/ApiPerms.java6
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/client/DrProvConnection.java28
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/client/MrProvConnection.java22
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/client/MrTopicConnection.java4
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java4
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/model/Feed.java5
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/resources/BridgeResource.java4
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/resources/DR_SubResource.java4
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/server/JettyServer.java28
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/service/DR_NodeService.java4
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/service/DR_SubService.java4
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java13
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/service/FeedService.java4
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/service/MR_ClientService.java4
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/service/MR_ClusterService.java4
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java4
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/util/Graph.java13
-rw-r--r--src/test/java/org/onap/dmaap/dbcapi/util/FqdnTest.java33
21 files changed, 108 insertions, 95 deletions
diff --git a/src/main/java/org/onap/dmaap/dbcapi/aaf/AafConnection.java b/src/main/java/org/onap/dmaap/dbcapi/aaf/AafConnection.java
index 1d7b273..e22290a 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/aaf/AafConnection.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/aaf/AafConnection.java
@@ -3,6 +3,8 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,7 +81,6 @@ public class AafConnection extends BaseLoggingClass {
} catch (Exception e) {
logger.error("Error", e);
errorLogger.error(DmaapbcLogMessageEnum.HTTP_CONNECTION_ERROR, pURL, e.getMessage());
- e.printStackTrace();
return(false);
}
diff --git a/src/main/java/org/onap/dmaap/dbcapi/aaf/AafLurService.java b/src/main/java/org/onap/dmaap/dbcapi/aaf/AafLurService.java
index 2ebf403..537c773 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/aaf/AafLurService.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/aaf/AafLurService.java
@@ -3,7 +3,7 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -128,7 +128,7 @@ public class AafLurService extends BaseLoggingClass {
return rc;
}
- List<Permission> perms = new ArrayList<Permission>();
+ List<Permission> perms = new ArrayList<>();
aafLur.fishAll( principal, perms);
String key = aafPerm.getKey();
for ( Permission prm: perms ) {
diff --git a/src/main/java/org/onap/dmaap/dbcapi/authentication/AafLurAndFish.java b/src/main/java/org/onap/dmaap/dbcapi/authentication/AafLurAndFish.java
index 5b4d7de..9defe34 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/authentication/AafLurAndFish.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/authentication/AafLurAndFish.java
@@ -3,7 +3,7 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -98,10 +98,10 @@ public class AafLurAndFish implements ApiAuthorizationCheckInterface {
try {
alaf.check("mmanager@people.osaaf.org", "demo123456!", p);
} catch (AuthenticationErrorException aee ) {
+ logger.error(aee);
logger.error( "Check failed for: " + p.toJSON());
- System.exit(-1);
+ System.exit(-1);
}
- logger.info( "Check succeeded for: " + p.toJSON() );
-
+ logger.info("Check succeeded for: " + p.toJSON());
}
}
diff --git a/src/main/java/org/onap/dmaap/dbcapi/authentication/ApiPerms.java b/src/main/java/org/onap/dmaap/dbcapi/authentication/ApiPerms.java
index f3b9ebc..bcadf40 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/authentication/ApiPerms.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/authentication/ApiPerms.java
@@ -3,6 +3,8 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2018 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -172,8 +174,8 @@ public class ApiPerms extends BaseLoggingClass {
}
public void setEnvMap() {
- Dmaap dmaap = new DmaapService().getDmaap();
- String dmaapName = dmaap.getDmaapName();
+ Dmaap dmaapVar = new DmaapService().getDmaap();
+ String dmaapName = dmaapVar.getDmaapName();
PermissionMap.initMap( envMap, dmaapName );
}
diff --git a/src/main/java/org/onap/dmaap/dbcapi/client/DrProvConnection.java b/src/main/java/org/onap/dmaap/dbcapi/client/DrProvConnection.java
index 34d36ba..cc6f02c 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/client/DrProvConnection.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/client/DrProvConnection.java
@@ -3,6 +3,8 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,30 +22,20 @@
package org.onap.dmaap.dbcapi.client;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.ConnectException;
-import java.net.ProtocolException;
-import java.net.SocketException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import javax.net.ssl.HttpsURLConnection;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.PropertyConfigurator;
import org.onap.dmaap.dbcapi.logging.BaseLoggingClass;
import org.onap.dmaap.dbcapi.logging.DmaapbcLogMessageEnum;
import org.onap.dmaap.dbcapi.model.ApiError;
-import org.onap.dmaap.dbcapi.model.DR_Pub;
import org.onap.dmaap.dbcapi.model.DR_Sub;
import org.onap.dmaap.dbcapi.model.Feed;
import org.onap.dmaap.dbcapi.service.DmaapService;
-import org.onap.dmaap.dbcapi.util.RandomInteger;
+
+import javax.net.ssl.HttpsURLConnection;
+import java.io.*;
+import java.net.ConnectException;
+import java.net.ProtocolException;
+import java.net.SocketException;
+import java.net.URL;
+import java.util.Arrays;
diff --git a/src/main/java/org/onap/dmaap/dbcapi/client/MrProvConnection.java b/src/main/java/org/onap/dmaap/dbcapi/client/MrProvConnection.java
index 94d671f..51bad4f 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/client/MrProvConnection.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/client/MrProvConnection.java
@@ -3,7 +3,7 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,22 +21,7 @@
package org.onap.dmaap.dbcapi.client;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.ConnectException;
-import java.net.HttpURLConnection;
-import java.net.ProtocolException;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.util.Arrays;
-
-import javax.net.ssl.HttpsURLConnection;
-
import org.apache.commons.codec.binary.Base64;
-import org.apache.log4j.Logger;
import org.onap.dmaap.dbcapi.aaf.AafDecrypt;
import org.onap.dmaap.dbcapi.logging.BaseLoggingClass;
import org.onap.dmaap.dbcapi.logging.DmaapbcLogMessageEnum;
@@ -45,6 +30,11 @@ import org.onap.dmaap.dbcapi.model.MR_Cluster;
import org.onap.dmaap.dbcapi.model.Topic;
import org.onap.dmaap.dbcapi.util.DmaapConfig;
+import javax.net.ssl.HttpsURLConnection;
+import java.io.*;
+import java.net.*;
+import java.util.Arrays;
+
public class MrProvConnection extends BaseLoggingClass{
private String provURL;
diff --git a/src/main/java/org/onap/dmaap/dbcapi/client/MrTopicConnection.java b/src/main/java/org/onap/dmaap/dbcapi/client/MrTopicConnection.java
index 492037c..a92dbc7 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/client/MrTopicConnection.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/client/MrTopicConnection.java
@@ -3,6 +3,8 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -63,7 +65,7 @@ public class MrTopicConnection extends BaseLoggingClass {
topicURL = cluster.getTopicProtocol() + "://" + fqdn + ":" + cluster.getTopicPort() + "/events/" + topic ;
- if ( cluster.getTopicProtocol().equals( "https")) {
+ if ( "https".equals(cluster.getTopicProtocol())) {
return makeSecureConnection( topicURL );
}
return makeConnection( topicURL );
diff --git a/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java b/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java
index 934b7bb..b404479 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java
@@ -3,6 +3,8 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,7 +57,7 @@ public class DatabaseClass extends BaseLoggingClass {
if (val == null) {
return(null);
}
- List<String> rv = new ArrayList<String>();
+ List<String> rv = new ArrayList<>();
for (String s: val.split(",")) {
rv.add(new String(s));
}
diff --git a/src/main/java/org/onap/dmaap/dbcapi/model/Feed.java b/src/main/java/org/onap/dmaap/dbcapi/model/Feed.java
index 648812f..b78377b 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/model/Feed.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/model/Feed.java
@@ -3,6 +3,8 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -262,8 +264,7 @@ public class Feed extends DmaapObject {
}
public static String getSubProvURL( String feedId ) {
- String ret = new String();
- ret = new DmaapService().getDmaap().getDrProvUrl() + "/subscribe/" + feedId ;
+ String ret = new DmaapService().getDmaap().getDrProvUrl() + "/subscribe/" + feedId ;
return ret;
}
diff --git a/src/main/java/org/onap/dmaap/dbcapi/resources/BridgeResource.java b/src/main/java/org/onap/dmaap/dbcapi/resources/BridgeResource.java
index e6fede7..192b63d 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/resources/BridgeResource.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/resources/BridgeResource.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -121,7 +123,7 @@ public class BridgeResource extends BaseLoggingClass {
}
logger.info( "Count for "+ key + ": " + mCnt);
totCnt += mCnt;
- if (showDetail) {
+ if (showDetail && mm!=null) {
brTopic[s] = new BrTopic();
brTopic[s].setBrSource( mm.getSourceCluster());
brTopic[s].setBrTarget(mm.getTargetCluster());
diff --git a/src/main/java/org/onap/dmaap/dbcapi/resources/DR_SubResource.java b/src/main/java/org/onap/dmaap/dbcapi/resources/DR_SubResource.java
index 58a39df..28bfdc5 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/resources/DR_SubResource.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/resources/DR_SubResource.java
@@ -3,6 +3,8 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -120,8 +122,6 @@ public class DR_SubResource extends BaseLoggingClass {
fnew.setSubs(subs);
logger.info( "update feed");
- //feeds.updateFeed( fnew, err );
-
return resp.success(Status.CREATED.getStatusCode(), snew);
}
diff --git a/src/main/java/org/onap/dmaap/dbcapi/server/JettyServer.java b/src/main/java/org/onap/dmaap/dbcapi/server/JettyServer.java
index 748eedc..81c08b2 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/server/JettyServer.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/server/JettyServer.java
@@ -2,7 +2,9 @@
* ============LICENSE_START=======================================================
* org.onap.dmaap
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,32 +23,14 @@
package org.onap.dmaap.dbcapi.server;
-import java.util.Properties;
-
-import javax.net.ssl.SSLContext;
-
-import org.apache.log4j.Logger;
-import org.eclipse.jetty.security.SecurityHandler;
-import org.eclipse.jetty.server.Connector;
-import org.eclipse.jetty.server.HttpConfiguration;
-import org.eclipse.jetty.server.HttpConnectionFactory;
-import org.eclipse.jetty.server.SecureRequestCustomizer;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.server.SslConnectionFactory;
+import org.eclipse.jetty.server.*;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.ssl.SslContextFactory;
-
-
-
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-import org.onap.dmaap.dbcapi.database.LoadSchema;
import org.onap.dmaap.dbcapi.logging.BaseLoggingClass;
+
+import java.util.Properties;
/**
* A Jetty server which supports:
* - http and https (simultaneously for dev env)
diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/DR_NodeService.java b/src/main/java/org/onap/dmaap/dbcapi/service/DR_NodeService.java
index cf8c7c1..b478dca 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/service/DR_NodeService.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/service/DR_NodeService.java
@@ -3,6 +3,8 @@
* org.onap.dcae
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,7 +60,7 @@ public class DR_NodeService extends BaseLoggingClass {
private void setX( String X, String list, ApiError apiError ) {
DrProvConnection prov = new DrProvConnection();
prov.makeNodesConnection( X, list );
- String resp = prov.doPutNodes( apiError );
+ prov.doPutNodes( apiError );
}
private String removeFromList( String aNode, String aList ) {
diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/DR_SubService.java b/src/main/java/org/onap/dmaap/dbcapi/service/DR_SubService.java
index d6012a7..2fd75d0 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/service/DR_SubService.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/service/DR_SubService.java
@@ -3,6 +3,8 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -94,7 +96,7 @@ public class DR_SubService extends BaseLoggingClass {
prov = new DrProvConnection();
prov.makeSubPostConnection( provURL );
String resp = prov.doPostDr_Sub( sub, apiError );
- if ( unit_test.equals( "Yes" ) ) {
+ if ( "Yes".equals(unit_test) ) {
resp = simulateResp( sub, "POST" );
apiError.setCode(200);
}
diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java b/src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java
index 48ee661..408d000 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java
@@ -3,6 +3,8 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,16 +23,6 @@
package org.onap.dmaap.dbcapi.service;
import java.util.ArrayList;
-
-
-
-
-
-
-
-
-
-
import org.onap.dmaap.dbcapi.aaf.AafService;
import org.onap.dmaap.dbcapi.aaf.DmaapGrant;
import org.onap.dmaap.dbcapi.aaf.DmaapPerm;
@@ -43,7 +35,6 @@ import org.onap.dmaap.dbcapi.logging.DmaapbcLogMessageEnum;
import org.onap.dmaap.dbcapi.model.ApiError;
import org.onap.dmaap.dbcapi.model.Dmaap;
import org.onap.dmaap.dbcapi.model.MR_Client;
-import org.onap.dmaap.dbcapi.model.ReplicationType;
import org.onap.dmaap.dbcapi.model.Topic;
import org.onap.dmaap.dbcapi.model.DmaapObject.DmaapObject_Status;
import org.onap.dmaap.dbcapi.util.DmaapConfig;
diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/FeedService.java b/src/main/java/org/onap/dmaap/dbcapi/service/FeedService.java
index baf6f2f..de18d95 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/service/FeedService.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/service/FeedService.java
@@ -3,6 +3,8 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -73,7 +75,7 @@ public class FeedService extends BaseLoggingClass {
for( Feed f: feeds.values() ) {
boolean keep = true;
if ( name != null ) {
- if ( match != null && match.equals("startsWith") ) {
+ if ( match != null && "startsWith".equals(match) ) {
if ( ! f.getFeedName().startsWith( name ) ) {
logger.info( "getAllFeeds: feedName=" + f.getFeedName() + " doesn't start with=" + name);
keep = false;
diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClientService.java b/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClientService.java
index 186a003..6010784 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClientService.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClientService.java
@@ -3,6 +3,8 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -76,7 +78,7 @@ public class MR_ClientService extends BaseLoggingClass{
}
public ArrayList<MR_Client> getAllMrClients(String fqtn) {
- ArrayList<MR_Client> results = new ArrayList<MR_Client>();
+ ArrayList<MR_Client> results = new ArrayList<>();
for (Map.Entry<String, MR_Client> entry : mr_clients.entrySet())
{
MR_Client client = entry.getValue();
diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClusterService.java b/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClusterService.java
index dea5d83..db6389e 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClusterService.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClusterService.java
@@ -3,6 +3,8 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -156,7 +158,7 @@ public class MR_ClusterService extends BaseLoggingClass {
cluster.setLastMod();
cluster.setStatus(DmaapObject_Status.INVALID);
mr_clusters.put( cluster.getDcaeLocationName(), cluster );
- } else if ( loc.isCentral() & multiSite ) {
+ } else if ( loc.isCentral() && multiSite ) {
ApiError resp = TopicService.setBridgeClientPerms( cluster );
if ( ! resp.is2xx() ) {
logger.error( "Unable to provision Bridge to " + cluster.getDcaeLocationName() );
diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java b/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java
index cfec54e..8ade70f 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java
@@ -3,6 +3,8 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -91,7 +93,7 @@ public class TopicService extends BaseLoggingClass {
}
private List<Topic> getAllTopics( Boolean withClients ) {
- ArrayList<Topic> topics = new ArrayList<Topic>(mr_topics.values());
+ ArrayList<Topic> topics = new ArrayList<>(mr_topics.values());
if ( withClients ) {
for( Topic topic: topics ) {
topic.setClients( clientService.getAllMrClients(topic.getFqtn()));
diff --git a/src/main/java/org/onap/dmaap/dbcapi/util/Graph.java b/src/main/java/org/onap/dmaap/dbcapi/util/Graph.java
index a7700a1..700c77f 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/util/Graph.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/util/Graph.java
@@ -3,6 +3,8 @@
* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,18 +22,17 @@
package org.onap.dmaap.dbcapi.util;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
import org.onap.dmaap.dbcapi.database.DatabaseClass;
import org.onap.dmaap.dbcapi.model.DcaeLocation;
import org.onap.dmaap.dbcapi.model.MR_Client;
import org.onap.dmaap.dbcapi.model.MR_Cluster;
import org.onap.dmaap.dbcapi.service.MR_ClusterService;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
public class Graph {
private HashMap<String, String> graph;
diff --git a/src/test/java/org/onap/dmaap/dbcapi/util/FqdnTest.java b/src/test/java/org/onap/dmaap/dbcapi/util/FqdnTest.java
new file mode 100644
index 0000000..7c7815f
--- /dev/null
+++ b/src/test/java/org/onap/dmaap/dbcapi/util/FqdnTest.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.onap.dmaap
+ * ================================================================================
+ * Copyright (C) 2019 IBM Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.dmaap.dbcapi.util;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class FqdnTest {
+
+ @Test
+ public void testIsValid() {
+ assertTrue(Fqdn.isValid("www.ibm.com"));
+ assertFalse(Fqdn.isValid("testuser@ibm.com"));
+ }
+} \ No newline at end of file