Commit 116fb62c by Ashutosh Mestry

ATLAS-2845: Rename AtlasCluster to AtlasServer.

parent c0a91c7e
...@@ -100,12 +100,20 @@ ...@@ -100,12 +100,20 @@
] ]
}, },
{ {
"name": "AtlasCluster", "name": "AtlasServer",
"typeVersion": "1.0", "typeVersion": "1.0",
"superTypes": [ "superTypes": [
], ],
"attributeDefs": [ "attributeDefs": [
{ {
"name": "name",
"typeName": "string",
"cardinality": "SINGLE",
"isIndexable": true,
"isOptional": false,
"isUnique": false
},
{
"name": "displayName", "name": "displayName",
"typeName": "string", "typeName": "string",
"cardinality": "SINGLE", "cardinality": "SINGLE",
...@@ -114,7 +122,7 @@ ...@@ -114,7 +122,7 @@
"isUnique": false "isUnique": false
}, },
{ {
"name": "qualifiedName", "name": "fullName",
"typeName": "string", "typeName": "string",
"cardinality": "SINGLE", "cardinality": "SINGLE",
"isIndexable": true, "isIndexable": true,
...@@ -258,7 +266,7 @@ ...@@ -258,7 +266,7 @@
"isUnique": false "isUnique": false
}, },
{ {
"name": "sourceClusterName", "name": "sourceServerName",
"typeName": "string", "typeName": "string",
"cardinality": "SINGLE", "cardinality": "SINGLE",
"isIndexable": true, "isIndexable": true,
...@@ -266,7 +274,7 @@ ...@@ -266,7 +274,7 @@
"isUnique": false "isUnique": false
}, },
{ {
"name": "targetClusterName", "name": "targetServerName",
"typeName": "string", "typeName": "string",
"cardinality": "SINGLE", "cardinality": "SINGLE",
"isIndexable": true, "isIndexable": true,
......
...@@ -8,16 +8,16 @@ ...@@ -8,16 +8,16 @@
"params": null, "params": null,
"attributeDefs": [ "attributeDefs": [
{ {
"name": "replicatedFromCluster", "name": "replicatedFrom",
"typeName": "array<AtlasCluster>", "typeName": "array<AtlasServer>",
"cardinality": "SET", "cardinality": "SET",
"isIndexable": false, "isIndexable": false,
"isOptional": true, "isOptional": true,
"isUnique": false "isUnique": false
}, },
{ {
"name": "replicatedToCluster", "name": "replicatedTo",
"typeName": "array<AtlasCluster>", "typeName": "array<AtlasServer>",
"cardinality": "SET", "cardinality": "SET",
"isIndexable": false, "isIndexable": false,
"isOptional": true, "isOptional": true,
......
...@@ -37,7 +37,7 @@ import com.sun.jersey.multipart.MultiPart; ...@@ -37,7 +37,7 @@ import com.sun.jersey.multipart.MultiPart;
import com.sun.jersey.multipart.file.FileDataBodyPart; import com.sun.jersey.multipart.file.FileDataBodyPart;
import com.sun.jersey.multipart.file.StreamDataBodyPart; import com.sun.jersey.multipart.file.StreamDataBodyPart;
import com.sun.jersey.multipart.impl.MultiPartWriter; import com.sun.jersey.multipart.impl.MultiPartWriter;
import org.apache.atlas.model.impexp.AtlasCluster; import org.apache.atlas.model.impexp.AtlasServer;
import org.apache.atlas.model.impexp.AtlasExportRequest; import org.apache.atlas.model.impexp.AtlasExportRequest;
import org.apache.atlas.model.impexp.AtlasImportRequest; import org.apache.atlas.model.impexp.AtlasImportRequest;
import org.apache.atlas.model.impexp.AtlasImportResult; import org.apache.atlas.model.impexp.AtlasImportResult;
...@@ -80,7 +80,7 @@ public abstract class AtlasBaseClient { ...@@ -80,7 +80,7 @@ public abstract class AtlasBaseClient {
public static final String ADMIN_METRICS = "admin/metrics"; public static final String ADMIN_METRICS = "admin/metrics";
public static final String ADMIN_IMPORT = "admin/import"; public static final String ADMIN_IMPORT = "admin/import";
public static final String ADMIN_EXPORT = "admin/export"; public static final String ADMIN_EXPORT = "admin/export";
public static final String ADMIN_CLUSTER_TEMPLATE = "%sadmin/cluster/%s"; public static final String ADMIN_SERVER_TEMPLATE = "%sadmin/server/%s";
public static final String QUERY = "query"; public static final String QUERY = "query";
public static final String LIMIT = "limit"; public static final String LIMIT = "limit";
...@@ -526,9 +526,9 @@ public abstract class AtlasBaseClient { ...@@ -526,9 +526,9 @@ public abstract class AtlasBaseClient {
return new FormDataBodyPart(IMPORT_REQUEST_PARAMTER, AtlasType.toJson(request), MediaType.APPLICATION_JSON_TYPE); return new FormDataBodyPart(IMPORT_REQUEST_PARAMTER, AtlasType.toJson(request), MediaType.APPLICATION_JSON_TYPE);
} }
public AtlasCluster getCluster(String clusterName) throws AtlasServiceException { public AtlasServer getServer(String serverName) throws AtlasServiceException {
API api = new API(String.format(ADMIN_CLUSTER_TEMPLATE, BASE_URI, clusterName), HttpMethod.GET, Response.Status.OK); API api = new API(String.format(ADMIN_SERVER_TEMPLATE, BASE_URI, serverName), HttpMethod.GET, Response.Status.OK);
return callAPI(api, AtlasCluster.class, null); return callAPI(api, AtlasServer.class, null);
} }
boolean isRetryableException(ClientHandlerException che) { boolean isRetryableException(ClientHandlerException che) {
......
...@@ -164,8 +164,8 @@ public final class Constants { ...@@ -164,8 +164,8 @@ public final class Constants {
*/ */
public static final String ATTR_NAME_REFERENCEABLE = "Referenceable."; public static final String ATTR_NAME_REFERENCEABLE = "Referenceable.";
public static final String ATTR_NAME_REPLICATED_TO_CLUSTER = "replicatedToCluster"; public static final String ATTR_NAME_REPLICATED_TO = "replicatedTo";
public static final String ATTR_NAME_REPLICATED_FROM_CLUSTER = "replicatedFromCluster"; public static final String ATTR_NAME_REPLICATED_FROM = "replicatedFrom";
private Constants() { private Constants() {
} }
......
...@@ -35,25 +35,28 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ ...@@ -35,25 +35,28 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_
@JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE) @JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class AtlasCluster extends AtlasBaseModelObject implements Serializable { public class AtlasServer extends AtlasBaseModelObject implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final String KEY_REPLICATION_DETAILS = "REPL_DETAILS"; public static final String KEY_REPLICATION_DETAILS = "REPL_DETAILS";
private String name; private String name;
private String qualifiedName; private String fullName;
private Map<String, String> additionalInfo; private String displayName;
private List<String> urls; private Map<String, String> additionalInfo = new HashMap<>();
private List<String> urls = new ArrayList<>();
public AtlasCluster() { public AtlasServer() {
urls = new ArrayList<>();
additionalInfo = new HashMap<>();
} }
public AtlasCluster(String name, String qualifiedName) { public AtlasServer(String name, String fullName) {
this(); this(name, name, fullName);
this.name = name; }
this.qualifiedName = qualifiedName;
public AtlasServer(String name, String displayName, String fullName) {
this.name = name;
this.displayName = displayName;
this.fullName = fullName;
} }
public void setName(String name) { public void setName(String name) {
...@@ -64,12 +67,45 @@ public class AtlasCluster extends AtlasBaseModelObject implements Serializable { ...@@ -64,12 +67,45 @@ public class AtlasCluster extends AtlasBaseModelObject implements Serializable {
return this.name; return this.name;
} }
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public void setAdditionalInfo(Map<String, String> additionalInfo) { public void setAdditionalInfo(Map<String, String> additionalInfo) {
this.additionalInfo = additionalInfo; this.additionalInfo = additionalInfo;
} }
public Map<String, String> getAdditionalInfo() {
return this.additionalInfo;
}
public String getAdditionalInfo(String key) {
return additionalInfo.get(key);
}
public void setUrls(List<String> urls) {
this.urls = urls;
}
public List<String> getUrls() {
return this.urls;
}
public void setAdditionalInfo(String key, String value) { public void setAdditionalInfo(String key, String value) {
if(additionalInfo == null) { if (additionalInfo == null) {
additionalInfo = new HashMap<>(); additionalInfo = new HashMap<>();
} }
...@@ -79,15 +115,15 @@ public class AtlasCluster extends AtlasBaseModelObject implements Serializable { ...@@ -79,15 +115,15 @@ public class AtlasCluster extends AtlasBaseModelObject implements Serializable {
public void setAdditionalInfoRepl(String guid, long modifiedTimestamp) { public void setAdditionalInfoRepl(String guid, long modifiedTimestamp) {
Map<String, Object> replicationDetailsMap = null; Map<String, Object> replicationDetailsMap = null;
if(additionalInfo != null && additionalInfo.containsKey(KEY_REPLICATION_DETAILS)) { if (additionalInfo != null && additionalInfo.containsKey(KEY_REPLICATION_DETAILS)) {
replicationDetailsMap = AtlasType.fromJson(getAdditionalInfo().get(KEY_REPLICATION_DETAILS), Map.class); replicationDetailsMap = AtlasType.fromJson(getAdditionalInfo().get(KEY_REPLICATION_DETAILS), Map.class);
} }
if(replicationDetailsMap == null) { if (replicationDetailsMap == null) {
replicationDetailsMap = new HashMap<>(); replicationDetailsMap = new HashMap<>();
} }
if(modifiedTimestamp == 0) { if (modifiedTimestamp == 0) {
replicationDetailsMap.remove(guid); replicationDetailsMap.remove(guid);
} else { } else {
replicationDetailsMap.put(guid, modifiedTimestamp); replicationDetailsMap.put(guid, modifiedTimestamp);
...@@ -96,59 +132,37 @@ public class AtlasCluster extends AtlasBaseModelObject implements Serializable { ...@@ -96,59 +132,37 @@ public class AtlasCluster extends AtlasBaseModelObject implements Serializable {
updateReplicationMap(replicationDetailsMap); updateReplicationMap(replicationDetailsMap);
} }
private void updateReplicationMap(Map<String, Object> replicationDetailsMap) {
String json = AtlasType.toJson(replicationDetailsMap);
setAdditionalInfo(KEY_REPLICATION_DETAILS, json);
}
public Object getAdditionalInfoRepl(String guid) { public Object getAdditionalInfoRepl(String guid) {
if(additionalInfo == null || !additionalInfo.containsKey(KEY_REPLICATION_DETAILS)) { if (additionalInfo == null || !additionalInfo.containsKey(KEY_REPLICATION_DETAILS)) {
return null; return null;
} }
String key = guid; String key = guid;
String mapJson = additionalInfo.get(KEY_REPLICATION_DETAILS); String mapJson = additionalInfo.get(KEY_REPLICATION_DETAILS);
Map<String, String> replicationDetailsMap = AtlasType.fromJson(mapJson, Map.class); Map<String, String> replicationDetailsMap = AtlasType.fromJson(mapJson, Map.class);
if(!replicationDetailsMap.containsKey(key)) {
if (!replicationDetailsMap.containsKey(key)) {
return null; return null;
} }
return replicationDetailsMap.get(key); return replicationDetailsMap.get(key);
} }
public Map<String, String> getAdditionalInfo() {
return this.additionalInfo;
}
public String getAdditionalInfo(String key) {
return additionalInfo.get(key);
}
public String getQualifiedName() {
return qualifiedName;
}
public void setQualifiedName(String qualifiedName) {
this.qualifiedName = qualifiedName;
}
public void setUrls(List<String> urls) {
this.urls = urls;
}
public List<String> getUrls() {
return this.urls;
}
@Override @Override
public StringBuilder toString(StringBuilder sb) { public StringBuilder toString(StringBuilder sb) {
sb.append(", name=").append(name); sb.append(", name=").append(name);
sb.append(", qualifiedName=").append(getQualifiedName()); sb.append(", fullName=").append(fullName);
sb.append(", urls=").append(urls); sb.append(", displayName=").append(displayName);
sb.append(", additionalInfo=").append(additionalInfo); sb.append(", additionalInfo=").append(additionalInfo);
sb.append("}"); sb.append(", urls=").append(urls);
return sb; return sb;
} }
private void updateReplicationMap(Map<String, Object> replicationDetailsMap) {
String json = AtlasType.toJson(replicationDetailsMap);
setAdditionalInfo(KEY_REPLICATION_DETAILS, json);
}
} }
...@@ -93,19 +93,19 @@ public class ExportImportAuditEntry extends AtlasBaseModelObject implements Seri ...@@ -93,19 +93,19 @@ public class ExportImportAuditEntry extends AtlasBaseModelObject implements Seri
return this.endTime; return this.endTime;
} }
public String getTargetClusterName() { public String getTargetServerName() {
return this.targetClusterName; return this.targetClusterName;
} }
public String getSourceClusterName() { public String getSourceServerName() {
return this.sourceClusterName; return this.sourceClusterName;
} }
public void setSourceClusterName(String sourceClusterName) { public void setSourceServerName(String sourceClusterName) {
this.sourceClusterName = sourceClusterName; this.sourceClusterName = sourceClusterName;
} }
public void setTargetClusterName(String targetClusterName) { public void setTargetServerName(String targetClusterName) {
this.targetClusterName = targetClusterName; this.targetClusterName = targetClusterName;
} }
......
...@@ -21,7 +21,7 @@ package org.apache.atlas.repository.impexp; ...@@ -21,7 +21,7 @@ package org.apache.atlas.repository.impexp;
import org.apache.atlas.annotation.AtlasService; import org.apache.atlas.annotation.AtlasService;
import org.apache.atlas.annotation.GraphTransaction; import org.apache.atlas.annotation.GraphTransaction;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.impexp.AtlasCluster; import org.apache.atlas.model.impexp.AtlasServer;
import org.apache.atlas.model.instance.AtlasEntity; import org.apache.atlas.model.instance.AtlasEntity;
import org.apache.atlas.model.instance.AtlasObjectId; import org.apache.atlas.model.instance.AtlasObjectId;
import org.apache.atlas.repository.graphdb.AtlasVertex; import org.apache.atlas.repository.graphdb.AtlasVertex;
...@@ -42,8 +42,8 @@ import java.util.ArrayList; ...@@ -42,8 +42,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
@AtlasService @AtlasService
public class ClusterService { public class AtlasServerService {
private static final Logger LOG = LoggerFactory.getLogger(ClusterService.class); private static final Logger LOG = LoggerFactory.getLogger(AtlasServerService.class);
private final DataAccess dataAccess; private final DataAccess dataAccess;
private final AtlasEntityStore entityStore; private final AtlasEntityStore entityStore;
...@@ -51,46 +51,68 @@ public class ClusterService { ...@@ -51,46 +51,68 @@ public class ClusterService {
private final EntityGraphRetriever entityGraphRetriever; private final EntityGraphRetriever entityGraphRetriever;
@Inject @Inject
public ClusterService(DataAccess dataAccess, AtlasEntityStore entityStore, AtlasTypeRegistry typeRegistry, EntityGraphRetriever entityGraphRetriever) { public AtlasServerService(DataAccess dataAccess, AtlasEntityStore entityStore,
AtlasTypeRegistry typeRegistry,
EntityGraphRetriever entityGraphRetriever) {
this.dataAccess = dataAccess; this.dataAccess = dataAccess;
this.entityStore = entityStore; this.entityStore = entityStore;
this.typeRegistry = typeRegistry; this.typeRegistry = typeRegistry;
this.entityGraphRetriever = entityGraphRetriever; this.entityGraphRetriever = entityGraphRetriever;
} }
public AtlasCluster get(AtlasCluster cluster) throws AtlasBaseException { public AtlasServer get(AtlasServer server) throws AtlasBaseException {
try { try {
return dataAccess.load(cluster); return dataAccess.load(server);
} catch (AtlasBaseException e) { } catch (AtlasBaseException e) {
LOG.error("dataAccess", e); LOG.error("dataAccess", e);
throw e; throw e;
} }
} }
public AtlasServer getCreateAtlasServer(String name, String fullName) throws AtlasBaseException {
AtlasServer defaultServer = new AtlasServer(name, fullName);
AtlasServer server = getAtlasServer(defaultServer);
if (server == null) {
return save(defaultServer);
}
return server;
}
private AtlasServer getAtlasServer(AtlasServer server) {
try {
return get(server);
} catch (AtlasBaseException ex) {
return null;
}
}
@GraphTransaction @GraphTransaction
public AtlasCluster save(AtlasCluster clusterInfo) { public AtlasServer save(AtlasServer server) {
try { try {
return dataAccess.save(clusterInfo); return dataAccess.save(server);
} catch (AtlasBaseException e) { } catch (AtlasBaseException e) {
return clusterInfo; return server;
} }
} }
@GraphTransaction @GraphTransaction
public void updateEntitiesWithCluster(AtlasCluster cluster, List<String> entityGuids, String attributeName) throws AtlasBaseException { public void updateEntitiesWithServer(AtlasServer server, List<String> entityGuids, String attributeName) throws AtlasBaseException {
if (cluster != null && StringUtils.isEmpty(cluster.getGuid())) { if (server != null && StringUtils.isEmpty(server.getGuid())) {
return; return;
} }
AtlasObjectId objectId = getObjectId(cluster); AtlasObjectId objectId = getObjectId(server);
for (String guid : entityGuids) { for (String guid : entityGuids) {
AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo = entityStore.getById(guid); AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo = entityStore.getById(guid);
updateAttribute(entityWithExtInfo, attributeName, objectId); updateAttribute(entityWithExtInfo, attributeName, objectId);
} }
} }
private AtlasObjectId getObjectId(AtlasCluster cluster) { private AtlasObjectId getObjectId(AtlasServer server) {
return new AtlasObjectId(cluster.getGuid(), AtlasCluster.class.getSimpleName()); return new AtlasObjectId(server.getGuid(), AtlasServer.class.getSimpleName());
} }
......
...@@ -22,7 +22,7 @@ import org.apache.atlas.ApplicationProperties; ...@@ -22,7 +22,7 @@ import org.apache.atlas.ApplicationProperties;
import org.apache.atlas.AtlasConstants; import org.apache.atlas.AtlasConstants;
import org.apache.atlas.AtlasException; import org.apache.atlas.AtlasException;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.impexp.AtlasCluster; import org.apache.atlas.model.impexp.AtlasServer;
import org.apache.atlas.model.impexp.AtlasExportRequest; import org.apache.atlas.model.impexp.AtlasExportRequest;
import org.apache.atlas.model.impexp.AtlasExportResult; import org.apache.atlas.model.impexp.AtlasExportResult;
import org.apache.atlas.model.impexp.AtlasImportRequest; import org.apache.atlas.model.impexp.AtlasImportRequest;
...@@ -45,15 +45,15 @@ public class AuditsWriter { ...@@ -45,15 +45,15 @@ public class AuditsWriter {
private static final Logger LOG = LoggerFactory.getLogger(AuditsWriter.class); private static final Logger LOG = LoggerFactory.getLogger(AuditsWriter.class);
private static final String CLUSTER_NAME_DEFAULT = "default"; private static final String CLUSTER_NAME_DEFAULT = "default";
private ClusterService clusterService; private AtlasServerService atlasServerService;
private ExportImportAuditService auditService; private ExportImportAuditService auditService;
private ExportAudits auditForExport = new ExportAudits(); private ExportAudits auditForExport = new ExportAudits();
private ImportAudits auditForImport = new ImportAudits(); private ImportAudits auditForImport = new ImportAudits();
@Inject @Inject
public AuditsWriter(ClusterService clusterService, ExportImportAuditService auditService) { public AuditsWriter(AtlasServerService atlasServerService, ExportImportAuditService auditService) {
this.clusterService = clusterService; this.atlasServerService = atlasServerService;
this.auditService = auditService; this.auditService = auditService;
} }
...@@ -63,7 +63,9 @@ public class AuditsWriter { ...@@ -63,7 +63,9 @@ public class AuditsWriter {
auditForExport.add(userName, result, startTime, endTime, entityCreationOrder); auditForExport.add(userName, result, startTime, endTime, entityCreationOrder);
} }
public void write(String userName, AtlasImportResult result, long startTime, long endTime, List<String> entityCreationOrder) throws AtlasBaseException { public void write(String userName, AtlasImportResult result,
long startTime, long endTime,
List<String> entityCreationOrder) throws AtlasBaseException {
auditForImport.add(userName, result, startTime, endTime, entityCreationOrder); auditForImport.add(userName, result, startTime, endTime, entityCreationOrder);
} }
...@@ -72,7 +74,7 @@ public class AuditsWriter { ...@@ -72,7 +74,7 @@ public class AuditsWriter {
} }
private void updateReplicationAttribute(boolean isReplicationSet, private void updateReplicationAttribute(boolean isReplicationSet,
String clusterName, String serverName,
List<String> exportedGuids, List<String> exportedGuids,
String attrNameReplicated, String attrNameReplicated,
long lastModifiedTimestamp) throws AtlasBaseException { long lastModifiedTimestamp) throws AtlasBaseException {
...@@ -80,30 +82,32 @@ public class AuditsWriter { ...@@ -80,30 +82,32 @@ public class AuditsWriter {
return; return;
} }
AtlasCluster cluster = saveCluster(clusterName, exportedGuids.get(0), lastModifiedTimestamp); AtlasServer server = saveServer(serverName, exportedGuids.get(0), lastModifiedTimestamp);
clusterService.updateEntitiesWithCluster(cluster, exportedGuids, attrNameReplicated); atlasServerService.updateEntitiesWithServer(server, exportedGuids, attrNameReplicated);
} }
private String getClusterNameFromOptions(Map options, String key) { private String getClusterNameFromOptions(Map options, String key) {
return options.containsKey(key) return options.containsKey(key)
? (String) options.get(key) ? (String) options.get(key)
: ""; : StringUtils.EMPTY;
} }
private AtlasCluster saveCluster(String clusterName) throws AtlasBaseException { private AtlasServer saveServer(String name) throws AtlasBaseException {
AtlasCluster cluster = new AtlasCluster(clusterName, clusterName); return atlasServerService.save(new AtlasServer(name, name));
return clusterService.save(cluster);
} }
private AtlasCluster saveCluster(String clusterName, String entityGuid, long lastModifiedTimestamp) throws AtlasBaseException { private AtlasServer saveServer(String name,
AtlasCluster cluster = new AtlasCluster(clusterName, clusterName); String entityGuid,
cluster.setAdditionalInfoRepl(entityGuid, lastModifiedTimestamp); long lastModifiedTimestamp) throws AtlasBaseException {
AtlasServer server = new AtlasServer(name, name);
server.setAdditionalInfoRepl(entityGuid, lastModifiedTimestamp);
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("saveCluster: {}", cluster); LOG.debug("saveServer: {}", server);
} }
return clusterService.save(cluster); return atlasServerService.save(server);
} }
public static String getCurrentClusterName() { public static String getCurrentClusterName() {
...@@ -113,12 +117,12 @@ public class AuditsWriter { ...@@ -113,12 +117,12 @@ public class AuditsWriter {
LOG.error("getCurrentClusterName", e); LOG.error("getCurrentClusterName", e);
} }
return ""; return StringUtils.EMPTY;
} }
private class ExportAudits { private class ExportAudits {
private AtlasExportRequest request; private AtlasExportRequest request;
private String targetClusterName; private String targetServerName;
private String optionKeyReplicatedTo; private String optionKeyReplicatedTo;
private boolean replicationOptionState; private boolean replicationOptionState;
...@@ -129,9 +133,9 @@ public class AuditsWriter { ...@@ -129,9 +133,9 @@ public class AuditsWriter {
request = result.getRequest(); request = result.getRequest();
replicationOptionState = isReplicationOptionSet(request.getOptions(), optionKeyReplicatedTo); replicationOptionState = isReplicationOptionSet(request.getOptions(), optionKeyReplicatedTo);
saveClusters(); saveServers();
auditService.add(userName, getCurrentClusterName(), targetClusterName, auditService.add(userName, getCurrentClusterName(), targetServerName,
ExportImportAuditEntry.OPERATION_EXPORT, ExportImportAuditEntry.OPERATION_EXPORT,
AtlasType.toJson(result), startTime, endTime, !entityGuids.isEmpty()); AtlasType.toJson(result), startTime, endTime, !entityGuids.isEmpty());
...@@ -139,16 +143,16 @@ public class AuditsWriter { ...@@ -139,16 +143,16 @@ public class AuditsWriter {
return; return;
} }
updateReplicationAttribute(replicationOptionState, targetClusterName, updateReplicationAttribute(replicationOptionState, targetServerName,
entityGuids, Constants.ATTR_NAME_REPLICATED_TO_CLUSTER, result.getLastModifiedTimestamp()); entityGuids, Constants.ATTR_NAME_REPLICATED_TO, result.getLastModifiedTimestamp());
} }
private void saveClusters() throws AtlasBaseException { private void saveServers() throws AtlasBaseException {
saveCluster(getCurrentClusterName()); saveServer(getCurrentClusterName());
targetClusterName = getClusterNameFromOptions(request.getOptions(), optionKeyReplicatedTo); targetServerName = getClusterNameFromOptions(request.getOptions(), optionKeyReplicatedTo);
if(StringUtils.isNotEmpty(targetClusterName)) { if(StringUtils.isNotEmpty(targetServerName)) {
saveCluster(targetClusterName); saveServer(targetServerName);
} }
} }
} }
...@@ -156,8 +160,7 @@ public class AuditsWriter { ...@@ -156,8 +160,7 @@ public class AuditsWriter {
private class ImportAudits { private class ImportAudits {
private AtlasImportRequest request; private AtlasImportRequest request;
private boolean replicationOptionState; private boolean replicationOptionState;
private String sourceClusterName; private String sourceServerName;
private AtlasCluster sourceCluster;
private String optionKeyReplicatedFrom; private String optionKeyReplicatedFrom;
public void add(String userName, AtlasImportResult result, public void add(String userName, AtlasImportResult result,
...@@ -167,10 +170,10 @@ public class AuditsWriter { ...@@ -167,10 +170,10 @@ public class AuditsWriter {
request = result.getRequest(); request = result.getRequest();
replicationOptionState = isReplicationOptionSet(request.getOptions(), optionKeyReplicatedFrom); replicationOptionState = isReplicationOptionSet(request.getOptions(), optionKeyReplicatedFrom);
saveClusters(); saveServers();
auditService.add(userName, auditService.add(userName,
sourceClusterName, getCurrentClusterName(), sourceServerName, getCurrentClusterName(),
ExportImportAuditEntry.OPERATION_IMPORT, ExportImportAuditEntry.OPERATION_IMPORT,
AtlasType.toJson(result), startTime, endTime, !entityGuids.isEmpty()); AtlasType.toJson(result), startTime, endTime, !entityGuids.isEmpty());
...@@ -178,23 +181,23 @@ public class AuditsWriter { ...@@ -178,23 +181,23 @@ public class AuditsWriter {
return; return;
} }
updateReplicationAttribute(replicationOptionState, this.sourceClusterName, entityGuids, updateReplicationAttribute(replicationOptionState, this.sourceServerName, entityGuids,
Constants.ATTR_NAME_REPLICATED_FROM_CLUSTER, result.getExportResult().getLastModifiedTimestamp()); Constants.ATTR_NAME_REPLICATED_FROM, result.getExportResult().getLastModifiedTimestamp());
} }
private void saveClusters() throws AtlasBaseException { private void saveServers() throws AtlasBaseException {
saveCluster(getCurrentClusterName()); saveServer(getCurrentClusterName());
sourceClusterName = getClusterNameFromOptionsState(); sourceServerName = getClusterNameFromOptionsState();
if(StringUtils.isNotEmpty(sourceClusterName)) { if(StringUtils.isNotEmpty(sourceServerName)) {
this.sourceCluster = saveCluster(sourceClusterName); saveServer(sourceServerName);
} }
} }
private String getClusterNameFromOptionsState() { private String getClusterNameFromOptionsState() {
return replicationOptionState return replicationOptionState
? getClusterNameFromOptions(request.getOptions(), optionKeyReplicatedFrom) ? getClusterNameFromOptions(request.getOptions(), optionKeyReplicatedFrom)
: ""; : StringUtils.EMPTY;
} }
} }
} }
...@@ -120,10 +120,10 @@ public class ExportImportAuditService { ...@@ -120,10 +120,10 @@ public class ExportImportAuditService {
addParameterIfValueNotEmpty(criteria, ExportImportAuditEntryDTO.PROPERTY_START_TIME, startTime); addParameterIfValueNotEmpty(criteria, ExportImportAuditEntryDTO.PROPERTY_START_TIME, startTime);
addParameterIfValueNotEmpty(criteria, ExportImportAuditEntryDTO.PROPERTY_END_TIME, endTime); addParameterIfValueNotEmpty(criteria, ExportImportAuditEntryDTO.PROPERTY_END_TIME, endTime);
addClusterFilterCriteria(criteria, cluster); addServerFilterCriteria(criteria, cluster);
} }
private void addClusterFilterCriteria(SearchParameters.FilterCriteria parentCriteria, String cluster) { private void addServerFilterCriteria(SearchParameters.FilterCriteria parentCriteria, String cluster) {
if (StringUtils.isEmpty(cluster)) { if (StringUtils.isEmpty(cluster)) {
return; return;
} }
...@@ -132,8 +132,8 @@ public class ExportImportAuditService { ...@@ -132,8 +132,8 @@ public class ExportImportAuditService {
criteria.setCondition(SearchParameters.FilterCriteria.Condition.OR); criteria.setCondition(SearchParameters.FilterCriteria.Condition.OR);
criteria.setCriterion(new ArrayList<>()); criteria.setCriterion(new ArrayList<>());
addParameterIfValueNotEmpty(criteria, ExportImportAuditEntryDTO.PROPERTY_SOURCE_CLUSTER_NAME, cluster); addParameterIfValueNotEmpty(criteria, ExportImportAuditEntryDTO.PROPERTY_SOURCE_SERVER_NAME, cluster);
addParameterIfValueNotEmpty(criteria, ExportImportAuditEntryDTO.PROPERTY_TARGET_CLUSTER_NAME, cluster); addParameterIfValueNotEmpty(criteria, ExportImportAuditEntryDTO.PROPERTY_TARGET_SERVER_NAME, cluster);
parentCriteria.getCriterion().add(criteria); parentCriteria.getCriterion().add(criteria);
} }
...@@ -158,8 +158,8 @@ public class ExportImportAuditService { ...@@ -158,8 +158,8 @@ public class ExportImportAuditService {
ExportImportAuditEntry entry = new ExportImportAuditEntry(); ExportImportAuditEntry entry = new ExportImportAuditEntry();
entry.setUserName(userName); entry.setUserName(userName);
entry.setSourceClusterName(sourceCluster); entry.setSourceServerName(sourceCluster);
entry.setTargetClusterName(targetCluster); entry.setTargetServerName(targetCluster);
entry.setOperation(operation); entry.setOperation(operation);
entry.setResultSummary(result); entry.setResultSummary(result);
entry.setStartTime(startTime); entry.setStartTime(startTime);
...@@ -167,6 +167,6 @@ public class ExportImportAuditService { ...@@ -167,6 +167,6 @@ public class ExportImportAuditService {
save(entry); save(entry);
LOG.info("addAuditEntry: user: {}, source: {}, target: {}, operation: {}", entry.getUserName(), LOG.info("addAuditEntry: user: {}, source: {}, target: {}, operation: {}", entry.getUserName(),
entry.getSourceClusterName(), entry.getTargetClusterName(), entry.getOperation()); entry.getSourceServerName(), entry.getTargetServerName(), entry.getOperation());
} }
} }
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
package org.apache.atlas.repository.ogm; package org.apache.atlas.repository.ogm;
import org.apache.atlas.model.impexp.AtlasCluster; import org.apache.atlas.model.impexp.AtlasServer;
import org.apache.atlas.model.instance.AtlasEntity; import org.apache.atlas.model.instance.AtlasEntity;
import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -29,39 +29,42 @@ import java.util.List; ...@@ -29,39 +29,42 @@ import java.util.List;
import java.util.Map; import java.util.Map;
@Component @Component
public class AtlasClusterDTO extends AbstractDataTransferObject<AtlasCluster> { public class AtlasServerDTO extends AbstractDataTransferObject<AtlasServer> {
private final String PROPERTY_CLUSTER_NAME = "displayName"; private final String PROPERTY_NAME = "name";
private final String PROPERTY_QUALIFIED_NAME = "qualifiedName"; private final String PROPERTY_DISPLAY_NAME = "displayName";
private final String PROPERTY_FULL_NAME = "fullName";
private final String PROPERTY_ADDITIONAL_INFO = "additionalInfo"; private final String PROPERTY_ADDITIONAL_INFO = "additionalInfo";
private final String PROPERTY_URLS = "urls"; private final String PROPERTY_URLS = "urls";
@Inject @Inject
public AtlasClusterDTO(AtlasTypeRegistry typeRegistry) { public AtlasServerDTO(AtlasTypeRegistry typeRegistry) {
super(typeRegistry, AtlasCluster.class, AtlasCluster.class.getSimpleName()); super(typeRegistry, AtlasServer.class, AtlasServer.class.getSimpleName());
} }
public AtlasCluster from(AtlasEntity entity) { public AtlasServer from(AtlasEntity entity) {
AtlasCluster cluster = new AtlasCluster(); AtlasServer cluster = new AtlasServer();
setGuid(cluster, entity); setGuid(cluster, entity);
cluster.setName((String) entity.getAttribute(PROPERTY_CLUSTER_NAME)); cluster.setName((String) entity.getAttribute(PROPERTY_NAME));
cluster.setQualifiedName((String) entity.getAttribute(PROPERTY_QUALIFIED_NAME)); cluster.setFullName((String) entity.getAttribute(PROPERTY_FULL_NAME));
cluster.setDisplayName((String) entity.getAttribute(PROPERTY_DISPLAY_NAME));
cluster.setAdditionalInfo((Map<String,String>) entity.getAttribute(PROPERTY_ADDITIONAL_INFO)); cluster.setAdditionalInfo((Map<String,String>) entity.getAttribute(PROPERTY_ADDITIONAL_INFO));
cluster.setUrls((List<String>) entity.getAttribute(PROPERTY_URLS)); cluster.setUrls((List<String>) entity.getAttribute(PROPERTY_URLS));
return cluster; return cluster;
} }
public AtlasCluster from(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) { public AtlasServer from(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) {
return from(entityWithExtInfo.getEntity()); return from(entityWithExtInfo.getEntity());
} }
@Override @Override
public AtlasEntity toEntity(AtlasCluster obj) { public AtlasEntity toEntity(AtlasServer obj) {
AtlasEntity entity = getDefaultAtlasEntity(obj); AtlasEntity entity = getDefaultAtlasEntity(obj);
entity.setAttribute(PROPERTY_CLUSTER_NAME, obj.getName()); entity.setAttribute(PROPERTY_NAME, obj.getName());
entity.setAttribute(PROPERTY_QUALIFIED_NAME, obj.getQualifiedName()); entity.setAttribute(PROPERTY_DISPLAY_NAME, obj.getDisplayName());
entity.setAttribute(PROPERTY_FULL_NAME, obj.getFullName());
entity.setAttribute(PROPERTY_ADDITIONAL_INFO, obj.getAdditionalInfo()); entity.setAttribute(PROPERTY_ADDITIONAL_INFO, obj.getAdditionalInfo());
entity.setAttribute(PROPERTY_URLS, obj.getUrls()); entity.setAttribute(PROPERTY_URLS, obj.getUrls());
...@@ -69,14 +72,14 @@ public class AtlasClusterDTO extends AbstractDataTransferObject<AtlasCluster> { ...@@ -69,14 +72,14 @@ public class AtlasClusterDTO extends AbstractDataTransferObject<AtlasCluster> {
} }
@Override @Override
public AtlasEntity.AtlasEntityWithExtInfo toEntityWithExtInfo(AtlasCluster obj) { public AtlasEntity.AtlasEntityWithExtInfo toEntityWithExtInfo(AtlasServer obj) {
return new AtlasEntity.AtlasEntityWithExtInfo(toEntity(obj)); return new AtlasEntity.AtlasEntityWithExtInfo(toEntity(obj));
} }
@Override @Override
public Map<String, Object> getUniqueAttributes(final AtlasCluster obj) { public Map<String, Object> getUniqueAttributes(final AtlasServer obj) {
return new HashMap<String, Object>() {{ return new HashMap<String, Object>() {{
put(PROPERTY_QUALIFIED_NAME, obj.getQualifiedName()); put(PROPERTY_FULL_NAME, obj.getFullName());
}}; }};
} }
} }
...@@ -40,14 +40,14 @@ public class ExportImportAuditEntryDTO extends AbstractDataTransferObject<Export ...@@ -40,14 +40,14 @@ public class ExportImportAuditEntryDTO extends AbstractDataTransferObject<Export
public static final String PROPERTY_START_TIME = "operationStartTime"; public static final String PROPERTY_START_TIME = "operationStartTime";
public static final String PROPERTY_END_TIME = "operationEndTime"; public static final String PROPERTY_END_TIME = "operationEndTime";
public static final String PROPERTY_RESULT_SUMMARY = "resultSummary"; public static final String PROPERTY_RESULT_SUMMARY = "resultSummary";
public static final String PROPERTY_SOURCE_CLUSTER_NAME = "sourceClusterName"; public static final String PROPERTY_SOURCE_SERVER_NAME = "sourceServerName";
public static final String PROPERTY_TARGET_CLUSTER_NAME = "targetClusterName"; public static final String PROPERTY_TARGET_SERVER_NAME = "targetServerName";
private static final Set<String> ATTRIBUTE_NAMES = new HashSet<>(Arrays.asList(PROPERTY_USER_NAME, private static final Set<String> ATTRIBUTE_NAMES = new HashSet<>(Arrays.asList(PROPERTY_USER_NAME,
PROPERTY_OPERATION, PROPERTY_OPERATION_PARAMS, PROPERTY_OPERATION, PROPERTY_OPERATION_PARAMS,
PROPERTY_START_TIME, PROPERTY_END_TIME, PROPERTY_START_TIME, PROPERTY_END_TIME,
PROPERTY_RESULT_SUMMARY, PROPERTY_RESULT_SUMMARY,
PROPERTY_SOURCE_CLUSTER_NAME, PROPERTY_TARGET_CLUSTER_NAME)); PROPERTY_SOURCE_SERVER_NAME, PROPERTY_TARGET_SERVER_NAME));
@Inject @Inject
public ExportImportAuditEntryDTO(AtlasTypeRegistry typeRegistry) { public ExportImportAuditEntryDTO(AtlasTypeRegistry typeRegistry) {
...@@ -68,8 +68,8 @@ public class ExportImportAuditEntryDTO extends AbstractDataTransferObject<Export ...@@ -68,8 +68,8 @@ public class ExportImportAuditEntryDTO extends AbstractDataTransferObject<Export
entry.setOperationParams((String) attributes.get(PROPERTY_OPERATION_PARAMS)); entry.setOperationParams((String) attributes.get(PROPERTY_OPERATION_PARAMS));
entry.setStartTime((long) attributes.get(PROPERTY_START_TIME)); entry.setStartTime((long) attributes.get(PROPERTY_START_TIME));
entry.setEndTime((long) attributes.get(PROPERTY_END_TIME)); entry.setEndTime((long) attributes.get(PROPERTY_END_TIME));
entry.setSourceClusterName((String) attributes.get(PROPERTY_SOURCE_CLUSTER_NAME)); entry.setSourceServerName((String) attributes.get(PROPERTY_SOURCE_SERVER_NAME));
entry.setTargetClusterName((String) attributes.get(PROPERTY_TARGET_CLUSTER_NAME)); entry.setTargetServerName((String) attributes.get(PROPERTY_TARGET_SERVER_NAME));
entry.setResultSummary((String) attributes.get(PROPERTY_RESULT_SUMMARY)); entry.setResultSummary((String) attributes.get(PROPERTY_RESULT_SUMMARY));
return entry; return entry;
...@@ -94,8 +94,8 @@ public class ExportImportAuditEntryDTO extends AbstractDataTransferObject<Export ...@@ -94,8 +94,8 @@ public class ExportImportAuditEntryDTO extends AbstractDataTransferObject<Export
entity.setAttribute(PROPERTY_OPERATION_PARAMS, obj.getOperationParams()); entity.setAttribute(PROPERTY_OPERATION_PARAMS, obj.getOperationParams());
entity.setAttribute(PROPERTY_START_TIME, obj.getStartTime()); entity.setAttribute(PROPERTY_START_TIME, obj.getStartTime());
entity.setAttribute(PROPERTY_END_TIME, obj.getEndTime()); entity.setAttribute(PROPERTY_END_TIME, obj.getEndTime());
entity.setAttribute(PROPERTY_SOURCE_CLUSTER_NAME, obj.getSourceClusterName()); entity.setAttribute(PROPERTY_SOURCE_SERVER_NAME, obj.getSourceServerName());
entity.setAttribute(PROPERTY_TARGET_CLUSTER_NAME, obj.getTargetClusterName()); entity.setAttribute(PROPERTY_TARGET_SERVER_NAME, obj.getTargetServerName());
entity.setAttribute(PROPERTY_RESULT_SUMMARY, obj.getResultSummary()); entity.setAttribute(PROPERTY_RESULT_SUMMARY, obj.getResultSummary());
return entity; return entity;
......
...@@ -41,7 +41,7 @@ import org.apache.atlas.repository.graphdb.AtlasGraph; ...@@ -41,7 +41,7 @@ import org.apache.atlas.repository.graphdb.AtlasGraph;
import org.apache.atlas.repository.graphdb.GraphDBMigrator; import org.apache.atlas.repository.graphdb.GraphDBMigrator;
import org.apache.atlas.repository.graphdb.janus.migration.GraphDBGraphSONMigrator; import org.apache.atlas.repository.graphdb.janus.migration.GraphDBGraphSONMigrator;
import org.apache.atlas.repository.impexp.ExportService; import org.apache.atlas.repository.impexp.ExportService;
import org.apache.atlas.repository.ogm.AtlasClusterDTO; import org.apache.atlas.repository.ogm.AtlasServerDTO;
import org.apache.atlas.repository.ogm.ExportImportAuditEntryDTO; import org.apache.atlas.repository.ogm.ExportImportAuditEntryDTO;
import org.apache.atlas.repository.ogm.profiles.AtlasSavedSearchDTO; import org.apache.atlas.repository.ogm.profiles.AtlasSavedSearchDTO;
import org.apache.atlas.repository.ogm.profiles.AtlasUserProfileDTO; import org.apache.atlas.repository.ogm.profiles.AtlasUserProfileDTO;
...@@ -172,7 +172,7 @@ public class TestModules { ...@@ -172,7 +172,7 @@ public class TestModules {
availableDTOs.addBinding().to(AtlasGlossaryDTO.class); availableDTOs.addBinding().to(AtlasGlossaryDTO.class);
availableDTOs.addBinding().to(AtlasGlossaryTermDTO.class); availableDTOs.addBinding().to(AtlasGlossaryTermDTO.class);
availableDTOs.addBinding().to(AtlasGlossaryCategoryDTO.class); availableDTOs.addBinding().to(AtlasGlossaryCategoryDTO.class);
availableDTOs.addBinding().to(AtlasClusterDTO.class); availableDTOs.addBinding().to(AtlasServerDTO.class);
availableDTOs.addBinding().to(ExportImportAuditEntryDTO.class); availableDTOs.addBinding().to(ExportImportAuditEntryDTO.class);
bind(DTORegistry.class).asEagerSingleton(); bind(DTORegistry.class).asEagerSingleton();
......
...@@ -20,7 +20,7 @@ package org.apache.atlas.repository.impexp; ...@@ -20,7 +20,7 @@ package org.apache.atlas.repository.impexp;
import org.apache.atlas.TestModules; import org.apache.atlas.TestModules;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.impexp.AtlasCluster; import org.apache.atlas.model.impexp.AtlasServer;
import org.apache.atlas.model.instance.AtlasObjectId; import org.apache.atlas.model.instance.AtlasObjectId;
import org.apache.atlas.repository.Constants; import org.apache.atlas.repository.Constants;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
...@@ -41,13 +41,12 @@ import static org.testng.Assert.assertNotEquals; ...@@ -41,13 +41,12 @@ import static org.testng.Assert.assertNotEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
@Guice(modules = TestModules.TestOnlyModule.class) @Guice(modules = TestModules.TestOnlyModule.class)
public class ClusterServiceTest { public class AtlasServerServiceTest {
private final String TOP_LEVEL_ENTITY_NAME = "db1@cl1"; private final String TOP_LEVEL_ENTITY_NAME = "db1@cl1";
private final String CLUSTER_NAME = "testCl1"; private final String SERVER_NAME = "testCl1";
private final String TARGET_CLUSTER_NAME = "testCl2"; private final String TARGET_SERVER_NAME = "testCl2";
private final String QUALIFIED_NAME_STOCKS = "stocks@cl1"; private final String QUALIFIED_NAME_STOCKS = "stocks@cl1";
private final String TYPE_HIVE_DB = "hive_db"; private final String TYPE_HIVE_DB = "hive_db";
private final String topLevelEntityGuid = "AAA-BBB-CCC";
@Inject @Inject
private AtlasTypeDefStore typeDefStore; private AtlasTypeDefStore typeDefStore;
...@@ -56,7 +55,8 @@ public class ClusterServiceTest { ...@@ -56,7 +55,8 @@ public class ClusterServiceTest {
private AtlasTypeRegistry typeRegistry; private AtlasTypeRegistry typeRegistry;
@Inject @Inject
private ClusterService clusterService; private AtlasServerService atlasServerService;
private String topLevelEntityGuid = "AAA-BBB-CCC";
@BeforeClass @BeforeClass
public void setup() throws IOException, AtlasBaseException { public void setup() throws IOException, AtlasBaseException {
...@@ -64,15 +64,15 @@ public class ClusterServiceTest { ...@@ -64,15 +64,15 @@ public class ClusterServiceTest {
} }
@Test @Test
public void saveAndRetrieveClusterInfo() throws AtlasBaseException { public void saveAndRetrieveServerInfo() throws AtlasBaseException {
AtlasCluster expected = getCluster(CLUSTER_NAME + "_1", TOP_LEVEL_ENTITY_NAME, "EXPORT", 0l, TARGET_CLUSTER_NAME); AtlasServer expected = getServer(SERVER_NAME + "_1", TOP_LEVEL_ENTITY_NAME, "EXPORT", 0l, TARGET_SERVER_NAME);
AtlasCluster expected2 = getCluster(TARGET_CLUSTER_NAME + "_1", TOP_LEVEL_ENTITY_NAME, "IMPORT", 0L, TARGET_CLUSTER_NAME); AtlasServer expected2 = getServer(TARGET_SERVER_NAME + "_1", TOP_LEVEL_ENTITY_NAME, "IMPORT", 0L, TARGET_SERVER_NAME);
AtlasCluster expected3 = getCluster(TARGET_CLUSTER_NAME + "_3", TOP_LEVEL_ENTITY_NAME, "IMPORT", 0, TARGET_CLUSTER_NAME); AtlasServer expected3 = getServer(TARGET_SERVER_NAME + "_3", TOP_LEVEL_ENTITY_NAME, "IMPORT", 0, TARGET_SERVER_NAME);
AtlasCluster actual = clusterService.save(expected); AtlasServer actual = atlasServerService.save(expected);
AtlasCluster actual2 = clusterService.save(expected2); AtlasServer actual2 = atlasServerService.save(expected2);
AtlasCluster actual3 = clusterService.save(expected3); AtlasServer actual3 = atlasServerService.save(expected3);
AtlasCluster actual2x = clusterService.get(expected2); AtlasServer actual2x = atlasServerService.get(expected2);
assertNotNull(actual.getGuid()); assertNotNull(actual.getGuid());
assertNotNull(actual2.getGuid()); assertNotNull(actual2.getGuid());
...@@ -83,18 +83,18 @@ public class ClusterServiceTest { ...@@ -83,18 +83,18 @@ public class ClusterServiceTest {
assertEquals(actual.getName(), expected.getName()); assertEquals(actual.getName(), expected.getName());
assertEquals(actual.getQualifiedName(), expected.getQualifiedName()); assertEquals(actual.getFullName(), expected.getFullName());
} }
private AtlasCluster getCluster(String clusterName, String topLevelEntity, String operation, long nextModifiedTimestamp, String targetClusterName) { private AtlasServer getServer(String serverName, String topLevelEntity, String operation, long nextModifiedTimestamp, String targetServerName) {
AtlasCluster cluster = new AtlasCluster(clusterName, clusterName); AtlasServer cluster = new AtlasServer(serverName, serverName);
Map<String, String> syncMap = new HashMap<>(); Map<String, String> syncMap = new HashMap<>();
syncMap.put("topLevelEntity", topLevelEntity); syncMap.put("topLevelEntity", topLevelEntity);
syncMap.put("operation", operation); syncMap.put("operation", operation);
syncMap.put("nextModifiedTimestamp", Long.toString(nextModifiedTimestamp)); syncMap.put("nextModifiedTimestamp", Long.toString(nextModifiedTimestamp));
syncMap.put("targetCluster", targetClusterName); syncMap.put("targetCluster", targetServerName);
cluster.setAdditionalInfo(syncMap); cluster.setAdditionalInfo(syncMap);
...@@ -105,13 +105,13 @@ public class ClusterServiceTest { ...@@ -105,13 +105,13 @@ public class ClusterServiceTest {
public void verifyAdditionalInfo() throws AtlasBaseException { public void verifyAdditionalInfo() throws AtlasBaseException {
final long expectedLastModifiedTimestamp = 200L; final long expectedLastModifiedTimestamp = 200L;
AtlasCluster expectedCluster = new AtlasCluster(CLUSTER_NAME, CLUSTER_NAME); AtlasServer expectedCluster = atlasServerService.getCreateAtlasServer(SERVER_NAME, SERVER_NAME);
String qualifiedNameAttr = Constants.QUALIFIED_NAME.replace(ATTR_NAME_REFERENCEABLE, ""); String qualifiedNameAttr = Constants.QUALIFIED_NAME.replace(ATTR_NAME_REFERENCEABLE, "");
AtlasObjectId objectId = new AtlasObjectId(TYPE_HIVE_DB, qualifiedNameAttr, QUALIFIED_NAME_STOCKS); AtlasObjectId objectId = new AtlasObjectId(TYPE_HIVE_DB, qualifiedNameAttr, QUALIFIED_NAME_STOCKS);
expectedCluster.setAdditionalInfoRepl(topLevelEntityGuid, expectedLastModifiedTimestamp); expectedCluster.setAdditionalInfoRepl(topLevelEntityGuid, expectedLastModifiedTimestamp);
AtlasCluster actualCluster = clusterService.save(expectedCluster); AtlasServer actualCluster = atlasServerService.save(expectedCluster);
assertEquals(actualCluster.getName(), expectedCluster.getName()); assertEquals(actualCluster.getName(), expectedCluster.getName());
int actualModifiedTimestamp = (int) actualCluster.getAdditionalInfoRepl(topLevelEntityGuid); int actualModifiedTimestamp = (int) actualCluster.getAdditionalInfoRepl(topLevelEntityGuid);
......
...@@ -76,14 +76,14 @@ public class ExportImportAuditServiceTest extends ExportImportTestBase { ...@@ -76,14 +76,14 @@ public class ExportImportAuditServiceTest extends ExportImportTestBase {
assertNotEquals(actualEntry.getGuid(), actualEntry2.getGuid()); assertNotEquals(actualEntry.getGuid(), actualEntry2.getGuid());
assertNotNull(actualEntry.getGuid()); assertNotNull(actualEntry.getGuid());
assertEquals(actualEntry.getSourceClusterName(), entry.getSourceClusterName()); assertEquals(actualEntry.getSourceServerName(), entry.getSourceServerName());
assertEquals(actualEntry.getTargetClusterName(), entry.getTargetClusterName()); assertEquals(actualEntry.getTargetServerName(), entry.getTargetServerName());
assertEquals(actualEntry.getOperation(), entry.getOperation()); assertEquals(actualEntry.getOperation(), entry.getOperation());
} }
@Test @Test
public void numberOfSavedEntries_Retrieved() throws AtlasBaseException, InterruptedException { public void numberOfSavedEntries_Retrieved() throws AtlasBaseException, InterruptedException {
final String source1 = "cluster1"; final String source1 = "server1";
final String target1 = "cly"; final String target1 = "cly";
int MAX_ENTRIES = 5; int MAX_ENTRIES = 5;
...@@ -100,7 +100,7 @@ public class ExportImportAuditServiceTest extends ExportImportTestBase { ...@@ -100,7 +100,7 @@ public class ExportImportAuditServiceTest extends ExportImportTestBase {
private ExportImportAuditEntry retrieveEntry(ExportImportAuditEntry entry) throws AtlasBaseException { private ExportImportAuditEntry retrieveEntry(ExportImportAuditEntry entry) throws AtlasBaseException {
List<ExportImportAuditEntry> result = auditService.get(entry.getUserName(), entry.getOperation(), List<ExportImportAuditEntry> result = auditService.get(entry.getUserName(), entry.getOperation(),
entry.getSourceClusterName(), entry.getSourceServerName(),
Long.toString(entry.getStartTime()), "", 10, 0); Long.toString(entry.getStartTime()), "", 10, 0);
assertNotNull(result); assertNotNull(result);
assertEquals(result.size(), 1); assertEquals(result.size(), 1);
...@@ -108,10 +108,10 @@ public class ExportImportAuditServiceTest extends ExportImportTestBase { ...@@ -108,10 +108,10 @@ public class ExportImportAuditServiceTest extends ExportImportTestBase {
return auditService.get(entry); return auditService.get(entry);
} }
private ExportImportAuditEntry saveAndGet(String sourceClusterName, String operation, String targetClusterName) throws AtlasBaseException { private ExportImportAuditEntry saveAndGet(String sourceServerName, String operation, String targetServerName) throws AtlasBaseException {
ExportImportAuditEntry entry = new ExportImportAuditEntry(sourceClusterName, operation); ExportImportAuditEntry entry = new ExportImportAuditEntry(sourceServerName, operation);
entry.setTargetClusterName(targetClusterName); entry.setTargetServerName(targetServerName);
entry.setUserName("default"); entry.setUserName("default");
entry.setStartTime(System.currentTimeMillis()); entry.setStartTime(System.currentTimeMillis());
entry.setEndTime(System.currentTimeMillis() + 1000L); entry.setEndTime(System.currentTimeMillis() + 1000L);
......
...@@ -24,7 +24,7 @@ import org.apache.atlas.RequestContext; ...@@ -24,7 +24,7 @@ import org.apache.atlas.RequestContext;
import org.apache.atlas.TestModules; import org.apache.atlas.TestModules;
import org.apache.atlas.TestUtilsV2; import org.apache.atlas.TestUtilsV2;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.impexp.AtlasCluster; import org.apache.atlas.model.impexp.AtlasServer;
import org.apache.atlas.model.impexp.AtlasExportRequest; import org.apache.atlas.model.impexp.AtlasExportRequest;
import org.apache.atlas.model.impexp.AtlasImportRequest; import org.apache.atlas.model.impexp.AtlasImportRequest;
import org.apache.atlas.model.impexp.AtlasImportResult; import org.apache.atlas.model.impexp.AtlasImportResult;
...@@ -63,9 +63,6 @@ public class ReplicationEntityAttributeTest extends ExportImportTestBase { ...@@ -63,9 +63,6 @@ public class ReplicationEntityAttributeTest extends ExportImportTestBase {
private final String EXPORT_REQUEST_FILE = "export-replicatedTo"; private final String EXPORT_REQUEST_FILE = "export-replicatedTo";
private final String IMPORT_REQUEST_FILE = "import-replicatedFrom"; private final String IMPORT_REQUEST_FILE = "import-replicatedFrom";
private final String DB_GUID = "1637a33e-6512-447b-ade7-249c8cb5344b";
private final String TABLE_GUID = "df122fc3-5555-40f8-a30f-3090b8a622f8";
private String REPLICATED_TO_CLUSTER_NAME = ""; private String REPLICATED_TO_CLUSTER_NAME = "";
private String REPLICATED_FROM_CLUSTER_NAME = ""; private String REPLICATED_FROM_CLUSTER_NAME = "";
...@@ -85,7 +82,7 @@ public class ReplicationEntityAttributeTest extends ExportImportTestBase { ...@@ -85,7 +82,7 @@ public class ReplicationEntityAttributeTest extends ExportImportTestBase {
ImportService importService; ImportService importService;
@Inject @Inject
ClusterService clusterService; AtlasServerService atlasServerService;
private AtlasEntityChangeNotifier mockChangeNotifier = mock(AtlasEntityChangeNotifier.class); private AtlasEntityChangeNotifier mockChangeNotifier = mock(AtlasEntityChangeNotifier.class);
private AtlasEntityStoreV2 entityStore; private AtlasEntityStoreV2 entityStore;
...@@ -120,7 +117,7 @@ public class ReplicationEntityAttributeTest extends ExportImportTestBase { ...@@ -120,7 +117,7 @@ public class ReplicationEntityAttributeTest extends ExportImportTestBase {
assertEquals(zipSource.getCreationOrder().size(), expectedEntityCount); assertEquals(zipSource.getCreationOrder().size(), expectedEntityCount);
assertCluster(REPLICATED_TO_CLUSTER_NAME, null); assertCluster(REPLICATED_TO_CLUSTER_NAME, null);
assertReplicationAttribute(Constants.ATTR_NAME_REPLICATED_TO_CLUSTER); assertReplicationAttribute(Constants.ATTR_NAME_REPLICATED_TO);
} }
@Test(dependsOnMethods = "exportWithReplicationToOption_AddsClusterObjectIdToReplicatedFromAttribute", enabled = false) @Test(dependsOnMethods = "exportWithReplicationToOption_AddsClusterObjectIdToReplicatedFromAttribute", enabled = false)
...@@ -129,7 +126,7 @@ public class ReplicationEntityAttributeTest extends ExportImportTestBase { ...@@ -129,7 +126,7 @@ public class ReplicationEntityAttributeTest extends ExportImportTestBase {
AtlasImportResult importResult = runImportWithParameters(importService, request, zipSource); AtlasImportResult importResult = runImportWithParameters(importService, request, zipSource);
assertCluster(REPLICATED_FROM_CLUSTER_NAME, importResult); assertCluster(REPLICATED_FROM_CLUSTER_NAME, importResult);
assertReplicationAttribute(Constants.ATTR_NAME_REPLICATED_FROM_CLUSTER); assertReplicationAttribute(Constants.ATTR_NAME_REPLICATED_FROM);
} }
private void assertReplicationAttribute(String attrNameReplication) throws AtlasBaseException { private void assertReplicationAttribute(String attrNameReplication) throws AtlasBaseException {
...@@ -139,13 +136,13 @@ public class ReplicationEntityAttributeTest extends ExportImportTestBase { ...@@ -139,13 +136,13 @@ public class ReplicationEntityAttributeTest extends ExportImportTestBase {
Object ex = e.getAttribute(attrNameReplication); Object ex = e.getAttribute(attrNameReplication);
assertNotNull(ex); assertNotNull(ex);
List<String> clusterNameSyncType = (List) ex; List<String> attrValue = (List) ex;
assertEquals(clusterNameSyncType.size(), 1); assertEquals(attrValue.size(), 1);
} }
} }
private void assertCluster(String name, AtlasImportResult importResult) throws AtlasBaseException { private void assertCluster(String name, AtlasImportResult importResult) throws AtlasBaseException {
AtlasCluster actual = clusterService.get(new AtlasCluster(name, name)); AtlasServer actual = atlasServerService.get(new AtlasServer(name, name));
assertNotNull(actual); assertNotNull(actual);
assertEquals(actual.getName(), name); assertEquals(actual.getName(), name);
...@@ -155,7 +152,7 @@ public class ReplicationEntityAttributeTest extends ExportImportTestBase { ...@@ -155,7 +152,7 @@ public class ReplicationEntityAttributeTest extends ExportImportTestBase {
} }
} }
private void assertClusterAdditionalInfo(AtlasCluster cluster, AtlasImportResult importResult) throws AtlasBaseException { private void assertClusterAdditionalInfo(AtlasServer cluster, AtlasImportResult importResult) throws AtlasBaseException {
AtlasExportRequest request = importResult.getExportResult().getRequest(); AtlasExportRequest request = importResult.getExportResult().getRequest();
AtlasEntityType type = (AtlasEntityType) typeRegistry.getType(request.getItemsToExport().get(0).getTypeName()); AtlasEntityType type = (AtlasEntityType) typeRegistry.getType(request.getItemsToExport().get(0).getTypeName());
AtlasEntity.AtlasEntityWithExtInfo entity = entityStore.getByUniqueAttributes(type, request.getItemsToExport().get(0).getUniqueAttributes()); AtlasEntity.AtlasEntityWithExtInfo entity = entityStore.getByUniqueAttributes(type, request.getItemsToExport().get(0).getUniqueAttributes());
......
{ {
"name": "replicatedFromCluster", "name": "replicatedFrom",
"typeName": "array<AtlasCluster>", "typeName": "array<AtlasServer>",
"cardinality": "SET", "cardinality": "SET",
"isIndexable": false, "isIndexable": false,
"isOptional": true, "isOptional": true,
......
...@@ -29,18 +29,21 @@ import org.apache.atlas.authorize.AtlasAuthorizationUtils; ...@@ -29,18 +29,21 @@ import org.apache.atlas.authorize.AtlasAuthorizationUtils;
import org.apache.atlas.discovery.SearchContext; import org.apache.atlas.discovery.SearchContext;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.discovery.AtlasSearchResult; import org.apache.atlas.model.discovery.AtlasSearchResult;
import org.apache.atlas.model.impexp.AtlasServer;
import org.apache.atlas.model.impexp.AtlasExportRequest; import org.apache.atlas.model.impexp.AtlasExportRequest;
import org.apache.atlas.model.impexp.AtlasExportResult; import org.apache.atlas.model.impexp.AtlasExportResult;
import org.apache.atlas.model.impexp.AtlasImportRequest; import org.apache.atlas.model.impexp.AtlasImportRequest;
import org.apache.atlas.model.impexp.AtlasImportResult; import org.apache.atlas.model.impexp.AtlasImportResult;
import org.apache.atlas.model.impexp.*; import org.apache.atlas.model.impexp.ExportImportAuditEntry;
import org.apache.atlas.model.impexp.MigrationStatus;
import org.apache.atlas.model.metrics.AtlasMetrics; import org.apache.atlas.model.metrics.AtlasMetrics;
import org.apache.atlas.repository.impexp.AtlasServerService;
import org.apache.atlas.repository.impexp.ExportImportAuditService;
import org.apache.atlas.repository.impexp.ExportService; import org.apache.atlas.repository.impexp.ExportService;
import org.apache.atlas.repository.impexp.ImportService; import org.apache.atlas.repository.impexp.ImportService;
import org.apache.atlas.repository.impexp.MigrationProgressService;
import org.apache.atlas.repository.impexp.ZipSink; import org.apache.atlas.repository.impexp.ZipSink;
import org.apache.atlas.repository.impexp.ZipSource; import org.apache.atlas.repository.impexp.ZipSource;
import org.apache.atlas.repository.impexp.ExportImportAuditService;
import org.apache.atlas.repository.impexp.*;
import org.apache.atlas.services.MetricsService; import org.apache.atlas.services.MetricsService;
import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasType;
import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry;
...@@ -126,10 +129,10 @@ public class AdminResource { ...@@ -126,10 +129,10 @@ public class AdminResource {
private final ImportService importService; private final ImportService importService;
private final SearchTracker activeSearches; private final SearchTracker activeSearches;
private final AtlasTypeRegistry typeRegistry; private final AtlasTypeRegistry typeRegistry;
private final MigrationProgressService migrationProgressService; private final MigrationProgressService migrationProgressService;
private final ReentrantLock importExportOperationLock; private final ReentrantLock importExportOperationLock;
private final ExportImportAuditService exportImportAuditService; private final ExportImportAuditService exportImportAuditService;
private final ClusterService clusterService; private final AtlasServerService atlasServerService;
static { static {
try { try {
...@@ -143,7 +146,7 @@ public class AdminResource { ...@@ -143,7 +146,7 @@ public class AdminResource {
public AdminResource(ServiceState serviceState, MetricsService metricsService, AtlasTypeRegistry typeRegistry, public AdminResource(ServiceState serviceState, MetricsService metricsService, AtlasTypeRegistry typeRegistry,
ExportService exportService, ImportService importService, SearchTracker activeSearches, ExportService exportService, ImportService importService, SearchTracker activeSearches,
MigrationProgressService migrationProgressService, MigrationProgressService migrationProgressService,
ClusterService clusterService, AtlasServerService serverService,
ExportImportAuditService exportImportAuditService) { ExportImportAuditService exportImportAuditService) {
this.serviceState = serviceState; this.serviceState = serviceState;
this.metricsService = metricsService; this.metricsService = metricsService;
...@@ -152,7 +155,7 @@ public class AdminResource { ...@@ -152,7 +155,7 @@ public class AdminResource {
this.activeSearches = activeSearches; this.activeSearches = activeSearches;
this.typeRegistry = typeRegistry; this.typeRegistry = typeRegistry;
this.migrationProgressService = migrationProgressService; this.migrationProgressService = migrationProgressService;
this.clusterService = clusterService; this.atlasServerService = serverService;
this.exportImportAuditService = exportImportAuditService; this.exportImportAuditService = exportImportAuditService;
this.importExportOperationLock = new ReentrantLock(); this.importExportOperationLock = new ReentrantLock();
} }
...@@ -448,24 +451,24 @@ public class AdminResource { ...@@ -448,24 +451,24 @@ public class AdminResource {
/** /**
* Fetch details of a cluster. * Fetch details of a cluster.
* @param clusterName name of target cluster with which it is paired * @param serverName name of target cluster with which it is paired
* @return AtlasCluster * @return AtlasServer
* @throws AtlasBaseException * @throws AtlasBaseException
*/ */
@GET @GET
@Path("/cluster/{clusterName}") @Path("/server/{serverName}")
@Consumes(Servlets.JSON_MEDIA_TYPE) @Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE) @Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasCluster getCluster(@PathParam("clusterName") String clusterName) throws AtlasBaseException { public AtlasServer getCluster(@PathParam("serverName") String serverName) throws AtlasBaseException {
AtlasPerfTracer perf = null; AtlasPerfTracer perf = null;
try { try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) { if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "cluster.getCluster(" + clusterName + ")"); perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "cluster.getServer(" + serverName + ")");
} }
AtlasCluster cluster = new AtlasCluster(clusterName, clusterName); AtlasServer cluster = new AtlasServer(serverName, serverName);
return clusterService.get(cluster); return atlasServerService.get(cluster);
} finally { } finally {
AtlasPerfTracer.log(perf); AtlasPerfTracer.log(perf);
} }
...@@ -475,7 +478,7 @@ public class AdminResource { ...@@ -475,7 +478,7 @@ public class AdminResource {
@Path("/expimp/audit") @Path("/expimp/audit")
@Consumes(Servlets.JSON_MEDIA_TYPE) @Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE) @Produces(Servlets.JSON_MEDIA_TYPE)
public List<ExportImportAuditEntry> getExportImportAudit(@QueryParam("clusterName") String cluster, public List<ExportImportAuditEntry> getExportImportAudit(@QueryParam("serverName") String serverName,
@QueryParam("userName") String userName, @QueryParam("userName") String userName,
@QueryParam("operation") String operation, @QueryParam("operation") String operation,
@QueryParam("startTime") String startTime, @QueryParam("startTime") String startTime,
...@@ -486,10 +489,10 @@ public class AdminResource { ...@@ -486,10 +489,10 @@ public class AdminResource {
try { try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) { if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "getExportImportAudit(" + cluster + ")"); perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "getExportImportAudit(" + serverName + ")");
} }
return exportImportAuditService.get(userName, operation, cluster, startTime, endTime, limit, offset); return exportImportAuditService.get(userName, operation, serverName, startTime, endTime, limit, offset);
} finally { } finally {
AtlasPerfTracer.log(perf); AtlasPerfTracer.log(perf);
} }
......
...@@ -21,7 +21,7 @@ package org.apache.atlas.web.resources; ...@@ -21,7 +21,7 @@ package org.apache.atlas.web.resources;
import org.apache.atlas.AtlasServiceException; import org.apache.atlas.AtlasServiceException;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.impexp.AtlasCluster; import org.apache.atlas.model.impexp.AtlasServer;
import org.apache.atlas.model.impexp.AtlasExportRequest; import org.apache.atlas.model.impexp.AtlasExportRequest;
import org.apache.atlas.model.impexp.AtlasImportRequest; import org.apache.atlas.model.impexp.AtlasImportRequest;
import org.apache.atlas.model.impexp.AtlasImportResult; import org.apache.atlas.model.impexp.AtlasImportResult;
...@@ -44,10 +44,10 @@ import static org.testng.Assert.assertTrue; ...@@ -44,10 +44,10 @@ import static org.testng.Assert.assertTrue;
public class AdminExportImportTestIT extends BaseResourceIT { public class AdminExportImportTestIT extends BaseResourceIT {
private final String FILE_TO_IMPORT = "stocks-base.zip"; private final String FILE_TO_IMPORT = "stocks-base.zip";
private final String EXPORT_REQUEST_FILE = "export-incremental"; private final String EXPORT_REQUEST_FILE = "export-incremental";
private final String SOURCE_CLUSTER_NAME = "cl1"; private final String SOURCE_SERVER_NAME = "cl1";
static final String IMPORT_TRANSFORM_CLEAR_ATTRS = static final String IMPORT_TRANSFORM_CLEAR_ATTRS =
"{ \"Asset\": { \"*\":[ \"clearAttrValue:replicatedToCluster,replicatedFromCluster\" ] } }"; "{ \"Asset\": { \"*\":[ \"clearAttrValue:replicatedTo,replicatedFrom\" ] } }";
static final String IMPORT_TRANSFORM_SET_DELETED = static final String IMPORT_TRANSFORM_SET_DELETED =
"{ \"Asset\": { \"*\":[ \"setDeleted\" ] } }"; "{ \"Asset\": { \"*\":[ \"setDeleted\" ] } }";
...@@ -77,7 +77,7 @@ public class AdminExportImportTestIT extends BaseResourceIT { ...@@ -77,7 +77,7 @@ public class AdminExportImportTestIT extends BaseResourceIT {
private void performImport(String fileToImport) throws AtlasServiceException { private void performImport(String fileToImport) throws AtlasServiceException {
AtlasImportRequest request = new AtlasImportRequest(); AtlasImportRequest request = new AtlasImportRequest();
request.getOptions().put(AtlasImportRequest.OPTION_KEY_REPLICATED_FROM, SOURCE_CLUSTER_NAME); request.getOptions().put(AtlasImportRequest.OPTION_KEY_REPLICATED_FROM, SOURCE_SERVER_NAME);
request.getOptions().put(AtlasImportRequest.TRANSFORMS_KEY, IMPORT_TRANSFORM_CLEAR_ATTRS); request.getOptions().put(AtlasImportRequest.TRANSFORMS_KEY, IMPORT_TRANSFORM_CLEAR_ATTRS);
performImport(fileToImport, request); performImport(fileToImport, request);
...@@ -100,11 +100,11 @@ public class AdminExportImportTestIT extends BaseResourceIT { ...@@ -100,11 +100,11 @@ public class AdminExportImportTestIT extends BaseResourceIT {
assertEquals(result.getProcessedEntities().size(), 37); assertEquals(result.getProcessedEntities().size(), 37);
} }
private void assertReplicationData(String clusterName) throws AtlasServiceException { private void assertReplicationData(String serverName) throws AtlasServiceException {
AtlasCluster cluster = atlasClientV2.getCluster(clusterName); AtlasServer server = atlasClientV2.getServer(serverName);
assertNotNull(cluster); assertNotNull(server);
assertNotNull(cluster.getAdditionalInfo()); assertNotNull(server.getAdditionalInfo());
assertTrue(cluster.getAdditionalInfo().size() > 0); assertTrue(server.getAdditionalInfo().size() > 0);
} }
@AfterClass @AfterClass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment