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