public List<DR_Sub> getAllDr_Subs() {
logger.debug( "enter getAllDR_Subs()");
- return new ArrayList<DR_Sub>(dr_subs.values());
+ return new ArrayList<>(dr_subs.values());
}
public ArrayList<DR_Sub> getDr_SubsByFeedId( String pubId ) {
- ArrayList<DR_Sub> someSubs = new ArrayList<DR_Sub>();
+ ArrayList<DR_Sub> someSubs = new ArrayList<>();
for( DR_Sub sub : dr_subs.values() ) {
if ( pubId.equals( sub.getFeedId() )) {
someSubs.add( sub );
String resp = prov.doPostDr_Sub( sub, apiError );
if ( "Yes".equals(unit_test) ) {
resp = simulateResp( sub, "POST" );
- apiError.setCode(200);
+ apiError.setCode(201);
}
logger.debug( "addDr_Sub resp=" + resp );
snew.setLastMod();
addEgressRoute( snew, apiError );
dr_subs.put( snew.getSubId(), snew );
- apiError.setCode(200);
+ apiError.setCode(201);
} else {
apiError.setCode(400);
}
}
public void removeDr_Sub( String key, ApiError apiError ) {
+ removeDr_Sub( key, apiError, true );
+ return;
+ }
+
+ public void removeDr_Sub( String key, ApiError apiError, boolean hitDR ) {
logger.debug( "enter removeDR_Subs()");
DR_Sub sub = dr_subs.get( key );
apiError.setCode(Status.NOT_FOUND.getStatusCode());
apiError.setFields( "subId");
apiError.setMessage("subId " + key + " not found");
- } else {
- DrProvConnection prov = new DrProvConnection();
- prov.makeSubPutConnection( key );
- String resp = prov.doDeleteDr_Sub( sub, apiError );
- logger.debug( "resp=" + resp );
+ } else {
+ if ( hitDR ) {
+ DrProvConnection prov = new DrProvConnection();
+ prov.makeSubPutConnection( key );
+ String resp = prov.doDeleteDr_Sub( sub, apiError );
+ logger.debug( "resp=" + resp );
+ } else {
+ apiError.setCode(200);
+ }
if ( apiError.is2xx() || unit_test.equals( "Yes" ) ) {
dr_subs.remove(key);
server, subid, sub.getUsername(), sub.getUserpwd());
String links = String.format( "\"links\": {\"feed\": \"https://dr-prov/feedlog/%s\", \"self\": \"https://dr-prov/sub/%s\", \"log\": \"https://dr-prov/sublog/%s\" }",
sub.getFeedId(),
- sub.getSubId(),
- sub.getSubId() );
+ subid,
+ subid );
ret += links + "}";
logger.info( "DR_SubService:simulateResp=" + ret);