CreateServiceInstanceRequest extends AsyncParameterizedServiceInstanceRequest { public static CreateServiceInstanceRequestBuilder builder() { return new CreateServiceInstanceRequestBuilder(); } CreateServiceInstanceRequest();  CreateServiceInstanceRequest(String serviceDefinitionId, String serviceInstanceId, String planId,
			ServiceDefinition serviceDefinition, Plan plan, Map<String, Object> parameters, Context context,
			boolean asyncAccepted, String platformInstanceId, String apiInfoLocation, Context originatingIdentity,
			String requestIdentity, MaintenanceInfo maintenanceInfo); private  CreateServiceInstanceRequest(String serviceDefinitionId, String serviceInstanceId, String planId,
			ServiceDefinition serviceDefinition, Plan plan, Map<String, Object> parameters, Context context,
			boolean asyncAccepted, String platformInstanceId, String apiInfoLocation, Context originatingIdentity,
			String requestIdentity, String organizationGuid, String spaceGuid, MaintenanceInfo maintenanceInfo); String getServiceInstanceId(); void setServiceInstanceId(final String serviceInstanceId); String getServiceDefinitionId(); String getPlanId(); @Deprecated String getOrganizationGuid(); @Deprecated String getSpaceGuid(); ServiceDefinition getServiceDefinition(); void setServiceDefinition(ServiceDefinition serviceDefinition); Plan getPlan(); void setPlan(Plan plan); MaintenanceInfo getMaintenanceInfo(); static CreateServiceInstanceRequestBuilder builder(); @Override final boolean equals(Object o); @Override boolean canEqual(Object other); @Override final int hashCode(); @Override String toString();  }
@Test void serializesAccordingToOsbSpecs() { Map<String, Object> parameters = new HashMap<>(); parameters.put("field4", "value4"); parameters.put("field5", "value5"); Context context = CloudFoundryContext.builder() .organizationGuid("org-guid") .spaceGuid("space-guid").build(); Context originatingIdentity = CloudFoundryContext.builder() .property("user_id", "user-id").build(); CreateServiceInstanceRequest request = CreateServiceInstanceRequest.builder() .serviceInstanceId("service-instance-id") .serviceDefinitionId("service-definition-id") .planId("plan-id") .context(context) .parameters("field1", "value1") .parameters("field2", 2) .parameters("field3", true) .parameters(parameters) .asyncAccepted(true) .platformInstanceId("platform-instance-id") .apiInfoLocation("https: .originatingIdentity(originatingIdentity) .requestIdentity("request-id") .plan(Plan.builder().build()) .serviceDefinition(ServiceDefinition.builder().build()) .maintenanceInfo( new MaintenanceInfo("1.1.0", "Patch for CVE-x")) .build(); DocumentContext json = JsonUtils.toJsonPath(request); JsonPathAssert.assertThat(json).hasPath("$.plan_id").isEqualTo("plan-id"); JsonPathAssert.assertThat(json).hasPath("$.service_id").isEqualTo("service-definition-id"); JsonPathAssert.assertThat(json).hasMapAtPath("$.parameters").hasSize(5); JsonPathAssert.assertThat(json).hasPath("$.parameters.field1").isEqualTo("value1"); JsonPathAssert.assertThat(json).hasMapAtPath("$.context").hasSize(3); JsonPathAssert.assertThat(json).hasMapAtPath("$.maintenance_info").hasSize(2); JsonPathAssert.assertThat(json).hasPath("$.maintenance_info.version").isEqualTo("1.1.0"); JsonPathAssert.assertThat(json).hasPath("$.maintenance_info.description").isEqualTo("Patch for CVE-x"); JsonPathAssert.assertThat(json).hasPath("$.space_guid").isEqualTo("space-guid"); JsonPathAssert.assertThat(json).hasPath("$.organization_guid").isEqualTo("org-guid"); JsonPathAssert.assertThat(json).hasNoPath("$.request_identity"); JsonPathAssert.assertThat(json).hasMapAtPath("$").hasSize(7); }
@Test void serializesWithoutContextAccordingToOsbSpecs() { CreateServiceInstanceRequest request = CreateServiceInstanceRequest.builder() .serviceInstanceId("service-instance-id") .serviceDefinitionId("service-definition-id") .planId("plan-id") .build(); DocumentContext json = JsonUtils.toJsonPath(request); JsonPathAssert.assertThat(json).hasPath("$.plan_id").isEqualTo("plan-id"); JsonPathAssert.assertThat(json).hasPath("$.service_id").isEqualTo("service-definition-id"); JsonPathAssert.assertThat(json).hasPath("$.space_guid").isEqualTo("default-undefined-value"); JsonPathAssert.assertThat(json).hasPath("$.organization_guid").isEqualTo("default-undefined-value"); JsonPathAssert.assertThat(json).hasMapAtPath("$").hasSize(4); }