本文整理匯總了Java中io.swagger.models.Operation.setParameters方法的典型用法代碼示例。如果您正苦於以下問題:Java Operation.setParameters方法的具體用法?Java Operation.setParameters怎麽用?Java Operation.setParameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.swagger.models.Operation
的用法示例。
在下文中一共展示了Operation.setParameters方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: map_BodyParameter
import io.swagger.models.Operation; //導入方法依賴的package包/類
@Test
public void map_BodyParameter() throws IOException {
// Arrange
Property property = mock(Property.class);
List<Parameter> parameters = createBodyParameter("object");
Operation newOp = new Operation();
newOp.setParameters(parameters);
newOp.vendorExtensions(ImmutableMap.of(OpenApiSpecificationExtensions.INFORMATION_PRODUCT,
DBEERPEDIA.BREWERIES.stringValue()));
newOp.response(200, new Response().schema(property));
mockDefinition().host(DBEERPEDIA.OPENAPI_HOST).produces(MediaType.APPLICATION_JSON).path(
"/breweries", new Path().get(newOp));
// Act
requestMapper.map(httpConfigurationMock);
// Assert
verify(httpConfigurationMock).registerResources(resourceCaptor.capture());
Resource resource = resourceCaptor.getValue();
assertThat(resource.getPath(), equalTo("/" + DBEERPEDIA.OPENAPI_HOST + "/breweries"));
}
示例2: map_BodyParameterWithRefObject
import io.swagger.models.Operation; //導入方法依賴的package包/類
@Test
public void map_BodyParameterWithRefObject() throws IOException {
// Arrange
Property property = mock(Property.class);
List<Parameter> parameters = createBodyRefParameter();
Operation newOp = new Operation();
newOp.setParameters(parameters);
newOp.vendorExtensions(ImmutableMap.of(OpenApiSpecificationExtensions.INFORMATION_PRODUCT,
DBEERPEDIA.BREWERIES.stringValue()));
newOp.response(200, new Response().schema(property));
mockDefinition().host(DBEERPEDIA.OPENAPI_HOST).produces(MediaType.APPLICATION_JSON).path(
"/breweries", new Path().post(newOp));
// Assert
thrown.expect(ConfigurationException.class);
thrown.expectMessage(String.format("No object property in body parameter"));
// Act
requestMapper.map(httpConfigurationMock);
}
示例3: map_BodyParameterNoObject
import io.swagger.models.Operation; //導入方法依賴的package包/類
@Test
public void map_BodyParameterNoObject() throws IOException {
// Arrange
Property property = mock(Property.class);
List<Parameter> parameters = createBodyParameter("object2");
Operation newOp = new Operation();
newOp.setParameters(parameters);
newOp.vendorExtensions(ImmutableMap.of(OpenApiSpecificationExtensions.INFORMATION_PRODUCT,
DBEERPEDIA.BREWERIES.stringValue()));
newOp.response(200, new Response().schema(property));
mockDefinition().host(DBEERPEDIA.OPENAPI_HOST).produces(MediaType.APPLICATION_JSON).path(
"/breweries", new Path().get(newOp));
// Assert
thrown.expect(ConfigurationException.class);
thrown.expectMessage(String.format("No object property in body parameter"));
// Act
requestMapper.map(httpConfigurationMock);
}
示例4: map_ReturnsEmptyMap_WhenParameterHasNoParameterInputVendorExtension
import io.swagger.models.Operation; //導入方法依賴的package包/類
@Test
public void map_ReturnsEmptyMap_WhenParameterHasNoParameterInputVendorExtension() {
// Arrange
Operation operation = new Operation();
PathParameter pathParameter = new PathParameter();
pathParameter.setVendorExtension("x-dotwebstack-another-vendor-extension",
parameter.getIdentifier().stringValue());
operation.setParameters(ImmutableList.of(pathParameter));
// Act
Map<String, String> result = mapper.map(operation, product, requestParameters);
// Assert
assertThat(result.isEmpty(), is(true));
}
示例5: map_ThrowsException_ForUnknownParameterName
import io.swagger.models.Operation; //導入方法依賴的package包/類
@Test
public void map_ThrowsException_ForUnknownParameterName() {
// Assert
thrown.expect(ConfigurationException.class);
thrown.expectMessage("No parameter found for vendor extension value:");
// Arrange
Operation operation = new Operation();
PathParameter parameter = new PathParameter();
parameter.setVendorExtension(OpenApiSpecificationExtensions.PARAMETER, "http://unknown");
operation.setParameters(ImmutableList.of(parameter));
// Act
mapper.map(operation, product, requestParameters);
}