當前位置: 首頁>>代碼示例>>Java>>正文


Java Operation.setParameters方法代碼示例

本文整理匯總了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"));

}
 
開發者ID:dotwebstack,項目名稱:dotwebstack-framework,代碼行數:23,代碼來源:OpenApiRequestMapperTest.java

示例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);

}
 
開發者ID:dotwebstack,項目名稱:dotwebstack-framework,代碼行數:22,代碼來源:OpenApiRequestMapperTest.java

示例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);

}
 
開發者ID:dotwebstack,項目名稱:dotwebstack-framework,代碼行數:22,代碼來源:OpenApiRequestMapperTest.java

示例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));
}
 
開發者ID:dotwebstack,項目名稱:dotwebstack-framework,代碼行數:17,代碼來源:RequestParameterMapperTest.java

示例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);
}
 
開發者ID:dotwebstack,項目名稱:dotwebstack-framework,代碼行數:17,代碼來源:RequestParameterMapperTest.java


注:本文中的io.swagger.models.Operation.setParameters方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。