Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/main/java/com/auth0/json/mgmt/connections/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public class Connection {
@JsonProperty("realms")
private List<String> realms;
@JsonProperty("show_as_button")
private boolean showAsButton;
private Boolean showAsButton;
@JsonProperty("is_domain_connection")
private boolean isDomainConnection;
private Boolean isDomainConnection;

public Connection() {
}
Expand Down Expand Up @@ -193,7 +193,8 @@ public void setRealms(List<String> realms) {
*
* @return the show as button flag.
*/
public boolean isShowAsButton() {
@JsonProperty("show_as_button")
public Boolean isShowAsButton() {
return showAsButton;
}

Expand All @@ -202,23 +203,26 @@ public boolean isShowAsButton() {
*
* @param showAsButton the show as button flag to set.
*/
public void setShowAsButton(boolean showAsButton) {
@JsonProperty("show_as_button")
public void setShowAsButton(Boolean showAsButton) {
this.showAsButton = showAsButton;
}

/**
* Getter for the domain connection flag.
* @return the domain connection flag.
*/
public boolean isDomainConnection() {
@JsonProperty("is_domain_connection")
public Boolean isDomainConnection() {
return isDomainConnection;
}

/**
* Setter for the domain connection flag.
* @param domainConnection the domain connection flag to set.
*/
public void setDomainConnection(boolean domainConnection) {
isDomainConnection = domainConnection;
@JsonProperty("is_domain_connection")
public void setDomainConnection(Boolean domainConnection) {
this.isDomainConnection = domainConnection;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ public void shouldThrowOnCreateConnectionWithNullData() {

@Test
public void shouldCreateConnection() throws Exception {
Request<Connection> request = api.connections().create(new Connection("my-connection", "auth0"));
Connection createConnection = new Connection("my-connection", "auth0");
createConnection.setDomainConnection(true);
createConnection.setShowAsButton(true);
Request<Connection> request = api.connections().create(createConnection);
assertThat(request, is(notNullValue()));

server.jsonResponse(MGMT_CONNECTION, 200);
Expand All @@ -188,7 +191,7 @@ public void shouldCreateConnection() throws Exception {
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));

Map<String, Object> body = bodyFromRequest(recordedRequest);
assertThat(body.size(), is(5));
assertThat(body.size(), is(4));
assertThat(body, hasEntry("name", "my-connection"));
assertThat(body, hasEntry("strategy", "auth0"));

Expand Down Expand Up @@ -244,7 +247,7 @@ public void shouldUpdateConnection() throws Exception {
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));

Map<String, Object> body = bodyFromRequest(recordedRequest);
assertThat(body.size(), is(5));
assertThat(body.size(), is(2));
assertThat(body, hasEntry("name", "my-connection"));
assertThat(body, hasEntry("strategy", "auth0"));

Expand Down
8 changes: 5 additions & 3 deletions src/test/resources/mgmt/connection.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"ScKKdrpyUwfkhOQP6KXItH32INgZf7Rb"
],
"metadata": {
"key": "value"
}
}
"key": "value"
},
"is_domain_connection": true,
"show_as_button": true
}
Loading