* 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.
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;
if ( unit_test.equals( "Yes" ) ) {
// assume resp is null, so need to simulate it
resp = simulateResp( req, "PUT" );
+ err.setCode(200);
}
logger.info( "resp=" + resp );
if ( resp == null ) {
feedid = "99";
}
String ret = String.format(
-"{\"suspend\":false,\"groupid\":0,\"description\":\"%s\",\"version\":\"1.0\",\"authorization\":{\"endpoint_addrs\":[],\"classification\":\"unclassified\",\"endpoint_ids\":[{\"password\":\"topSecret123\",\"id\":\"sim\"}]},\"name\":\"%s\",\"business_description\":\"\",\"publisher\":\"sim\",\"links\":{\"subscribe\":\"https://%s/subscribe/%s\",\"log\":\"https://%s/feedlog/%s\",\"publish\":\"https://%s/publish/%s\",\"self\":\"https://%s/feed/%s\"}}",
- f.getFeedDescription(),
- f.getFeedName(),
- server, feedid,
- server, feedid,
- server, feedid,
- server, feedid
+"{\"suspend\":false,\"groupid\":0,\"description\":\"%s\",\"version\":\"1.0\",\"authorization\":",
+ f.getFeedDescription() );
- );
+ String endpoints = "{\"endpoint_addrs\":[],\"classification\":\"unclassified\",\"endpoint_ids\":[";
+ String sep = "";
+ for( DR_Pub pub: f.getPubs()) {
+ endpoints += String.format( "%s{\"password\":\"%s\",\"id\":\"%s\"}",
+ sep, pub.getUserpwd(), pub.getUsername() );
+ sep = ",";
+
+ }
+ endpoints += "]},";
+ ret += endpoints;
+
+ ret += String.format(
+ "\"name\":\"%s\",\"business_description\":\"\",\"publisher\":\"sim\",\"links\":{\"subscribe\":\"https://%s/subscribe/%s\",\"log\":\"https://%s/feedlog/%s\",\"publish\":\"https://%s/publish/%s\",\"self\":\"https://%s/feed/%s\"}}",
+
+ f.getFeedName(),
+ server, feedid,
+ server, feedid,
+ server, feedid,
+ server, feedid
+ );
+ logger.info( "simulateResp ret=" + ret );
return ret;
}
private String simulateDelResp( Feed f ){