From e2f5a1f1f1b917620ba4ade6c024f5ee3d202036 Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Fri, 12 May 2017 17:17:31 +0200 Subject: [PATCH] config-util: final parameters This automatically-generated patch flags all appropriate parameters as final (including caught exceptions). Change-Id: Ic60c96d83aa19cd7e5adeaf9a7422d26713b326f Signed-off-by: Stephen Kitt --- .../config/util/AttributeEntry.java | 4 +- .../controller/config/util/CloseableUtil.java | 4 +- .../config/util/ConfigRegistryJMXClient.java | 52 +++++++------- .../util/ConfigTransactionJMXClient.java | 72 +++++++++---------- .../config/util/xml/DocumentedException.java | 28 ++++---- .../config/util/xml/XmlElement.java | 66 ++++++++--------- .../controller/config/util/xml/XmlUtil.java | 10 +-- .../util/ConfigTransactionClientsTest.java | 20 +++--- .../controller/config/util/LookupTest.java | 4 +- .../config/util/TestingConfigRegistry.java | 28 ++++---- .../TestingConfigTransactionController.java | 34 ++++----- 11 files changed, 161 insertions(+), 161 deletions(-) diff --git a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/AttributeEntry.java b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/AttributeEntry.java index c3299ac34a..47c41290cc 100644 --- a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/AttributeEntry.java +++ b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/AttributeEntry.java @@ -14,8 +14,8 @@ public class AttributeEntry { private final String type; private final boolean rw; - public AttributeEntry(String key, String description, Object value, - String type, boolean rw) { + public AttributeEntry(final String key, final String description, final Object value, + final String type, final boolean rw) { this.key = key; this.description = description; this.value = value; diff --git a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/CloseableUtil.java b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/CloseableUtil.java index b5f5752dce..5803da0ab2 100644 --- a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/CloseableUtil.java +++ b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/CloseableUtil.java @@ -13,12 +13,12 @@ public class CloseableUtil { private CloseableUtil() { } - public static void closeAll(Iterable autoCloseables) throws Exception { + public static void closeAll(final Iterable autoCloseables) throws Exception { Exception lastException = null; for (AutoCloseable autoCloseable : autoCloseables) { try { autoCloseable.close(); - } catch (Exception e) { + } catch (final Exception e) { if (lastException == null) { lastException = e; } else { diff --git a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/ConfigRegistryJMXClient.java b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/ConfigRegistryJMXClient.java index 71adea8a2f..395e0837c2 100644 --- a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/ConfigRegistryJMXClient.java +++ b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/ConfigRegistryJMXClient.java @@ -33,11 +33,11 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { private final ObjectName configRegistryON; private final MBeanServer configMBeanServer; - public ConfigRegistryJMXClient(MBeanServer configMBeanServer) { + public ConfigRegistryJMXClient(final MBeanServer configMBeanServer) { this(configMBeanServer, OBJECT_NAME); } - private ConfigRegistryJMXClient(MBeanServer configMBeanServer, ObjectName configRegistryON) { + private ConfigRegistryJMXClient(final MBeanServer configMBeanServer, final ObjectName configRegistryON) { this.configMBeanServer = configMBeanServer; this.configRegistryON = configRegistryON; Set searchResult = configMBeanServer.queryMBeans(configRegistryON, null); @@ -48,7 +48,7 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { false); } - public static ConfigRegistryJMXClient createWithoutNotifications(MBeanServer configMBeanServer) { + public static ConfigRegistryJMXClient createWithoutNotifications(final MBeanServer configMBeanServer) { return new ConfigRegistryJMXClient(configMBeanServer, ConfigRegistryConstants.OBJECT_NAME_NO_NOTIFICATIONS); } @@ -60,7 +60,7 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { @Override public ConfigTransactionJMXClient getConfigTransactionClient( - String transactionName) { + final String transactionName) { ObjectName objectName = ObjectNameUtil .createTransactionControllerON(transactionName); return getConfigTransactionClient(objectName); @@ -68,7 +68,7 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { @Override public ConfigTransactionJMXClient getConfigTransactionClient( - ObjectName objectName) { + final ObjectName objectName) { return new ConfigTransactionJMXClient(configRegistryMXBeanProxy, objectName, configMBeanServer); } @@ -80,12 +80,12 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { * This method will be removed soon. */ @Deprecated - public T newMBeanProxy(ObjectName on, Class clazz) { + public T newMBeanProxy(final ObjectName on, final Class clazz) { ObjectName onObj = translateServiceRefIfPossible(on, clazz, configMBeanServer); return JMX.newMBeanProxy(configMBeanServer, onObj, clazz); } - static ObjectName translateServiceRefIfPossible(ObjectName on, Class clazz, MBeanServer configMBeanServer) { + static ObjectName translateServiceRefIfPossible(final ObjectName on, final Class clazz, final MBeanServer configMBeanServer) { ObjectName onObj = on; if (ObjectNameUtil.isServiceReference(onObj) && !clazz.equals(ServiceReferenceMXBean.class)) { ServiceReferenceMXBean proxy = JMX.newMXBeanProxy(configMBeanServer, onObj, ServiceReferenceMXBean.class); @@ -95,7 +95,7 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { } - public T newMXBeanProxy(ObjectName on, Class clazz) { + public T newMXBeanProxy(final ObjectName on, final Class clazz) { return JMX.newMXBeanProxy(configMBeanServer, on, clazz); } @@ -105,7 +105,7 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { } @Override - public CommitStatus commitConfig(ObjectName transactionControllerON) + public CommitStatus commitConfig(final ObjectName transactionControllerON) throws ConflictingVersionException, ValidationException { return configRegistryMXBeanProxy.commitConfig(transactionControllerON); } @@ -120,7 +120,7 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { try { return (Long) configMBeanServer.getAttribute(configRegistryON, "Version"); - } catch (JMException e) { + } catch (final JMException e) { throw new RuntimeException(e); } } @@ -141,18 +141,18 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { } @Override - public Set lookupConfigBeans(String moduleName) { + public Set lookupConfigBeans(final String moduleName) { return configRegistryMXBeanProxy.lookupConfigBeans(moduleName); } @Override - public Set lookupConfigBeans(String moduleName, - String instanceName) { + public Set lookupConfigBeans(final String moduleName, + final String instanceName) { return configRegistryMXBeanProxy.lookupConfigBeans(moduleName, instanceName); } @Override - public ObjectName lookupConfigBean(String moduleName, String instanceName) + public ObjectName lookupConfigBean(final String moduleName, final String instanceName) throws InstanceNotFoundException { return configRegistryMXBeanProxy.lookupConfigBean(moduleName, instanceName); } @@ -163,18 +163,18 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { } @Override - public Set lookupRuntimeBeans(String ifcName, - String instanceName) { + public Set lookupRuntimeBeans(final String ifcName, + final String instanceName) { return configRegistryMXBeanProxy.lookupRuntimeBeans(ifcName, instanceName); } @Override - public void checkConfigBeanExists(ObjectName objectName) throws InstanceNotFoundException { + public void checkConfigBeanExists(final ObjectName objectName) throws InstanceNotFoundException { configRegistryMXBeanProxy.checkConfigBeanExists(objectName); } @Override - public ObjectName lookupConfigBeanByServiceInterfaceName(String serviceInterfaceQName, String refName) { + public ObjectName lookupConfigBeanByServiceInterfaceName(final String serviceInterfaceQName, final String refName) { return configRegistryMXBeanProxy.lookupConfigBeanByServiceInterfaceName(serviceInterfaceQName, refName); } @@ -184,23 +184,23 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { } @Override - public Map lookupServiceReferencesByServiceInterfaceName(String serviceInterfaceQName) { + public Map lookupServiceReferencesByServiceInterfaceName(final String serviceInterfaceQName) { return configRegistryMXBeanProxy.lookupServiceReferencesByServiceInterfaceName(serviceInterfaceQName); } @Override - public Set lookupServiceInterfaceNames(ObjectName objectName) throws InstanceNotFoundException { + public Set lookupServiceInterfaceNames(final ObjectName objectName) throws InstanceNotFoundException { return configRegistryMXBeanProxy.lookupServiceInterfaceNames(objectName); } @Override - public String getServiceInterfaceName(String namespace, String localName) { + public String getServiceInterfaceName(final String namespace, final String localName) { return configRegistryMXBeanProxy.getServiceInterfaceName(namespace, localName); } @Override - public Object invokeMethod(ObjectName on, String name, Object[] params, - String[] signature) { + public Object invokeMethod(final ObjectName on, final String name, final Object[] params, + final String[] signature) { try { return configMBeanServer.invoke(on, name, params, signature); } catch (InstanceNotFoundException | ReflectionException @@ -213,7 +213,7 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { } @Override - public Object getAttributeCurrentValue(ObjectName on, String attributeName) { + public Object getAttributeCurrentValue(final ObjectName on, final String attributeName) { try { return configMBeanServer.getAttribute(on, attributeName); } catch (AttributeNotFoundException | InstanceNotFoundException @@ -229,12 +229,12 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { } @Override - public ObjectName getServiceReference(String serviceInterfaceQName, String refName) throws InstanceNotFoundException { + public ObjectName getServiceReference(final String serviceInterfaceQName, final String refName) throws InstanceNotFoundException { return configRegistryMXBeanProxy.getServiceReference(serviceInterfaceQName, refName); } @Override - public void checkServiceReferenceExists(ObjectName objectName) throws InstanceNotFoundException { + public void checkServiceReferenceExists(final ObjectName objectName) throws InstanceNotFoundException { configRegistryMXBeanProxy.checkServiceReferenceExists(objectName); } } diff --git a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/ConfigTransactionJMXClient.java b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/ConfigTransactionJMXClient.java index d49c37ddd8..f135923646 100644 --- a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/ConfigTransactionJMXClient.java +++ b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/ConfigTransactionJMXClient.java @@ -31,9 +31,9 @@ public class ConfigTransactionJMXClient implements ConfigTransactionClient { private final MBeanServer configMBeanServer; public ConfigTransactionJMXClient( - ConfigRegistryMXBean configRegistryMXBeanProxy, - ObjectName configTransactionControllerON, - MBeanServer configMBeanServer) { + final ConfigRegistryMXBean configRegistryMXBeanProxy, + final ObjectName configTransactionControllerON, + final MBeanServer configMBeanServer) { this.configMBeanServer = configMBeanServer; this.configRegistryMXBeanProxy = configRegistryMXBeanProxy; this.configTransactionControllerON = configTransactionControllerON; @@ -42,7 +42,7 @@ public class ConfigTransactionJMXClient implements ConfigTransactionClient { ConfigTransactionControllerMXBean.class); } - public T newMXBeanProxy(ObjectName on, Class clazz) { + public T newMXBeanProxy(final ObjectName on, final Class clazz) { ObjectName onName = on; // if on is without transaction, add it. Reason is that when using getters on MXBeans the transaction name is stripped onName = ObjectNameUtil.withTransactionName(onName, getTransactionName()); @@ -59,7 +59,7 @@ public class ConfigTransactionJMXClient implements ConfigTransactionClient { * This method will be removed soon. */ @Deprecated - public T newMBeanProxy(ObjectName on, Class clazz) { + public T newMBeanProxy(final ObjectName on, final Class clazz) { return JMX.newMBeanProxy(configMBeanServer, on, clazz); } @@ -71,8 +71,8 @@ public class ConfigTransactionJMXClient implements ConfigTransactionClient { } @Override - public void assertVersion(int expectedParentVersion, - int expectedCurrentVersion) { + public void assertVersion(final int expectedParentVersion, + final int expectedCurrentVersion) { if (expectedParentVersion != getParentVersion()) { throw new IllegalStateException(); } @@ -83,18 +83,18 @@ public class ConfigTransactionJMXClient implements ConfigTransactionClient { // proxy around ConfigManagerMXBean @Override - public ObjectName createModule(String moduleName, String instanceName) + public ObjectName createModule(final String moduleName, final String instanceName) throws InstanceAlreadyExistsException { return configTransactionControllerMXBeanProxy.createModule(moduleName, instanceName); } @Override - public void reCreateModule(ObjectName objectName) throws InstanceNotFoundException { + public void reCreateModule(final ObjectName objectName) throws InstanceNotFoundException { configTransactionControllerMXBeanProxy.reCreateModule(objectName); } @Override - public void destroyModule(ObjectName objectName) + public void destroyModule(final ObjectName objectName) throws InstanceNotFoundException { configTransactionControllerMXBeanProxy.destroyModule(objectName); } @@ -104,14 +104,14 @@ public class ConfigTransactionJMXClient implements ConfigTransactionClient { /** * {@inheritDoc} */ - public void destroyConfigBean(String moduleName, String instanceName) + public void destroyConfigBean(final String moduleName, final String instanceName) throws InstanceNotFoundException { destroyModule(ObjectNameUtil.createTransactionModuleON( getTransactionName(), moduleName, instanceName)); } @Override - public void destroyModule(String moduleName, String instanceName) + public void destroyModule(final String moduleName, final String instanceName) throws InstanceNotFoundException { destroyModule(ObjectNameUtil.createTransactionModuleON( getTransactionName(), moduleName, instanceName)); @@ -132,7 +132,7 @@ public class ConfigTransactionJMXClient implements ConfigTransactionClient { try { return (Long) configMBeanServer.getAttribute( configTransactionControllerON, "ParentVersion"); - } catch (JMException e) { + } catch (final JMException e) { throw new RuntimeException(e); } } @@ -142,7 +142,7 @@ public class ConfigTransactionJMXClient implements ConfigTransactionClient { try { return (Long) configMBeanServer.getAttribute( configTransactionControllerON, "Version"); - } catch (JMException e) { + } catch (final JMException e) { throw new RuntimeException(e); } } @@ -168,35 +168,35 @@ public class ConfigTransactionJMXClient implements ConfigTransactionClient { } @Override - public Set lookupConfigBeans(String moduleName) { + public Set lookupConfigBeans(final String moduleName) { return configTransactionControllerMXBeanProxy.lookupConfigBeans(moduleName); } @Override - public ObjectName lookupConfigBean(String moduleName, String instanceName) + public ObjectName lookupConfigBean(final String moduleName, final String instanceName) throws InstanceNotFoundException { return configTransactionControllerMXBeanProxy.lookupConfigBean(moduleName, instanceName); } @Override - public Set lookupConfigBeans(String moduleName, - String instanceName) { + public Set lookupConfigBeans(final String moduleName, + final String instanceName) { return configTransactionControllerMXBeanProxy .lookupConfigBeans(moduleName, instanceName); } @Override - public void checkConfigBeanExists(ObjectName objectName) throws InstanceNotFoundException { + public void checkConfigBeanExists(final ObjectName objectName) throws InstanceNotFoundException { configTransactionControllerMXBeanProxy.checkConfigBeanExists(objectName); } @Override - public ObjectName saveServiceReference(String serviceInterfaceName, String refName, ObjectName moduleON) throws InstanceNotFoundException { + public ObjectName saveServiceReference(final String serviceInterfaceName, final String refName, final ObjectName moduleON) throws InstanceNotFoundException { return configTransactionControllerMXBeanProxy.saveServiceReference(serviceInterfaceName,refName, moduleON); } @Override - public void removeServiceReference(String serviceInterfaceName, String refName) throws InstanceNotFoundException{ + public void removeServiceReference(final String serviceInterfaceName, final String refName) throws InstanceNotFoundException{ configTransactionControllerMXBeanProxy.removeServiceReference(serviceInterfaceName, refName); } @@ -206,7 +206,7 @@ public class ConfigTransactionJMXClient implements ConfigTransactionClient { } @Override - public ObjectName lookupConfigBeanByServiceInterfaceName(String serviceInterfaceQName, String refName) { + public ObjectName lookupConfigBeanByServiceInterfaceName(final String serviceInterfaceQName, final String refName) { return configTransactionControllerMXBeanProxy.lookupConfigBeanByServiceInterfaceName(serviceInterfaceQName, refName); } @@ -216,37 +216,37 @@ public class ConfigTransactionJMXClient implements ConfigTransactionClient { } @Override - public Map lookupServiceReferencesByServiceInterfaceName(String serviceInterfaceQName) { + public Map lookupServiceReferencesByServiceInterfaceName(final String serviceInterfaceQName) { return configTransactionControllerMXBeanProxy.lookupServiceReferencesByServiceInterfaceName(serviceInterfaceQName); } @Override - public Set lookupServiceInterfaceNames(ObjectName objectName) throws InstanceNotFoundException { + public Set lookupServiceInterfaceNames(final ObjectName objectName) throws InstanceNotFoundException { return configTransactionControllerMXBeanProxy.lookupServiceInterfaceNames(objectName); } @Override - public String getServiceInterfaceName(String namespace, String localName) { + public String getServiceInterfaceName(final String namespace, final String localName) { return configTransactionControllerMXBeanProxy.getServiceInterfaceName(namespace, localName); } @Override - public boolean removeServiceReferences(ObjectName objectName) throws InstanceNotFoundException { + public boolean removeServiceReferences(final ObjectName objectName) throws InstanceNotFoundException { return configTransactionControllerMXBeanProxy.removeServiceReferences(objectName); } @Override - public ObjectName getServiceReference(String serviceInterfaceQName, String refName) throws InstanceNotFoundException { + public ObjectName getServiceReference(final String serviceInterfaceQName, final String refName) throws InstanceNotFoundException { return configTransactionControllerMXBeanProxy.getServiceReference(serviceInterfaceQName, refName); } @Override - public void checkServiceReferenceExists(ObjectName objectName) throws InstanceNotFoundException { + public void checkServiceReferenceExists(final ObjectName objectName) throws InstanceNotFoundException { configTransactionControllerMXBeanProxy.checkServiceReferenceExists(objectName); } @Override - public Attribute getAttribute(ObjectName on, String attrName) { + public Attribute getAttribute(final ObjectName on, final String attrName) { if (ObjectNameUtil.getTransactionName(on) == null) { throw new IllegalArgumentException("Not in transaction instance " + on + ", no transaction name present"); @@ -254,36 +254,36 @@ public class ConfigTransactionJMXClient implements ConfigTransactionClient { try { return new Attribute(attrName, configMBeanServer.getAttribute(on,attrName)); - } catch (JMException e) { + } catch (final JMException e) { throw new IllegalStateException("Unable to get attribute " + attrName + " for " + on, e); } } @Override - public Object getAttributeCurrentValue(ObjectName on, String attrName) { + public Object getAttributeCurrentValue(final ObjectName on, final String attrName) { return getAttribute(on, attrName).getValue(); } @Override - public void validateBean(ObjectName configBeanON) + public void validateBean(final ObjectName configBeanON) throws ValidationException { try { configMBeanServer.invoke(configBeanON, "validate", null, null); - } catch (MBeanException e) { + } catch (final MBeanException e) { Exception targetException = e.getTargetException(); if (targetException instanceof ValidationException){ throw (ValidationException) targetException; } else { throw new RuntimeException(e); } - } catch (JMException e) { + } catch (final JMException e) { throw new RuntimeException(e); } } @Override - public void setAttribute(ObjectName on, String attrName, Attribute attribute) { + public void setAttribute(final ObjectName on, final String attrName, final Attribute attribute) { if (ObjectNameUtil.getTransactionName(on) == null) { throw new IllegalArgumentException("Not in transaction instance " + on + ", no transaction name present"); @@ -291,7 +291,7 @@ public class ConfigTransactionJMXClient implements ConfigTransactionClient { try { configMBeanServer.setAttribute(on, attribute); - } catch (JMException e) { + } catch (final JMException e) { throw new IllegalStateException("Unable to set attribute " + attrName + " for " + on, e); } diff --git a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/xml/DocumentedException.java b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/xml/DocumentedException.java index 2f18bf0d01..cf96e2630d 100644 --- a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/xml/DocumentedException.java +++ b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/xml/DocumentedException.java @@ -55,7 +55,7 @@ public class DocumentedException extends Exception { BUILDER_FACTORY.setFeature("http://xml.org/sax/features/external-parameter-entities", false); BUILDER_FACTORY.setXIncludeAware(false); BUILDER_FACTORY.setExpandEntityReferences(false); - } catch (ParserConfigurationException e) { + } catch (final ParserConfigurationException e) { throw new ExceptionInInitializerError(e); } BUILDER_FACTORY.setNamespaceAware(true); @@ -72,7 +72,7 @@ public class DocumentedException extends Exception { private final String typeValue; - ErrorType(String typeValue) { + ErrorType(final String typeValue) { this.typeValue = Preconditions.checkNotNull(typeValue); } @@ -88,7 +88,7 @@ public class DocumentedException extends Exception { return this.typeValue; } - public static ErrorType from(String text) { + public static ErrorType from(final String text) { for (ErrorType e : values()) { if (e.getTypeValue().equalsIgnoreCase(text)) { return e; @@ -130,7 +130,7 @@ public class DocumentedException extends Exception { return this.tagValue; } - public static ErrorTag from( String text ) { + public static ErrorTag from( final String text ) { for( ErrorTag e: values() ) { if( e.getTagValue().equals( text ) ) { @@ -148,7 +148,7 @@ public class DocumentedException extends Exception { private final String severityValue; - ErrorSeverity(String severityValue) { + ErrorSeverity(final String severityValue) { this.severityValue = Preconditions.checkNotNull(severityValue); } @@ -164,7 +164,7 @@ public class DocumentedException extends Exception { return this.severityValue; } - public static ErrorSeverity from(String text) { + public static ErrorSeverity from(final String text) { for (ErrorSeverity e : values()) { if (e.getSeverityValue().equalsIgnoreCase(text)) { return e; @@ -180,7 +180,7 @@ public class DocumentedException extends Exception { private final ErrorSeverity errorSeverity; private final Map errorInfo; - public DocumentedException(String message) { + public DocumentedException(final String message) { this(message, DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.INVALID_VALUE, @@ -216,27 +216,27 @@ public class DocumentedException extends Exception { this.errorInfo = errorInfo; } - public static DocumentedException wrap(E exception) throws DocumentedException { + public static DocumentedException wrap(final E exception) throws DocumentedException { final Map errorInfo = new HashMap<>(); errorInfo.put(ErrorTag.OPERATION_FAILED.name(), "Exception thrown"); throw new DocumentedException(exception.getMessage(), exception, ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED, ErrorSeverity.ERROR, errorInfo); } - public static DocumentedException wrap(ValidationException e) throws DocumentedException { + public static DocumentedException wrap(final ValidationException e) throws DocumentedException { final Map errorInfo = new HashMap<>(); errorInfo.put(ErrorTag.OPERATION_FAILED.name(), "Validation failed"); throw new DocumentedException(e.getMessage(), e, ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED, ErrorSeverity.ERROR, errorInfo); } - public static DocumentedException wrap(ConflictingVersionException e) throws DocumentedException { + public static DocumentedException wrap(final ConflictingVersionException e) throws DocumentedException { final Map errorInfo = new HashMap<>(); errorInfo.put(ErrorTag.OPERATION_FAILED.name(), "Optimistic lock failed"); throw new DocumentedException(e.getMessage(), e, ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED, ErrorSeverity.ERROR, errorInfo); } - public static DocumentedException fromXMLDocument( Document fromDoc ) { + public static DocumentedException fromXMLDocument( final Document fromDoc ) { ErrorType errorType = ErrorType.APPLICATION; ErrorTag errorTag = ErrorTag.OPERATION_FAILED; @@ -281,7 +281,7 @@ public class DocumentedException extends Exception { return new DocumentedException( errorMessage, errorType, errorTag, errorSeverity, errorInfo ); } - private static Map parseErrorInfo( Node node ) { + private static Map parseErrorInfo( final Node node ) { Map infoMap = new HashMap<>(); NodeList children = node.getChildNodes(); for( int i = 0; i < children.getLength(); i++ ) { @@ -344,7 +344,7 @@ public class DocumentedException extends Exception { } } } - catch( ParserConfigurationException e ) { + catch( final ParserConfigurationException e ) { // this shouldn't happen LOG.error("Error outputting to XML document", e); } @@ -352,7 +352,7 @@ public class DocumentedException extends Exception { return doc; } - private Node createTextNode( Document doc, String tag, String textContent ) { + private Node createTextNode( final Document doc, final String tag, final String textContent ) { Node node = doc.createElementNS( URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0, tag ); node.setTextContent( textContent ); return node; diff --git a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/xml/XmlElement.java b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/xml/XmlElement.java index d58acf128e..1ebb0047eb 100644 --- a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/xml/XmlElement.java +++ b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/xml/XmlElement.java @@ -38,19 +38,19 @@ public final class XmlElement { private final Element element; private static final Logger LOG = LoggerFactory.getLogger(XmlElement.class); - private XmlElement(Element element) { + private XmlElement(final Element element) { this.element = element; } - public static XmlElement fromDomElement(Element e) { + public static XmlElement fromDomElement(final Element e) { return new XmlElement(e); } - public static XmlElement fromDomDocument(Document xml) { + public static XmlElement fromDomDocument(final Document xml) { return new XmlElement(xml.getDocumentElement()); } - public static XmlElement fromString(String s) throws DocumentedException { + public static XmlElement fromString(final String s) throws DocumentedException { try { return new XmlElement(XmlUtil.readXmlToElement(s)); } catch (IOException | SAXException e) { @@ -58,13 +58,13 @@ public final class XmlElement { } } - public static XmlElement fromDomElementWithExpected(Element element, String expectedName) throws DocumentedException { + public static XmlElement fromDomElementWithExpected(final Element element, final String expectedName) throws DocumentedException { XmlElement xmlElement = XmlElement.fromDomElement(element); xmlElement.checkName(expectedName); return xmlElement; } - public static XmlElement fromDomElementWithExpected(Element element, String expectedName, String expectedNamespace) throws DocumentedException { + public static XmlElement fromDomElementWithExpected(final Element element, final String expectedName, final String expectedNamespace) throws DocumentedException { XmlElement xmlElement = XmlElement.fromDomElementWithExpected(element, expectedName); xmlElement.checkNamespace(expectedNamespace); return xmlElement; @@ -104,7 +104,7 @@ public final class XmlElement { return namespaces; } - public void checkName(String expectedName) throws UnexpectedElementException { + public void checkName(final String expectedName) throws UnexpectedElementException { if (!getName().equals(expectedName)){ throw new UnexpectedElementException(String.format("Expected %s xml element but was %s", expectedName, getName()), @@ -114,7 +114,7 @@ public final class XmlElement { } } - public void checkNamespaceAttribute(String expectedNamespace) throws UnexpectedNamespaceException, MissingNameSpaceException { + public void checkNamespaceAttribute(final String expectedNamespace) throws UnexpectedNamespaceException, MissingNameSpaceException { if (!getNamespaceAttribute().equals(expectedNamespace)) { throw new UnexpectedNamespaceException(String.format("Unexpected namespace %s should be %s", @@ -126,7 +126,7 @@ public final class XmlElement { } } - public void checkNamespace(String expectedNamespace) throws UnexpectedNamespaceException, MissingNameSpaceException { + public void checkNamespace(final String expectedNamespace) throws UnexpectedNamespaceException, MissingNameSpaceException { if (!getNamespace().equals(expectedNamespace)) { throw new UnexpectedNamespaceException(String.format("Unexpected namespace %s should be %s", @@ -146,19 +146,19 @@ public final class XmlElement { return element.getTagName(); } - public String getAttribute(String attributeName) { + public String getAttribute(final String attributeName) { return element.getAttribute(attributeName); } - public String getAttribute(String attributeName, String namespace) { + public String getAttribute(final String attributeName, final String namespace) { return element.getAttributeNS(namespace, attributeName); } - public NodeList getElementsByTagName(String name) { + public NodeList getElementsByTagName(final String name) { return element.getElementsByTagName(name); } - public void appendChild(Element element) { + public void appendChild(final Element element) { this.element.appendChild(element); } @@ -182,7 +182,7 @@ public final class XmlElement { /** * Non recursive */ - private List getChildElementsInternal(ElementFilteringStrategy strat) { + private List getChildElementsInternal(final ElementFilteringStrategy strat) { NodeList childNodes = element.getChildNodes(); final List result = new ArrayList<>(); for (int i = 0; i < childNodes.getLength(); i++) { @@ -201,17 +201,17 @@ public final class XmlElement { public List getChildElements() { return getChildElementsInternal(new ElementFilteringStrategy() { @Override - public boolean accept(Element e) { + public boolean accept(final Element e) { return true; } }); } - public List getChildElementsWithinNamespace(final String childName, String namespace) { + public List getChildElementsWithinNamespace(final String childName, final String namespace) { return Lists.newArrayList(Collections2.filter(getChildElementsWithinNamespace(namespace), new Predicate() { @Override - public boolean apply(XmlElement xmlElement) { + public boolean apply(final XmlElement xmlElement) { return xmlElement.getName().equals(childName); } })); @@ -220,10 +220,10 @@ public final class XmlElement { public List getChildElementsWithinNamespace(final String namespace) { return getChildElementsInternal(new ElementFilteringStrategy() { @Override - public boolean accept(Element e) { + public boolean accept(final Element e) { try { return XmlElement.fromDomElement(e).getNamespace().equals(namespace); - } catch (MissingNameSpaceException e1) { + } catch (final MissingNameSpaceException e1) { return false; } } @@ -239,14 +239,14 @@ public final class XmlElement { public List getChildElements(final String tagName) { return getChildElementsInternal(new ElementFilteringStrategy() { @Override - public boolean accept(Element e) { + public boolean accept(final Element e) { // localName returns pure localName without prefix return e.getLocalName().equals(tagName); } }); } - public XmlElement getOnlyChildElement(String childName) throws DocumentedException { + public XmlElement getOnlyChildElement(final String childName) throws DocumentedException { List nameElements = getChildElements(childName); if (nameElements.size() != 1){ throw new DocumentedException("One element " + childName + " expected in " + toString(), @@ -257,7 +257,7 @@ public final class XmlElement { return nameElements.get(0); } - public Optional getOnlyChildElementOptionally(String childName) { + public Optional getOnlyChildElementOptionally(final String childName) { List nameElements = getChildElements(childName); if (nameElements.size() != 1) { return Optional.absent(); @@ -269,7 +269,7 @@ public final class XmlElement { List children = getChildElementsWithinNamespace(namespace); children = Lists.newArrayList(Collections2.filter(children, new Predicate() { @Override - public boolean apply(XmlElement xmlElement) { + public boolean apply(final XmlElement xmlElement) { return xmlElement.getName().equals(childName); } })); @@ -279,7 +279,7 @@ public final class XmlElement { return Optional.of(children.get(0)); } - public XmlElement getOnlyChildElementWithSameNamespace(String childName) throws DocumentedException { + public XmlElement getOnlyChildElementWithSameNamespace(final String childName) throws DocumentedException { return getOnlyChildElement(childName, getNamespace()); } @@ -289,7 +289,7 @@ public final class XmlElement { List children = getChildElementsWithinNamespace(namespace.get()); children = Lists.newArrayList(Collections2.filter(children, new Predicate() { @Override - public boolean apply(XmlElement xmlElement) { + public boolean apply(final XmlElement xmlElement) { return xmlElement.getName().equals(childName); } })); @@ -318,11 +318,11 @@ public final class XmlElement { return Optional.absent(); } - public XmlElement getOnlyChildElement(final String childName, String namespace) throws DocumentedException { + public XmlElement getOnlyChildElement(final String childName, final String namespace) throws DocumentedException { List children = getChildElementsWithinNamespace(namespace); children = Lists.newArrayList(Collections2.filter(children, new Predicate() { @Override - public boolean apply(XmlElement xmlElement) { + public boolean apply(final XmlElement xmlElement) { return xmlElement.getName().equals(childName); } })); @@ -434,7 +434,7 @@ public final class XmlElement { if (element.getNamespaceURI() != null) { try { sb.append(", namespace='").append(getNamespace()).append('\''); - } catch (MissingNameSpaceException e) { + } catch (final MissingNameSpaceException e) { LOG.trace("Missing namespace for element."); } } @@ -476,14 +476,14 @@ public final class XmlElement { List children = getChildElementsWithinNamespace(getNamespace()); return Lists.newArrayList(Collections2.filter(children, new Predicate() { @Override - public boolean apply(XmlElement xmlElement) { + public boolean apply(final XmlElement xmlElement) { return xmlElement.getName().equals(childName); } })); } - public void checkUnrecognisedElements(List recognisedElements, - XmlElement... additionalRecognisedElements) throws DocumentedException { + public void checkUnrecognisedElements(final List recognisedElements, + final XmlElement... additionalRecognisedElements) throws DocumentedException { List childElements = getChildElements(); childElements.removeAll(recognisedElements); for (XmlElement additionalRecognisedElement : additionalRecognisedElements) { @@ -497,12 +497,12 @@ public final class XmlElement { } } - public void checkUnrecognisedElements(XmlElement... additionalRecognisedElements) throws DocumentedException { + public void checkUnrecognisedElements(final XmlElement... additionalRecognisedElements) throws DocumentedException { checkUnrecognisedElements(Collections.emptyList(), additionalRecognisedElements); } @Override - public boolean equals(Object o) { + public boolean equals(final Object o) { if (this == o) { return true; } diff --git a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/xml/XmlUtil.java b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/xml/XmlUtil.java index a69bab5cb1..fb27d6eae2 100644 --- a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/xml/XmlUtil.java +++ b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/xml/XmlUtil.java @@ -57,7 +57,7 @@ public final class XmlUtil { // Performance improvement for messages with size <10k according to // https://xerces.apache.org/xerces2-j/faq-performance.html factory.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false); - } catch (ParserConfigurationException e) { + } catch (final ParserConfigurationException e) { throw new ExceptionInInitializerError(e); } factory.setNamespaceAware(true); @@ -72,13 +72,13 @@ public final class XmlUtil { protected DocumentBuilder initialValue() { try { return BUILDER_FACTORY.newDocumentBuilder(); - } catch (ParserConfigurationException e) { + } catch (final ParserConfigurationException e) { throw new IllegalStateException("Failed to create threadLocal dom builder", e); } } @Override - public void set(DocumentBuilder value) { + public void set(final DocumentBuilder value) { throw new UnsupportedOperationException(); } }; @@ -199,7 +199,7 @@ public final class XmlUtil { try { return SCHEMA_FACTORY.newSchema(sources); - } catch (SAXException e) { + } catch (final SAXException e) { throw new IllegalStateException("Failed to instantiate XML schema", e); } } @@ -207,7 +207,7 @@ public final class XmlUtil { public static Object evaluateXPath(final XPathExpression expr, final Object rootNode, final QName returnType) { try { return expr.evaluate(rootNode, returnType); - } catch (XPathExpressionException e) { + } catch (final XPathExpressionException e) { throw new IllegalStateException("Error while evaluating xpath expression " + expr, e); } } diff --git a/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/ConfigTransactionClientsTest.java b/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/ConfigTransactionClientsTest.java index 37b08e4671..29cddab15b 100644 --- a/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/ConfigTransactionClientsTest.java +++ b/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/ConfigTransactionClientsTest.java @@ -65,7 +65,7 @@ public class ConfigTransactionClientsTest { } private Set testClientLookupConfigBeans( - ConfigTransactionClient client) { + final ConfigTransactionClient client) { Set beans = client.lookupConfigBeans(); for (ObjectName on : beans) { assertEquals("Module", on.getKeyProperty("type")); @@ -80,7 +80,7 @@ public class ConfigTransactionClientsTest { assertEquals(testClientGetObjectName(jmxTransactionClient), true); } - private boolean testClientGetObjectName(ConfigTransactionClient client) { + private boolean testClientGetObjectName(final ConfigTransactionClient client) { return transactionControllerON.equals(client.getObjectName()); } @@ -91,7 +91,7 @@ public class ConfigTransactionClientsTest { } private Set testClientGetAvailableModuleNames( - ConfigTransactionClient client) { + final ConfigTransactionClient client) { return client.getAvailableModuleNames(); } @@ -101,7 +101,7 @@ public class ConfigTransactionClientsTest { assertEquals("transactionName", jmxTN); } - private String testClientGetTransactionName(ConfigTransactionClient client) { + private String testClientGetTransactionName(final ConfigTransactionClient client) { return client.getTransactionName(); } @@ -145,7 +145,7 @@ public class ConfigTransactionClientsTest { Assert.assertNotNull(on); } - private ObjectName testClientCreateModule(ConfigTransactionClient client) + private ObjectName testClientCreateModule(final ConfigTransactionClient client) throws Exception { return client.createModule("testModuleName", "testInstanceName"); } @@ -169,7 +169,7 @@ public class ConfigTransactionClientsTest { } private Set testClientLookupConfigBeans2( - ConfigTransactionClient client, String moduleName) { + final ConfigTransactionClient client, final String moduleName) { Set beans = client.lookupConfigBeans(moduleName); assertEquals(1, beans.size()); return beans; @@ -183,8 +183,8 @@ public class ConfigTransactionClientsTest { } private Set testClientLookupConfigBean( - ConfigTransactionClient client, String moduleName, - String instanceName) { + final ConfigTransactionClient client, final String moduleName, + final String instanceName) { Set beans = client.lookupConfigBeans(moduleName, instanceName); assertEquals(1, beans.size()); @@ -199,8 +199,8 @@ public class ConfigTransactionClientsTest { } private Set testClientLookupConfigBeans3( - ConfigTransactionClient client, String moduleName, - String instanceName) { + final ConfigTransactionClient client, final String moduleName, + final String instanceName) { Set beans = client.lookupConfigBeans(moduleName, instanceName); assertEquals(1, beans.size()); diff --git a/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/LookupTest.java b/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/LookupTest.java index f9d0a5c647..9a6f931afd 100644 --- a/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/LookupTest.java +++ b/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/LookupTest.java @@ -104,7 +104,7 @@ public class LookupTest { test(method, args); } - private void test(Method method, Object[] args) throws Exception { + private void test(final Method method, final Object[] args) throws Exception { for (Entry> entry : lookupProvidersToClients .entrySet()) { Object expected = method.invoke(entry.getKey(), args); @@ -125,7 +125,7 @@ public class LookupTest { client.lookupConfigBean( InstanceNotFoundException.class.getSimpleName(), ""); fail(client.toString()); - } catch (InstanceNotFoundException e) { + } catch (final InstanceNotFoundException e) { } } diff --git a/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigRegistry.java b/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigRegistry.java index 8732aa72d1..cf1fe92638 100644 --- a/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigRegistry.java +++ b/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigRegistry.java @@ -76,7 +76,7 @@ public class TestingConfigRegistry implements ConfigRegistryMXBean { } @Override - public CommitStatus commitConfig(ObjectName transactonControllerON) + public CommitStatus commitConfig(final ObjectName transactonControllerON) throws ConflictingVersionException, ValidationException { if (transactonControllerON == null) { Exception e = new RuntimeException("message"); @@ -107,7 +107,7 @@ public class TestingConfigRegistry implements ConfigRegistryMXBean { } @Override - public Set lookupConfigBeans(String moduleName) { + public Set lookupConfigBeans(final String moduleName) { if (moduleName.equals(moduleName1)) { return Sets.newHashSet(conf1, conf2); } else if (moduleName.equals(moduleName2)) { @@ -118,8 +118,8 @@ public class TestingConfigRegistry implements ConfigRegistryMXBean { } @Override - public Set lookupConfigBeans(String moduleName, - String instanceName) { + public Set lookupConfigBeans(final String moduleName, + final String instanceName) { if (moduleName.equals(moduleName1) && instanceName.equals(instName1)) { return Sets.newHashSet(conf2); } else if (moduleName.equals(moduleName2) @@ -131,7 +131,7 @@ public class TestingConfigRegistry implements ConfigRegistryMXBean { } @Override - public ObjectName lookupConfigBean(String moduleName, String instanceName) + public ObjectName lookupConfigBean(final String moduleName, final String instanceName) throws InstanceNotFoundException { if (moduleName.equals(InstanceNotFoundException.class.getSimpleName())) { throw new InstanceNotFoundException(); @@ -145,8 +145,8 @@ public class TestingConfigRegistry implements ConfigRegistryMXBean { } @Override - public Set lookupRuntimeBeans(String moduleName, - String instanceName) { + public Set lookupRuntimeBeans(final String moduleName, + final String instanceName) { if (moduleName.equals(moduleName1) && instanceName.equals(instName1)) { return Sets. newHashSet(run2); } else if (moduleName.equals(moduleName2) @@ -158,7 +158,7 @@ public class TestingConfigRegistry implements ConfigRegistryMXBean { } @Override - public void checkConfigBeanExists(ObjectName objectName) throws InstanceNotFoundException { + public void checkConfigBeanExists(final ObjectName objectName) throws InstanceNotFoundException { Set configBeans = Sets. newHashSet(run1, run2, run3); if(configBeans.size()>0){ checkBool = true; @@ -166,7 +166,7 @@ public class TestingConfigRegistry implements ConfigRegistryMXBean { } @Override - public ObjectName lookupConfigBeanByServiceInterfaceName(String serviceInterfaceQName, String refName) { + public ObjectName lookupConfigBeanByServiceInterfaceName(final String serviceInterfaceQName, final String refName) { if (serviceInterfaceQName.equals(serviceQName1) && refName.equals(refName1)) { return conf1; } @@ -181,7 +181,7 @@ public class TestingConfigRegistry implements ConfigRegistryMXBean { } @Override - public Map lookupServiceReferencesByServiceInterfaceName(String serviceInterfaceQName) { + public Map lookupServiceReferencesByServiceInterfaceName(final String serviceInterfaceQName) { if(serviceInterfaceQName.equals(serviceQName1)){ map.put("conf1", conf1); @@ -196,12 +196,12 @@ public class TestingConfigRegistry implements ConfigRegistryMXBean { } @Override - public Set lookupServiceInterfaceNames(ObjectName objectName) throws InstanceNotFoundException { + public Set lookupServiceInterfaceNames(final ObjectName objectName) throws InstanceNotFoundException { return Sets. newHashSet(serviceQName1, serviceQName2); } @Override - public String getServiceInterfaceName(String namespace, String localName) { + public String getServiceInterfaceName(final String namespace, final String localName) { return null; } @@ -211,12 +211,12 @@ public class TestingConfigRegistry implements ConfigRegistryMXBean { } @Override - public ObjectName getServiceReference(String serviceInterfaceQName, String refName) throws InstanceNotFoundException { + public ObjectName getServiceReference(final String serviceInterfaceQName, final String refName) throws InstanceNotFoundException { return conf1; } @Override - public void checkServiceReferenceExists(ObjectName objectName) throws InstanceNotFoundException { + public void checkServiceReferenceExists(final ObjectName objectName) throws InstanceNotFoundException { throw new UnsupportedOperationException(); } } diff --git a/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigTransactionController.java b/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigTransactionController.java index d3b8add96d..b1826e028a 100644 --- a/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigTransactionController.java +++ b/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigTransactionController.java @@ -54,7 +54,7 @@ public class TestingConfigTransactionController implements } @Override - public ObjectName createModule(String moduleName, String instanceName) + public ObjectName createModule(final String moduleName, final String instanceName) throws InstanceAlreadyExistsException { //return null; return ObjectNameUtil.createON(ObjectNameUtil.ON_DOMAIN @@ -63,11 +63,11 @@ public class TestingConfigTransactionController implements } @Override - public void reCreateModule(ObjectName objectName) { + public void reCreateModule(final ObjectName objectName) { } @Override - public void destroyModule(ObjectName objectName) + public void destroyModule(final ObjectName objectName) throws InstanceNotFoundException { if(objectName != null){ conf4 = null; @@ -99,7 +99,7 @@ public class TestingConfigTransactionController implements } @Override - public Set lookupConfigBeans(String moduleName) { + public Set lookupConfigBeans(final String moduleName) { if (moduleName.equals(moduleName1)) { return Sets.newHashSet(conf1, conf2); } else if (moduleName.equals(moduleName2)) { @@ -110,7 +110,7 @@ public class TestingConfigTransactionController implements } @Override - public ObjectName lookupConfigBean(String moduleName, String instanceName) + public ObjectName lookupConfigBean(final String moduleName, final String instanceName) throws InstanceNotFoundException { if (moduleName.equals(InstanceNotFoundException.class.getSimpleName())) { throw new InstanceNotFoundException(); @@ -119,8 +119,8 @@ public class TestingConfigTransactionController implements } @Override - public Set lookupConfigBeans(String moduleName, - String instanceName) { + public Set lookupConfigBeans(final String moduleName, + final String instanceName) { if (moduleName.equals(moduleName1) && instanceName.equals(instName1)) { return Sets.newHashSet(conf2); } else if (moduleName.equals(moduleName2) @@ -132,17 +132,17 @@ public class TestingConfigTransactionController implements } @Override - public void checkConfigBeanExists(ObjectName objectName) throws InstanceNotFoundException { + public void checkConfigBeanExists(final ObjectName objectName) throws InstanceNotFoundException { check = "configBeanExists"; } @Override - public ObjectName saveServiceReference(String serviceInterfaceName, String refName, ObjectName moduleON) throws InstanceNotFoundException { + public ObjectName saveServiceReference(final String serviceInterfaceName, final String refName, final ObjectName moduleON) throws InstanceNotFoundException { return moduleON; } @Override - public void removeServiceReference(String serviceInterfaceName, String refName) { + public void removeServiceReference(final String serviceInterfaceName, final String refName) { check = refName; } @@ -152,7 +152,7 @@ public class TestingConfigTransactionController implements } @Override - public ObjectName lookupConfigBeanByServiceInterfaceName(String serviceInterfaceQName, String refName) { + public ObjectName lookupConfigBeanByServiceInterfaceName(final String serviceInterfaceQName, final String refName) { return conf3; } @@ -164,23 +164,23 @@ public class TestingConfigTransactionController implements } @Override - public Map lookupServiceReferencesByServiceInterfaceName(String serviceInterfaceQName) { + public Map lookupServiceReferencesByServiceInterfaceName(final String serviceInterfaceQName) { mapSub.put("A",conf2); return mapSub; } @Override - public Set lookupServiceInterfaceNames(ObjectName objectName) throws InstanceNotFoundException { + public Set lookupServiceInterfaceNames(final ObjectName objectName) throws InstanceNotFoundException { return Sets.newHashSet("setA"); } @Override - public String getServiceInterfaceName(String namespace, String localName) { + public String getServiceInterfaceName(final String namespace, final String localName) { return check=namespace+localName; } @Override - public boolean removeServiceReferences(ObjectName objectName) throws InstanceNotFoundException { + public boolean removeServiceReferences(final ObjectName objectName) throws InstanceNotFoundException { return true; } @@ -200,12 +200,12 @@ public class TestingConfigTransactionController implements } @Override - public ObjectName getServiceReference(String serviceInterfaceQName, String refName) throws InstanceNotFoundException { + public ObjectName getServiceReference(final String serviceInterfaceQName, final String refName) throws InstanceNotFoundException { return conf3; } @Override - public void checkServiceReferenceExists(ObjectName objectName) throws InstanceNotFoundException { + public void checkServiceReferenceExists(final ObjectName objectName) throws InstanceNotFoundException { check = "referenceExist"; } } -- 2.36.6