@Test void testCorrectionWithNoNamespaces() { ServiceNameValidator serviceNameValidator = new ServiceNameValidator(null, false); String result = (String) serviceNameValidator.attemptToCorrect(SERVICE_NAME, CONTEXT_DO_NOT_APPLY_NAMESPACE); assertEquals(SERVICE_NAME, result); }
@Override public Object attemptToCorrect(Object serviceName, final Map<String, Object> relatedParameters) { if (!(serviceName instanceof String)) { throw new ContentException(Messages.COULD_NOT_CREATE_VALID_SERVICE_NAME_FROM_0, serviceName); } boolean applyNamespaceLocal = MapUtil.parseBooleanFlag(relatedParameters, SupportedParameters.APPLY_NAMESPACE, true); boolean applyNamespace = applyNamespaceGlobal && applyNamespaceLocal; return NameUtil.computeValidServiceName((String) serviceName, namespace, applyNamespace); }
ServiceNameValidator implements ParameterValidator { @Override public Object attemptToCorrect(Object serviceName, final Map<String, Object> relatedParameters) { if (!(serviceName instanceof String)) { throw new ContentException(Messages.COULD_NOT_CREATE_VALID_SERVICE_NAME_FROM_0, serviceName); } boolean applyNamespaceLocal = MapUtil.parseBooleanFlag(relatedParameters, SupportedParameters.APPLY_NAMESPACE, true); boolean applyNamespace = applyNamespaceGlobal && applyNamespaceLocal; return NameUtil.computeValidServiceName((String) serviceName, namespace, applyNamespace); } }
ServiceNameValidator implements ParameterValidator { @Override public Object attemptToCorrect(Object serviceName, final Map<String, Object> relatedParameters) { if (!(serviceName instanceof String)) { throw new ContentException(Messages.COULD_NOT_CREATE_VALID_SERVICE_NAME_FROM_0, serviceName); } boolean applyNamespaceLocal = MapUtil.parseBooleanFlag(relatedParameters, SupportedParameters.APPLY_NAMESPACE, true); boolean applyNamespace = applyNamespaceGlobal && applyNamespaceLocal; return NameUtil.computeValidServiceName((String) serviceName, namespace, applyNamespace); } ServiceNameValidator(String namespace, boolean applyNamespace); }
ServiceNameValidator implements ParameterValidator { @Override public Object attemptToCorrect(Object serviceName, final Map<String, Object> relatedParameters) { if (!(serviceName instanceof String)) { throw new ContentException(Messages.COULD_NOT_CREATE_VALID_SERVICE_NAME_FROM_0, serviceName); } boolean applyNamespaceLocal = MapUtil.parseBooleanFlag(relatedParameters, SupportedParameters.APPLY_NAMESPACE, true); boolean applyNamespace = applyNamespaceGlobal && applyNamespaceLocal; return NameUtil.computeValidServiceName((String) serviceName, namespace, applyNamespace); } ServiceNameValidator(String namespace, boolean applyNamespace); @Override Class<?> getContainerType(); @Override String getParameterName(); @Override boolean isValid(Object serviceName, final Map<String, Object> context); @Override boolean canCorrect(); @Override Object attemptToCorrect(Object serviceName, final Map<String, Object> relatedParameters); @Override Set<String> getRelatedParameterNames(); }
ServiceNameValidator implements ParameterValidator { @Override public Object attemptToCorrect(Object serviceName, final Map<String, Object> relatedParameters) { if (!(serviceName instanceof String)) { throw new ContentException(Messages.COULD_NOT_CREATE_VALID_SERVICE_NAME_FROM_0, serviceName); } boolean applyNamespaceLocal = MapUtil.parseBooleanFlag(relatedParameters, SupportedParameters.APPLY_NAMESPACE, true); boolean applyNamespace = applyNamespaceGlobal && applyNamespaceLocal; return NameUtil.computeValidServiceName((String) serviceName, namespace, applyNamespace); } ServiceNameValidator(String namespace, boolean applyNamespace); @Override Class<?> getContainerType(); @Override String getParameterName(); @Override boolean isValid(Object serviceName, final Map<String, Object> context); @Override boolean canCorrect(); @Override Object attemptToCorrect(Object serviceName, final Map<String, Object> relatedParameters); @Override Set<String> getRelatedParameterNames();  }