Actually remove pubs and subs on Feed delete
[dmaap/dbcapi.git] / src / main / java / org / onap / dmaap / dbcapi / service / DR_SubService.java
index c3f8c9c..138ff57 100644 (file)
@@ -26,8 +26,8 @@ import java.util.Map;
 
 import javax.ws.rs.core.Response.Status;
 
-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.logging.DmaapbcLogMessageEnum;
 import org.onap.dmaap.dbcapi.model.ApiError;
@@ -167,14 +167,21 @@ public class DR_SubService extends BaseLoggingClass {
                
        public void removeDr_Sub( String key, ApiError apiError ) {
                logger.debug( "enter removeDR_Subs()");
+               
                DR_Sub sub = dr_subs.get( key );
                if ( sub == null ) {
                        apiError.setCode(Status.NOT_FOUND.getStatusCode());
                        apiError.setFields( "subId");
                        apiError.setMessage("subId " + key + " not found");
                } else {        
-                       dr_subs.remove(key);
-                       apiError.setCode(200);
+                       DrProvConnection prov = new DrProvConnection();
+                       prov.makeSubPutConnection( key );
+                       String resp = prov.doDeleteDr_Sub( sub, apiError );
+                       logger.debug( "resp=" + resp );
+                       
+                       if ( apiError.is2xx() ) {
+                               dr_subs.remove(key);
+                       }
                }
 
                return;