本文整理汇总了Java中org.raml.model.parameter.Header类的典型用法代码示例。如果您正苦于以下问题:Java Header类的具体用法?Java Header怎么用?Java Header使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Header类属于org.raml.model.parameter包,在下文中一共展示了Header类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: shouldReturnErrorsForBrokenSecuritySpecifications
import org.raml.model.parameter.Header; //导入依赖的package包/类
@Test
public void shouldReturnErrorsForBrokenSecuritySpecifications() {
org.mockserver.model.Header authorizationHeader = new org.mockserver.model.Header(HttpHeaders.AUTHORIZATION, "Basic 1234", "wrong");
Parameter tokenParameter = new Parameter("token", "123456", "i_am_text");
when(expectation.getRequestHeader(HttpHeaders.AUTHORIZATION)).thenReturn(Optional.of(authorizationHeader));
when(expectation.getQueryParameter("token")).thenReturn(Optional.of(tokenParameter));
ValidationErrors errors = new RequestSecurityValidator(expectation).validate();
assertThat(errors.isInError()).isTrue();
assertThat(errors.getMessages())
.hasSize(4)
.contains(
"[ security ] [ header ] [ basic ] Only one value allowed for security parameters but multiple found.",
"[ security ] [ header ] [ basic ] Value of [ wrong ] does not meet API requirements.",
"[ security ] [ query ] [ query-token ] Only one value allowed for security parameters but multiple found.",
"[ security ] [ query ] [ query-token ] Value of [ i_am_text ] does not meet API requirements."
);
}
开发者ID:ozwolf-software,项目名称:raml-mock-server,代码行数:21,代码来源:RequestSecurityValidatorTest.java
示例2: addHeaders
import org.raml.model.parameter.Header; //导入依赖的package包/类
private void addHeaders(Action action, DCMethod method)
{
// first add common headers, based on mediaType
method.getHeaderParams().addAll(headerParams);
Map<String, Header> headers = action.getHeaders();
for (String headerName : headers.keySet())
{
Header header = headers.get(headerName);
HeaderParam param = new HeaderParam();
// for some strange reason, the header param names are suffixed with "-header". so we remove it
String name = headerName.endsWith("-header") ? headerName.substring(0,headerName.length()-7) : headerName;
param.setName(name);
if (header.getDefaultValue()!=null)
{
param.setValue(header.getDefaultValue());
}
method.addHeaderParam(param);
}
}
开发者ID:oracle,项目名称:mobile-persistence,代码行数:20,代码来源:RAMLParser.java
示例3: convertHeader
import org.raml.model.parameter.Header; //导入依赖的package包/类
public HeaderParameter convertHeader(Header source) {
if (source == null) {
return null;
}
HeaderParameter target = new HeaderParameter();
target.setExample(convertExample(source.getExample()));
target.setDescription(convertDescription(source.getDescription()));
target.setName(convertName(source.getDisplayName()));
target.setPattern(convertPattern(source.getPattern()));
target.setDefaultValue(convertDefaultValue(source.getDefaultValue()));
target.setMaximum(source.getMaximum());
target.setMinimum(source.getMinimum());
target.setEnumeration(source.getEnumeration());
target.setMaxLength(source.getMaxLength());
target.setMinLength(source.getMinLength());
target.setRepeat(source.isRepeat());
target.setRequired(source.isRequired());
target.setType(convertParameterType(source.getType()));
return target;
}
开发者ID:alv-ch,项目名称:alv-ch-java,代码行数:21,代码来源:RamlConverter.java
示例4: testConvertResponse
import org.raml.model.parameter.Header; //导入依赖的package包/类
@Test
public void testConvertResponse() {
Response source = new Response();
source.setDescription("responseDescription");
Map<String, Header> headers = new HashMap<>();
headers.put("testHeader", new Header());
Map<String, MimeType> body = new HashMap<>();
body.put("testBody", new MimeType());
source.setHeaders(headers);
source.setBody(body);
ch.alv.components.web.api.config.Response result = converter.convertResponse(source);
assertEquals(source.getDescription(), result.getDescription());
assertEquals(source.getBody().size(), result.getBody().size());
assertEquals(source.getHeaders().size(), result.getHeaders().size());
assertNull(converter.convertResponse(null));
}
开发者ID:alv-ch,项目名称:alv-ch-java,代码行数:19,代码来源:RamlConverterTest.java
示例5: exampleResponse
import org.raml.model.parameter.Header; //导入依赖的package包/类
@Override
public EndpointRoute exampleResponse(HttpResponseStatus status, String description, String headerName, String example, String headerDescription) {
Response response = new Response();
response.setDescription(description);
exampleResponses.put(status.code(), response);
if (headerName != null) {
Header header = new Header();
header.setDescription(headerDescription);
header.setExample(example);
Map<String, Header> headers = new HashMap<>();
headers.put(headerName, header);
response.setHeaders(headers);
}
return this;
}
开发者ID:gentics,项目名称:mesh,代码行数:16,代码来源:EndpointImpl.java
示例6: apply
import org.raml.model.parameter.Header; //导入依赖的package包/类
@Override
public void apply(Header header, ResourceClassBuilder resourceClassBuilder) {
resourceClassBuilder.getApiClass()
.withMethod(new AddHeaderMethod(header, header.getDisplayName(),
resourceClassBuilder.getReq(),
resourceClassBuilder.getApiClass()));
resourceClassBuilder.getDefaultsMethod().forParamDefaults(header.getDisplayName(), header);
}
开发者ID:qameta,项目名称:rarc,代码行数:9,代码来源:HeaderRule.java
示例7: basicAuthorizationHeaders
import org.raml.model.parameter.Header; //导入依赖的package包/类
private Map<String, Header> basicAuthorizationHeaders() {
Map<String, Header> headers = new HashMap<>();
Header header = new Header();
header.setRequired(true);
header.setRepeat(false);
header.setType(ParamType.STRING);
header.setPattern("Basic (.+)");
headers.put(HttpHeaders.AUTHORIZATION, header);
return headers;
}
开发者ID:ozwolf-software,项目名称:raml-mock-server,代码行数:14,代码来源:RequestSecurityValidatorTest.java
示例8: getMandatoryHeaders
import org.raml.model.parameter.Header; //导入依赖的package包/类
public Map<String, String> getMandatoryHeaders() {
Map<String, Header> oHeaders=getAction().getHeaders();
Map<String, String> oReturn=new HashMap<String, String>();
for(Map.Entry<String, Header> oHeader:oHeaders.entrySet()) {
if(oHeader.getValue().isRequired()) {
String oValue=Resolver.getValueParam(oHeader.getValue(), oHeader.getKey(),"[Mandatory Header]");
oReturn.put(oHeader.getKey(),oValue);
}
}
return oReturn;
}
开发者ID:pagesjaunes,项目名称:raml-codegen,代码行数:12,代码来源:ActionAdaptator.java
示例9: convertHeaders
import org.raml.model.parameter.Header; //导入依赖的package包/类
public List<HeaderParameter> convertHeaders(Map<String, Header> source) {
List<HeaderParameter> list = new ArrayList<>();
if (source.isEmpty()) {
return list;
}
for (String key : source.keySet()) {
list.add(convertHeader(source.get(key)));
}
return list;
}
开发者ID:alv-ch,项目名称:alv-ch-java,代码行数:12,代码来源:RamlConverter.java
示例10: testConvertHeaders
import org.raml.model.parameter.Header; //导入依赖的package包/类
@Test
public void testConvertHeaders() {
Map<String, Header> sourceHeaders = new HashMap<>();
sourceHeaders.put("testHeader", new Header());
List<HeaderParameter> result = converter.convertHeaders(sourceHeaders);
assertEquals(1, result.size());
}
开发者ID:alv-ch,项目名称:alv-ch-java,代码行数:8,代码来源:RamlConverterTest.java
示例11: testConvertHeader
import org.raml.model.parameter.Header; //导入依赖的package包/类
@Test
public void testConvertHeader() {
Header source = new Header();
source.setDisplayName("testHeader");
source.setExample("testHeaderExample");
source.setPattern("testHeaderPattern");
source.setType(ParamType.INTEGER);
source.setDefaultValue("testHeaderDefaultValue");
List<String> enums = new ArrayList<>();
enums.add("testValue");
source.setEnumeration(enums);
source.setMaximum(new BigDecimal("5"));
source.setMinimum(new BigDecimal("1"));
source.setMinLength(3);
source.setMaxLength(9);
source.setRepeat(true);
source.setRequired(true);
HeaderParameter result = converter.convertHeader(source);
assertEquals(source.getDisplayName(), result.getName());
assertEquals(source.getExample(), result.getExample());
assertEquals(source.getPattern(), result.getPattern());
assertEquals(ParameterType.INTEGER, result.getType());
assertEquals(source.getDefaultValue(), result.getDefaultValue());
assertEquals(source.getEnumeration(), result.getEnumeration());
assertEquals(source.getMaximum(), result.getMaximum());
assertEquals(source.getMinimum(), result.getMinimum());
assertEquals(source.getMinLength(), result.getMinLength());
assertEquals(source.getMaxLength(), result.getMaxLength());
assertEquals(source.isRepeat(), result.isRepeat());
assertEquals(source.isRequired(), result.isRequired());
assertNull(converter.convertHeader(null));
}
开发者ID:alv-ch,项目名称:alv-ch-java,代码行数:35,代码来源:RamlConverterTest.java
示例12: AddHeaderMethod
import org.raml.model.parameter.Header; //导入依赖的package包/类
public AddHeaderMethod(Header header, String name, ReqSpecField req, ApiResourceClass apiClass) {
this.header = header;
this.name = name;
this.req = req;
this.apiClass = apiClass;
}
开发者ID:qameta,项目名称:rarc,代码行数:7,代码来源:AddHeaderMethod.java
示例13: HeaderDefinition
import org.raml.model.parameter.Header; //导入依赖的package包/类
public HeaderDefinition(String name, String javaType, PatternDefinition pattern, Header uriParameter) {
super(name, javaType, pattern, uriParameter);
}
开发者ID:hubrick,项目名称:raml-maven-plugin,代码行数:4,代码来源:HeaderDefinition.java
示例14: RJP08V1RamlHeader
import org.raml.model.parameter.Header; //导入依赖的package包/类
public RJP08V1RamlHeader(Header header) {
this.header = header;
}
开发者ID:phoenixnap,项目名称:springmvc-raml-plugin,代码行数:4,代码来源:RJP08V1RamlHeader.java
示例15: createRamlHeader
import org.raml.model.parameter.Header; //导入依赖的package包/类
@Override
public RamlHeader createRamlHeader(Object header) {
return new RJP08V1RamlHeader((Header)header);
}
开发者ID:phoenixnap,项目名称:springmvc-raml-plugin,代码行数:5,代码来源:RJP08V1RamlModelFactory.java
示例16: headers
import org.raml.model.parameter.Header; //导入依赖的package包/类
public Map<String, Header> headers(SecurityScheme scheme) {
return scheme.getDescribedBy() == null
? Collections.<String, Header>emptyMap()
: scheme.getDescribedBy().getHeaders();
}
开发者ID:nidi3,项目名称:raml-tester,代码行数:6,代码来源:SecurityExtractor.java
示例17: getHeaders
import org.raml.model.parameter.Header; //导入依赖的package包/类
public Map<String, Header> getHeaders() {
return response.getHeaders() == null ? Collections.<String, Header>emptyMap() : response.getHeaders();
}
开发者ID:adrobisch,项目名称:raml-converter,代码行数:4,代码来源:ResponseContext.java
示例18: getHeaders
import org.raml.model.parameter.Header; //导入依赖的package包/类
public Map<String, Header> getHeaders() {
return action.getHeaders();
}
开发者ID:adrobisch,项目名称:raml-converter,代码行数:4,代码来源:ActionContext.java
注:本文中的org.raml.model.parameter.Header类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论