package org.onap.dmaap.datarouter.node;
+import org.apache.log4j.Logger;
+
import java.util.*;
import java.net.*;
private long nextcheck;
private String[] ips;
private String fqdn;
+ private static Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.node.IsFrom");
/**
* Configure the JVM DNS cache to have a 10 second TTL. This needs to be called very very early or it won't have any effect.
long now = System.currentTimeMillis();
if (now > nextcheck) {
nextcheck = now + 10000;
- Vector<String> v = new Vector<String>();
+ Vector<String> v = new Vector<>();
try {
InetAddress[] addrs = InetAddress.getAllByName(fqdn);
for (InetAddress a : addrs) {
v.add(a.getHostAddress());
}
- } catch (Exception e) {
+ } catch (UnknownHostException e) {
+ logger.debug("IsFrom: UnknownHostEx: " + e.toString(), e);
}
ips = v.toArray(new String[v.size()]);
+ logger.info("IsFrom: DNS ENTRIES FOR FQDN " + fqdn + " : " + Arrays.toString(ips));
}
for (String s : ips) {
- if (s.equals(ip)) {
+ if (s.equals(ip) || s.equals(System.getenv("DMAAP_DR_PROV_SERVICE_HOST"))) {
return (true);
}
}
try {
thishost = InetAddress.getLocalHost();
loopback = InetAddress.getLoopbackAddress();
- checkHttpsRelaxation(); //Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047.
+ //checkHttpsRelaxation(); //Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047.
} catch (UnknownHostException e) {
// ignore
}
private void checkHttpsRelaxation() {
if (!mailSendFlag) {
Properties p = (new DB()).getProperties();
- intlogger.info("HTTPS relaxatio: " + p.get("org.onap.dmaap.datarouter.provserver.https.relaxation"));
+ intlogger.info("HTTPS relaxation: " + p.get("org.onap.dmaap.datarouter.provserver.https.relaxation"));
if (p.get("org.onap.dmaap.datarouter.provserver.https.relaxation").equals("true")) {
try {
#Jetty Server properties
org.onap.dmaap.datarouter.provserver.http.port = 8080
org.onap.dmaap.datarouter.provserver.https.port = 8443
-org.onap.dmaap.datarouter.provserver.https.relaxation = false
+org.onap.dmaap.datarouter.provserver.https.relaxation = true
org.onap.dmaap.datarouter.provserver.keystore.type = jks
org.onap.dmaap.datarouter.provserver.keymanager.password = changeit
#Jetty Server properties
org.onap.dmaap.datarouter.provserver.http.port = 8080
org.onap.dmaap.datarouter.provserver.https.port = 8443
-org.onap.dmaap.datarouter.provserver.https.relaxation = false
+org.onap.dmaap.datarouter.provserver.https.relaxation = true
org.onap.dmaap.datarouter.provserver.keystore.type = jks
org.onap.dmaap.datarouter.provserver.keymanager.password = changeit
public void Given_Request_Is_HTTP_POST_And_POST_Fails_Bad_Request_Response_Is_Generated() throws Exception {
PowerMockito.mockStatic(Subscription.class);
PowerMockito.when(Subscription.getSubscriptionMatching(mock(Subscription.class))).thenReturn(null);
+ PowerMockito.when(Subscription.countActiveSubscriptions()).thenReturn(0);
JSONObject JSObject = buildRequestJsonObject();
SubscribeServlet subscribeServlet = new SubscribeServlet() {
protected JSONObject getJSONfromInput(HttpServletRequest req) {