diff options
Diffstat (limited to 'datarouter-prov/src')
18 files changed, 65 insertions, 65 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/authz/impl/ProvAuthorizer.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/authz/impl/ProvAuthorizer.java index c76ce42a..525c518e 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/authz/impl/ProvAuthorizer.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/authz/impl/ProvAuthorizer.java @@ -42,8 +42,8 @@ public class ProvAuthorizer implements Authorizer { private Logger log; private ProvDataProvider provData; - private static final String SUBJECT_HEADER = "X-ATT-DR-ON-BEHALF-OF"; // HTTP header carrying requester identity - private static final String SUBJECT_HEADER_GROUP = "X-ATT-DR-ON-BEHALF-OF-GROUP"; // HTTP header carrying requester identity by group Rally : US708115 + private static final String SUBJECT_HEADER = "X-DMAAP-DR-ON-BEHALF-OF"; // HTTP header carrying requester identity + private static final String SUBJECT_HEADER_GROUP = "X-DMAAP-DR-ON-BEHALF-OF-GROUP"; // HTTP header carrying requester identity by group Rally : US708115 /** Constructor. For the moment, do nothing special. Make it a singleton? * */ diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java index d916a21c..2d4f85f6 100755 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java @@ -97,25 +97,25 @@ import javax.mail.internet.MimeMultipart; @SuppressWarnings("serial") public class BaseServlet extends HttpServlet implements ProvDataProvider { - public static final String BEHALF_HEADER = "X-ATT-DR-ON-BEHALF-OF"; - static final String FEED_BASECONTENT_TYPE = "application/vnd.att-dr.feed"; - public static final String FEED_CONTENT_TYPE = "application/vnd.att-dr.feed; version=2.0"; - public static final String FEEDFULL_CONTENT_TYPE = "application/vnd.att-dr.feed-full; version=2.0"; - public static final String FEEDLIST_CONTENT_TYPE = "application/vnd.att-dr.feed-list; version=1.0"; - static final String SUB_BASECONTENT_TYPE = "application/vnd.att-dr.subscription"; - public static final String SUB_CONTENT_TYPE = "application/vnd.att-dr.subscription; version=2.0"; - public static final String SUBFULL_CONTENT_TYPE = "application/vnd.att-dr.subscription-full; version=2.0"; - static final String SUBLIST_CONTENT_TYPE = "application/vnd.att-dr.subscription-list; version=1.0"; + public static final String BEHALF_HEADER = "X-DMAAP-DR-ON-BEHALF-OF"; + static final String FEED_BASECONTENT_TYPE = "application/vnd.dmaap-dr.feed"; + public static final String FEED_CONTENT_TYPE = "application/vnd.dmaap-dr.feed; version=2.0"; + public static final String FEEDFULL_CONTENT_TYPE = "application/vnd.dmaap-dr.feed-full; version=2.0"; + public static final String FEEDLIST_CONTENT_TYPE = "application/vnd.dmaap-dr.feed-list; version=1.0"; + static final String SUB_BASECONTENT_TYPE = "application/vnd.dmaap-dr.subscription"; + public static final String SUB_CONTENT_TYPE = "application/vnd.dmaap-dr.subscription; version=2.0"; + public static final String SUBFULL_CONTENT_TYPE = "application/vnd.dmaap-dr.subscription-full; version=2.0"; + static final String SUBLIST_CONTENT_TYPE = "application/vnd.dmaap-dr.subscription-list; version=1.0"; //Adding groups functionality, ...1610 - static final String GROUP_BASECONTENT_TYPE = "application/vnd.att-dr.group"; - static final String GROUPFULL_CONTENT_TYPE = "application/vnd.att-dr.group-full; version=2.0"; + static final String GROUP_BASECONTENT_TYPE = "application/vnd.dmaap-dr.group"; + static final String GROUPFULL_CONTENT_TYPE = "application/vnd.dmaap-dr.group-full; version=2.0"; - public static final String LOGLIST_CONTENT_TYPE = "application/vnd.att-dr.log-list; version=1.0"; - public static final String PROVFULL_CONTENT_TYPE1 = "application/vnd.att-dr.provfeed-full; version=1.0"; - public static final String PROVFULL_CONTENT_TYPE2 = "application/vnd.att-dr.provfeed-full; version=2.0"; + public static final String LOGLIST_CONTENT_TYPE = "application/vnd.dmaap-dr.log-list; version=1.0"; + public static final String PROVFULL_CONTENT_TYPE1 = "application/vnd.dmaap-dr.provfeed-full; version=1.0"; + public static final String PROVFULL_CONTENT_TYPE2 = "application/vnd.dmaap-dr.provfeed-full; version=2.0"; public static final String CERT_ATTRIBUTE = "javax.servlet.request.X509Certificate"; static final String DB_PROBLEM_MSG = "There has been a problem with the DB. It is suggested you try the operation again."; diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServlet.java index 28b2a3ca..895eba08 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServlet.java @@ -299,7 +299,7 @@ public class DRFeedsServlet extends ProxyServlet { sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } - feed.setPublisher(bhdr); // set from X-ATT-DR-ON-BEHALF-OF header + feed.setPublisher(bhdr); // set from X-DMAAP-DR-ON-BEHALF-OF header // Check if this feed already exists Feed feed2 = Feed.getFeedByNameVersion(feed.getName(), feed.getVersion()); diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedServlet.java index 33097cd5..e64f2c69 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedServlet.java @@ -298,9 +298,9 @@ public class FeedServlet extends ProxyServlet { return; } feed.setFeedid(feedid); - feed.setPublisher(bhdr); // set from X-ATT-DR-ON-BEHALF-OF header + feed.setPublisher(bhdr); // set from X-DMAAP-DR-ON-BEHALF-OF header - String subjectgroup = (req.getHeader("X-ATT-DR-ON-BEHALF-OF-GROUP")); //Adding for group feature:Rally US708115 + String subjectgroup = (req.getHeader("X-DMAAP-DR-ON-BEHALF-OF-GROUP")); //Adding for group feature:Rally US708115 if (!oldFeed.getPublisher().equals(feed.getPublisher()) && subjectgroup == null) { message = "This feed must be modified by the same publisher that created it."; elr.setMessage(message); diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java index 17a1d752..151c0b26 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java @@ -357,7 +357,7 @@ public class GroupServlet extends ProxyServlet { return; } //gup.setFeedid(feedid); - //sub.setSubscriber(bhdr); // set from X-ATT-DR-ON-BEHALF-OF header + //sub.setSubscriber(bhdr); // set from X-DMAAP-DR-ON-BEHALF-OF header // Check if this group already exists; not an error (yet), just warn Group gb2 = Group.getGroupMatching(gup); diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscribeServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscribeServlet.java index 226b5fc9..2127f004 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscribeServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscribeServlet.java @@ -285,7 +285,7 @@ public class SubscribeServlet extends ProxyServlet { return; } sub.setFeedid(feedid); - sub.setSubscriber(bhdr); // set from X-ATT-DR-ON-BEHALF-OF header + sub.setSubscriber(bhdr); // set from X-DMAAP-DR-ON-BEHALF-OF header // Check if this subscription already exists; not an error (yet), just warn Subscription sub2 = Subscription.getSubscriptionMatching(sub); diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java index be79e2ff..ec4d33a0 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java @@ -58,7 +58,7 @@ import static org.onap.dmaap.datarouter.provisioning.utils.HttpServletUtils.send @SuppressWarnings("serial")
public class SubscriptionServlet extends ProxyServlet {
- public static final String SUBCNTRL_CONTENT_TYPE = "application/vnd.att-dr.subscription-control";
+ public static final String SUBCNTRL_CONTENT_TYPE = "application/vnd.dmaap-dr.subscription-control";
//Adding EELF Logger Rally:US664892
private static EELFLogger eelflogger = EELFManager.getInstance()
.getLogger(SubscriptionServlet.class);
@@ -316,9 +316,9 @@ public class SubscriptionServlet extends ProxyServlet { }
sub.setSubid(oldsub.getSubid());
sub.setFeedid(oldsub.getFeedid());
- sub.setSubscriber(bhdr); // set from X-ATT-DR-ON-BEHALF-OF header
+ sub.setSubscriber(bhdr); // set from X-DMAAP-DR-ON-BEHALF-OF header
- String subjectgroup = (req.getHeader("X-ATT-DR-ON-BEHALF-OF-GROUP")); //Adding for group feature:Rally US708115
+ String subjectgroup = (req.getHeader("X-DMAAP-DR-ON-BEHALF-OF-GROUP")); //Adding for group feature:Rally US708115
if (!oldsub.getSubscriber().equals(sub.getSubscriber()) && subjectgroup == null) {
message = "This subscriber must be modified by the same subscriber that created it.";
elr.setMessage(message);
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EventLogRecord.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EventLogRecord.java index b8a3aa53..4d0b6acc 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EventLogRecord.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EventLogRecord.java @@ -32,7 +32,7 @@ import org.onap.dmaap.datarouter.provisioning.BaseServlet; /**
* This class is used to log provisioning server events. Each event consists of a who
- * (who made the provisioning request including the IP address, the X-ATT-DR-ON-BEHALF-OF
+ * (who made the provisioning request including the IP address, the X-DMAAP-DR-ON-BEHALF-OF
* header value, and the client certificate), a what (what request was made; the method
* and servlet involved), and a how (how the request was handled; the result code and
* message returned to the client). EventLogRecords are logged using log4j at the INFO level.
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java index f1873424..a2076b04 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java @@ -320,7 +320,7 @@ public class Feed extends Syncable { public Feed(JSONObject jo) throws InvalidObjectException {
this("", "", "", "");
try {
- // The JSONObject is assumed to contain a vnd.att-dr.feed representation
+ // The JSONObject is assumed to contain a vnd.dmaap-dr.feed representation
this.feedid = jo.optInt("feedid", -1);
this.groupid = jo.optInt("groupid"); //New field is added - Groups feature Rally:US708115 - 1610
this.name = jo.getString("name");
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java index 3f5f7c76..30fc87c4 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java @@ -209,7 +209,7 @@ public class Group extends Syncable { public Group(JSONObject jo) throws InvalidObjectException {
this("", "", "");
try {
- // The JSONObject is assumed to contain a vnd.att-dr.group representation
+ // The JSONObject is assumed to contain a vnd.dmaap-dr.group representation
this.groupid = jo.optInt("groupid", -1);
String gname = jo.getString("name");
String gdescription = jo.getString("description");
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java index f4275255..e1b24c53 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java @@ -219,7 +219,7 @@ public class Subscription extends Syncable { public Subscription(JSONObject jo) throws InvalidObjectException {
this("", "", "");
try {
- // The JSONObject is assumed to contain a vnd.att-dr.subscription representation
+ // The JSONObject is assumed to contain a vnd.dmaap-dr.subscription representation
this.subid = jo.optInt(SUBID_KEY, -1);
this.feedid = jo.optInt(FEEDID_KEY, -1);
this.groupid = jo.optInt(GROUPID_KEY, -1); //New field is added - Groups feature Rally:US708115 - 1610
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPost.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPost.java index ca328b1f..dfe7f787 100644 --- a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPost.java +++ b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPost.java @@ -63,7 +63,7 @@ public class IntegrationTestDrFeedsPost extends IntegrationTestBase { @Test public void testNormalNoCtVersion() { JSONObject jo = buildFeedRequest(); - testCommon(jo, HttpServletResponse.SC_CREATED, "application/vnd.att-dr.feed", "JUnit"); + testCommon(jo, HttpServletResponse.SC_CREATED, "application/vnd.dmaap-dr.feed", "JUnit"); } @Test @@ -302,7 +302,7 @@ public class IntegrationTestDrFeedsPost extends IntegrationTestBase { } } /* -curl -v -X POST -H 'X-ATT-DR-ON-BEHALF-OF: tester' -H 'Content-type: application/vnd.att-dr.feed' \ +curl -v -X POST -H 'X-DMAAP-DR-ON-BEHALF-OF: tester' -H 'Content-type: application/vnd.dmaap-dr.feed' \ --user publisher:tomcat \ --data "$data" http://127.0.0.1:8080/prov/feed/ */ diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServletTest.java index 1c8040f6..a8f9c56a 100755 --- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServletTest.java +++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServletTest.java @@ -197,7 +197,7 @@ public class DRFeedsServletTest extends DrServletTestBase { @Test public void Given_Request_Is_HTTP_POST_And_Content_Header_Is_Not_Supported_Type_Then_Unsupported_Media_Type_Response_Is_Generated() throws Exception { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.feed; version=1.1"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.feed; version=1.1"); when(request.getContentType()).thenReturn("stub_contentType"); drfeedsServlet.doPost(request, response); verify(response) @@ -235,7 +235,7 @@ public class DRFeedsServletTest extends DrServletTestBase { @Test public void Given_Request_Is_HTTP_POST_And_Feed_Is_Not_Valid_Object_Bad_Request_Response_Is_Generated() throws Exception { - when(request.getHeader("X-ATT-DR-ON-BEHALF-OF-GROUP")).thenReturn(null); + when(request.getHeader("X-DMAAP-DR-ON-BEHALF-OF-GROUP")).thenReturn(null); JSONObject JSObject = buildRequestJsonObject(); DRFeedsServlet drfeedsServlet = new DRFeedsServlet() { @@ -400,8 +400,8 @@ public class DRFeedsServletTest extends DrServletTestBase { } private void setUpValidContentHeadersAndJSONOnHttpRequest() { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.feed; version=1.0"); - when(request.getHeader("X-ATT-DR-ON-BEHALF-OF-GROUP")).thenReturn("stub_subjectGroup"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.feed; version=1.0"); + when(request.getHeader("X-DMAAP-DR-ON-BEHALF-OF-GROUP")).thenReturn("stub_subjectGroup"); } } diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/FeedServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/FeedServletTest.java index ca4ccd8c..f042e11d 100755 --- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/FeedServletTest.java +++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/FeedServletTest.java @@ -262,7 +262,7 @@ public class FeedServletTest extends DrServletTestBase { @Test public void Given_Request_Is_HTTP_PUT_And_Content_Header_Is_Not_Supported_Type_Then_Unsupported_Media_Type_Response_Is_Generated() throws Exception { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.feed-fail; version=2.0"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.feed-fail; version=2.0"); when(request.getContentType()).thenReturn("stub_contentType"); feedServlet.doPut(request, response); verify(response) @@ -291,7 +291,7 @@ public class FeedServletTest extends DrServletTestBase { @Test public void Given_Request_Is_HTTP_PUT_And_Feed_Change_Is_Not_Publisher_Who_Requested_Feed_Bad_Request_Response_Is_Generated() throws Exception { - when(request.getHeader("X-ATT-DR-ON-BEHALF-OF-GROUP")).thenReturn(null); + when(request.getHeader("X-DMAAP-DR-ON-BEHALF-OF-GROUP")).thenReturn(null); JSONObject JSObject = buildRequestJsonObject(); FeedServlet feedServlet = new FeedServlet() { protected JSONObject getJSONfromInput(HttpServletRequest req) { @@ -466,8 +466,8 @@ public class FeedServletTest extends DrServletTestBase { } private void setUpValidContentHeadersAndJSONOnHttpRequest() { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.feed; version=1.0"); - when(request.getHeader("X-ATT-DR-ON-BEHALF-OF-GROUP")).thenReturn("stub_subjectGroup"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.feed; version=1.0"); + when(request.getHeader("X-DMAAP-DR-ON-BEHALF-OF-GROUP")).thenReturn("stub_subjectGroup"); } private void reinsertFeedIntoDb() throws SQLException { diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/GroupServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/GroupServletTest.java index d6f1e6dc..a0781264 100755 --- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/GroupServletTest.java +++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/GroupServletTest.java @@ -154,7 +154,7 @@ public class GroupServletTest { @Test public void Given_Request_Is_HTTP_PUT_And_Request_Contains_Badly_Formed_JSON_Then_Bad_Request_Response_Is_Generated() throws Exception { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0"); ServletInputStream inStream = mock(ServletInputStream.class); when(request.getInputStream()).thenReturn(inStream); groupServlet.doPut(request, response); @@ -163,7 +163,7 @@ public class GroupServletTest { @Test public void Given_Request_Is_HTTP_PUT_And_Group_Name_Is_Too_Long_Then_Bad_Request_Response_Is_Generated() throws Exception { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0"); GroupServlet groupServlet = overideGetJSONFromInputToReturnAnInvalidGroup(true); groupServlet.doPut(request, response); verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class))); @@ -171,7 +171,7 @@ public class GroupServletTest { @Test public void Given_Request_Is_HTTP_PUT_And_PUT_Fails_Then_Internal_Server_Error_Response_Is_Generated() throws Exception { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0"); GroupServlet groupServlet = overideGetJSONFromInputToReturnAValidGroupWithFail(); groupServlet.doPut(request, response); verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class))); @@ -179,7 +179,7 @@ public class GroupServletTest { @Test public void Given_Request_Is_HTTP_PUT_And_Request_Succeeds() throws Exception { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0"); GroupServlet groupServlet = overideGetJSONFromInputToReturnGroupInDb(); ServletOutputStream outStream = mock(ServletOutputStream.class); when(response.getOutputStream()).thenReturn(outStream); @@ -210,7 +210,7 @@ public class GroupServletTest { @Test public void Given_Request_Is_HTTP_POST_And_Request_Contains_Badly_Formed_JSON_Then_Bad_Request_Response_Is_Generated() throws Exception { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0"); ServletInputStream inStream = mock(ServletInputStream.class); when(request.getInputStream()).thenReturn(inStream); groupServlet.doPost(request, response); @@ -219,7 +219,7 @@ public class GroupServletTest { @Test public void Given_Request_Is_HTTP_POST_And_Group_Description_Is_Too_Long_Then_Bad_Request_Response_Is_Generated() throws Exception { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0"); GroupServlet groupServlet = overideGetJSONFromInputToReturnAnInvalidGroup(false); groupServlet.doPost(request, response); verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class))); @@ -227,7 +227,7 @@ public class GroupServletTest { @Test public void Given_Request_Is_HTTP_POST_And_Group_Name_Already_Exists_Then_Bad_Request_Response_Is_Generated() throws Exception { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0"); GroupServlet groupServlet = overideGetJSONFromInputToReturnGroupInDb(); groupServlet.doPost(request, response); verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class))); @@ -235,7 +235,7 @@ public class GroupServletTest { @Test public void Given_Request_Is_HTTP_POST_And_POST_Fails_Then_Internal_Server_Error_Response_Is_Generated() throws Exception { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0"); GroupServlet groupServlet = overideGetJSONFromInputToReturnAValidGroupWithFail(); groupServlet.doPost(request, response); verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class))); @@ -243,7 +243,7 @@ public class GroupServletTest { @Test public void Given_Request_Is_HTTP_POST_And_Request_Succeeds() throws Exception { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0"); GroupServlet groupServlet = overideGetJSONFromInputToReturnNewGroupToInsert(); ServletOutputStream outStream = mock(ServletOutputStream.class); when(response.getOutputStream()).thenReturn(outStream); diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscribeServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscribeServletTest.java index a3431ce9..0b5c23fe 100755 --- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscribeServletTest.java +++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscribeServletTest.java @@ -185,7 +185,7 @@ public class SubscribeServletTest extends DrServletTestBase { @Test public void Given_Request_Is_HTTP_POST_And_Content_Header_Is_Not_Supported_Type_Then_Unsupported_Media_Type_Response_Is_Generated() throws Exception { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.feed; version=1.1"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.feed; version=1.1"); when(request.getContentType()).thenReturn("stub_contentType"); subscribeServlet.doPost(request, response); verify(response).sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), argThat(notNullValue(String.class))); @@ -340,8 +340,8 @@ public class SubscribeServletTest extends DrServletTestBase { } private void setUpValidContentHeadersAndJSONOnHttpRequest() { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.subscription; version=1.0"); - when(request.getHeader("X-ATT-DR-ON-BEHALF-OF-GROUP")).thenReturn("stub_subjectGroup"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.subscription; version=1.0"); + when(request.getHeader("X-DMAAP-DR-ON-BEHALF-OF-GROUP")).thenReturn("stub_subjectGroup"); } } diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServletTest.java index 02d73cc1..fd1e68ef 100755 --- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServletTest.java +++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServletTest.java @@ -251,7 +251,7 @@ public class SubscriptionServletTest extends DrServletTestBase { @Test public void Given_Request_Is_HTTP_PUT_And_Request_Contains_Badly_Formed_JSON_Then_Bad_Request_Response_Is_Generated() throws Exception { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.subscription; version=1.0"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.subscription; version=1.0"); ServletInputStream inStream = mock(ServletInputStream.class); when(request.getInputStream()).thenReturn(inStream); subscriptionServlet.doPut(request, response); @@ -260,7 +260,7 @@ public class SubscriptionServletTest extends DrServletTestBase { @Test public void Given_Request_Is_HTTP_PUT_And_Subscription_Object_Is_Invalid_Bad_Request_Response_Is_Generated() throws Exception { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.subscription; version=1.0"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.subscription; version=1.0"); SubscriptionServlet subscriptionServlet = new SubscriptionServlet() { protected JSONObject getJSONfromInput(HttpServletRequest req) { JSONObject jo = new JSONObject(); @@ -273,8 +273,8 @@ public class SubscriptionServletTest extends DrServletTestBase { @Test public void Given_Request_Is_HTTP_PUT_And_Subscriber_Modified_By_Different_Creator_Then_Bad_Request_Is_Generated() throws Exception { - when(request.getHeader("X-ATT-DR-ON-BEHALF-OF-GROUP")).thenReturn(null); - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.subscription; version=1.0"); + when(request.getHeader("X-DMAAP-DR-ON-BEHALF-OF-GROUP")).thenReturn(null); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.subscription; version=1.0"); JSONObject JSObject = buildRequestJsonObject(); SubscriptionServlet subscriptionServlet = new SubscriptionServlet() { protected JSONObject getJSONfromInput(HttpServletRequest req) { @@ -295,8 +295,8 @@ public class SubscriptionServletTest extends DrServletTestBase { @Test public void Given_Request_Is_HTTP_PUT_And_Update_Fails() throws Exception { - when(request.getHeader("X-ATT-DR-ON-BEHALF-OF-GROUP")).thenReturn("stub_subjectGroup"); - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.subscription; version=1.0"); + when(request.getHeader("X-DMAAP-DR-ON-BEHALF-OF-GROUP")).thenReturn("stub_subjectGroup"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.subscription; version=1.0"); JSONObject JSObject = buildRequestJsonObject(); SubscriptionServlet subscriptionServlet = new SubscriptionServlet() { protected JSONObject getJSONfromInput(HttpServletRequest req) { @@ -323,8 +323,8 @@ public class SubscriptionServletTest extends DrServletTestBase { public void Given_Request_Is_HTTP_PUT_And_Update_Succeeds() throws Exception { ServletOutputStream outStream = mock(ServletOutputStream.class); when(response.getOutputStream()).thenReturn(outStream); - when(request.getHeader("X-ATT-DR-ON-BEHALF-OF-GROUP")).thenReturn("stub_subjectGroup"); - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.subscription; version=1.0"); + when(request.getHeader("X-DMAAP-DR-ON-BEHALF-OF-GROUP")).thenReturn("stub_subjectGroup"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.subscription; version=1.0"); JSONObject JSObject = buildRequestJsonObject(); SubscriptionServlet subscriptionServlet = new SubscriptionServlet() { protected JSONObject getJSONfromInput(HttpServletRequest req) { @@ -383,7 +383,7 @@ public class SubscriptionServletTest extends DrServletTestBase { @Test public void Given_Request_Is_HTTP_POST_And_Request_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated() throws Exception { - when(request.getHeader(anyString())).thenReturn("application/vnd.att-dr.subscription-control"); + when(request.getHeader(anyString())).thenReturn("application/vnd.dmaap-dr.subscription-control"); setAuthoriserToReturnRequestNotAuthorized(); subscriptionServlet.doPost(request, response); verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class))); @@ -391,7 +391,7 @@ public class SubscriptionServletTest extends DrServletTestBase { @Test public void Given_Request_Is_HTTP_POST_And_Request_Contains_Badly_Formed_JSON_Then_Bad_Request_Response_Is_Generated() throws Exception { - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.subscription-control; version=1.0"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.subscription-control; version=1.0"); ServletInputStream inStream = mock(ServletInputStream.class); when(request.getInputStream()).thenReturn(inStream); subscriptionServlet.doPost(request, response); @@ -400,8 +400,8 @@ public class SubscriptionServletTest extends DrServletTestBase { @Test public void Given_Request_Is_HTTP_POST_And_Post_Fails() throws Exception { - when(request.getHeader("X-ATT-DR-ON-BEHALF-OF-GROUP")).thenReturn("stub_subjectGroup"); - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.subscription-control; version=1.0"); + when(request.getHeader("X-DMAAP-DR-ON-BEHALF-OF-GROUP")).thenReturn("stub_subjectGroup"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.subscription-control; version=1.0"); JSONObject JSObject = buildRequestJsonObject(); SubscriptionServlet subscriptionServlet = new SubscriptionServlet() { protected JSONObject getJSONfromInput(HttpServletRequest req) { @@ -422,8 +422,8 @@ public class SubscriptionServletTest extends DrServletTestBase { public void Given_Request_Is_HTTP_POST_And_Post_Succeeds() throws Exception { ServletOutputStream outStream = mock(ServletOutputStream.class); when(response.getOutputStream()).thenReturn(outStream); - when(request.getHeader("X-ATT-DR-ON-BEHALF-OF-GROUP")).thenReturn("stub_subjectGroup"); - when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.subscription-control; version=1.0"); + when(request.getHeader("X-DMAAP-DR-ON-BEHALF-OF-GROUP")).thenReturn("stub_subjectGroup"); + when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.subscription-control; version=1.0"); JSONObject JSObject = buildRequestJsonObject(); SubscriptionServlet subscriptionServlet = new SubscriptionServlet() { protected JSONObject getJSONfromInput(HttpServletRequest req) { diff --git a/datarouter-prov/src/test/resources/create.sql b/datarouter-prov/src/test/resources/create.sql index b2906035..b704602f 100755 --- a/datarouter-prov/src/test/resources/create.sql +++ b/datarouter-prov/src/test/resources/create.sql @@ -168,7 +168,7 @@ insert into NODESETS(SETID, NODEID) VALUES (2,2); insert into LOG_RECORDS(RECORD_ID,TYPE,EVENT_TIME,PUBLISH_ID,FEEDID,REQURI,METHOD,CONTENT_TYPE,CONTENT_LENGTH,FEED_FILEID,REMOTE_ADDR,USER,STATUS,DELIVERY_SUBID,DELIVERY_FILEID,RESULT,ATTEMPTS,REASON) -VALUES(1,'pub',2536159564422,'ID',1,'URL','GET','application/vnd.att-dr.log-list; version=1.0',100,1,'172.0.0.8','user',204,1,1,204,0,'other'); +VALUES(1,'pub',2536159564422,'ID',1,'URL','GET','application/vnd.dmaap-dr.log-list; version=1.0',100,1,'172.0.0.8','user',204,1,1,204,0,'other'); CREATE ALIAS IF NOT EXISTS `SUBSTRING_INDEX` AS $$ String Function(String one, String two, String three){ |