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
2068d7dd
Commit
2068d7dd
authored
6 years ago
by
Ashutosh Mestry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2969: Addressed UniformInterfaceException from earlier commit.
parent
97e131a5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
AdminResource.java
...in/java/org/apache/atlas/web/resources/AdminResource.java
+2
-0
AdminExportImportTestIT.java
...g/apache/atlas/web/resources/AdminExportImportTestIT.java
+18
-5
empty-1.zip
webapp/src/test/resources/empty-1.zip
+0
-0
No files found.
webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
View file @
2068d7dd
...
@@ -408,10 +408,12 @@ public class AdminResource {
...
@@ -408,10 +408,12 @@ public class AdminResource {
}
catch
(
AtlasBaseException
excp
)
{
}
catch
(
AtlasBaseException
excp
)
{
if
(
excp
.
getAtlasErrorCode
().
equals
(
AtlasErrorCode
.
IMPORT_ATTEMPTING_EMPTY_ZIP
))
{
if
(
excp
.
getAtlasErrorCode
().
equals
(
AtlasErrorCode
.
IMPORT_ATTEMPTING_EMPTY_ZIP
))
{
LOG
.
info
(
excp
.
getMessage
());
LOG
.
info
(
excp
.
getMessage
());
return
new
AtlasImportResult
();
}
else
{
}
else
{
LOG
.
error
(
"importData(binary) failed"
,
excp
);
LOG
.
error
(
"importData(binary) failed"
,
excp
);
throw
excp
;
throw
excp
;
}
}
}
catch
(
Exception
excp
)
{
}
catch
(
Exception
excp
)
{
LOG
.
error
(
"importData(binary) failed"
,
excp
);
LOG
.
error
(
"importData(binary) failed"
,
excp
);
...
...
This diff is collapsed.
Click to expand it.
webapp/src/test/java/org/apache/atlas/web/resources/AdminExportImportTestIT.java
View file @
2068d7dd
...
@@ -21,6 +21,7 @@ package org.apache.atlas.web.resources;
...
@@ -21,6 +21,7 @@ package org.apache.atlas.web.resources;
import
org.apache.atlas.AtlasServiceException
;
import
org.apache.atlas.AtlasServiceException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.impexp.AtlasExportResult
;
import
org.apache.atlas.model.impexp.AtlasServer
;
import
org.apache.atlas.model.impexp.AtlasServer
;
import
org.apache.atlas.model.impexp.AtlasExportRequest
;
import
org.apache.atlas.model.impexp.AtlasExportRequest
;
import
org.apache.atlas.model.impexp.AtlasImportRequest
;
import
org.apache.atlas.model.impexp.AtlasImportRequest
;
...
@@ -43,6 +44,7 @@ import static org.testng.Assert.assertTrue;
...
@@ -43,6 +44,7 @@ import static org.testng.Assert.assertTrue;
public
class
AdminExportImportTestIT
extends
BaseResourceIT
{
public
class
AdminExportImportTestIT
extends
BaseResourceIT
{
private
final
String
FILE_TO_IMPORT
=
"stocks-base.zip"
;
private
final
String
FILE_TO_IMPORT
=
"stocks-base.zip"
;
private
final
String
FILE_TO_IMPORT_EMPTY
=
"empty-1.zip"
;
private
final
String
EXPORT_REQUEST_FILE
=
"export-incremental"
;
private
final
String
EXPORT_REQUEST_FILE
=
"export-incremental"
;
private
final
String
SOURCE_SERVER_NAME
=
"cl1"
;
private
final
String
SOURCE_SERVER_NAME
=
"cl1"
;
...
@@ -62,6 +64,13 @@ public class AdminExportImportTestIT extends BaseResourceIT {
...
@@ -62,6 +64,13 @@ public class AdminExportImportTestIT extends BaseResourceIT {
assertReplicationData
(
"cl1"
);
assertReplicationData
(
"cl1"
);
}
}
@Test
(
dependsOnMethods
=
"isActive"
)
public
void
importEmptyData
()
throws
AtlasServiceException
{
AtlasImportResult
result
=
performImportUsing
(
FILE_TO_IMPORT_EMPTY
,
new
AtlasImportRequest
());
assertNotNull
(
result
);
assertEquals
(
AtlasExportResult
.
OperationStatus
.
FAIL
.
toString
(),
result
.
getOperationStatus
().
toString
());
}
@Test
(
dependsOnMethods
=
"importData"
)
@Test
(
dependsOnMethods
=
"importData"
)
public
void
exportData
()
throws
AtlasServiceException
,
IOException
,
AtlasBaseException
{
public
void
exportData
()
throws
AtlasServiceException
,
IOException
,
AtlasBaseException
{
final
int
EXPECTED_CREATION_ORDER_SIZE
=
10
;
final
int
EXPECTED_CREATION_ORDER_SIZE
=
10
;
...
@@ -85,6 +94,14 @@ public class AdminExportImportTestIT extends BaseResourceIT {
...
@@ -85,6 +94,14 @@ public class AdminExportImportTestIT extends BaseResourceIT {
private
void
performImport
(
String
fileToImport
,
AtlasImportRequest
request
)
throws
AtlasServiceException
{
private
void
performImport
(
String
fileToImport
,
AtlasImportRequest
request
)
throws
AtlasServiceException
{
AtlasImportResult
result
=
performImportUsing
(
fileToImport
,
request
);
assertNotNull
(
result
);
assertEquals
(
result
.
getOperationStatus
(),
AtlasImportResult
.
OperationStatus
.
SUCCESS
);
assertNotNull
(
result
.
getMetrics
());
assertEquals
(
result
.
getProcessedEntities
().
size
(),
37
);
}
private
AtlasImportResult
performImportUsing
(
String
fileToImport
,
AtlasImportRequest
request
)
throws
AtlasServiceException
{
FileInputStream
fileInputStream
=
null
;
FileInputStream
fileInputStream
=
null
;
try
{
try
{
...
@@ -93,11 +110,7 @@ public class AdminExportImportTestIT extends BaseResourceIT {
...
@@ -93,11 +110,7 @@ public class AdminExportImportTestIT extends BaseResourceIT {
assertFalse
(
true
,
"Exception: "
+
e
.
getMessage
());
assertFalse
(
true
,
"Exception: "
+
e
.
getMessage
());
}
}
AtlasImportResult
result
=
atlasClientV2
.
importData
(
request
,
fileInputStream
);
return
atlasClientV2
.
importData
(
request
,
fileInputStream
);
assertNotNull
(
result
);
assertEquals
(
result
.
getOperationStatus
(),
AtlasImportResult
.
OperationStatus
.
SUCCESS
);
assertNotNull
(
result
.
getMetrics
());
assertEquals
(
result
.
getProcessedEntities
().
size
(),
37
);
}
}
private
void
assertReplicationData
(
String
serverName
)
throws
AtlasServiceException
{
private
void
assertReplicationData
(
String
serverName
)
throws
AtlasServiceException
{
...
...
This diff is collapsed.
Click to expand it.
webapp/src/test/resources/empty-1.zip
0 → 100644
View file @
2068d7dd
File added
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