Skip to content

Commit

Permalink
Rename BindResource property from "field" to "property" for consistency.
Browse files Browse the repository at this point in the history
  • Loading branch information
scottfrederick committed Oct 4, 2017
1 parent 29b16db commit e7594ca
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,28 @@ public class BindResource {
@JsonProperty
private final String route;

private Map<String, Object> fields = new HashMap<>();
private Map<String, Object> properties = new HashMap<>();

public BindResource() {
this.appGuid = null;
this.route = null;
}

public BindResource(String appGuid, String route, Map<String, Object> fields) {
public BindResource(String appGuid, String route, Map<String, Object> properties) {
this.appGuid = appGuid;
this.route = route;
if (fields != null) {
this.fields.putAll(fields);
if (properties != null) {
this.properties.putAll(properties);
}
}

public BindResource(Map<String, Object> fields) {
this(null, null, fields);
public BindResource(Map<String, Object> properties) {
this(null, null, properties);
}

@JsonAnySetter
private void setField(String key, Object value) {
fields.put(key, value);
private void setProperty(String key, Object value) {
properties.put(key, value);
}

/**
Expand All @@ -56,7 +56,7 @@ private void setField(String key, Object value) {
* @param key the key of the value to retrieve
* @return the value of the field, or {@literal null} if the key is not present in the request
*/
public Object getField(String key) {
return fields.get(key);
public Object getProperty(String key) {
return properties.get(key);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public void requestWithAppGuidBindingIsRead() {
assertEquals(2, context.getProperty("field2"));

assertNull(request.getBindResource().getRoute());
assertEquals("data", request.getBindResource().getField("field1"));
assertEquals(2, request.getBindResource().getField("field2"));
assertEquals("data", request.getBindResource().getProperty("field1"));
assertEquals(2, request.getBindResource().getProperty("field2"));

assertEquals(1, request.getParameters().get("parameter1"));
assertEquals("foo", request.getParameters().get("parameter2"));
Expand All @@ -50,8 +50,8 @@ public void requestWithRouteBindingIsRead() {
assertNull(request.getAppGuid());
assertNull(request.getBindResource().getAppGuid());
assertEquals("http://test.example.com", request.getBindResource().getRoute());
assertEquals("data", request.getBindResource().getField("field1"));
assertEquals(2, request.getBindResource().getField("field2"));
assertEquals("data", request.getBindResource().getProperty("field1"));
assertEquals(2, request.getBindResource().getProperty("field2"));

assertEquals(KUBERNETES_PLATFORM, request.getContext().getPlatform());
assertThat(request.getContext(), instanceOf(KubernetesContext.class));
Expand Down

0 comments on commit e7594ca

Please sign in to comment.