Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
c95c71b4
Commit
c95c71b4
authored
May 26, 2015
by
Suma Shivaprasad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UT changes for BUG-37105
parent
e2392607
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
TypesJerseyResourceIT.java
.../hadoop/metadata/web/resources/TypesJerseyResourceIT.java
+17
-5
No files found.
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/TypesJerseyResourceIT.java
View file @
c95c71b4
...
...
@@ -22,6 +22,7 @@ import com.google.common.collect.ImmutableList;
import
com.sun.jersey.api.client.ClientResponse
;
import
com.sun.jersey.api.client.WebResource
;
import
org.apache.hadoop.metadata.MetadataServiceClient
;
import
org.apache.hadoop.metadata.typesystem.TypesDef
;
import
org.apache.hadoop.metadata.typesystem.json.TypesSerialization
;
import
org.apache.hadoop.metadata.typesystem.json.TypesSerialization
$
;
import
org.apache.hadoop.metadata.typesystem.types.AttributeDefinition
;
...
...
@@ -82,7 +83,7 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
Assert
.
assertNotNull
(
responseAsString
);
JSONObject
response
=
new
JSONObject
(
responseAsString
);
Assert
.
assertNotNull
(
response
.
get
(
"types"
));
Assert
.
assertNotNull
(
response
.
get
(
MetadataServiceClient
.
TYPES
));
Assert
.
assertNotNull
(
response
.
get
(
MetadataServiceClient
.
REQUEST_ID
));
}
}
...
...
@@ -104,10 +105,21 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
String
responseAsString
=
clientResponse
.
getEntity
(
String
.
class
);
Assert
.
assertNotNull
(
responseAsString
);
JSONObject
response
=
new
JSONObject
(
responseAsString
);
Assert
.
assertNotNull
(
response
.
get
(
"definition"
));
Assert
.
assertNotNull
(
response
.
get
(
MetadataServiceClient
.
DEFINITION
));
Assert
.
assertNotNull
(
response
.
get
(
MetadataServiceClient
.
REQUEST_ID
));
String
typesJson
=
response
.
getString
(
MetadataServiceClient
.
DEFINITION
);
final
TypesDef
typesDef
=
TypesSerialization
.
fromJson
(
typesJson
);
List
<
HierarchicalTypeDefinition
<
ClassType
>>
hierarchicalTypeDefinitions
=
typesDef
.
classTypesAsJavaList
();
for
(
HierarchicalTypeDefinition
<
ClassType
>
classType
:
hierarchicalTypeDefinitions
)
{
for
(
AttributeDefinition
attrDef
:
classType
.
attributeDefinitions
)
{
if
(
"name"
.
equals
(
attrDef
.
name
))
{
Assert
.
assertEquals
(
attrDef
.
isIndexable
,
true
);
Assert
.
assertEquals
(
attrDef
.
isUnique
,
true
);
}
}
}
}
}
...
...
@@ -196,14 +208,14 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
HierarchicalTypeDefinition
<
ClassType
>
databaseTypeDefinition
=
TypesUtil
.
createClassTypeDef
(
"database"
,
ImmutableList
.<
String
>
of
(),
TypesUtil
.
createRequiredAttrDef
(
"name"
,
DataTypes
.
STRING_TYPE
),
TypesUtil
.
create
Unique
RequiredAttrDef
(
"name"
,
DataTypes
.
STRING_TYPE
),
TypesUtil
.
createRequiredAttrDef
(
"description"
,
DataTypes
.
STRING_TYPE
));
typeDefinitions
.
add
(
databaseTypeDefinition
);
HierarchicalTypeDefinition
<
ClassType
>
tableTypeDefinition
=
TypesUtil
.
createClassTypeDef
(
"table"
,
ImmutableList
.<
String
>
of
(),
TypesUtil
.
createRequiredAttrDef
(
"name"
,
DataTypes
.
STRING_TYPE
),
TypesUtil
.
create
Unique
RequiredAttrDef
(
"name"
,
DataTypes
.
STRING_TYPE
),
TypesUtil
.
createRequiredAttrDef
(
"description"
,
DataTypes
.
STRING_TYPE
),
TypesUtil
.
createRequiredAttrDef
(
"type"
,
DataTypes
.
STRING_TYPE
),
new
AttributeDefinition
(
"database"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment