aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/client/DrProvConnection.java29
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java2
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/logging/logmsg.properties2
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/resources/DR_PubResource.java3
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/resources/FeedResource.java5
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/server/JettyServer.java29
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java7
7 files changed, 47 insertions, 30 deletions
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 54fa84e..f268eae 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/client/DrProvConnection.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/client/DrProvConnection.java
@@ -57,7 +57,7 @@ public class DrProvConnection extends BaseLoggingClass {
public DrProvConnection() {
provURL = new DmaapService().getDmaap().getDrProvUrl();
if ( provURL.length() < 1 ) {
- errorLogger.error( DmaapbcLogMessageEnum.PREREQ_DMAAP_OBJECT, "getDrProvUrl");
+ errorLogger.error( DmaapbcLogMessageEnum.PREREQ_DMAAP_OBJECT, "DmaapService().getDmaap().getDrProvUrl()");
}
DmaapConfig p = (DmaapConfig)DmaapConfig.getConfig();
provApi = p.getProperty( "DR.provApi", "ONAP" );
@@ -457,9 +457,15 @@ public class DrProvConnection extends BaseLoggingClass {
}
} catch (ConnectException ce) {
- errorLogger.error( DmaapbcLogMessageEnum.HTTP_CONNECTION_EXCEPTION, provURL, ce.getMessage() );
- err.setCode( 500 );
- err.setMessage("Backend connection refused");
+ if ( unit_test.equals( "Yes" ) ) {
+ err.setCode(200);
+ err.setMessage( "simulated response");
+ logger.info( "artificial 200 response from doPutFeed because unit_test =" + unit_test );
+ } else {
+ errorLogger.error(DmaapbcLogMessageEnum.HTTP_CONNECTION_EXCEPTION, provURL, ce.getMessage());
+ err.setCode(500);
+ err.setMessage("Backend connection refused");
+ }
} catch (SocketException se) {
errorLogger.error( DmaapbcLogMessageEnum.SOCKET_EXCEPTION, se.getMessage(), "response from Prov server" );
err.setCode( 500 );
@@ -635,11 +641,16 @@ public class DrProvConnection extends BaseLoggingClass {
} catch (ConnectException ce) {
-
- errorLogger.error( DmaapbcLogMessageEnum.HTTP_CONNECTION_EXCEPTION, provURL, ce.getMessage() );
- err.setCode( 500 );
- err.setMessage("Backend connection refused");
- logger.error(ce.getMessage(), ce);
+ if ( unit_test.equals( "Yes" ) ) {
+ err.setCode(200);
+ err.setMessage( "simulated response");
+ logger.info( "artificial 200 response from doGetNodes because unit_test =" + unit_test );
+ } else {
+ errorLogger.error(DmaapbcLogMessageEnum.HTTP_CONNECTION_EXCEPTION, provURL, ce.getMessage());
+ err.setCode(500);
+ err.setMessage("Backend connection refused");
+ logger.error(ce.getMessage(), ce);
+ }
} catch (Exception e) {
if ( unit_test.equals( "Yes" ) ) {
err.setCode(200);
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 14bacc4..909c20c 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java
@@ -161,6 +161,8 @@ public class DatabaseClass extends BaseLoggingClass {
public void init(Dmaap val) {
if (dmaap == null) {
dmaap = val;
+ } else {
+ update(val);
}
}
diff --git a/src/main/java/org/onap/dmaap/dbcapi/logging/logmsg.properties b/src/main/java/org/onap/dmaap/dbcapi/logging/logmsg.properties
index cb8a939..6548433 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/logging/logmsg.properties
+++ b/src/main/java/org/onap/dmaap/dbcapi/logging/logmsg.properties
@@ -180,7 +180,7 @@ DB_NO_FIELD_HANDLER=\
# 5xx Business Process Errors
PREREQ_DMAAP_OBJECT=\
501|\
- Attempt to access {} before dmaap object resource is available.|\
+ Attempt to access {0} before dmaap object resource is available.|\
No remediation.|\
The dmaap object needs to be defined before attempting the desired access
diff --git a/src/main/java/org/onap/dmaap/dbcapi/resources/DR_PubResource.java b/src/main/java/org/onap/dmaap/dbcapi/resources/DR_PubResource.java
index 6e652a8..f512124 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/resources/DR_PubResource.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/resources/DR_PubResource.java
@@ -77,7 +77,8 @@ public class DR_PubResource extends BaseLoggingClass {
};
return responseBuilder.success(list);
}
-
+
+
@POST
@ApiOperation( value = "return DR_Pub details",
notes = "create a DR Publisher in the specified environment.",
diff --git a/src/main/java/org/onap/dmaap/dbcapi/resources/FeedResource.java b/src/main/java/org/onap/dmaap/dbcapi/resources/FeedResource.java
index 6589c0d..28bdb00 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/resources/FeedResource.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/resources/FeedResource.java
@@ -27,7 +27,6 @@ import io.swagger.annotations.ApiResponses;
import java.util.List;
-import javax.jws.WebParam;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
@@ -90,7 +89,7 @@ public class FeedResource extends BaseLoggingClass {
@ApiResponse( code = 400, message = "Error", response = ApiError.class )
})
public Response addFeed(
- @WebParam(name = "feed") Feed feed,
+ Feed feed,
@QueryParam("useExisting") String useExisting) {
ApiError apiError = new ApiError();
@@ -146,7 +145,7 @@ public class FeedResource extends BaseLoggingClass {
@Path("/{id}")
public Response updateFeed(
@PathParam("id") String id,
- @WebParam(name = "feed") Feed feed) {
+ Feed feed) {
FeedService feedService = new FeedService();
ApiError apiError = new ApiError();
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 7457ce9..6a75d65 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/server/JettyServer.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/server/JettyServer.java
@@ -24,6 +24,8 @@ package org.onap.dmaap.dbcapi.server;
import com.google.common.collect.Sets;
import javax.servlet.DispatcherType;
+
+import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.server.*;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
@@ -71,7 +73,7 @@ public class JettyServer extends BaseLoggingClass {
HttpConfiguration https_config = new HttpConfiguration(http_config);
https_config.addCustomizer(new SecureRequestCustomizer());
- SslContextFactory sslContextFactory = new SslContextFactory();
+ SslContextFactory sslContextFactory = new SslContextFactory.Server();
sslContextFactory.setWantClientAuth(true);
setUpKeystore(params, sslContextFactory);
@@ -79,25 +81,20 @@ public class JettyServer extends BaseLoggingClass {
if (sslPort != 0) {
try (ServerConnector sslConnector = new ServerConnector(server,
- new SslConnectionFactory(sslContextFactory, "http/1.1"),
+ new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
new HttpConnectionFactory(https_config))) {
sslConnector.setPort(sslPort);
- if (allowHttp) {
- logger.info("Starting httpConnector on port " + httpPort);
- logger.info("Starting sslConnector on port " + sslPort + " for https");
- server.setConnectors(new Connector[]{httpConnector, sslConnector});
- } else {
- logger.info("NOT starting httpConnector because HttpAllowed param is " + allowHttp);
- logger.info("Starting sslConnector on port " + sslPort + " for https");
- server.setConnectors(new Connector[]{sslConnector});
- }
+ server.addConnector(sslConnector);
+ serverLogger.info("Starting sslConnector on port " + sslPort + " for https");
}
} else {
- serverLogger.info("NOT starting sslConnector on port " + sslPort + " for https");
- if (allowHttp) {
- serverLogger.info("Starting httpConnector on port " + httpPort);
- server.setConnectors(new Connector[]{httpConnector});
- }
+ serverLogger.info("NOT starting sslConnector because InHttpsPort param is " + sslPort );
+ }
+ if (allowHttp) {
+ serverLogger.info("Starting httpConnector on port " + httpPort);
+ server.addConnector(httpConnector);
+ } else {
+ serverLogger.info("NOT starting httpConnector because HttpAllowed param is " + allowHttp);
}
}
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 c54fce8..8789ac4 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java
@@ -69,6 +69,13 @@ public class DmaapService extends BaseLoggingClass {
" multisite=" + multiSite +
" noEnvironmentPrefix=" + noEnvironmentPrefix
);
+
+ Dmaap dmaap = dmaapholder.get();
+ logger.info( "DmaapService object values: " +
+ " dmaapName=" + dmaap.getDmaapName() +
+ " drProvURL=" + dmaap.getDrProvUrl() +
+ " version="+ dmaap.getVersion()
+ );
}