Commit 50ff27c7 by jajodia Committed by Madhan Neethiraj

ATLAS-3041: fix for failure in deleting relationship-def by name

parent df44a5cb
...@@ -619,6 +619,8 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore { ...@@ -619,6 +619,8 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
typesDef.setEntityDefs(Collections.singletonList((AtlasEntityDef) baseTypeDef)); typesDef.setEntityDefs(Collections.singletonList((AtlasEntityDef) baseTypeDef));
} else if (baseTypeDef instanceof AtlasEnumDef) { } else if (baseTypeDef instanceof AtlasEnumDef) {
typesDef.setEnumDefs(Collections.singletonList((AtlasEnumDef) baseTypeDef)); typesDef.setEnumDefs(Collections.singletonList((AtlasEnumDef) baseTypeDef));
} else if (baseTypeDef instanceof AtlasRelationshipDef) {
typesDef.setRelationshipDefs(Collections.singletonList((AtlasRelationshipDef) baseTypeDef));
} else if (baseTypeDef instanceof AtlasStructDef) { } else if (baseTypeDef instanceof AtlasStructDef) {
typesDef.setStructDefs(Collections.singletonList((AtlasStructDef) baseTypeDef)); typesDef.setStructDefs(Collections.singletonList((AtlasStructDef) baseTypeDef));
} }
......
...@@ -332,9 +332,15 @@ public class AtlasTypeDefGraphStoreTest { ...@@ -332,9 +332,15 @@ public class AtlasTypeDefGraphStoreTest {
try { try {
final String HIVEDB_v2_JSON = "hiveDBv2"; final String HIVEDB_v2_JSON = "hiveDBv2";
final String hiveDB2 = "hive_db_v2"; final String hiveDB2 = "hive_db_v2";
final String relationshipDefName = "cluster_hosts_relationship";
final String hostEntityDef = "host";
final String clusterEntityDef = "cluster";
AtlasTypesDef typesDef = TestResourceFileUtils.readObjectFromJson(".", HIVEDB_v2_JSON, AtlasTypesDef.class); AtlasTypesDef typesDef = TestResourceFileUtils.readObjectFromJson(".", HIVEDB_v2_JSON, AtlasTypesDef.class);
typeDefStore.createTypesDef(typesDef); typeDefStore.createTypesDef(typesDef);
typeDefStore.deleteTypeByName(hiveDB2); typeDefStore.deleteTypeByName(hiveDB2);
typeDefStore.deleteTypeByName(relationshipDefName);
typeDefStore.deleteTypeByName(hostEntityDef);
typeDefStore.deleteTypeByName(clusterEntityDef);
} catch (AtlasBaseException e) { } catch (AtlasBaseException e) {
fail("Deletion should've succeeded"); fail("Deletion should've succeeded");
} }
......
...@@ -52,5 +52,58 @@ ...@@ -52,5 +52,58 @@
"isUnique": false, "isUnique": false,
"isIndexable": false "isIndexable": false
}] }]
}] },
{
"name": "cluster",
"serviceType": "atlas_core",
"typeVersion": "1.0",
"attributeDefs": [
{
"name": "attr1",
"typeName": "string",
"cardinality": "SINGLE",
"isIndexable": true,
"isOptional": false,
"isUnique": false
}
]
},
{
"name": "host",
"serviceType": "atlas_core",
"typeVersion": "1.0",
"attributeDefs": [
{
"name": "attr2",
"typeName": "string",
"cardinality": "SINGLE",
"isIndexable": true,
"isOptional": false,
"includeInNotification": true,
"isUnique": false
}
]
}],
"relationshipDefs": [
{
"name": "cluster_hosts_relationship",
"relationshipLabel": "cluster_hosts_relationship_label",
"serviceType": "atlas_core",
"typeVersion": "1.0",
"relationshipCategory": "COMPOSITION",
"propagateTags": "NONE",
"endDef1": {
"type": "cluster",
"name": "host_list",
"isContainer": true,
"cardinality": "SET"
},
"endDef2": {
"type": "host",
"name": "cluster",
"isContainer": false,
"cardinality": "SINGLE"
}
}
]
} }
\ No newline at end of file
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