import javax.ws.rs.core.Response.Status;
import org.apache.log4j.Logger;
-import org.onap.dmaap.dbcapi.aaf.client.DrProvConnection;
-import org.onap.dmaap.dbcapi.aaf.database.DatabaseClass;
+import org.onap.dmaap.dbcapi.client.DrProvConnection;
+import org.onap.dmaap.dbcapi.database.DatabaseClass;
import org.onap.dmaap.dbcapi.logging.BaseLoggingClass;
import org.onap.dmaap.dbcapi.model.ApiError;
import org.onap.dmaap.dbcapi.model.DR_Pub;
// need to save the Sub objects independently
private boolean saveSubs( Feed fnew, Feed req ) {
ArrayList<DR_Sub> subs = req.getSubs();
- if ( subs.size() == 0 ) {
+ if ( subs == null || subs.size() == 0 ) {
logger.info( "No subs specified");
} else {
DR_SubService subSvc = new DR_SubService( fnew.getSubscribeURL() );
}
return feeds.remove(req.getFeedId());
} else {
- req.setStatus(DmaapObject_Status.DELETED);
- req.setPubs(null);
+
+ logger.info( "Disable pubs for deleted feed - creating tmp pub");
+ ArrayList<DR_Pub> tmppub = new ArrayList<DR_Pub>();
+ tmppub.add( new DR_Pub( dcaeLocations.getCentralLocation())
+ .setRandomUserName()
+ .setRandomPassword());
+ req.setPubs(tmppub);
req.setSubs(null);
- req.setLastMod();
- feeds.put( req.getFeedId(), req );
- return null;
+ Feed fnew = updateFeed( req, err );
+ if ( ! err.is2xx()) {
+ return req;
+ }
+ fnew.setStatus(DmaapObject_Status.DELETED);
+ feeds.put( fnew.getFeedId(), fnew );
+ return null;
}
}
private String simulateResp( Feed f, String action ){
- String server = "drps.onap.org";
+ String server = "localhost";
String feedid;
if ( action.equals( "POST" ) ) {
RandomInteger ran = new RandomInteger(10000);
return ret;
}
private String simulateDelResp( Feed f ){
- String server = "drps.onap.org";
+ String server = "localhost";
String feedid = f.getFeedId();
String ret = String.format(
"{\"suspend\":true,\"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\"}}",