Rename constants. Remove dead comment

This commit is contained in:
Tadgh 2020-09-14 15:35:58 -04:00
parent f20c42a8bd
commit 6e0ef035e9
3 changed files with 15 additions and 16 deletions

View File

@ -79,7 +79,6 @@ public class SubscriptionMatchingSubscriber implements MessageHandler {
public void handleMessage(@Nonnull Message<?> theMessage) throws MessagingException {
ourLog.trace("Handling resource modified message: {}", theMessage);
//TODO ADD BACKPORT FOR HANDLING OLD LEGACY SUBSCRIPTIONS HERE
if (!(theMessage instanceof ResourceModifiedJsonMessage)) {
ourLog.warn("Unexpected message payload type: {}", theMessage);
return;

View File

@ -15,9 +15,9 @@ import java.util.Set;
* they can also be accessed in standard map fashion with a `get` on the map.
*/
public class HapiMessageHeaders implements Map<String, Object>, IModelJson {
public static String RETRY_COUNT_HEADER = "retryCount";
public static String FIRST_FAILURE_HEADER = "firstFailure";
public static String LAST_FAILURE_HEADER = "lastFailure";
public static String RETRY_COUNT_KEY = "retryCount";
public static String FIRST_FAILURE_KEY = "firstFailure";
public static String LAST_FAILURE_KEY = "lastFailure";
private final Map<String, Object> headers;
@ -91,16 +91,16 @@ public class HapiMessageHeaders implements Map<String, Object>, IModelJson {
}
public Integer getRetryCount() {
return (Integer)this.getHeaders().get(RETRY_COUNT_HEADER);
return (Integer)this.getHeaders().get(RETRY_COUNT_KEY);
}
public Date getFirstFailureDate() {
return (Date)this.getHeaders().get(FIRST_FAILURE_HEADER);
return (Date)this.getHeaders().get(FIRST_FAILURE_KEY);
}
public Date getLastFailureDate() {
return (Date)this.getHeaders().get(LAST_FAILURE_HEADER);
return (Date)this.getHeaders().get(LAST_FAILURE_KEY);
}
public Map<String, Object> getHeaders() {
@ -111,8 +111,8 @@ public class HapiMessageHeaders implements Map<String, Object>, IModelJson {
* Sets deffault values for the special headers that HAPI cares about during retry.
*/
public void initializeDefaultRetryValues() {
headers.put(RETRY_COUNT_HEADER, 0);
headers.put(FIRST_FAILURE_HEADER, null);
headers.put(LAST_FAILURE_HEADER, null);
headers.put(RETRY_COUNT_KEY, 0);
headers.put(FIRST_FAILURE_KEY, null);
headers.put(LAST_FAILURE_KEY, null);
}
}

View File

@ -5,9 +5,9 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import static ca.uhn.fhir.rest.server.messaging.json.HapiMessageHeaders.FIRST_FAILURE_HEADER;
import static ca.uhn.fhir.rest.server.messaging.json.HapiMessageHeaders.LAST_FAILURE_HEADER;
import static ca.uhn.fhir.rest.server.messaging.json.HapiMessageHeaders.RETRY_COUNT_HEADER;
import static ca.uhn.fhir.rest.server.messaging.json.HapiMessageHeaders.FIRST_FAILURE_KEY;
import static ca.uhn.fhir.rest.server.messaging.json.HapiMessageHeaders.LAST_FAILURE_KEY;
import static ca.uhn.fhir.rest.server.messaging.json.HapiMessageHeaders.RETRY_COUNT_KEY;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
@ -26,8 +26,8 @@ class BaseResourceModifiedMessageTest {
assertThat(jsonMessage.getHapiHeaders().getFirstFailureDate(), is(equalTo(null)));
assertThat(jsonMessage.getHapiHeaders().getLastFailureDate(), is(equalTo(null)));
assertThat(jsonMessage.getHeaders().get(RETRY_COUNT_HEADER), is(equalTo(0)));
assertThat(jsonMessage.getHeaders().get(FIRST_FAILURE_HEADER), is(equalTo(null)));
assertThat(jsonMessage.getHeaders().get(LAST_FAILURE_HEADER), is(equalTo(null)));
assertThat(jsonMessage.getHeaders().get(RETRY_COUNT_KEY), is(equalTo(0)));
assertThat(jsonMessage.getHeaders().get(FIRST_FAILURE_KEY), is(equalTo(null)));
assertThat(jsonMessage.getHeaders().get(LAST_FAILURE_KEY), is(equalTo(null)));
}
}