use of com.jayway.jsonpath.DocumentContext in project spring-cloud-open-service-broker by spring-cloud.
the class GetServiceInstanceAppBindingResponseTest method responseWithDefaultsIsBuilt.
@Test
public void responseWithDefaultsIsBuilt() {
GetServiceInstanceAppBindingResponse response = GetServiceInstanceAppBindingResponse.builder().build();
assertThat(response.getParameters()).hasSize(0);
assertThat(response.getCredentials()).hasSize(0);
assertThat(response.getSyslogDrainUrl()).isNull();
assertThat(response.getVolumeMounts()).hasSize(0);
DocumentContext json = JsonUtils.toJsonPath(response);
assertThat(json).hasNoPath("$.parameters");
assertThat(json).hasNoPath("$.credentials");
assertThat(json).hasNoPath("$.syslog_drain_url");
assertThat(json).hasNoPath("$.volume_mounts");
}
use of com.jayway.jsonpath.DocumentContext in project spring-cloud-open-service-broker by spring-cloud.
the class GetServiceInstanceAppBindingResponseTest method responseWithDiscreteValuesIsBuilt.
@Test
@SuppressWarnings("serial")
public void responseWithDiscreteValuesIsBuilt() {
Map<String, Object> parameters = new HashMap<String, Object>() {
{
put("field4", "value4");
put("field5", "value5");
}
};
Map<String, Object> credentials = new HashMap<String, Object>() {
{
put("credential4", "value4");
put("credential5", "value5");
}
};
List<VolumeMount> volumeMounts = Arrays.asList(VolumeMount.builder().build(), VolumeMount.builder().build());
GetServiceInstanceAppBindingResponse response = GetServiceInstanceAppBindingResponse.builder().parameters("field1", "value1").parameters("field2", 2).parameters("field3", true).parameters(parameters).credentials("credential1", "value1").credentials("credential2", 2).credentials("credential3", true).credentials(credentials).syslogDrainUrl("https://logs.example.com").volumeMounts(VolumeMount.builder().build()).volumeMounts(VolumeMount.builder().build()).volumeMounts(volumeMounts).build();
assertThat(response.getParameters()).hasSize(5);
assertThat(response.getParameters().get("field1")).isEqualTo("value1");
assertThat(response.getParameters().get("field2")).isEqualTo(2);
assertThat(response.getParameters().get("field3")).isEqualTo(true);
assertThat(response.getParameters().get("field4")).isEqualTo("value4");
assertThat(response.getParameters().get("field5")).isEqualTo("value5");
assertThat(response.getCredentials()).hasSize(5);
assertThat(response.getCredentials().get("credential1")).isEqualTo("value1");
assertThat(response.getCredentials().get("credential2")).isEqualTo(2);
assertThat(response.getCredentials().get("credential3")).isEqualTo(true);
assertThat(response.getCredentials().get("credential4")).isEqualTo("value4");
assertThat(response.getCredentials().get("credential5")).isEqualTo("value5");
assertThat(response.getSyslogDrainUrl()).isEqualTo("https://logs.example.com");
assertThat(response.getVolumeMounts()).hasSize(4);
DocumentContext json = JsonUtils.toJsonPath(response);
assertThat(json).hasPath("$.parameters.field1").isEqualTo("value1");
assertThat(json).hasPath("$.parameters.field2").isEqualTo(2);
assertThat(json).hasPath("$.parameters.field3").isEqualTo(true);
assertThat(json).hasPath("$.parameters.field4").isEqualTo("value4");
assertThat(json).hasPath("$.parameters.field5").isEqualTo("value5");
assertThat(json).hasPath("$.credentials.credential1").isEqualTo("value1");
assertThat(json).hasPath("$.credentials.credential2").isEqualTo(2);
assertThat(json).hasPath("$.credentials.credential3").isEqualTo(true);
assertThat(json).hasPath("$.credentials.credential4").isEqualTo("value4");
assertThat(json).hasPath("$.credentials.credential5").isEqualTo("value5");
assertThat(json).hasPath("$.syslog_drain_url").isEqualTo("https://logs.example.com");
assertThat(json).hasListAtPath("$.volume_mounts").hasSize(4);
}
use of com.jayway.jsonpath.DocumentContext in project spring-cloud-open-service-broker by spring-cloud.
the class GetServiceInstanceResponseTest method responseWithDefaultsIsBuilt.
@Test
public void responseWithDefaultsIsBuilt() {
GetServiceInstanceResponse response = GetServiceInstanceResponse.builder().build();
assertThat(response.getServiceDefinitionId()).isNull();
assertThat(response.getPlanId()).isNull();
assertThat(response.getDashboardUrl()).isNull();
assertThat(response.getParameters()).hasSize(0);
DocumentContext json = JsonUtils.toJsonPath(response);
assertThat(json).hasNoPath("$.service_id");
assertThat(json).hasNoPath("$.plan_id");
assertThat(json).hasNoPath("$.dashboard_url");
assertThat(json).hasMapAtPath("$.parameters").hasSize(0);
}
use of com.jayway.jsonpath.DocumentContext in project spring-cloud-open-service-broker by spring-cloud.
the class GetServiceInstanceResponseTest method responseWithAllValuesIsBuilt.
@Test
@SuppressWarnings("serial")
public void responseWithAllValuesIsBuilt() {
Map<String, Object> parameters = new HashMap<String, Object>() {
{
put("field4", "value4");
put("field5", "value5");
}
};
GetServiceInstanceResponse response = GetServiceInstanceResponse.builder().serviceDefinitionId("service-definition-id").planId("plan-id").dashboardUrl("https://dashboard.example.com").parameters("field1", "value1").parameters("field2", 2).parameters("field3", true).parameters(parameters).build();
assertThat(response.getServiceDefinitionId()).isEqualTo("service-definition-id");
assertThat(response.getPlanId()).isEqualTo("plan-id");
assertThat(response.getDashboardUrl()).isEqualTo("https://dashboard.example.com");
assertThat(response.getParameters()).hasSize(5);
assertThat(response.getParameters().get("field1")).isEqualTo("value1");
assertThat(response.getParameters().get("field2")).isEqualTo(2);
assertThat(response.getParameters().get("field3")).isEqualTo(true);
assertThat(response.getParameters().get("field4")).isEqualTo("value4");
assertThat(response.getParameters().get("field5")).isEqualTo("value5");
DocumentContext json = JsonUtils.toJsonPath(response);
assertThat(json).hasPath("$.service_id").isEqualTo("service-definition-id");
assertThat(json).hasPath("$.plan_id").isEqualTo("plan-id");
assertThat(json).hasPath("$.dashboard_url").isEqualTo("https://dashboard.example.com");
assertThat(json).hasPath("$.parameters.field1").isEqualTo("value1");
assertThat(json).hasPath("$.parameters.field2").isEqualTo(2);
assertThat(json).hasPath("$.parameters.field3").isEqualTo(true);
assertThat(json).hasPath("$.parameters.field4").isEqualTo("value4");
assertThat(json).hasPath("$.parameters.field5").isEqualTo("value5");
}
use of com.jayway.jsonpath.DocumentContext in project spring-cloud-open-service-broker by spring-cloud.
the class UpdateServiceInstanceResponseTest method responseWithDefaultsIsBuilt.
@Test
public void responseWithDefaultsIsBuilt() {
UpdateServiceInstanceResponse response = UpdateServiceInstanceResponse.builder().build();
assertThat(response.isAsync()).isEqualTo(false);
assertThat(response.getOperation()).isNull();
DocumentContext json = JsonUtils.toJsonPath(response);
assertThat(json).hasNoPath("$.operation");
}
Aggregations