diff options
author | egernug <gerard.nugent@est.tech> | 2019-02-04 14:27:11 +0000 |
---|---|---|
committer | Conor Ward <conor.ward@est.tech> | 2019-02-06 11:44:36 +0000 |
commit | ee6fa61e2cd7df99891092709765235b6166a041 (patch) | |
tree | d239addfdac1e2b3d6fe2cb6dd6b1c3fd5b3da6e /datarouter-node | |
parent | f926474924870c9ed4d5c4c8ccba55a1942d8e37 (diff) |
Replace ATT headers2.0.0
Change-Id: I27b9240e33381b91c40c21a04f7ec6bdb7c16ce0
Issue-ID: DMAAP-997
Signed-off-by: egernug <gerard.nugent@est.tech>
Diffstat (limited to 'datarouter-node')
4 files changed, 23 insertions, 23 deletions
diff --git a/datarouter-node/pom.xml b/datarouter-node/pom.xml index 7df19895..133de4a3 100755 --- a/datarouter-node/pom.xml +++ b/datarouter-node/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.dmaap.datarouter</groupId> <artifactId>parent</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>datarouter-node</artifactId> diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java index 4d570b55..80729905 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java @@ -102,7 +102,7 @@ public class DeliveryTask implements Runnable, Comparable<DeliveryTask> { i = s.indexOf('\t'); String h = s.substring(0, i); String v = s.substring(i + 1); - if ("x-att-dr-routing".equalsIgnoreCase(h)) { + if ("x-dmaap-dr-routing".equalsIgnoreCase(h)) { subid = v.replaceAll("[^ ]*/", ""); feedid = dth.getFeedId(subid.replaceAll(" .*", "")); } @@ -187,7 +187,7 @@ public class DeliveryTask implements Runnable, Comparable<DeliveryTask> { uc.setRequestMethod(method); uc.setRequestProperty("Content-Length", Long.toString(length)); uc.setRequestProperty("Authorization", di.getAuth()); - uc.setRequestProperty("X-ATT-DR-PUBLISH-ID", pubid); + uc.setRequestProperty("X-DMAAP-DR-PUBLISH-ID", pubid); for (String[] nv : hdrs) { uc.addRequestProperty(nv[0], nv[1]); } @@ -244,7 +244,7 @@ public class DeliveryTask implements Runnable, Comparable<DeliveryTask> { InputStream is; if (rc >= 200 && rc <= 299) { is = uc.getInputStream(); - xpubid = uc.getHeaderField("X-ATT-DR-PUBLISH-ID"); + xpubid = uc.getHeaderField("X-DMAAP-DR-PUBLISH-ID"); } else { if (rc >= 300 && rc <= 399) { rmsg = uc.getHeaderField("Location"); diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java index b1ab44fb..7e1d46d3 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java @@ -105,7 +105,7 @@ public class NodeServlet extends HttpServlet { NodeUtils.setRequestIdAndInvocationId(req); eelflogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader("X-ATT-DR-ON-BEHALF-OF"), + eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader("X-DMAAP-DR-ON-BEHALF-OF"), getIdFromPath(req) + ""); try { if (down(resp)) { @@ -148,7 +148,7 @@ public class NodeServlet extends HttpServlet { NodeUtils.setIpAndFqdnForEelf("doPut"); NodeUtils.setRequestIdAndInvocationId(req); eelflogger.info(EelfMsgs.ENTRY); - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader("X-ATT-DR-ON-BEHALF-OF"), + eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader("X-DMAAP-DR-ON-BEHALF-OF"), getIdFromPath(req) + ""); try { common(req, resp, true); @@ -168,7 +168,7 @@ public class NodeServlet extends HttpServlet { NodeUtils.setIpAndFqdnForEelf("doDelete"); NodeUtils.setRequestIdAndInvocationId(req); eelflogger.info(EelfMsgs.ENTRY); - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader("X-ATT-DR-ON-BEHALF-OF"), + eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader("X-DMAAP-DR-ON-BEHALF-OF"), getIdFromPath(req) + ""); try { common(req, resp, false); @@ -235,7 +235,7 @@ public class NodeServlet extends HttpServlet { feedid = fileid.substring(0, i); fileid = fileid.substring(i + 1); pubid = config.getPublishId(); - xpubid = req.getHeader("X-ATT-DR-PUBLISH-ID"); + xpubid = req.getHeader("X-DMAAP-DR-PUBLISH-ID"); targets = config.getTargets(feedid); } else if (fileid.startsWith("/internal/publish/")) { if (!config.isAnotherNode(credentials, ip)) { @@ -245,8 +245,8 @@ public class NodeServlet extends HttpServlet { return; } fileid = fileid.substring(18); - pubid = req.getHeader("X-ATT-DR-PUBLISH-ID"); - targets = config.parseRouting(req.getHeader("X-ATT-DR-ROUTING")); + pubid = req.getHeader("X-DMAAP-DR-PUBLISH-ID"); + targets = config.parseRouting(req.getHeader("X-DMAAP-DR-ROUTING")); } else { logger.info("NODE0105 Rejecting bad URI for PUT or DELETE of " + req.getPathInfo() + " from " + req .getRemoteAddr()); @@ -302,7 +302,7 @@ public class NodeServlet extends HttpServlet { eelflogger.info(EelfMsgs.EXIT); return; } - resp.setHeader("X-ATT-DR-PUBLISH-ID", pubid); + resp.setHeader("X-DMAAP-DR-PUBLISH-ID", pubid); } String fbase = config.getSpoolDir() + "/" + pubid; File data = new File(fbase); @@ -324,9 +324,9 @@ public class NodeServlet extends HttpServlet { "content-language".equals(hnlc) || "content-md5".equals(hnlc) || "content-range".equals(hnlc))) || - "x-att-dr-meta".equals(hnlc) || - (feedid == null && "x-att-dr-received".equals(hnlc)) || - (hnlc.startsWith("x-") && !hnlc.startsWith("x-att-dr-"))) { + "x-dmaap-dr-meta".equals(hnlc) || + (feedid == null && "x-dmaap-dr-received".equals(hnlc)) || + (hnlc.startsWith("x-") && !hnlc.startsWith("x-dmaap-dr-"))) { Enumeration hvals = req.getHeaders(hn); while (hvals.hasMoreElements()) { String hv = (String) hvals.nextElement(); @@ -339,7 +339,7 @@ public class NodeServlet extends HttpServlet { if ("x-invocationid".equals(hnlc)) { hasInvocationIdHeader = true; } - if ("x-att-dr-meta".equals(hnlc)) { + if ("x-dmaap-dr-meta".equals(hnlc)) { if (hv.length() > 4096) { logger.info( "NODE0109 Rejecting publish attempt with metadata too long for feed " + feedid @@ -367,7 +367,7 @@ public class NodeServlet extends HttpServlet { if(!hasInvocationIdHeader){ mx.append("X-InvocationID\t").append(MDC.get("InvocationId")).append('\n'); } - mx.append("X-ATT-DR-RECEIVED\t").append(rcvd).append('\n'); + mx.append("X-DMAAP-DR-RECEIVED\t").append(rcvd).append('\n'); String metadata = mx.toString(); byte[] buf = new byte[1024 * 1024]; int i; @@ -404,7 +404,7 @@ public class NodeServlet extends HttpServlet { mw = new FileWriter(meta); mw.write(metadata); if (di.getSubId() == null) { - mw.write("X-ATT-DR-ROUTING\t" + t.getRouting() + "\n"); + mw.write("X-DMAAP-DR-ROUTING\t" + t.getRouting() + "\n"); } mw.close(); meta.renameTo(new File(dbase + ".M")); diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServletTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServletTest.java index 4f31e922..2a659aaf 100644 --- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServletTest.java +++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServletTest.java @@ -68,7 +68,7 @@ public class NodeServletTest { setUpConfig(); setUpNodeMainDelivery(); when(request.getHeader("Authorization")).thenReturn("User1"); - when(request.getHeader("X-ATT-DR-PUBLISH-ID")).thenReturn("User1"); + when(request.getHeader("X-DMAAP-DR-PUBLISH-ID")).thenReturn("User1"); } @Test @@ -215,7 +215,7 @@ public class NodeServletTest { private void setBehalfHeader(String headerValue) { - when(request.getHeader("X-ATT-DR-ON-BEHALF-OF")).thenReturn(headerValue); + when(request.getHeader("X-DMAAP-DR-ON-BEHALF-OF")).thenReturn(headerValue); } private ListAppender<ILoggingEvent> setTestLogger() { @@ -302,15 +302,15 @@ public class NodeServletTest { } List<String> headers = new ArrayList<>(); headers.add("Content-Type"); - headers.add("X-ATT-DR-ON-BEHALF-OF"); - headers.add("X-ATT-DR-META"); + headers.add("X-DMAAP-DR-ON-BEHALF-OF"); + headers.add("X-DMAAP-DR-META"); Enumeration<String> headerNames = Collections.enumeration(headers); when(request.getHeaderNames()).thenReturn(headerNames); Enumeration<String> contentTypeHeader = Collections.enumeration(Arrays.asList("text/plain")); Enumeration<String> behalfHeader = Collections.enumeration(Arrays.asList("User1")); Enumeration<String> metaDataHeader = Collections.enumeration(Arrays.asList(metaDataString)); when(request.getHeaders("Content-Type")).thenReturn(contentTypeHeader); - when(request.getHeaders("X-ATT-DR-ON-BEHALF-OF")).thenReturn(behalfHeader); - when(request.getHeaders("X-ATT-DR-META")).thenReturn(metaDataHeader); + when(request.getHeaders("X-DMAAP-DR-ON-BEHALF-OF")).thenReturn(behalfHeader); + when(request.getHeaders("X-DMAAP-DR-META")).thenReturn(metaDataHeader); } } |