You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2025/02/17 09:19:06 UTC

(atlas) branch atlas-2.5 updated (b4a0d86cf -> 8f41b0c84)

This is an automated email from the ASF dual-hosted git repository.

madhan pushed a change to branch atlas-2.5
in repository https://gitbox.apache.org/repos/asf/atlas.git


    from b4a0d86cf ATLAS-4964: atlas-plugin-classloader module: update for code readabil… (#292)
     new d451c7dac ATLAS-4966 : atlas-server-api module: update for code readability imp… (#293)
     new 8f41b0c84 ATLAS-4966: atlas-server-api module: update for code readability improvements - #2

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 server-api/pom.xml                                 |  6 +-
 .../main/java/org/apache/atlas/RequestContext.java | 77 +++++++++++++---------
 .../atlas/exception/EntityNotFoundException.java   |  9 ++-
 .../apache/atlas/exception/NotFoundException.java  |  9 ++-
 .../org/apache/atlas/ha/AtlasServerIdSelector.java | 32 +++++----
 .../atlas/listener/ActiveStateChangeHandler.java   | 11 ++--
 .../atlas/listener/EntityChangeListener.java       |  7 +-
 .../apache/atlas/listener/TypesChangeListener.java |  5 +-
 .../org/apache/atlas/setup/SetupException.java     |  1 -
 .../java/org/apache/atlas/setup/SetupStep.java     |  1 -
 .../apache/atlas/ha/AtlasServerIdSelectorTest.java | 16 +++--
 11 files changed, 98 insertions(+), 76 deletions(-)
 rename server-api/src/{main/test => test/java}/org/apache/atlas/ha/AtlasServerIdSelectorTest.java (92%)


(atlas) 01/02: ATLAS-4966 : atlas-server-api module: update for code readability imp… (#293)

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch atlas-2.5
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit d451c7dac567579e20644ef70b7bbd0350a2f613
Author: pareshd <pa...@freestoneinfotech.com>
AuthorDate: Mon Feb 17 13:25:23 2025 +0530

    ATLAS-4966 : atlas-server-api module: update for code readability imp… (#293)
    
    (cherry picked from commit 43faf4f0591374bbb45027d751619f1d3411c301)
---
 server-api/pom.xml                                 |  6 +-
 .../main/java/org/apache/atlas/RequestContext.java | 71 +++++++++++++---------
 .../org/apache/atlas/ha/AtlasServerIdSelector.java | 32 ++++++----
 .../atlas/listener/ActiveStateChangeHandler.java   | 11 ++--
 .../atlas/listener/EntityChangeListener.java       |  7 +--
 .../apache/atlas/listener/TypesChangeListener.java |  5 +-
 .../org/apache/atlas/setup/SetupException.java     |  1 -
 .../java/org/apache/atlas/setup/SetupStep.java     |  1 -
 8 files changed, 77 insertions(+), 57 deletions(-)

diff --git a/server-api/pom.xml b/server-api/pom.xml
index cec6d0e98..bd4153859 100644
--- a/server-api/pom.xml
+++ b/server-api/pom.xml
@@ -31,8 +31,12 @@
     <name>Apache Atlas Server API</name>
     <description>Apache Atlas Server related APIs</description>
 
-    <dependencies>
+    <properties>
+        <checkstyle.failOnViolation>true</checkstyle.failOnViolation>
+        <checkstyle.skip>false</checkstyle.skip>
+    </properties>
 
+    <dependencies>
         <dependency>
             <groupId>org.apache.atlas</groupId>
             <artifactId>atlas-client-v1</artifactId>
diff --git a/server-api/src/main/java/org/apache/atlas/RequestContext.java b/server-api/src/main/java/org/apache/atlas/RequestContext.java
index e1670a924..ab921bec3 100644
--- a/server-api/src/main/java/org/apache/atlas/RequestContext.java
+++ b/server-api/src/main/java/org/apache/atlas/RequestContext.java
@@ -41,12 +41,11 @@ import java.util.Set;
 
 import static org.apache.atlas.model.instance.AtlasObjectId.KEY_GUID;
 
-
 public class RequestContext {
     private static final Logger METRICS = LoggerFactory.getLogger("METRICS");
 
-    private static final ThreadLocal<RequestContext> CURRENT_CONTEXT = new ThreadLocal<>();
-    private static final Set<RequestContext>         ACTIVE_REQUESTS = new HashSet<>();
+    private static final ThreadLocal<RequestContext> CURRENT_CONTEXT  = new ThreadLocal<>();
+    private static final Set<RequestContext>         ACTIVE_REQUESTS  = new HashSet<>();
     private static final boolean                     isMetricsEnabled = METRICS.isDebugEnabled();
 
     private final long                                   requestTime          = System.currentTimeMillis();
@@ -58,28 +57,27 @@ public class RequestContext {
     private final Map<String, List<AtlasClassification>> addedPropagations    = new HashMap<>();
     private final Map<String, List<AtlasClassification>> removedPropagations  = new HashMap<>();
     private final AtlasPerfMetrics                       metrics              = isMetricsEnabled ? new AtlasPerfMetrics() : null;
-    private       List<EntityGuidPair>                   entityGuidInRequest  = null;
+    private       List<EntityGuidPair>                   entityGuidInRequest;
     private final Set<String>                            entitiesToSkipUpdate = new HashSet<>();
     private final Set<String>                            onlyCAUpdateEntities = new HashSet<>();
     private final Set<String>                            onlyBAUpdateEntities = new HashSet<>();
     private final List<AtlasTask>                        queuedTasks          = new ArrayList<>();
 
-
     private String       user;
     private Set<String>  userGroups;
     private String       clientIPAddress;
     private List<String> forwardedAddresses;
-    private DeleteType   deleteType   = DeleteType.DEFAULT;
-    private boolean     isPurgeRequested = false;
-    private int         maxAttempts  = 1;
-    private int         attemptCount = 1;
-    private boolean     isImportInProgress = false;
-    private boolean     isMigrationInProgress = false;
-    private boolean     isInNotificationProcessing = false;
-    private boolean     isInTypePatching           = false;
-    private boolean     createShellEntityForNonExistingReference = false;
-    private boolean     skipFailedEntities = false;
-    private String      currentTypePatchAction = "";
+    private boolean      isPurgeRequested;
+    private boolean      skipFailedEntities;
+    private boolean      isImportInProgress;
+    private boolean      isMigrationInProgress;
+    private boolean      isInNotificationProcessing;
+    private boolean      isInTypePatching;
+    private boolean      createShellEntityForNonExistingReference;
+    private DeleteType   deleteType             = DeleteType.DEFAULT;
+    private String       currentTypePatchAction = "";
+    private int          maxAttempts            = 1;
+    private int          attemptCount           = 1;
 
     private RequestContext() {
     }
@@ -91,6 +89,7 @@ public class RequestContext {
 
         if (ret == null) {
             ret = new RequestContext();
+
             CURRENT_CONTEXT.set(ret);
 
             synchronized (ACTIVE_REQUESTS) {
@@ -141,20 +140,24 @@ public class RequestContext {
 
     public static String getCurrentUser() {
         RequestContext context = CURRENT_CONTEXT.get();
-        String ret = context != null ? context.getUser() : null;
+        String         ret     = context != null ? context.getUser() : null;
+
         if (StringUtils.isBlank(ret)) {
             try {
                 ret = UserGroupInformation.getLoginUser().getShortUserName();
             } catch (Exception e) {
                 ret = null;
             }
-            if (StringUtils.isBlank(ret)){
+
+            if (StringUtils.isBlank(ret)) {
                 ret = System.getProperty("user.name");
+
                 if (StringUtils.isBlank(ret)) {
                     ret = "atlas";
                 }
             }
         }
+
         return ret;
     }
 
@@ -171,9 +174,13 @@ public class RequestContext {
         this.userGroups = userGroups;
     }
 
-    public DeleteType getDeleteType() { return deleteType; }
+    public DeleteType getDeleteType() {
+        return deleteType;
+    }
 
-    public void setDeleteType(DeleteType deleteType) { this.deleteType = (deleteType == null) ? DeleteType.DEFAULT : deleteType; }
+    public void setDeleteType(DeleteType deleteType) {
+        this.deleteType = (deleteType == null) ? DeleteType.DEFAULT : deleteType;
+    }
 
     public String getClientIPAddress() {
         return clientIPAddress;
@@ -215,9 +222,13 @@ public class RequestContext {
         isImportInProgress = importInProgress;
     }
 
-    public boolean isPurgeRequested() { return isPurgeRequested; }
+    public boolean isPurgeRequested() {
+        return isPurgeRequested;
+    }
 
-    public void setPurgeRequested(boolean isPurgeRequested) { this.isPurgeRequested = isPurgeRequested; }
+    public void setPurgeRequested(boolean isPurgeRequested) {
+        this.isPurgeRequested = isPurgeRequested;
+    }
 
     public boolean isInNotificationProcessing() {
         return isInNotificationProcessing;
@@ -260,25 +271,25 @@ public class RequestContext {
     }
 
     public void recordEntityUpdate(AtlasEntityHeader entity) {
-        if (entity != null && entity.getGuid() != null && ! entitiesToSkipUpdate.contains(entity.getGuid())) {
+        if (entity != null && entity.getGuid() != null && !entitiesToSkipUpdate.contains(entity.getGuid())) {
             updatedEntities.put(entity.getGuid(), entity);
         }
     }
 
     public void recordEntityToSkip(String guid) {
-        if(! StringUtils.isEmpty(guid)) {
+        if (!StringUtils.isEmpty(guid)) {
             entitiesToSkipUpdate.add(guid);
         }
     }
 
     public void recordEntityWithCustomAttributeUpdate(String guid) {
-        if(! StringUtils.isEmpty(guid)) {
+        if (!StringUtils.isEmpty(guid)) {
             onlyCAUpdateEntities.add(guid);
         }
     }
 
     public void recordEntityWithBusinessAttributeUpdate(String guid) {
-        if(! StringUtils.isEmpty(guid)) {
+        if (!StringUtils.isEmpty(guid)) {
             onlyBAUpdateEntities.add(guid);
         }
     }
@@ -378,7 +389,9 @@ public class RequestContext {
         return diffEntityCache.get(guid);
     }
 
-    public Collection<AtlasEntity> getDifferentialEntities() { return diffEntityCache.values(); }
+    public Collection<AtlasEntity> getDifferentialEntities() {
+        return diffEntityCache.values();
+    }
 
     public Collection<AtlasEntityHeader> getUpdatedEntities() {
         return updatedEntities.values();
@@ -423,7 +436,9 @@ public class RequestContext {
         return deletedEntities.containsKey(guid);
     }
 
-    public MetricRecorder startMetricRecord(String name) { return metrics != null ? metrics.getMetricRecorder(name) : null; }
+    public MetricRecorder startMetricRecord(String name) {
+        return metrics != null ? metrics.getMetricRecorder(name) : null;
+    }
 
     public void endMetricRecord(MetricRecorder recorder) {
         if (metrics != null && recorder != null) {
diff --git a/server-api/src/main/java/org/apache/atlas/ha/AtlasServerIdSelector.java b/server-api/src/main/java/org/apache/atlas/ha/AtlasServerIdSelector.java
index 93d1d9e22..b28cdc8e0 100644
--- a/server-api/src/main/java/org/apache/atlas/ha/AtlasServerIdSelector.java
+++ b/server-api/src/main/java/org/apache/atlas/ha/AtlasServerIdSelector.java
@@ -29,9 +29,12 @@ import org.slf4j.LoggerFactory;
 import java.net.InetSocketAddress;
 
 public class AtlasServerIdSelector {
-
     private static final Logger LOG = LoggerFactory.getLogger(AtlasServerIdSelector.class);
 
+    private AtlasServerIdSelector() {
+        throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
+    }
+
     /**
      * Return the ID corresponding to this Atlas instance.
      *
@@ -46,37 +49,42 @@ public class AtlasServerIdSelector {
      */
     public static String selectServerId(Configuration configuration) throws AtlasException {
         // ids are already trimmed by this method
-        String[] ids = configuration.getStringArray(HAConfiguration.ATLAS_SERVER_IDS);
-        String matchingServerId = null;
-        int appPort = Integer.parseInt(System.getProperty(AtlasConstants.SYSTEM_PROPERTY_APP_PORT));
+        String[] ids              = configuration.getStringArray(HAConfiguration.ATLAS_SERVER_IDS);
+        String   matchingServerId = null;
+        int      appPort          = Integer.parseInt(System.getProperty(AtlasConstants.SYSTEM_PROPERTY_APP_PORT));
+
         for (String id : ids) {
-            String hostPort = configuration.getString(HAConfiguration.ATLAS_SERVER_ADDRESS_PREFIX +id);
+            String hostPort = configuration.getString(HAConfiguration.ATLAS_SERVER_ADDRESS_PREFIX + id);
+
             if (!StringUtils.isEmpty(hostPort)) {
                 InetSocketAddress socketAddress;
+
                 try {
                     socketAddress = NetUtils.createSocketAddr(hostPort);
                 } catch (Exception e) {
                     LOG.warn("Exception while trying to get socket address for {}", hostPort, e);
+
                     continue;
                 }
-                if (!socketAddress.isUnresolved()
-                        && NetUtils.isLocalAddress(socketAddress.getAddress())
-                        && appPort == socketAddress.getPort()) {
+
+                if (!socketAddress.isUnresolved() && NetUtils.isLocalAddress(socketAddress.getAddress()) && appPort == socketAddress.getPort()) {
                     LOG.info("Found matched server id {} with host port: {}", id, hostPort);
+
                     matchingServerId = id;
+
                     break;
                 }
             } else {
                 LOG.info("Could not find matching address entry for id: {}", id);
             }
         }
+
         if (matchingServerId == null) {
-            String msg = String.format("Could not find server id for this instance. " +
-                            "Unable to find IDs matching any local host and port binding among %s",
-                    StringUtils.join(ids, ","));
+            String msg = String.format("Could not find server id for this instance. Unable to find IDs matching any local host and port binding among %s", StringUtils.join(ids, ","));
+
             throw new AtlasException(msg);
         }
+
         return matchingServerId;
     }
-
 }
diff --git a/server-api/src/main/java/org/apache/atlas/listener/ActiveStateChangeHandler.java b/server-api/src/main/java/org/apache/atlas/listener/ActiveStateChangeHandler.java
index 2916d6b46..d49162efa 100644
--- a/server-api/src/main/java/org/apache/atlas/listener/ActiveStateChangeHandler.java
+++ b/server-api/src/main/java/org/apache/atlas/listener/ActiveStateChangeHandler.java
@@ -26,7 +26,7 @@ import org.apache.atlas.AtlasException;
  * The two state transitions we handle are (1) becoming active and (2) becoming passive.
  */
 public interface ActiveStateChangeHandler {
-    public enum HandlerOrder {
+    enum HandlerOrder {
         AUDIT_REPOSITORY(0),
         GRAPH_BACKED_SEARCH_INDEXER(1),
         TYPEDEF_STORE_INITIALIZER(2),
@@ -38,11 +38,13 @@ public interface ActiveStateChangeHandler {
 
         private final int order;
 
-        private HandlerOrder(int order) {
+        HandlerOrder(int order) {
             this.order = order;
         }
 
-        public int getOrder() { return order; }
+        public int getOrder() {
+            return order;
+        }
     }
 
     /**
@@ -63,14 +65,13 @@ public interface ActiveStateChangeHandler {
      *
      * @throws {@link AtlasException} if anything is wrong on shutdown
      */
-    void instanceIsPassive() throws AtlasException;
 
+    void instanceIsPassive() throws AtlasException;
 
     /**
      * Defines the order in which the handler should be called.
      *   When state becomes active, the handler will be called from low order to high
      *   When state becomes passive, the handler will be called from high order to low
-     *
      */
     int getHandlerOrder();
 }
diff --git a/server-api/src/main/java/org/apache/atlas/listener/EntityChangeListener.java b/server-api/src/main/java/org/apache/atlas/listener/EntityChangeListener.java
index e24f582c8..d0623190c 100644
--- a/server-api/src/main/java/org/apache/atlas/listener/EntityChangeListener.java
+++ b/server-api/src/main/java/org/apache/atlas/listener/EntityChangeListener.java
@@ -71,17 +71,14 @@ public interface EntityChangeListener {
 
     /**
      * This is upon updating a trait from a typed instance.
-     *
      * @param entity    the entity
      * @param traits    trait that needs to be added to entity
-     *
      * @throws AtlasException if the listener notification fails
      */
     void onTraitsUpdated(Referenceable entity, Collection<? extends Struct> traits) throws AtlasException;
-    
+
     /**
      * This is upon deleting entities from the repository.
-     *
      * @param entities the deleted entities
      * @param isImport
      * @throws AtlasException
@@ -90,7 +87,6 @@ public interface EntityChangeListener {
 
     /**
      * This is upon adding a new term to a list of typed instance.
-     *
      * @param entities entity list
      * @param term  term that needs to be added to entity
      * @throws AtlasException if the listener notification fails
@@ -99,7 +95,6 @@ public interface EntityChangeListener {
 
     /**
      * This is upon adding a new trait to a typed instance.
-     *
      * @param entities entity list
      * @param term  term that needs to be added to entity
      * @throws AtlasException if the listener notification fails
diff --git a/server-api/src/main/java/org/apache/atlas/listener/TypesChangeListener.java b/server-api/src/main/java/org/apache/atlas/listener/TypesChangeListener.java
index 0fcec5061..d31f20511 100644
--- a/server-api/src/main/java/org/apache/atlas/listener/TypesChangeListener.java
+++ b/server-api/src/main/java/org/apache/atlas/listener/TypesChangeListener.java
@@ -27,7 +27,6 @@ import java.util.Collection;
  * Types change notification listener.
  */
 public interface TypesChangeListener {
-
     /**
      * This is upon adding new type(s) to Store.
      *
@@ -44,6 +43,6 @@ public interface TypesChangeListener {
      */
     // void onRemove(String typeName) throws MetadataException;
 
-     //This is upon updating an existing type to the store
-     void onChange(Collection<? extends AtlasType> dataTypes) throws AtlasException;
+    //This is upon updating an existing type to the store
+    void onChange(Collection<? extends AtlasType> dataTypes) throws AtlasException;
 }
diff --git a/server-api/src/main/java/org/apache/atlas/setup/SetupException.java b/server-api/src/main/java/org/apache/atlas/setup/SetupException.java
index 5ecea3c6f..562901ecd 100644
--- a/server-api/src/main/java/org/apache/atlas/setup/SetupException.java
+++ b/server-api/src/main/java/org/apache/atlas/setup/SetupException.java
@@ -19,7 +19,6 @@
 package org.apache.atlas.setup;
 
 public class SetupException extends Exception {
-
     public SetupException(String message) {
         super(message);
     }
diff --git a/server-api/src/main/java/org/apache/atlas/setup/SetupStep.java b/server-api/src/main/java/org/apache/atlas/setup/SetupStep.java
index 77632df3e..9fe5ea560 100644
--- a/server-api/src/main/java/org/apache/atlas/setup/SetupStep.java
+++ b/server-api/src/main/java/org/apache/atlas/setup/SetupStep.java
@@ -17,7 +17,6 @@
  */
 
 package org.apache.atlas.setup;
-
 /**
  * Represents a step that initializes some dependency of Atlas.
  *


(atlas) 02/02: ATLAS-4966: atlas-server-api module: update for code readability improvements - #2

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch atlas-2.5
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 8f41b0c842558a3a6c261cb3722effbfa2ecdb69
Author: Madhan Neethiraj <ma...@apache.org>
AuthorDate: Mon Feb 17 01:12:01 2025 -0800

    ATLAS-4966: atlas-server-api module: update for code readability improvements - #2
    
    (cherry picked from commit 4e3b9a66f33519b66ee79f85c5fb4d769fc723a5)
---
 .../src/main/java/org/apache/atlas/RequestContext.java   | 10 +++++-----
 .../apache/atlas/exception/EntityNotFoundException.java  |  9 ++++-----
 .../org/apache/atlas/exception/NotFoundException.java    |  9 ++++-----
 .../org/apache/atlas/ha/AtlasServerIdSelectorTest.java   | 16 ++++++++++------
 4 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/server-api/src/main/java/org/apache/atlas/RequestContext.java b/server-api/src/main/java/org/apache/atlas/RequestContext.java
index ab921bec3..b3acdb627 100644
--- a/server-api/src/main/java/org/apache/atlas/RequestContext.java
+++ b/server-api/src/main/java/org/apache/atlas/RequestContext.java
@@ -44,9 +44,9 @@ import static org.apache.atlas.model.instance.AtlasObjectId.KEY_GUID;
 public class RequestContext {
     private static final Logger METRICS = LoggerFactory.getLogger("METRICS");
 
-    private static final ThreadLocal<RequestContext> CURRENT_CONTEXT  = new ThreadLocal<>();
-    private static final Set<RequestContext>         ACTIVE_REQUESTS  = new HashSet<>();
-    private static final boolean                     isMetricsEnabled = METRICS.isDebugEnabled();
+    private static final ThreadLocal<RequestContext> CURRENT_CONTEXT    = new ThreadLocal<>();
+    private static final Set<RequestContext>         ACTIVE_REQUESTS    = new HashSet<>();
+    private static final boolean                     IS_METRICS_ENABLED = METRICS.isDebugEnabled();
 
     private final long                                   requestTime          = System.currentTimeMillis();
     private final Map<String, AtlasEntityHeader>         updatedEntities      = new HashMap<>();
@@ -56,7 +56,7 @@ public class RequestContext {
     private final Map<String, AtlasEntity>               diffEntityCache      = new HashMap<>();
     private final Map<String, List<AtlasClassification>> addedPropagations    = new HashMap<>();
     private final Map<String, List<AtlasClassification>> removedPropagations  = new HashMap<>();
-    private final AtlasPerfMetrics                       metrics              = isMetricsEnabled ? new AtlasPerfMetrics() : null;
+    private final AtlasPerfMetrics                       metrics              = IS_METRICS_ENABLED ? new AtlasPerfMetrics() : null;
     private       List<EntityGuidPair>                   entityGuidInRequest;
     private final Set<String>                            entitiesToSkipUpdate = new HashSet<>();
     private final Set<String>                            onlyCAUpdateEntities = new HashSet<>();
@@ -482,7 +482,7 @@ public class RequestContext {
         return this.queuedTasks;
     }
 
-    public class EntityGuidPair {
+    public static class EntityGuidPair {
         private final Object entity;
         private final String guid;
 
diff --git a/server-api/src/main/java/org/apache/atlas/exception/EntityNotFoundException.java b/server-api/src/main/java/org/apache/atlas/exception/EntityNotFoundException.java
index 14be3ed62..7584761f0 100644
--- a/server-api/src/main/java/org/apache/atlas/exception/EntityNotFoundException.java
+++ b/server-api/src/main/java/org/apache/atlas/exception/EntityNotFoundException.java
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,8 +37,7 @@ public class EntityNotFoundException extends NotFoundException {
         super(cause);
     }
 
-    public EntityNotFoundException(String message, Throwable cause, boolean enableSuppression,
-            boolean writableStackTrace) {
+    public EntityNotFoundException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
         super(message, cause, enableSuppression, writableStackTrace);
     }
 }
diff --git a/server-api/src/main/java/org/apache/atlas/exception/NotFoundException.java b/server-api/src/main/java/org/apache/atlas/exception/NotFoundException.java
index c24789ddf..a0dc7660d 100644
--- a/server-api/src/main/java/org/apache/atlas/exception/NotFoundException.java
+++ b/server-api/src/main/java/org/apache/atlas/exception/NotFoundException.java
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,8 +39,7 @@ public class NotFoundException extends AtlasException {
         super(cause);
     }
 
-    public NotFoundException(String message, Throwable cause, boolean enableSuppression,
-                             boolean writableStackTrace) {
+    public NotFoundException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
         super(message, cause, enableSuppression, writableStackTrace);
     }
 }
diff --git a/server-api/src/main/test/org/apache/atlas/ha/AtlasServerIdSelectorTest.java b/server-api/src/test/java/org/apache/atlas/ha/AtlasServerIdSelectorTest.java
similarity index 92%
rename from server-api/src/main/test/org/apache/atlas/ha/AtlasServerIdSelectorTest.java
rename to server-api/src/test/java/org/apache/atlas/ha/AtlasServerIdSelectorTest.java
index 3321ce48f..c99e0eeb3 100644
--- a/server-api/src/main/test/org/apache/atlas/ha/AtlasServerIdSelectorTest.java
+++ b/server-api/src/test/java/org/apache/atlas/ha/AtlasServerIdSelectorTest.java
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,26 +43,30 @@ public class AtlasServerIdSelectorTest {
     @Test
     public void testShouldSelectRightServerAddress() throws AtlasException {
         when(configuration.getStringArray(HAConfiguration.ATLAS_SERVER_IDS)).thenReturn(new String[] {"id1", "id2"});
-        when(configuration.getString(HAConfiguration.ATLAS_SERVER_ADDRESS_PREFIX +"id1")).thenReturn("127.0.0.1:31000");
-        when(configuration.getString(HAConfiguration.ATLAS_SERVER_ADDRESS_PREFIX +"id2")).thenReturn("127.0.0.1:21000");
+        when(configuration.getString(HAConfiguration.ATLAS_SERVER_ADDRESS_PREFIX + "id1")).thenReturn("127.0.0.1:31000");
+        when(configuration.getString(HAConfiguration.ATLAS_SERVER_ADDRESS_PREFIX + "id2")).thenReturn("127.0.0.1:21000");
 
         String atlasServerId = AtlasServerIdSelector.selectServerId(configuration);
+
         assertEquals(atlasServerId, "id2");
     }
 
     @Test(expectedExceptions = AtlasException.class)
     public void testShouldFailIfNoIDsConfiguration() throws AtlasException {
         when(configuration.getStringArray(HAConfiguration.ATLAS_SERVER_IDS)).thenReturn(new String[] {});
+
         AtlasServerIdSelector.selectServerId(configuration);
+
         fail("Should not return any server id if IDs not found in configuration");
     }
 
     @Test(expectedExceptions = AtlasException.class)
     public void testShouldFailIfNoMatchingAddressForID() throws AtlasException {
         when(configuration.getStringArray(HAConfiguration.ATLAS_SERVER_IDS)).thenReturn(new String[] {"id1", "id2"});
-        when(configuration.getString(HAConfiguration.ATLAS_SERVER_ADDRESS_PREFIX +"id1")).thenReturn("127.0.0.1:31000");
+        when(configuration.getString(HAConfiguration.ATLAS_SERVER_ADDRESS_PREFIX + "id1")).thenReturn("127.0.0.1:31000");
 
         AtlasServerIdSelector.selectServerId(configuration);
+
         fail("Should not return any server id if no matching address found for any ID");
     }
 }