Bug 8153: Enforce check-style rules for netconf - config-netconf-connector 91/54991/4
authormatus.kubica <matus.kubica@pantheon.tech>
Thu, 13 Apr 2017 16:01:34 +0000 (18:01 +0200)
committerJakub Morvay <jmorvay@cisco.com>
Thu, 27 Apr 2017 21:03:41 +0000 (21:03 +0000)
    Organize Imports for Checkstyle compliance.
    Checkstyle compliance: line length.
    Checkstyle compliance: various types of small changes.
    Checkstyle compliant Exception handling.
    Checkstyle final clean up & enforcement.
    Add the fail on violation flag into the pom.xml .

Change-Id: Idb0546157cb40658eccd2af6b73d66362fc22508
Signed-off-by: matus.kubica <matus.kubica@pantheon.tech>
15 files changed:
netconf/config-netconf-connector/pom.xml
netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/operations/DiscardChanges.java
netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/operations/Lock.java
netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/operations/UnLock.java
netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/operations/Validate.java
netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/operations/editconfig/EditConfig.java
netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/operations/editconfig/EditConfigXmlParser.java
netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/operations/getconfig/GetConfig.java
netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/operations/runtimerpc/RuntimeRpc.java
netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/osgi/Activator.java
netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/osgi/NetconfOperationProvider.java
netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/osgi/NetconfOperationServiceFactoryImpl.java
netconf/config-netconf-connector/src/test/java/org/opendaylight/netconf/confignetconfconnector/NetconfMappingTest.java
netconf/config-netconf-connector/src/test/java/org/opendaylight/netconf/confignetconfconnector/operations/editconfig/EditConfigTest.java
netconf/config-netconf-connector/src/test/java/org/opendaylight/netconf/confignetconfconnector/operations/editconfig/MergeEditConfigStrategyTest.java

index 8a63f3c8998941f29cdba56033c5190d8d003c6e..85593ce6be17eb72a9b86187120e45e2cb07644c 100644 (file)
           </instructions>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 
