This is an automated email from the ASF dual-hosted git repository.
madhan pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 86057ff ATLAS-3067: updated EntityJerseyResourceIT.testUTF8() to aid
troubleshooting failures - #3
86057ff is described below
commit 86057ff3faee44d9459ae3b627e2ca938184fd28
Author: Madhan Neethiraj <[email protected]>
AuthorDate: Thu Jul 18 06:48:04 2019 -0700
ATLAS-3067: updated EntityJerseyResourceIT.testUTF8() to aid
troubleshooting failures - #3
(cherry picked from commit bd31c50539c7b4df5fb43065844a007ce68a0106)
---
.../web/integration/EntityJerseyResourceIT.java | 35 ++++++++++------------
1 file changed, 16 insertions(+), 19 deletions(-)
diff --git
a/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java
b/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java
index 767278e..b3be8ef 100755
---
a/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java
+++
b/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java
@@ -820,27 +820,24 @@ public class EntityJerseyResourceIT extends
BaseResourceIT {
@Test
public void testUTF8() throws Exception {
- //Type names cannot be arbitrary UTF8 characters. See
org.apache.atlas.type.AtlasTypeUtil#validateType()
- String classType = randomString();
- String attrName = random();
- String attrValue = random();
-
- ClassTypeDefinition classTypeDefinition = TypesUtil
- .createClassTypeDef(classType, null,
Collections.<String>emptySet(),
- TypesUtil.createUniqueRequiredAttrDef(attrName,
AtlasBaseTypeDef.ATLAS_TYPE_STRING));
- TypesDef typesDef = new
TypesDef(Collections.<EnumTypeDefinition>emptyList(),
Collections.<StructTypeDefinition>emptyList(),
- Collections.<TraitTypeDefinition>emptyList(),
- Collections.singletonList(classTypeDefinition));
+ String classType = randomString(); //Type names
cannot be arbitrary UTF8 characters. See
org.apache.atlas.type.AtlasTypeUtil#validateType()
+ String attrName = random();
+ String attrValue = random();
+ ClassTypeDefinition classTypeDefinition =
TypesUtil.createClassTypeDef(classType, null, Collections.<String>emptySet(),
TypesUtil.createUniqueRequiredAttrDef(attrName,
AtlasBaseTypeDef.ATLAS_TYPE_STRING));
+ TypesDef typesDef = new
TypesDef(Collections.<EnumTypeDefinition>emptyList(),
Collections.<StructTypeDefinition>emptyList(),
Collections.<TraitTypeDefinition>emptyList(),
Collections.singletonList(classTypeDefinition));
+
createType(typesDef);
- Referenceable instance = new Referenceable(classType,
Collections.singletonMap(attrName, attrValue));
- Id guid = createInstance(instance);
- ObjectNode response =
atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.GET_ENTITY, null,
guid._getId());
- Object objResponse = response.get(AtlasClient.DEFINITION);
- String jsonResponse = AtlasType.toJson(objResponse);
- Referenceable createdEntity = AtlasType.fromV1Json(jsonResponse,
Referenceable.class);
+ Referenceable entityToCreate = new Referenceable(classType,
Collections.singletonMap(attrName, attrValue));
+ Id guid = createInstance(entityToCreate);
+ ObjectNode response =
atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.GET_ENTITY, null,
guid._getId());
+ Object objResponse = response.get(AtlasClient.DEFINITION);
+ String jsonResponse = AtlasType.toJson(objResponse);
+ Referenceable createdEntity = AtlasType.fromV1Json(jsonResponse,
Referenceable.class);
+ Object entityAttrValue = createdEntity.get(attrName);
- Assert.assertEquals(createdEntity.get(attrName), attrValue,
"entityId=" + guid + "; objResponse=" + objResponse + "; jsonResponse=" +
jsonResponse + "; createdEntity=" + createdEntity);
+ Assert.assertEquals(entityAttrValue, attrValue,
+ "attrName=" + attrName + "; attrValue=" +
attrValue + "; entityToCreate=" + entityToCreate + "; entityId=" + guid + ";
getEntityResponse_Obj=" + objResponse + "; getEntityResponse_Json=" +
jsonResponse + "; getEntityResponse_Entity=" + createdEntity);
}
@@ -1139,4 +1136,4 @@ public class EntityJerseyResourceIT extends
BaseResourceIT {
return ret;
}
-}
\ No newline at end of file
+}