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
b9525a57
Commit
b9525a57
authored
Nov 24, 2016
by
Vimal Sharma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
V2 API webapp tests are failing(ayubkhan via svimal2106)
parent
d4efc378
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
88 additions
and
51 deletions
+88
-51
pom.xml
pom.xml
+0
-1
release-log.txt
release-log.txt
+1
-0
DataSetLineageJerseyResourceIT.java
...e/atlas/web/resources/DataSetLineageJerseyResourceIT.java
+15
-0
MetadataDiscoveryJerseyResourceIT.java
...tlas/web/resources/MetadataDiscoveryJerseyResourceIT.java
+23
-24
TypedefsJerseyResourceIT.java
.../apache/atlas/web/resources/TypedefsJerseyResourceIT.java
+13
-3
TypesJerseyResourceIT.java
...org/apache/atlas/web/resources/TypesJerseyResourceIT.java
+24
-18
web.xml
webapp/src/test/webapp/WEB-INF/web.xml
+12
-5
No files found.
pom.xml
View file @
b9525a57
...
...
@@ -1751,7 +1751,6 @@
<redirectTestOutputToFile>
true
</redirectTestOutputToFile>
<!-- ATLAS-1317: Disable problematic tests. Need to revisit and fix them later -->
<excludes>
<exclude>
**/TypedefsJerseyResourceIT.java
</exclude>
<exclude>
**/TypesJerseyResourceIT.java
</exclude>
<exclude>
**/MetadataDiscoveryJerseyResourceIT.java
</exclude>
<exclude>
**/HiveHookIT.java
</exclude>
...
...
release-log.txt
View file @
b9525a57
...
...
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES:
ATLAS-1316 V2 API webapp tests are failing (ayubkhan via svimal2106)
ATLAS-1315 Fix webapp Integration tests (ayubkhan,apoorvnaik via svimal2106)
ATLAS-1313 Tests SSLAndKerberosTest.testService and SSLTest.testService are failing (ayubkhan via svimal2106)
ATLAS-1116 Performance monitoring of backend methods in API requests (shwethags)
...
...
webapp/src/test/java/org/apache/atlas/web/resources/DataSetLineageJerseyResourceIT.java
View file @
b9525a57
...
...
@@ -32,6 +32,10 @@ import org.codehaus.jettison.json.JSONObject;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
org.apache.atlas.typesystem.types.HierarchicalTypeDefinition
;
import
org.apache.atlas.typesystem.types.TraitType
;
import
org.apache.atlas.typesystem.types.utils.TypesUtil
;
import
com.google.common.collect.ImmutableSet
;
import
javax.ws.rs.HttpMethod
;
import
javax.ws.rs.core.Response
;
...
...
@@ -213,6 +217,17 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
}
private
void
setupInstances
()
throws
Exception
{
HierarchicalTypeDefinition
<
TraitType
>
factTrait
=
TypesUtil
.
createTraitTypeDef
(
"Fact"
,
ImmutableSet
.<
String
>
of
());
HierarchicalTypeDefinition
<
TraitType
>
etlTrait
=
TypesUtil
.
createTraitTypeDef
(
"ETL"
,
ImmutableSet
.<
String
>
of
());
HierarchicalTypeDefinition
<
TraitType
>
dimensionTrait
=
TypesUtil
.
createTraitTypeDef
(
"Dimension"
,
ImmutableSet
.<
String
>
of
());
HierarchicalTypeDefinition
<
TraitType
>
metricTrait
=
TypesUtil
.
createTraitTypeDef
(
"Metric"
,
ImmutableSet
.<
String
>
of
());
createType
(
getTypesDef
(
null
,
null
,
ImmutableList
.
of
(
factTrait
,
etlTrait
,
dimensionTrait
,
metricTrait
),
null
));
salesDBName
=
"Sales"
+
randomString
();
Id
salesDB
=
database
(
salesDBName
,
"Sales Database"
,
"John ETL"
,
"hdfs://host:8000/apps/warehouse/sales"
);
...
...
webapp/src/test/java/org/apache/atlas/web/resources/MetadataDiscoveryJerseyResourceIT.java
View file @
b9525a57
...
...
@@ -57,18 +57,19 @@ import static org.testng.Assert.fail;
public
class
MetadataDiscoveryJerseyResourceIT
extends
BaseResourceIT
{
private
String
tagName
;
private
String
dbName
;
@BeforeClass
public
void
setUp
()
throws
Exception
{
super
.
setUp
();
dbName
=
"db"
+
randomString
();
createTypes
();
createInstance
();
createInstance
(
createHiveDBInstance
(
dbName
)
);
}
@Test
public
void
testSearchByDSL
()
throws
Exception
{
String
dslQuery
=
"from
dsl_test_type
"
;
String
dslQuery
=
"from
"
+
DATABASE_TYPE
+
" qualifiedName=\""
+
dbName
+
"\"
"
;
WebResource
resource
=
service
.
path
(
"api/atlas/discovery/search/dsl"
).
queryParam
(
"query"
,
dslQuery
);
ClientResponse
clientResponse
=
resource
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
).
type
(
Servlets
.
JSON_MEDIA_TYPE
)
...
...
@@ -86,21 +87,17 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
JSONArray
results
=
response
.
getJSONArray
(
AtlasClient
.
RESULTS
);
Assert
.
assertNotNull
(
results
);
assertEquals
(
results
.
length
(),
2
);
assertEquals
(
results
.
length
(),
1
);
int
numRows
=
response
.
getInt
(
AtlasClient
.
COUNT
);
assertEquals
(
numRows
,
2
);
assertEquals
(
numRows
,
1
);
}
@Test
public
void
testSearchDSLLimits
()
throws
Exception
{
Referenceable
entity
=
new
Referenceable
(
"dsl_test_type"
);
entity
.
set
(
"name"
,
randomString
());
entity
.
set
(
"description"
,
randomString
());
createInstance
(
entity
);
//search without new parameters of limit and offset should work
String
dslQuery
=
"from
dsl_test_type
"
;
String
dslQuery
=
"from
"
+
DATABASE_TYPE
+
" qualifiedName=\""
+
dbName
+
"\"
"
;
WebResource
resource
=
service
.
path
(
"api/atlas/discovery/search/dsl"
).
queryParam
(
"query"
,
dslQuery
);
ClientResponse
clientResponse
=
resource
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
).
type
(
Servlets
.
JSON_MEDIA_TYPE
)
...
...
@@ -109,11 +106,11 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
//higher limit, all results returned
JSONArray
results
=
serviceClient
.
searchByDSL
(
dslQuery
,
10
,
0
);
assertEquals
(
results
.
length
(),
2
);
assertEquals
(
results
.
length
(),
1
);
//default limit and offset -1, all results returned
results
=
serviceClient
.
searchByDSL
(
dslQuery
,
-
1
,
-
1
);
assertEquals
(
results
.
length
(),
2
);
assertEquals
(
results
.
length
(),
1
);
//uses the limit parameter passed
results
=
serviceClient
.
searchByDSL
(
dslQuery
,
1
,
0
);
...
...
@@ -121,7 +118,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
//uses the offset parameter passed
results
=
serviceClient
.
searchByDSL
(
dslQuery
,
10
,
1
);
assertEquals
(
results
.
length
(),
1
);
assertEquals
(
results
.
length
(),
0
);
//limit > 0
try
{
...
...
@@ -160,7 +157,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
@Test
public
void
testSearchUsingGremlin
()
throws
Exception
{
String
query
=
"g.V.has('type', '
dsl_test_type
').toList()"
;
String
query
=
"g.V.has('type', '
hive_db
').toList()"
;
WebResource
resource
=
service
.
path
(
"api/atlas/discovery/search/gremlin"
).
queryParam
(
"query"
,
query
);
ClientResponse
clientResponse
=
resource
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
).
type
(
Servlets
.
JSON_MEDIA_TYPE
)
...
...
@@ -179,7 +176,8 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
@Test
public
void
testSearchUsingDSL
()
throws
Exception
{
String
query
=
"from dsl_test_type"
;
//String query = "from dsl_test_type";
String
query
=
"from "
+
DATABASE_TYPE
+
" qualifiedName=\""
+
dbName
+
"\""
;
WebResource
resource
=
service
.
path
(
"api/atlas/discovery/search"
).
queryParam
(
"query"
,
query
);
ClientResponse
clientResponse
=
resource
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
).
type
(
Servlets
.
JSON_MEDIA_TYPE
)
...
...
@@ -217,10 +215,10 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
@Test
(
dependsOnMethods
=
"testSearchDSLLimits"
)
public
void
testSearchUsingFullText
()
throws
Exception
{
JSONObject
response
=
serviceClient
.
searchByFullText
(
tag
Name
,
10
,
0
);
JSONObject
response
=
serviceClient
.
searchByFullText
(
db
Name
,
10
,
0
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
assertEquals
(
response
.
getString
(
"query"
),
tag
Name
);
assertEquals
(
response
.
getString
(
"query"
),
db
Name
);
assertEquals
(
response
.
getString
(
"queryType"
),
"full-text"
);
JSONArray
results
=
response
.
getJSONArray
(
AtlasClient
.
RESULTS
);
...
...
@@ -228,29 +226,29 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
JSONObject
row
=
results
.
getJSONObject
(
0
);
Assert
.
assertNotNull
(
row
.
get
(
"guid"
));
assertEquals
(
row
.
getString
(
"typeName"
),
"dsl_test_type"
);
assertEquals
(
row
.
getString
(
"typeName"
),
DATABASE_TYPE
);
Assert
.
assertNotNull
(
row
.
get
(
"score"
));
int
numRows
=
response
.
getInt
(
AtlasClient
.
COUNT
);
assertEquals
(
numRows
,
1
);
//API works without limit and offset
String
query
=
"dsl_test_type"
;
String
query
=
dbName
;
WebResource
resource
=
service
.
path
(
"api/atlas/discovery/search/fulltext"
).
queryParam
(
"query"
,
query
);
ClientResponse
clientResponse
=
resource
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
).
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
GET
,
ClientResponse
.
class
);
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
OK
.
getStatusCode
());
results
=
new
JSONObject
(
clientResponse
.
getEntity
(
String
.
class
)).
getJSONArray
(
AtlasClient
.
RESULTS
);
assertEquals
(
results
.
length
(),
2
);
assertEquals
(
results
.
length
(),
1
);
//verify passed in limits and offsets are used
//higher limit and 0 offset returns all results
results
=
serviceClient
.
searchByFullText
(
query
,
10
,
0
).
getJSONArray
(
AtlasClient
.
RESULTS
);
assertEquals
(
results
.
length
(),
2
);
assertEquals
(
results
.
length
(),
1
);
//offset is used
results
=
serviceClient
.
searchByFullText
(
query
,
10
,
1
).
getJSONArray
(
AtlasClient
.
RESULTS
);
assertEquals
(
results
.
length
(),
1
);
assertEquals
(
results
.
length
(),
0
);
//limit is used
results
=
serviceClient
.
searchByFullText
(
query
,
1
,
0
).
getJSONArray
(
AtlasClient
.
RESULTS
);
...
...
@@ -277,8 +275,9 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
private
Id
createInstance
()
throws
Exception
{
Referenceable
entityInstance
=
new
Referenceable
(
"dsl_test_type"
,
"Classification"
);
entityInstance
.
set
(
"name"
,
"foo name"
);
entityInstance
.
set
(
"description"
,
"bar description"
);
entityInstance
.
set
(
"name"
,
randomString
());
entityInstance
.
set
(
"description"
,
randomString
());
Struct
traitInstance
=
(
Struct
)
entityInstance
.
getTrait
(
"Classification"
);
tagName
=
randomString
();
...
...
webapp/src/test/java/org/apache/atlas/web/resources/TypedefsJerseyResourceIT.java
View file @
b9525a57
...
...
@@ -52,6 +52,7 @@ import static org.apache.atlas.type.AtlasTypeUtil.createClassTypeDef;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertFalse
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
static
org
.
testng
.
Assert
.
fail
;
/**
...
...
@@ -108,8 +109,9 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
@Test
public
void
testUpdate
()
throws
Exception
{
String
entityType
=
randomString
();
AtlasEntityDef
typeDefinition
=
createClassTypeDef
(
randomString
()
,
ImmutableSet
.<
String
>
of
(),
createClassTypeDef
(
entityType
,
ImmutableSet
.<
String
>
of
(),
AtlasTypeUtil
.
createUniqueRequiredAttrDef
(
"name"
,
"string"
));
AtlasTypesDef
atlasTypesDef
=
new
AtlasTypesDef
();
...
...
@@ -135,10 +137,18 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
assertEquals
(
updatedTypeDefs
.
getEntityDefs
().
get
(
0
).
getName
(),
atlasTypesDef
.
getEntityDefs
().
get
(
0
).
getName
());
Map
<
String
,
String
>
filterParams
=
new
HashMap
<>();
filterParams
.
put
(
SearchFilter
.
PARAM_TYPE
,
"
entity
"
);
filterParams
.
put
(
SearchFilter
.
PARAM_TYPE
,
"
ENTITY
"
);
AtlasTypesDef
allTypeDefs
=
clientV2
.
getAllTypeDefs
(
new
SearchFilter
(
filterParams
));
assertNotNull
(
allTypeDefs
);
assertEquals
(
allTypeDefs
.
getEntityDefs
().
get
(
0
).
getAttributeDefs
().
size
(),
2
);
Boolean
entityDefFound
=
false
;
for
(
AtlasEntityDef
atlasEntityDef
:
allTypeDefs
.
getEntityDefs
()){
if
(
atlasEntityDef
.
getName
().
equals
(
typeDefinition
.
getName
()))
{
assertEquals
(
atlasEntityDef
.
getAttributeDefs
().
size
(),
2
);
entityDefFound
=
true
;
break
;
}
}
assertTrue
(
entityDefFound
,
"Required entityDef not found."
);
}
@Test
(
dependsOnMethods
=
"testCreate"
)
...
...
webapp/src/test/java/org/apache/atlas/web/resources/TypesJerseyResourceIT.java
View file @
b9525a57
...
...
@@ -78,23 +78,27 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
@Test
public
void
testSubmit
()
throws
Exception
{
for
(
HierarchicalTypeDefinition
typeDefinition
:
typeDefinitions
)
{
String
typesAsJSON
=
TypesSerialization
.
toJson
(
typeDefinition
,
false
);
System
.
out
.
println
(
"typesAsJSON = "
+
typesAsJSON
);
WebResource
resource
=
service
.
path
(
"api/atlas/types"
);
ClientResponse
clientResponse
=
resource
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
).
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
POST
,
ClientResponse
.
class
,
typesAsJSON
);
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
CREATED
.
getStatusCode
());
String
responseAsString
=
clientResponse
.
getEntity
(
String
.
class
);
Assert
.
assertNotNull
(
responseAsString
);
JSONObject
response
=
new
JSONObject
(
responseAsString
);
JSONArray
typesAdded
=
response
.
getJSONArray
(
AtlasClient
.
TYPES
);
assertEquals
(
typesAdded
.
length
(),
1
);
assertEquals
(
typesAdded
.
getJSONObject
(
0
).
getString
(
"name"
),
typeDefinition
.
typeName
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
try
{
serviceClient
.
getType
(
typeDefinition
.
typeName
);
}
catch
(
AtlasServiceException
ase
){
String
typesAsJSON
=
TypesSerialization
.
toJson
(
typeDefinition
,
false
);
System
.
out
.
println
(
"typesAsJSON = "
+
typesAsJSON
);
WebResource
resource
=
service
.
path
(
"api/atlas/types"
);
ClientResponse
clientResponse
=
resource
.
accept
(
Servlets
.
JSON_MEDIA_TYPE
).
type
(
Servlets
.
JSON_MEDIA_TYPE
)
.
method
(
HttpMethod
.
POST
,
ClientResponse
.
class
,
typesAsJSON
);
assertEquals
(
clientResponse
.
getStatus
(),
Response
.
Status
.
CREATED
.
getStatusCode
());
String
responseAsString
=
clientResponse
.
getEntity
(
String
.
class
);
Assert
.
assertNotNull
(
responseAsString
);
JSONObject
response
=
new
JSONObject
(
responseAsString
);
JSONArray
typesAdded
=
response
.
getJSONArray
(
AtlasClient
.
TYPES
);
assertEquals
(
typesAdded
.
length
(),
1
);
assertEquals
(
typesAdded
.
getJSONObject
(
0
).
getString
(
"name"
),
typeDefinition
.
typeName
);
Assert
.
assertNotNull
(
response
.
get
(
AtlasClient
.
REQUEST_ID
));
}
}
}
...
...
@@ -263,13 +267,15 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
HierarchicalTypeDefinition
<
ClassType
>
databaseTypeDefinition
=
TypesUtil
.
createClassTypeDef
(
"database"
,
ImmutableSet
.<
String
>
of
(),
TypesUtil
.
createUniqueRequiredAttrDef
(
"name"
,
DataTypes
.
STRING_TYPE
),
TypesUtil
.
createRequiredAttrDef
(
"description"
,
DataTypes
.
STRING_TYPE
));
TypesUtil
.
createRequiredAttrDef
(
"description"
,
DataTypes
.
STRING_TYPE
),
TypesUtil
.
createRequiredAttrDef
(
"qualifiedName"
,
DataTypes
.
STRING_TYPE
));
typeDefinitions
.
add
(
databaseTypeDefinition
);
HierarchicalTypeDefinition
<
ClassType
>
tableTypeDefinition
=
TypesUtil
.
createClassTypeDef
(
"table"
,
ImmutableSet
.<
String
>
of
(),
TypesUtil
.
createUniqueRequiredAttrDef
(
"name"
,
DataTypes
.
STRING_TYPE
),
TypesUtil
.
createRequiredAttrDef
(
"description"
,
DataTypes
.
STRING_TYPE
),
TypesUtil
.
createRequiredAttrDef
(
"qualifiedName"
,
DataTypes
.
STRING_TYPE
),
createOptionalAttrDef
(
"columnNames"
,
DataTypes
.
arrayTypeName
(
DataTypes
.
STRING_TYPE
)),
createOptionalAttrDef
(
"created"
,
DataTypes
.
DATE_TYPE
),
createOptionalAttrDef
(
"parameters"
,
...
...
webapp/src/test/webapp/WEB-INF/web.xml
View file @
b9525a57
...
...
@@ -27,9 +27,14 @@
<context-param>
<param-name>
guice.packages
</param-name>
<param-value>
org.apache.atlas.web.resources,org.apache.atlas.web.params
org.apache.atlas.web.resources,org.apache.atlas.web.params
,org.apache.atlas.web.rest,org.apache.atlas.web.errors
</param-value>
</context-param>
<context-param>
<param-name>
com.sun.jersey.api.json.POJOMappingFeature
</param-name>
<param-value>
true
</param-value>
</context-param>
<!--
More information can be found here:
...
...
@@ -46,7 +51,7 @@
<filter-name>
guiceFilter
</filter-name>
<filter-class>
com.google.inject.servlet.GuiceFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>
springSecurityFilterChain
</filter-name>
<url-pattern>
/*
</url-pattern>
...
...
@@ -58,11 +63,11 @@
</filter-mapping>
<listener>
<listener-class>
org.
apache.atlas.web.listeners.TestGuiceServletConfig
</listener-class>
<listener-class>
org.
springframework.web.util.Log4jConfigListener
</listener-class>
</listener>
<listener>
<listener-class>
org.
springframework.web.util.Log4jConfigListener
</listener-class>
<listener-class>
org.
apache.atlas.web.listeners.GuiceServletConfig
</listener-class>
</listener>
<listener>
...
...
@@ -73,6 +78,7 @@
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<session-config>
<session-timeout>
60
</session-timeout>
<tracking-mode>
COOKIE
</tracking-mode>
...
...
@@ -82,4 +88,5 @@
</cookie-config>
</session-config>
</web-app>
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