index 52d97fb950264fe6a8b67fcf8de4fc87b77361e7..f3cc24494cbb98284cb06e9557ad5fb2fec6a838 100644 (file)
@@ -32,7 +32,8 @@ public class DiscardChanges extends AbstractConfigNetconfOperation {
 
     private static final Logger LOG = LoggerFactory.getLogger(DiscardChanges.class);
 
-    public DiscardChanges(final ConfigSubsystemFacade configSubsystemFacade, final String netconfSessionIdForReporting) {
+    public DiscardChanges(final ConfigSubsystemFacade configSubsystemFacade,
+                          final String netconfSessionIdForReporting) {
         super(configSubsystemFacade, netconfSessionIdForReporting);
     }
 
@@ -46,8 +47,10 @@ public class DiscardChanges extends AbstractConfigNetconfOperation {
         return DISCARD;
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     @Override
-    protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement xml) throws DocumentedException {
+    protected Element handleWithNoSubsequentOperations(final Document document,
+                                                       final XmlElement xml) throws DocumentedException {
         fromXml(xml);
         try {
             getConfigSubsystemFacade().abortConfiguration();
index cb5e99feeb74f5f984d6f245392dc26c600b9551..9cca810ec98133ff54e818807ac282bbd761df49 100644 (file)
@@ -22,7 +22,8 @@ import org.w3c.dom.Element;
 
 /**
  * Simple Lock implementation that pretends to lock candidate datastore.
- * Candidate datastore is allocated per session and is private so no real locking is needed (JMX is the only possible interference)
+ * Candidate datastore is allocated per session and is private so no real locking is needed
+ * (JMX is the only possible interference)
  */
 public class Lock extends AbstractLastNetconfOperation {
 
@@ -36,17 +37,20 @@ public class Lock extends AbstractLastNetconfOperation {
     }
 
     @Override
-    protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) throws DocumentedException {
+    protected Element handleWithNoSubsequentOperations(final Document document,
+                                                       final XmlElement operationElement) throws DocumentedException {
         final Datastore targetDatastore = extractTargetParameter(operationElement);
-        if(targetDatastore == Datastore.candidate) {
-            // Since candidate datastore instances are allocated per session and not accessible anywhere else, no need to lock
+        if (targetDatastore == Datastore.candidate) {
+            // Since candidate datastore instances are allocated per session and not accessible anywhere else,
+            // no need to lock
             LOG.debug("Locking {} datastore on session: {}", targetDatastore, getNetconfSessionIdForReporting());
             // TODO should this fail if we are already locked ?
             return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
         }
 
         // Not supported running lock
-        throw new DocumentedException("Unable to lock " + Datastore.running + " datastore", DocumentedException.ErrorType.APPLICATION,
+        throw new DocumentedException("Unable to lock " + Datastore.running + " datastore",
+                DocumentedException.ErrorType.APPLICATION,
                 DocumentedException.ErrorTag.OPERATION_NOT_SUPPORTED, DocumentedException.ErrorSeverity.ERROR);
     }
 
index a20426b6d4e1af39c6fe9a7ab8d97cd4b6af4d37..17fff3d2185c74163142beb0671cf4e60f527ff8 100644 (file)
@@ -22,7 +22,8 @@ import org.w3c.dom.Element;
 
 /**
  * Simple unlock implementation that pretends to unlock candidate datastore.
- * Candidate datastore is allocated per session and is private so no real locking is needed (JMX is the only possible interference)
+ * Candidate datastore is allocated per session and is private so no real locking is needed
+ * (JMX is the only possible interference)
  */
 public class UnLock extends AbstractLastNetconfOperation {
 
@@ -35,17 +36,20 @@ public class UnLock extends AbstractLastNetconfOperation {
     }
 
     @Override
-    protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) throws DocumentedException {
+    protected Element handleWithNoSubsequentOperations(final Document document,
+                                                       final XmlElement operationElement) throws DocumentedException {
         final Datastore targetDatastore = Lock.extractTargetParameter(operationElement);
-        if(targetDatastore == Datastore.candidate) {
-            // Since candidate datastore instances are allocated per session and not accessible anywhere else, no need to lock
+        if (targetDatastore == Datastore.candidate) {
+            // Since candidate datastore instances are allocated per session and not accessible anywhere else,
+            // no need to lock
             LOG.debug("Unlocking {} datastore on session: {}", targetDatastore, getNetconfSessionIdForReporting());
             // TODO this should fail if we are not locked
             return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
         }
 
         // Not supported running lock
-        throw new DocumentedException("Unable to unlock " + Datastore.running + " datastore", DocumentedException.ErrorType.APPLICATION,
+        throw new DocumentedException("Unable to unlock " + Datastore.running + " datastore",
+                DocumentedException.ErrorType.APPLICATION,
                 DocumentedException.ErrorTag.OPERATION_NOT_SUPPORTED, DocumentedException.ErrorSeverity.ERROR);
     }
 
index 61d05bc9f8119992d1fb7ab3c188b1ce7352b00b..7c4e823e389829a5f496c09d5e38d105b7dbdf51 100644 (file)
@@ -48,9 +48,10 @@ public class Validate extends AbstractConfigNetconfOperation {
         final String datastoreValue = sourceChildNode.getName();
         final Datastore sourceDatastore = Datastore.valueOf(datastoreValue);
 
-        if (sourceDatastore != Datastore.candidate){
-            throw new DocumentedException( "Only " + Datastore.candidate
-                    + " is supported as source for " + VALIDATE + " but was " + datastoreValue, ErrorType.APPLICATION, ErrorTag.DATA_MISSING, ErrorSeverity.ERROR);
+        if (sourceDatastore != Datastore.candidate) {
+            throw new DocumentedException("Only " + Datastore.candidate
+                    + " is supported as source for " + VALIDATE + " but was " + datastoreValue, ErrorType.APPLICATION,
+                    ErrorTag.DATA_MISSING, ErrorSeverity.ERROR);
         }
     }
 
@@ -60,7 +61,8 @@ public class Validate extends AbstractConfigNetconfOperation {
     }
 
     @Override
-    protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement xml) throws DocumentedException {
+    protected Element handleWithNoSubsequentOperations(final Document document,
+                                                       final XmlElement xml) throws DocumentedException {
         checkXml(xml);
         try {
             getConfigSubsystemFacade().validateConfiguration();
@@ -72,7 +74,8 @@ public class Validate extends AbstractConfigNetconfOperation {
             final Map<String, String> errorInfo = new HashMap<>();
             errorInfo
                     .put(ErrorTag.OPERATION_FAILED.name(),
-                            "Datastore is not present. Use 'get-config' or 'edit-config' before triggering 'operations' operation");
+                            "Datastore is not present. "
+                                    + "Use 'get-config' or 'edit-config' before triggering 'operations' operation");
             throw new DocumentedException(e.getMessage(), e, ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED,
                     ErrorSeverity.ERROR, errorInfo);
 
index eb01a57c11138396eb177571e75bf382ebc1dd49..e247928033564c095afa65b40f60b8edab7e37bb 100644 (file)
@@ -65,8 +65,10 @@ public class EditConfig extends AbstractConfigNetconfOperation {
     }
 
     @Override
-    protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement xml) throws DocumentedException {
-        // FIXME config mapping getter works on dynamic yang store service and so does later executeConfigExecution method
+    protected Element handleWithNoSubsequentOperations(final Document document,
+                                                       final XmlElement xml) throws DocumentedException {
+        // FIXME config mapping getter works on dynamic yang store service
+        // and so does later executeConfigExecution method
         // They might have different view of current yangs in ODL and might cause race conditions
         final Config cfg = getConfigSubsystemFacade().getConfigMapping();
         final ConfigExecution configExecution = editConfigXmlParser.fromXml(xml, cfg);
index c317d1dd971eb90005b187f63f756a8baa8807be..ddba4ae81397a1d0695db8f58ccfbff2027f2625 100644 (file)
@@ -45,8 +45,8 @@ public class EditConfigXmlParser {
         xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
 
 
-        XmlElement targetElement = null;
-        XmlElement targetChildNode = null;
+        XmlElement targetElement;
+        XmlElement targetChildNode;
         targetElement  = xml.getOnlyChildElementWithSameNamespace(EditConfigXmlParser.TARGET_KEY);
         targetChildNode = targetElement.getOnlyChildElementWithSameNamespace();
 
@@ -55,7 +55,7 @@ public class EditConfigXmlParser {
         LOG.debug("Setting {} to '{}'", EditConfigXmlParser.TARGET_KEY, targetDatastore);
 
         // check target
-        if (targetDatastore != Datastore.candidate){
+        if (targetDatastore != Datastore.candidate) {
             throw new DocumentedException(String.format(
                     "Only %s datastore supported for edit config but was: %s",
                     Datastore.candidate,
@@ -82,7 +82,7 @@ public class EditConfigXmlParser {
                 .getOnlyChildElementWithSameNamespaceOptionally(EditConfigXmlParser.ERROR_OPTION_KEY);
         if (errorOptionElement.isPresent()) {
             final String errorOptionParsed = errorOptionElement.get().getTextContent();
-            if (!errorOptionParsed.equals(EditConfigXmlParser.DEFAULT_ERROR_OPTION)){
+            if (!errorOptionParsed.equals(EditConfigXmlParser.DEFAULT_ERROR_OPTION)) {
                 throw new UnsupportedOperationException("Only " + EditConfigXmlParser.DEFAULT_ERROR_OPTION
                         + " supported for " + EditConfigXmlParser.ERROR_OPTION_KEY + ", was " + errorOptionParsed);
             }
@@ -97,7 +97,7 @@ public class EditConfigXmlParser {
             editStrategyType = EditStrategyType.valueOf(mergeStrategyString);
         }
 
-        XmlElement configElement = null;
+        XmlElement configElement;
         configElement = xml.getOnlyChildElementWithSameNamespace(XmlNetconfConstants.CONFIG_KEY);
 
         return new ConfigExecution(cfgMapping, configElement, testOption, editStrategyType);
index d7e3061cc37da0406b240fdd186cc7cdb0745381..dc1c31d19886c925c53306134faba33a34323e13 100644 (file)
@@ -28,7 +28,8 @@ public class GetConfig extends AbstractConfigNetconfOperation {
 
     private static final Logger LOG = LoggerFactory.getLogger(GetConfig.class);
 
-    public GetConfig(final ConfigSubsystemFacade configSubsystemFacade, final Optional<String> maybeNamespace, final String netconfSessionIdForReporting) {
+    public GetConfig(final ConfigSubsystemFacade configSubsystemFacade, final Optional<String> maybeNamespace,
+                     final String netconfSessionIdForReporting) {
         super(configSubsystemFacade, netconfSessionIdForReporting);
         this.maybeNamespace = maybeNamespace;
     }
index b8d5b58a2d4f55f7b4de8504a77fa2f72fd969bb..bbcdf28b6517277c1144570a1ca986144c631ad8 100644 (file)
@@ -53,7 +53,7 @@ public class RuntimeRpc extends AbstractConfigNetconfOperation {
         final Optional<XmlElement> contextInstanceElement = operationElement
                 .getOnlyChildElementOptionally(RpcFacade.CONTEXT_INSTANCE);
 
-        if (!contextInstanceElement.isPresent()){
+        if (!contextInstanceElement.isPresent()) {
             return HandlingPriority.CANNOT_HANDLE;
         }
 
@@ -97,8 +97,8 @@ public class RuntimeRpc extends AbstractConfigNetconfOperation {
                 execution.getAttributes());
         final Object result = getConfigSubsystemFacade().getRpcFacade().executeOperation(execution);
 
-        LOG.trace("Operation {} called successfully on {} with arguments {} with result {}", execution.getOperationName(),
-                execution.getOn(), execution.getAttributes(), result);
+        LOG.trace("Operation {} called successfully on {} with arguments {} with result {}",
+                execution.getOperationName(), execution.getOn(), execution.getAttributes(), result);
 
         if (execution.isVoid()) {
             return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
index 336c03a59b5b7b0eb48af22e0f2db0c18dcf2e29..40edbec2134b07934d98f10c3b973c4e75df5c36 100644 (file)
@@ -30,24 +30,30 @@ public class Activator implements BundleActivator {
 
     @Override
     public void start(final BundleContext context) throws Exception {
-        ServiceTrackerCustomizer<ConfigSubsystemFacadeFactory, ConfigSubsystemFacadeFactory> schemaServiceTrackerCustomizer = new ServiceTrackerCustomizer<ConfigSubsystemFacadeFactory, ConfigSubsystemFacadeFactory>() {
+        ServiceTrackerCustomizer<ConfigSubsystemFacadeFactory,
+                ConfigSubsystemFacadeFactory> schemaServiceTrackerCustomizer =
+                new ServiceTrackerCustomizer<ConfigSubsystemFacadeFactory, ConfigSubsystemFacadeFactory>() {
 
             @Override
-            public ConfigSubsystemFacadeFactory addingService(ServiceReference<ConfigSubsystemFacadeFactory> reference) {
+            public ConfigSubsystemFacadeFactory addingService(
+                    ServiceReference<ConfigSubsystemFacadeFactory> reference) {
                 LOG.debug("Got addingService(SchemaContextProvider) event");
                 // Yang store service should not be registered multiple times
-                ConfigSubsystemFacadeFactory configSubsystemFacade = reference.getBundle().getBundleContext().getService(reference);
+                ConfigSubsystemFacadeFactory configSubsystemFacade =
+                        reference.getBundle().getBundleContext().getService(reference);
                 osgiRegistration = startNetconfServiceFactory(configSubsystemFacade, context);
                 return configSubsystemFacade;
             }
 
             @Override
-            public void modifiedService(ServiceReference<ConfigSubsystemFacadeFactory> reference, ConfigSubsystemFacadeFactory service) {
+            public void modifiedService(ServiceReference<ConfigSubsystemFacadeFactory> reference,
+                                        ConfigSubsystemFacadeFactory service) {
                 LOG.warn("Config manager facade was modified unexpectedly");
             }
 
             @Override
-            public void removedService(ServiceReference<ConfigSubsystemFacadeFactory> reference, ConfigSubsystemFacadeFactory service) {
+            public void removedService(ServiceReference<ConfigSubsystemFacadeFactory> reference,
+                                       ConfigSubsystemFacadeFactory service) {
                 LOG.warn("Config manager facade was removed unexpectedly");
             }
         };
@@ -64,12 +70,15 @@ public class Activator implements BundleActivator {
         }
     }
 
-    private ServiceRegistration<NetconfOperationServiceFactory> startNetconfServiceFactory(final ConfigSubsystemFacadeFactory configSubsystemFacade, final BundleContext context) {
-        final NetconfOperationServiceFactoryImpl netconfOperationServiceFactory = new NetconfOperationServiceFactoryImpl(configSubsystemFacade);
+    private ServiceRegistration<NetconfOperationServiceFactory> startNetconfServiceFactory(
+            final ConfigSubsystemFacadeFactory configSubsystemFacade, final BundleContext context) {
+        final NetconfOperationServiceFactoryImpl netconfOperationServiceFactory =
+                new NetconfOperationServiceFactoryImpl(configSubsystemFacade);
         // Add properties to autowire with netconf-impl instance for cfg subsystem
         final Dictionary<String, String> properties = new Hashtable<>();
         properties.put(NetconfConstants.SERVICE_NAME, NetconfConstants.CONFIG_NETCONF_CONNECTOR);
-        return context.registerService(NetconfOperationServiceFactory.class, netconfOperationServiceFactory, properties);
+        return context.registerService(NetconfOperationServiceFactory.class,
+                netconfOperationServiceFactory, properties);
     }
 
 }
index 6f0a448dd213168e8a253ca833a30700c9c03514..30064685db637c588db33506041339139454be66 100644 (file)
@@ -26,7 +26,8 @@ import org.opendaylight.netconf.mapping.api.NetconfOperation;
 final class NetconfOperationProvider {
     private final Set<NetconfOperation> operations;
 
-    NetconfOperationProvider(final ConfigSubsystemFacade configSubsystemFacade, final String netconfSessionIdForReporting) {
+    NetconfOperationProvider(final ConfigSubsystemFacade configSubsystemFacade,
+                             final String netconfSessionIdForReporting) {
 
         operations = setUpOperations(configSubsystemFacade, netconfSessionIdForReporting);
     }
index 01405d447ea046997753ea0df61507c8ed6b7557..370e59e83e0d445f2e46857e935f7b183893bd9b 100644 (file)
@@ -24,7 +24,8 @@ public class NetconfOperationServiceFactoryImpl implements NetconfOperationServi
 
     @Override
     public NetconfOperationServiceImpl createService(String netconfSessionIdForReporting) {
-        return new NetconfOperationServiceImpl(configFacadeFactory.createFacade(netconfSessionIdForReporting), netconfSessionIdForReporting);
+        return new NetconfOperationServiceImpl(configFacadeFactory.createFacade(netconfSessionIdForReporting),
+                netconfSessionIdForReporting);
     }
 
     @Override
index c935801ddad79921f632ecfd8dc42d9c52691609..f4059a6438fa4434623ee3a180262021e4f08163 100644 (file)
@@ -140,7 +140,7 @@ public class NetconfMappingTest extends AbstractConfigTest {
 
     private static final String INSTANCE_NAME = "instance-from-code";
     private static final String NETCONF_SESSION_ID = "foo";
-    private static final String TEST_NAMESPACE= "urn:opendaylight:params:xml:ns:yang:controller:test:impl";
+    private static final String TEST_NAMESPACE = "urn:opendaylight:params:xml:ns:yang:controller:test:impl";
     private NetconfTestImplModuleFactory factory;
     private DepTestImplModuleFactory factory2;
     private IdentityTestModuleFactory factory3;
@@ -176,13 +176,15 @@ public class NetconfMappingTest extends AbstractConfigTest {
             @Override
             public String fromYang(final String enumType, final String enumYangValue) {
                 return Preconditions.checkNotNull(getEnumMapping().get(enumYangValue),
-                        "Unable to resolve enum value %s, for enum %s with mappings %s", enumYangValue, enumType, getEnumMapping());
+                        "Unable to resolve enum value %s, for enum %s with mappings %s",
+                        enumYangValue, enumType, getEnumMapping());
             }
 
             @Override
             public String toYang(final String enumType, final String enumYangValue) {
                 return Preconditions.checkNotNull(getEnumMapping().inverse().get(enumYangValue),
-                        "Unable to resolve enum value %s, for enum %s with mappings %s", enumYangValue, enumType, getEnumMapping().inverse());
+                        "Unable to resolve enum value %s, for enum %s with mappings %s",
+                        enumYangValue, enumType, getEnumMapping().inverse());
             }
         }).when(this.yangStoreSnapshot).getEnumResolver();
 
@@ -192,27 +194,31 @@ public class NetconfMappingTest extends AbstractConfigTest {
         factory4 = new TestImplModuleFactory();
         doNothing().when(sessionCloseable).close();
 
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, this.factory, this.factory2,
-                this.factory3, factory4));
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, this.factory,
+                this.factory2, this.factory3, factory4));
 
         transactionProvider = new TransactionProvider(this.configRegistryClient, NETCONF_SESSION_ID);
 
-        configSubsystemFacade = new ConfigSubsystemFacade(configRegistryClient, configRegistryClient, yangStoreSnapshot, "mapping-test");
+        configSubsystemFacade = new ConfigSubsystemFacade(configRegistryClient, configRegistryClient, yangStoreSnapshot,
+                "mapping-test");
     }
 
-    private ObjectName createModule(final String instanceName) throws InstanceAlreadyExistsException, InstanceNotFoundException, URISyntaxException, ValidationException, ConflictingVersionException {
+    private ObjectName createModule(final String instanceName) throws InstanceAlreadyExistsException,
+            InstanceNotFoundException, URISyntaxException, ValidationException, ConflictingVersionException {
         final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
 
         final ObjectName on = transaction.createModule(this.factory.getImplementationName(), instanceName);
         final NetconfTestImplModuleMXBean mxBean = transaction.newMXBeanProxy(on, NetconfTestImplModuleMXBean.class);
         setModule(mxBean, transaction, instanceName + "_dep");
 
-        int i = 1;
-        for (final Class<? extends AbstractServiceInterface> sInterface : factory.getImplementedServiceIntefaces()) {
-            final ServiceInterfaceAnnotation annotation = sInterface.getAnnotation(ServiceInterfaceAnnotation.class);
+        int index = 1;
+        for (final Class<? extends AbstractServiceInterface> serviceInterface :
+                factory.getImplementedServiceIntefaces()) {
+            final ServiceInterfaceAnnotation annotation =
+                    serviceInterface.getAnnotation(ServiceInterfaceAnnotation.class);
             transaction.saveServiceReference(
-                    transaction.getServiceInterfaceName(annotation.namespace(), annotation.localName()), "ref_from_code_to_" + instanceName + "_" + i++,
-                    on);
+                    transaction.getServiceInterfaceName(annotation.namespace(), annotation.localName()),
+                    "ref_from_code_to_" + instanceName + "_" + index++, on);
 
         }
         transaction.commit();
@@ -339,9 +345,9 @@ public class NetconfMappingTest extends AbstractConfigTest {
 
             @Override
             public void testText(final Text text) throws NodeTestException {
-                if(text.getData().equals("ref_dep2")) {
+                if (text.getData().equals("ref_dep2")) {
                     defaultRefNameCount++;
-                } else if(text.getData().equals("ref_dep_user_two")) {
+                } else if (text.getData().equals("ref_dep_user_two")) {
                     userRefNameCount++;
                 }
             }
@@ -355,7 +361,8 @@ public class NetconfMappingTest extends AbstractConfigTest {
         nt.performTest(tester, Node.TEXT_NODE);
     }
 
-    private static void assertCorrectServiceNames(final Document configCandidate, final Set<String> refNames) throws NodeTestException {
+    private static void assertCorrectServiceNames(final Document configCandidate,
+                                                  final Set<String> refNames) throws NodeTestException {
         final Set<String> refNames2 = new HashSet<>(refNames);
         final NodeList servicesNodes = configCandidate.getElementsByTagName("services");
         assertEquals(1, servicesNodes.getLength());
@@ -365,10 +372,10 @@ public class NetconfMappingTest extends AbstractConfigTest {
 
             @Override
             public void testElement(final Element element) throws NodeTestException {
-                if(element.getNodeName() != null) {
-                    if(element.getNodeName().equals("name")) {
+                if (element.getNodeName() != null) {
+                    if (element.getNodeName().equals("name")) {
                         final String elmText = element.getTextContent();
-                        if(refNames2.contains(elmText)) {
+                        if (refNames2.contains(elmText)) {
                             refNames2.remove(elmText);
                         } else {
                             throw new NodeTestException("Unexpected services defined: " + elmText);
@@ -394,17 +401,23 @@ public class NetconfMappingTest extends AbstractConfigTest {
         edit("netconfMessages/editConfig.xml");
         commit();
         Document response = getConfigRunning();
-        final Element ipElement = readXmlToElement("<ip xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">0:0:0:0:0:0:0:1</ip>");
-        assertContainsElement(response, readXmlToElement("<ip xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">0:0:0:0:0:0:0:1</ip>"));
+        final Element ipElement = readXmlToElement(
+                "<ip xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">0:0:0:0:0:0:0:1</ip>");
+        assertContainsElement(response, readXmlToElement(
+                "<ip xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">0:0:0:0:0:0:0:1</ip>"));
 
-        assertContainsElement(response, readXmlToElement("<union-test-attr xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">456</union-test-attr>"));
+        assertContainsElement(response, readXmlToElement("<union-test-attr xmlns="
+                + "\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">456</union-test-attr>"));
 
 
         edit("netconfMessages/editConfig_setUnions.xml");
         commit();
         response = getConfigRunning();
-        assertContainsElement(response, readXmlToElement("<ip xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">127.1.2.3</ip>"));
-        assertContainsElement(response, readXmlToElement("<union-test-attr xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">randomStringForUnion</union-test-attr>"));
+        assertContainsElement(response, readXmlToElement(
+                "<ip xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">127.1.2.3</ip>"));
+        assertContainsElement(response, readXmlToElement("<union-test-attr xmlns="
+                + "\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">"
+                + "randomStringForUnion</union-test-attr>"));
 
     }
 
@@ -438,7 +451,8 @@ public class NetconfMappingTest extends AbstractConfigTest {
         commit();
         assertXMLEqual(getConfigCandidate(), getConfigRunning());
 
-        final Document expectedResult = XmlFileLoader.xmlFileToDocument("netconfMessages/editConfig_expectedResult.xml");
+        final Document expectedResult =
+                XmlFileLoader.xmlFileToDocument("netconfMessages/editConfig_expectedResult.xml");
         XMLUnit.setIgnoreWhitespace(true);
         assertXMLEqual(expectedResult, getConfigRunning());
         assertXMLEqual(expectedResult, getConfigCandidate());
@@ -451,9 +465,11 @@ public class NetconfMappingTest extends AbstractConfigTest {
     }
 
     private static void checkBigDecimal(final Document response) throws NodeTestException, SAXException, IOException {
-        assertContainsElement(response, readXmlToElement("<sleep-factor xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">2.58</sleep-factor>"));
+        assertContainsElement(response, readXmlToElement("<sleep-factor xmlns="
+                + "\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">2.58</sleep-factor>"));
         // Default
-        assertContainsElement(response, readXmlToElement("<sleep-factor xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">2.00</sleep-factor>"));
+        assertContainsElement(response, readXmlToElement("<sleep-factor xmlns="
+                + "\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">2.00</sleep-factor>"));
     }
 
     private void closeSession() throws ParserConfigurationException, SAXException,
@@ -480,25 +496,29 @@ public class NetconfMappingTest extends AbstractConfigTest {
         executeOp(commitOp, "netconfMessages/commit.xml");
     }
 
-    private static Document lockCandidate() throws ParserConfigurationException, SAXException, IOException, DocumentedException {
+    private static Document lockCandidate() throws ParserConfigurationException, SAXException, IOException,
+            DocumentedException {
         final Lock commitOp = new Lock(NETCONF_SESSION_ID);
         return executeOp(commitOp, "netconfMessages/lock.xml");
     }
 
-    private static Document unlockCandidate() throws ParserConfigurationException, SAXException, IOException, DocumentedException {
+    private static Document unlockCandidate() throws ParserConfigurationException, SAXException, IOException,
+            DocumentedException {
         final UnLock commitOp = new UnLock(NETCONF_SESSION_ID);
         return executeOp(commitOp, "netconfMessages/unlock.xml");
     }
 
     private Document getConfigCandidate() throws ParserConfigurationException, SAXException, IOException,
             DocumentedException {
-        final GetConfig getConfigOp = new GetConfig(configSubsystemFacade, Optional.<String>absent(), NETCONF_SESSION_ID);
+        final GetConfig getConfigOp = new GetConfig(configSubsystemFacade, Optional.<String>absent(),
+                NETCONF_SESSION_ID);
         return executeOp(getConfigOp, "netconfMessages/getConfig_candidate.xml");
     }
 
     private Document getConfigRunning() throws ParserConfigurationException, SAXException, IOException,
             DocumentedException {
-        final GetConfig getConfigOp = new GetConfig(configSubsystemFacade, Optional.<String>absent(), NETCONF_SESSION_ID);
+        final GetConfig getConfigOp = new GetConfig(configSubsystemFacade, Optional.<String>absent(),
+                NETCONF_SESSION_ID);
         return executeOp(getConfigOp, "netconfMessages/getConfig.xml");
     }
 
@@ -596,9 +616,9 @@ public class NetconfMappingTest extends AbstractConfigTest {
     public void testUnrecognisedConfigElements() throws Exception {
 
         final String format = "netconfMessages/unrecognised/editConfig_unrecognised%d.xml";
-        final int TESTS_COUNT = 8;
+        final int testsCount = 8;
 
-        for (int i = 0; i < TESTS_COUNT; i++) {
+        for (int i = 0; i < testsCount; i++) {
             final String file = String.format(format, i + 1);
             LOG.info("Reading {}", file);
             try {
@@ -666,24 +686,33 @@ public class NetconfMappingTest extends AbstractConfigTest {
         return executeOp(discardOp, "netconfMessages/discardChanges.xml");
     }
 
-    private static void checkBinaryLeafEdited(final Document response) throws NodeTestException, SAXException, IOException {
-        assertContainsElement(response, readXmlToElement("<binaryLeaf xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">YmluYXJ5</binaryLeaf>"));
-        assertContainsElement(response, readXmlToElement("<binaryLeaf xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">ZGVmYXVsdEJpbg==</binaryLeaf>"));
+    private static void checkBinaryLeafEdited(final Document response)
+            throws NodeTestException, SAXException, IOException {
+        assertContainsElement(response, readXmlToElement("<binaryLeaf xmlns="
+                + "\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">YmluYXJ5</binaryLeaf>"));
+        assertContainsElement(response, readXmlToElement("<binaryLeaf xmlns="
+                + "\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">ZGVmYXVsdEJpbg==</binaryLeaf>"));
     }
 
     private static void checkTypedefs(final Document response) throws NodeTestException, SAXException, IOException {
 
-        assertContainsElement(response, readXmlToElement("<extended xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">10</extended>"));
+        assertContainsElement(response, readXmlToElement(
+                "<extended xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">10</extended>"));
         // Default
-        assertContainsElement(response, readXmlToElement("<extended xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">1</extended>"));
+        assertContainsElement(response, readXmlToElement(
+                "<extended xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">1</extended>"));
 
-        assertContainsElement(response, readXmlToElement("<extended-twice xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">20</extended-twice>"));
+        assertContainsElement(response, readXmlToElement("<extended-twice xmlns="
+                + "\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">20</extended-twice>"));
         // Default
-        assertContainsElement(response, readXmlToElement("<extended-twice xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">2</extended-twice>"));
+        assertContainsElement(response, readXmlToElement("<extended-twice xmlns="
+                + "\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">2</extended-twice>"));
 
-        assertContainsElement(response, readXmlToElement("<extended-enum xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">two</extended-enum>"));
+        assertContainsElement(response, readXmlToElement("<extended-enum xmlns="
+                + "\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">two</extended-enum>"));
         // Default
-        assertContainsElement(response, readXmlToElement("<extended-enum xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">one</extended-enum>"));
+        assertContainsElement(response, readXmlToElement("<extended-enum xmlns="
+                + "\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">one</extended-enum>"));
     }
 
     private static void assertContainsString(final String string, final String substring) {
@@ -705,13 +734,13 @@ public class NetconfMappingTest extends AbstractConfigTest {
     }
 
     private static String getXpathForNetconfImplSubnode(final String instanceName, final String subnode) {
-        return "/urn:ietf:params:xml:ns:netconf:base:1.0:rpc-reply" +
-                "/urn:ietf:params:xml:ns:netconf:base:1.0:data" +
-                "/urn:opendaylight:params:xml:ns:yang:controller:config:modules" +
-                "/urn:opendaylight:params:xml:ns:yang:controller:config:module" +
-                "[urn:opendaylight:params:xml:ns:yang:controller:config:name='" + instanceName + "']" +
-                "/urn:opendaylight:params:xml:ns:yang:controller:test:impl:impl-netconf" +
-                "/urn:opendaylight:params:xml:ns:yang:controller:test:impl:" + subnode;
+        return "/urn:ietf:params:xml:ns:netconf:base:1.0:rpc-reply"
+                + "/urn:ietf:params:xml:ns:netconf:base:1.0:data"
+                + "/urn:opendaylight:params:xml:ns:yang:controller:config:modules"
+                + "/urn:opendaylight:params:xml:ns:yang:controller:config:module"
+                + "[urn:opendaylight:params:xml:ns:yang:controller:config:name='" + instanceName + "']"
+                + "/urn:opendaylight:params:xml:ns:yang:controller:test:impl:impl-netconf"
+                "/urn:opendaylight:params:xml:ns:yang:controller:test:impl:" + subnode;
     }
 
     private static void checkTypeConfigAttribute(final Document response) throws Exception {
@@ -720,7 +749,7 @@ public class NetconfMappingTest extends AbstractConfigTest {
                 "test2", "default-string");
         for (final Entry<String, String> nameToExpectedValue : namesToTypeValues.entrySet()) {
             XMLAssert.assertXpathEvaluatesTo(nameToExpectedValue.getValue(),
-                    getXpathForNetconfImplSubnode(nameToExpectedValue.getKey(),"type"),
+                    getXpathForNetconfImplSubnode(nameToExpectedValue.getKey(), "type"),
                     response);
         }
     }
@@ -732,7 +761,8 @@ public class NetconfMappingTest extends AbstractConfigTest {
 
         final SchemaContext schemaContext = YangParserTestUtils.parseYangStreams(yangDependencies);
         final YangStoreService yangStoreService = new YangStoreService(new SchemaContextProvider() {
-            @Override public SchemaContext getSchemaContext() {
+            @Override
+            public SchemaContext getSchemaContext() {
                 return schemaContext;
             }
         }, mock(SchemaSourceProvider.class));
@@ -783,7 +813,8 @@ public class NetconfMappingTest extends AbstractConfigTest {
         assertEquals(8 * 4, getElementsSize(response, "inner-inner-running-data"));
         assertEquals(8 * 4, getElementsSize(response, "deep3"));
         assertEquals(8 * 4 * 2, getElementsSize(response, "list-of-strings"));
-        assertEquals(8, getElementsSize(response, "inner-running-data-additional", "urn:opendaylight:params:xml:ns:yang:controller:test:impl"));
+        assertEquals(8, getElementsSize(response, "inner-running-data-additional",
+                "urn:opendaylight:params:xml:ns:yang:controller:test:impl"));
         assertEquals(8, getElementsSize(response, "deep4"));
         // TODO assert keys
 
@@ -818,7 +849,8 @@ public class NetconfMappingTest extends AbstractConfigTest {
         return response.getElementsByTagNameNS(namespace, elementName).getLength();
     }
 
-    private static Document executeOp(final NetconfOperation op, final String filename) throws ParserConfigurationException,
+    private static Document executeOp(final NetconfOperation op,
+                                      final String filename) throws ParserConfigurationException,
             SAXException, IOException, DocumentedException {
 
         final Document request = XmlFileLoader.xmlFileToDocument(filename);
@@ -835,8 +867,9 @@ public class NetconfMappingTest extends AbstractConfigTest {
 
     private List<InputStream> getYangs() {
         final List<String> paths = Arrays.asList("/META-INF/yang/config.yang", "/META-INF/yang/rpc-context.yang",
-                "/META-INF/yang/config-test.yang", "/META-INF/yang/config-test-impl.yang", "/META-INF/yang/test-types.yang",
-                "/META-INF/yang/test-groups.yang", "/META-INF/yang/ietf-inet-types@2013-07-15.yang");
+                "/META-INF/yang/config-test.yang", "/META-INF/yang/config-test-impl.yang",
+                "/META-INF/yang/test-types.yang", "/META-INF/yang/test-groups.yang",
+                "/META-INF/yang/ietf-inet-types@2013-07-15.yang");
         final Collection<InputStream> yangDependencies = new ArrayList<>();
         for (final String path : paths) {
             final InputStream is = Preconditions
@@ -846,10 +879,11 @@ public class NetconfMappingTest extends AbstractConfigTest {
         return Lists.newArrayList(yangDependencies);
     }
 
-    private void setModule(final NetconfTestImplModuleMXBean mxBean, final ConfigTransactionJMXClient transaction, final String depName)
+    private void setModule(final NetconfTestImplModuleMXBean mxBean, final ConfigTransactionJMXClient transaction,
+                           final String depName)
             throws InstanceAlreadyExistsException, InstanceNotFoundException {
         mxBean.setSimpleInt((long) 44);
-        mxBean.setBinaryLeaf(new byte[] { 8, 7, 9 });
+        mxBean.setBinaryLeaf(new byte[]{8, 7, 9});
         final DtoD dtob = getDtoD();
         mxBean.setDtoD(dtob);
         //
@@ -865,7 +899,7 @@ public class NetconfMappingTest extends AbstractConfigTest {
         p2.setCoreSize(44L);
         p2.setPort("port23");
         p2.setSimpleInt3(456);
-        mxBean.setPeers(Lists.<Peers> newArrayList(p1, p2));
+        mxBean.setPeers(Lists.<Peers>newArrayList(p1, p2));
         // //
         mxBean.setSimpleLong(454545L);
         mxBean.setSimpleLong2(44L);
@@ -874,16 +908,18 @@ public class NetconfMappingTest extends AbstractConfigTest {
         mxBean.setSimpleShort(new Short((short) 4));
         mxBean.setSimpleTest(545);
 
-        mxBean.setComplexList(Lists.<ComplexList> newArrayList());
-        mxBean.setSimpleList(Lists.<Integer> newArrayList());
+        mxBean.setComplexList(Lists.<ComplexList>newArrayList());
+        mxBean.setSimpleList(Lists.<Integer>newArrayList());
 
         final ObjectName testingDepOn = transaction.createModule(this.factory2.getImplementationName(), depName);
-        int i = 1;
-        for (final Class<? extends AbstractServiceInterface> sInterface : factory2.getImplementedServiceIntefaces()) {
-            final ServiceInterfaceAnnotation annotation = sInterface.getAnnotation(ServiceInterfaceAnnotation.class);
+        int index = 1;
+        for (final Class<? extends AbstractServiceInterface> serviceInterface :
+                factory2.getImplementedServiceIntefaces()) {
+            final ServiceInterfaceAnnotation annotation =
+                    serviceInterface.getAnnotation(ServiceInterfaceAnnotation.class);
             transaction.saveServiceReference(
-                    transaction.getServiceInterfaceName(annotation.namespace(), annotation.localName()), "ref_from_code_to_" + depName + "_" + i++,
-                    testingDepOn);
+                    transaction.getServiceInterfaceName(annotation.namespace(), annotation.localName()),
+                    "ref_from_code_to_" + depName + "_" + index++, testingDepOn);
 
         }
         mxBean.setTestingDep(testingDepOn);
index e04f0c731fab0c86d4aaa6702d31914119b69eaa..39a3ee1e3b872edfeff6ec97b8de19ddd06871e8 100644 (file)
@@ -89,7 +89,8 @@ public class EditConfigTest {
         EditConfig edit = new EditConfig(cfgFacade, ValidateTest.NETCONF_SESSION_ID_FOR_REPORTING);
         EditConfigStrategy editStrat = mock(EditConfigStrategy.class);
 
-        doNothing().when(editStrat).executeConfiguration(anyString(), anyString(), anyMapOf(String.class, AttributeConfigElement.class),
+        doNothing().when(editStrat).executeConfiguration(anyString(), anyString(), anyMapOf(String.class,
+                AttributeConfigElement.class),
                 any(ConfigTransactionClient.class), any(ServiceRegistryWrapper.class));
 
         ConfigExecution editConfigExecution = mockExecution(editStrat);
@@ -103,7 +104,8 @@ public class EditConfigTest {
         verify(provider).getOrCreateTransaction();
 
         // For every instance execute strat
-        verify(editStrat, times(2/* Test */+ 2/* Set */ + 2/*Handle missing instance Test*/ + 2 /*Handle missing instance Set*/)).executeConfiguration(anyString(),
+        verify(editStrat, times(2/* Test */ + 2/* Set */ + 2/*Handle missing instance Test*/
+                + 2 /*Handle missing instance Set*/)).executeConfiguration(anyString(),
                 anyString(), anyMapOf(String.class, AttributeConfigElement.class),
                 any(ConfigTransactionClient.class), any(ServiceRegistryWrapper.class));
     }
@@ -122,7 +124,7 @@ public class EditConfigTest {
     }
 
     private Object getMappingDefinition(EditConfigStrategy editStrat) {
-        Map<String, Multimap<String, ModuleElementDefinition>> result = Maps.newHashMap();
+        final Map<String, Multimap<String, ModuleElementDefinition>> result = Maps.newHashMap();
 
         Multimap<String, ModuleElementDefinition> innerMultimap = HashMultimap.create();
         Map<String, AttributeConfigElement> attributes = getSimpleAttributes();
@@ -157,7 +159,7 @@ public class EditConfigTest {
     }
 
     private Map<String, Multimap<String, ModuleElementResolved>> getMapping(EditConfigStrategy editStrat) {
-        Map<String, Multimap<String, ModuleElementResolved>> result = Maps.newHashMap();
+        final Map<String, Multimap<String, ModuleElementResolved>> result = Maps.newHashMap();
 
         Multimap<String, ModuleElementResolved> innerMultimap = HashMultimap.create();
         Map<String, AttributeConfigElement> attributes = getSimpleAttributes();
@@ -178,10 +180,10 @@ public class EditConfigTest {
     }
 
     static Map<String, AttributeConfigElement> getSimpleAttributes() {
-        Map<String, AttributeConfigElement> attributes = Maps.newHashMap();
+        final Map<String, AttributeConfigElement> attributes = Maps.newHashMap();
         AttributeConfigElement ace1 = mock(AttributeConfigElement.class);
         doReturn("abcd").when(ace1).getResolvedDefaultValue();
-        doReturn(Optional.<String> of("abc")).when(ace1).getResolvedValue();
+        doReturn(Optional.<String>of("abc")).when(ace1).getResolvedValue();
         doReturn("mockedAce1").when(ace1).toString();
         doReturn("jmxNameAce1").when(ace1).getJmxName();
         attributes.put("a1", ace1);
index 7cc0288fe871b68d9b99abd3866eade10b3f1eae..12b6bf4d622fe60f8ffae65b32ae1e2220b98d81 100644 (file)
@@ -32,38 +32,38 @@ import org.opendaylight.controller.config.yang.test.impl.MultipleDependenciesMod
 import org.opendaylight.controller.config.yang.test.impl.MultipleDependenciesModuleMXBean;
 
 public class MergeEditConfigStrategyTest extends AbstractConfigTest {
-    private static final MultipleDependenciesModuleFactory factory = new MultipleDependenciesModuleFactory();
+    private static final MultipleDependenciesModuleFactory FACTORY = new MultipleDependenciesModuleFactory();
+    private static final String FACTORY_NAME = FACTORY.getImplementationName();
     public static final String PARENT = "parent";
     public static final String D1 = "d1";
     public static final String D2 = "d2";
     public static final String D3 = "d3";
 
-    private static final String factoryName = factory.getImplementationName();
-
     @Before
     public void setUp() throws Exception {
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, factory));
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, FACTORY));
 
         ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        ObjectName d1 = transaction.createModule(factoryName, D1);
-        ObjectName d2 = transaction.createModule(factoryName, D2);
-        ObjectName parent = transaction.createModule(factoryName, PARENT);
+        ObjectName d1 = transaction.createModule(FACTORY_NAME, D1);
+        ObjectName d2 = transaction.createModule(FACTORY_NAME, D2);
+        ObjectName parent = transaction.createModule(FACTORY_NAME, PARENT);
         MultipleDependenciesModuleMXBean multipleDependenciesModuleMXBean = transaction.newMXBeanProxy(parent,
                 MultipleDependenciesModuleMXBean.class);
         multipleDependenciesModuleMXBean.setTestingDeps(asList(d1, d2));
-        transaction.createModule(factoryName, D3);
+        transaction.createModule(FACTORY_NAME, D3);
         transaction.commit();
     }
 
     @Test
     public void testMergingOfObjectNames() throws Exception {
-        MergeEditConfigStrategy strategy = new MergeEditConfigStrategy();
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+        final MergeEditConfigStrategy strategy = new MergeEditConfigStrategy();
+        final ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
 
         // add D3
 
         AttributeConfigElement attributeConfigElement = mock(AttributeConfigElement.class);
-        doReturn(Optional.of(new ObjectName[] {createReadOnlyModuleON(factoryName, D3)})).when(attributeConfigElement).getResolvedValue();
+        doReturn(Optional.of(new ObjectName[] {createReadOnlyModuleON(FACTORY_NAME, D3)}))
+                .when(attributeConfigElement).getResolvedValue();
         doReturn("mocked").when(attributeConfigElement).toString();
         String attributeName = MultipleDependenciesModule.testingDepsJmxAttribute.getAttributeName();
         doReturn(attributeName).when(attributeConfigElement).getJmxName();
@@ -71,18 +71,18 @@ public class MergeEditConfigStrategyTest extends AbstractConfigTest {
                 attributeName,
                 attributeConfigElement);
 
-        strategy.executeConfiguration(factoryName, PARENT, configuration, transaction,
+        strategy.executeConfiguration(FACTORY_NAME, PARENT, configuration, transaction,
                 mock(ServiceRegistryWrapper.class));
         transaction.commit();
 
         // parent's attribute should contain d1,d2,d3
         MultipleDependenciesModuleMXBean proxy = configRegistryClient.newMXBeanProxy(
-                createReadOnlyModuleON(factoryName, PARENT),
+                createReadOnlyModuleON(FACTORY_NAME, PARENT),
                 MultipleDependenciesModuleMXBean.class);
         List<ObjectName> testingDeps = proxy.getTestingDeps();
-        List<ObjectName> expected = asList(createReadOnlyModuleON(factoryName, D1),
-                createReadOnlyModuleON(factoryName, D2),
-                createReadOnlyModuleON(factoryName, D3));
+        List<ObjectName> expected = asList(createReadOnlyModuleON(FACTORY_NAME, D1),
+                createReadOnlyModuleON(FACTORY_NAME, D2),
+                createReadOnlyModuleON(FACTORY_NAME, D3));
         assertEquals(expected, testingDeps);
     }
 }