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
40666d18
Commit
40666d18
authored
Sep 21, 2017
by
ashutoshm
Committed by
Madhan Neethiraj
Sep 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2158: ZipFileResourceTestUtils: Improved failure scenario.
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
6a64cd9c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
16 deletions
+22
-16
ZipFileResourceTestUtils.java
...che/atlas/repository/impexp/ZipFileResourceTestUtils.java
+22
-16
No files found.
repository/src/test/java/org/apache/atlas/repository/impexp/ZipFileResourceTestUtils.java
View file @
40666d18
...
...
@@ -76,24 +76,26 @@ public class ZipFileResourceTestUtils {
File
[]
topModelsDirContents
=
topModelsDir
.
exists
()
?
topModelsDir
.
listFiles
()
:
null
;
assertTrue
(
topModelsDirContents
!=
null
,
topModelsDir
.
getAbsolutePath
()
+
": unable to find/read directory"
);
Arrays
.
sort
(
topModelsDirContents
);
for
(
File
modelDir
:
topModelsDirContents
)
{
if
(
modelDir
.
exists
()
&&
modelDir
.
isDirectory
())
{
ret
=
getFileContents
(
modelDir
,
fileName
);
if
(
ret
!=
null
)
{
break
;
if
(
topModelsDirContents
!=
null
)
{
Arrays
.
sort
(
topModelsDirContents
);
for
(
File
modelDir
:
topModelsDirContents
)
{
if
(
modelDir
.
exists
()
&&
modelDir
.
isDirectory
()
)
{
ret
=
getFileContents
(
modelDir
,
fileName
);
if
(
ret
!=
null
)
{
break
;
}
}
}
}
if
(
ret
==
null
)
{
ret
=
getFileContents
(
topModelsDir
,
fileName
);
}
if
(
ret
==
null
)
{
ret
=
getFileContents
(
topModelsDir
,
fileName
);
}
assertTrue
(
ret
!=
null
,
fileName
+
": unable to find model file"
);
assertTrue
(
ret
!=
null
,
fileName
+
": unable to find model file"
);
}
else
{
throw
new
IOException
(
"Unable to retrieve model contents."
);
}
return
ret
;
}
...
...
@@ -169,15 +171,19 @@ public class ZipFileResourceTestUtils {
}
private
static
void
createTypesAsNeeded
(
AtlasTypesDef
typesFromJson
,
AtlasTypeDefStore
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
throws
AtlasBaseException
{
AtlasTypesDef
typesToCreate
=
AtlasTypeDefStoreInitializer
.
getTypesToCreate
(
typesFromJson
,
typeRegistry
);
if
(
typesFromJson
==
null
)
{
return
;
}
if
(!
typesToCreate
.
isEmpty
())
{
AtlasTypesDef
typesToCreate
=
AtlasTypeDefStoreInitializer
.
getTypesToCreate
(
typesFromJson
,
typeRegistry
);
if
(
typesToCreate
!=
null
&&
!
typesToCreate
.
isEmpty
())
{
typeDefStore
.
createTypesDef
(
typesToCreate
);
}
}
private
static
AtlasTypesDef
getAtlasTypesDefFromFile
(
String
fileName
)
throws
IOException
{
String
sampleTypes
=
ZipFileResourceTestUtils
.
getModelJson
(
fileName
);
if
(
sampleTypes
==
null
)
return
null
;
return
AtlasType
.
fromJson
(
sampleTypes
,
AtlasTypesDef
.
class
);
}
...
...
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