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
4128f5d2
Commit
4128f5d2
authored
6 years ago
by
Sarath Subramanian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2890: Fix intermittent UT and IT failures for atlas in apache CI
(cherry picked from commit 60104c18ab808eee2c777adea2795411c0d4de4b)
parent
ece78ba0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
9 deletions
+33
-9
TypedefsJerseyResourceIT.java
...pache/atlas/web/integration/TypedefsJerseyResourceIT.java
+33
-9
No files found.
webapp/src/test/java/org/apache/atlas/web/integration/TypedefsJerseyResourceIT.java
View file @
4128f5d2
...
@@ -20,7 +20,9 @@ package org.apache.atlas.web.integration;
...
@@ -20,7 +20,9 @@ package org.apache.atlas.web.integration;
import
com.sun.jersey.core.util.MultivaluedMapImpl
;
import
com.sun.jersey.core.util.MultivaluedMapImpl
;
import
org.apache.atlas.AtlasClientV2
;
import
org.apache.atlas.AtlasClientV2
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasServiceException
;
import
org.apache.atlas.AtlasServiceException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.SearchFilter
;
import
org.apache.atlas.model.SearchFilter
;
import
org.apache.atlas.model.TypeCategory
;
import
org.apache.atlas.model.TypeCategory
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
...
@@ -45,6 +47,7 @@ import java.util.Arrays;
...
@@ -45,6 +47,7 @@ import java.util.Arrays;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
static
org
.
apache
.
atlas
.
AtlasErrorCode
.
TYPE_NAME_NOT_FOUND
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasAttributeDef
.
Cardinality
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasStructDef
.
AtlasAttributeDef
.
Cardinality
;
import
static
org
.
apache
.
atlas
.
type
.
AtlasTypeUtil
.
createClassTypeDef
;
import
static
org
.
apache
.
atlas
.
type
.
AtlasTypeUtil
.
createClassTypeDef
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
...
@@ -83,23 +86,22 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
...
@@ -83,23 +86,22 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
public
void
testCreate
()
throws
Exception
{
public
void
testCreate
()
throws
Exception
{
createType
(
typeDefinitions
);
createType
(
typeDefinitions
);
// validate if all types created successfully
for
(
AtlasEnumDef
enumDef
:
typeDefinitions
.
getEnumDefs
())
{
for
(
AtlasEnumDef
enumDef
:
typeDefinitions
.
getEnumDefs
())
{
AtlasEnumDef
byName
=
atlasClientV2
.
getEnumDefByName
(
enumDef
.
getName
());
checkIfTypeExists
(
enumDef
.
getName
());
assertNotNull
(
byName
);
}
}
for
(
AtlasStructDef
structDef
:
typeDefinitions
.
getStructDefs
())
{
for
(
AtlasStructDef
structDef
:
typeDefinitions
.
getStructDefs
())
{
AtlasStructDef
byName
=
atlasClientV2
.
getStructDefByName
(
structDef
.
getName
());
checkIfTypeExists
(
structDef
.
getName
());
assertNotNull
(
byName
);
}
}
for
(
AtlasClassificationDef
classificationDef
:
typeDefinitions
.
getClassificationDefs
())
{
for
(
AtlasClassificationDef
classificationDef
:
typeDefinitions
.
getClassificationDefs
())
{
AtlasClassificationDef
byName
=
atlasClientV2
.
getClassificationDefByName
(
classificationDef
.
getName
());
checkIfTypeExists
(
classificationDef
.
getName
());
assertNotNull
(
byName
);
}
}
for
(
AtlasEntityDef
entityDef
:
typeDefinitions
.
getEntityDefs
())
{
for
(
AtlasEntityDef
entityDef
:
typeDefinitions
.
getEntityDefs
())
{
AtlasEntityDef
byName
=
atlasClientV2
.
getEntityDefByName
(
entityDef
.
getName
());
checkIfTypeExists
(
entityDef
.
getName
());
assertNotNull
(
byName
);
}
}
}
}
@Test
@Test
...
@@ -367,4 +369,26 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
...
@@ -367,4 +369,26 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
def
.
getClassificationDefs
().
clear
();
def
.
getClassificationDefs
().
clear
();
def
.
getEntityDefs
().
clear
();
def
.
getEntityDefs
().
clear
();
}
}
private
void
checkIfTypeExists
(
String
typeName
)
throws
Exception
{
int
retryCount
=
0
;
int
maxRetries
=
3
;
int
sleepTime
=
5000
;
while
(
true
)
{
try
{
boolean
typeExists
=
atlasClientV2
.
typeWithNameExists
(
typeName
);
if
(!
typeExists
)
{
throw
new
AtlasBaseException
(
TYPE_NAME_NOT_FOUND
,
typeName
);
}
else
{
break
;
}
}
catch
(
AtlasBaseException
e
)
{
Thread
.
sleep
(
sleepTime
);
if
(++
retryCount
==
maxRetries
)
throw
e
;
}
}
}
}
}
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