use of org.apache.cxf.annotations.SchemaValidation.SchemaValidationType in project tomee by apache.
the class ServiceUtils method isSchemaValidationEnabled.
/**
* A short cut method to be able to test for if Schema Validation should be enabled
* for IN or OUT without having to check BOTH and IN or OUT.
*
* @param message
* @param type
*/
public static boolean isSchemaValidationEnabled(SchemaValidationType type, Message message) {
SchemaValidationType validationType = getSchemaValidationType(message);
boolean isRequestor = MessageUtils.isRequestor(message);
if (SchemaValidationType.REQUEST.equals(validationType)) {
if (isRequestor) {
validationType = SchemaValidationType.OUT;
} else {
validationType = SchemaValidationType.IN;
}
} else if (SchemaValidationType.RESPONSE.equals(validationType)) {
if (isRequestor) {
validationType = SchemaValidationType.IN;
} else {
validationType = SchemaValidationType.OUT;
}
}
return validationType.equals(type) || ((SchemaValidationType.IN.equals(type) || SchemaValidationType.OUT.equals(type)) && SchemaValidationType.BOTH.equals(validationType));
}
use of org.apache.cxf.annotations.SchemaValidation.SchemaValidationType in project cxf by apache.
the class ServiceUtilsTest method testGetSchemaValidationType.
@Test
public void testGetSchemaValidationType() {
for (SchemaValidationType type : SchemaValidationType.values()) {
setupSchemaValidationValue(type.name(), false);
assertEquals(type, ServiceUtils.getSchemaValidationType(msg));
setupSchemaValidationValue(type.name().toLowerCase(), false);
assertEquals(type, ServiceUtils.getSchemaValidationType(msg));
setupSchemaValidationValue(StringUtils.capitalize(type.name()), false);
assertEquals(type, ServiceUtils.getSchemaValidationType(msg));
}
}
use of org.apache.cxf.annotations.SchemaValidation.SchemaValidationType in project cxf by apache.
the class JavaFirstSchemaValidationTest method createNoSchemaValidationFeature.
private static SchemaValidationFeature createNoSchemaValidationFeature() {
Map<String, SchemaValidationType> operationMap = new HashMap<>();
operationMap.put("*", SchemaValidationType.NONE);
DefaultSchemaValidationTypeProvider provider = new DefaultSchemaValidationTypeProvider(operationMap);
return new SchemaValidationFeature(provider);
}
use of org.apache.cxf.annotations.SchemaValidation.SchemaValidationType in project cxf by apache.
the class JavaFirstSchemaValidationTest method createSchemaValidationFeature.
private static SchemaValidationFeature createSchemaValidationFeature() {
Map<String, SchemaValidationType> operationMap = new HashMap<>();
operationMap.put("saveInheritEndpoint", SchemaValidationType.BOTH);
operationMap.put("saveNoValidation", SchemaValidationType.NONE);
operationMap.put("saveValidateIn", SchemaValidationType.IN);
operationMap.put("saveValidateOut", SchemaValidationType.OUT);
DefaultSchemaValidationTypeProvider provider = new DefaultSchemaValidationTypeProvider(operationMap);
return new SchemaValidationFeature(provider);
}
Aggregations