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
1dee77af
Commit
1dee77af
authored
7 years ago
by
Ashutosh Mestry
Committed by
Madhan Neethiraj
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2146: Remove Powermock Usage
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
2bcbd259
master
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
38 deletions
+25
-38
pom.xml
repository/pom.xml
+0
-6
EntityDiscoveryService.java
...va/org/apache/atlas/discovery/EntityDiscoveryService.java
+3
-1
ExportService.java
...ava/org/apache/atlas/repository/impexp/ExportService.java
+3
-1
TypeAttributeDifference.java
...ache/atlas/repository/impexp/TypeAttributeDifference.java
+7
-3
EntityDiscoveryServiceTest.java
...rg/apache/atlas/discovery/EntityDiscoveryServiceTest.java
+3
-7
ExportServiceTest.java
...org/apache/atlas/repository/impexp/ExportServiceTest.java
+6
-16
TypeAttributeDifferenceTest.java
.../atlas/repository/impexp/TypeAttributeDifferenceTest.java
+3
-4
No files found.
repository/pom.xml
View file @
1dee77af
...
@@ -33,12 +33,6 @@
...
@@ -33,12 +33,6 @@
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
org.powermock
</groupId>
<artifactId>
powermock-reflect
</artifactId>
<version>
1.6.1
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.atlas
</groupId>
<groupId>
org.apache.atlas
</groupId>
<artifactId>
atlas-intg
</artifactId>
<artifactId>
atlas-intg
</artifactId>
</dependency>
</dependency>
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
View file @
1dee77af
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
*/
*/
package
org
.
apache
.
atlas
.
discovery
;
package
org
.
apache
.
atlas
.
discovery
;
import
com.google.common.annotations.VisibleForTesting
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasConfiguration
;
import
org.apache.atlas.AtlasConfiguration
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasErrorCode
;
...
@@ -770,7 +771,8 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
...
@@ -770,7 +771,8 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
return
""
;
return
""
;
}
}
private
static
String
getTypeFilter
(
AtlasTypeRegistry
typeRegistry
,
String
typeName
,
int
maxTypesLengthInIdxQuery
)
{
@VisibleForTesting
static
String
getTypeFilter
(
AtlasTypeRegistry
typeRegistry
,
String
typeName
,
int
maxTypesLengthInIdxQuery
)
{
AtlasEntityType
type
=
typeRegistry
.
getEntityTypeByName
(
typeName
);
AtlasEntityType
type
=
typeRegistry
.
getEntityTypeByName
(
typeName
);
String
typeAndSubTypesQryStr
=
type
!=
null
?
type
.
getTypeAndAllSubTypesQryStr
()
:
null
;
String
typeAndSubTypesQryStr
=
type
!=
null
?
type
.
getTypeAndAllSubTypesQryStr
()
:
null
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/impexp/ExportService.java
View file @
1dee77af
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
*/
*/
package
org
.
apache
.
atlas
.
repository
.
impexp
;
package
org
.
apache
.
atlas
.
repository
.
impexp
;
import
com.google.common.annotations.VisibleForTesting
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.AtlasServiceException
;
import
org.apache.atlas.AtlasServiceException
;
...
@@ -167,7 +168,8 @@ public class ExportService {
...
@@ -167,7 +168,8 @@ public class ExportService {
return
statuses
;
return
statuses
;
}
}
private
AtlasExportResult
.
OperationStatus
getOverallOperationStatus
(
AtlasExportResult
.
OperationStatus
...
statuses
)
{
@VisibleForTesting
AtlasExportResult
.
OperationStatus
getOverallOperationStatus
(
AtlasExportResult
.
OperationStatus
...
statuses
)
{
AtlasExportResult
.
OperationStatus
overall
=
(
statuses
.
length
==
0
)
?
AtlasExportResult
.
OperationStatus
overall
=
(
statuses
.
length
==
0
)
?
AtlasExportResult
.
OperationStatus
.
FAIL
:
statuses
[
0
];
AtlasExportResult
.
OperationStatus
.
FAIL
:
statuses
[
0
];
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java
View file @
1dee77af
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
*/
*/
package
org
.
apache
.
atlas
.
repository
.
impexp
;
package
org
.
apache
.
atlas
.
repository
.
impexp
;
import
com.google.common.annotations.VisibleForTesting
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.impexp.AtlasImportResult
;
import
org.apache.atlas.model.impexp.AtlasImportResult
;
...
@@ -92,7 +93,8 @@ public class TypeAttributeDifference {
...
@@ -92,7 +93,8 @@ public class TypeAttributeDifference {
}
}
}
}
private
boolean
addElements
(
AtlasEnumDef
existing
,
AtlasEnumDef
incoming
)
throws
AtlasBaseException
{
@VisibleForTesting
boolean
addElements
(
AtlasEnumDef
existing
,
AtlasEnumDef
incoming
)
throws
AtlasBaseException
{
return
addElements
(
existing
,
getElementsAbsentInExisting
(
existing
,
incoming
));
return
addElements
(
existing
,
getElementsAbsentInExisting
(
existing
,
incoming
));
}
}
...
@@ -100,7 +102,8 @@ public class TypeAttributeDifference {
...
@@ -100,7 +102,8 @@ public class TypeAttributeDifference {
return
addAttributes
(
existing
,
getElementsAbsentInExisting
(
existing
,
incoming
));
return
addAttributes
(
existing
,
getElementsAbsentInExisting
(
existing
,
incoming
));
}
}
private
List
<
AtlasStructDef
.
AtlasAttributeDef
>
getElementsAbsentInExisting
(
AtlasStructDef
existing
,
AtlasStructDef
incoming
)
throws
AtlasBaseException
{
@VisibleForTesting
List
<
AtlasStructDef
.
AtlasAttributeDef
>
getElementsAbsentInExisting
(
AtlasStructDef
existing
,
AtlasStructDef
incoming
)
throws
AtlasBaseException
{
List
<
AtlasStructDef
.
AtlasAttributeDef
>
difference
=
new
ArrayList
<>();
List
<
AtlasStructDef
.
AtlasAttributeDef
>
difference
=
new
ArrayList
<>();
for
(
AtlasStructDef
.
AtlasAttributeDef
attr
:
incoming
.
getAttributeDefs
())
{
for
(
AtlasStructDef
.
AtlasAttributeDef
attr
:
incoming
.
getAttributeDefs
())
{
updateCollectionWithDifferingAttributes
(
difference
,
existing
,
attr
);
updateCollectionWithDifferingAttributes
(
difference
,
existing
,
attr
);
...
@@ -123,7 +126,8 @@ public class TypeAttributeDifference {
...
@@ -123,7 +126,8 @@ public class TypeAttributeDifference {
}
}
}
}
private
List
<
AtlasEnumDef
.
AtlasEnumElementDef
>
getElementsAbsentInExisting
(
AtlasEnumDef
existing
,
AtlasEnumDef
incoming
)
throws
AtlasBaseException
{
@VisibleForTesting
List
<
AtlasEnumDef
.
AtlasEnumElementDef
>
getElementsAbsentInExisting
(
AtlasEnumDef
existing
,
AtlasEnumDef
incoming
)
throws
AtlasBaseException
{
List
<
AtlasEnumDef
.
AtlasEnumElementDef
>
difference
=
new
ArrayList
<>();
List
<
AtlasEnumDef
.
AtlasEnumElementDef
>
difference
=
new
ArrayList
<>();
for
(
AtlasEnumDef
.
AtlasEnumElementDef
ed
:
incoming
.
getElementDefs
())
{
for
(
AtlasEnumDef
.
AtlasEnumElementDef
ed
:
incoming
.
getElementDefs
())
{
updateCollectionWithDifferingAttributes
(
existing
,
difference
,
ed
);
updateCollectionWithDifferingAttributes
(
existing
,
difference
,
ed
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/
services
/EntityDiscoveryServiceTest.java
→
repository/src/test/java/org/apache/atlas/
discovery
/EntityDiscoveryServiceTest.java
View file @
1dee77af
...
@@ -15,24 +15,20 @@
...
@@ -15,24 +15,20 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
package
org
.
apache
.
atlas
.
services
;
package
org
.
apache
.
atlas
.
discovery
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.discovery.EntityDiscoveryService
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.powermock.reflect.Whitebox
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
javax.inject.Inject
;
import
javax.inject.Inject
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.*;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
@Guice
(
modules
=
TestModules
.
TestOnlyModule
.
class
)
@Guice
(
modules
=
TestModules
.
TestOnlyModule
.
class
)
public
class
EntityDiscoveryServiceTest
{
public
class
EntityDiscoveryServiceTest
{
...
@@ -121,7 +117,7 @@ public class EntityDiscoveryServiceTest {
...
@@ -121,7 +117,7 @@ public class EntityDiscoveryServiceTest {
}
}
private
String
invokeGetSubTypesForType
(
String
inputString
,
int
maxSubTypes
)
throws
Exception
{
private
String
invokeGetSubTypesForType
(
String
inputString
,
int
maxSubTypes
)
throws
Exception
{
String
s
=
Whitebox
.
invokeMethod
(
EntityDiscoveryService
.
class
,
"getTypeFilter"
,
typeRegistry
,
inputString
,
maxSubTypes
);
String
s
=
EntityDiscoveryService
.
getTypeFilter
(
typeRegistry
,
inputString
,
maxSubTypes
);
assertNotNull
(
s
);
assertNotNull
(
s
);
return
s
;
return
s
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
View file @
1dee77af
...
@@ -37,7 +37,6 @@ import org.apache.atlas.repository.store.graph.v1.EntityGraphMapper;
...
@@ -37,7 +37,6 @@ import org.apache.atlas.repository.store.graph.v1.EntityGraphMapper;
import
org.apache.atlas.repository.store.graph.v1.SoftDeleteHandlerV1
;
import
org.apache.atlas.repository.store.graph.v1.SoftDeleteHandlerV1
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.powermock.reflect.Whitebox
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.testng.Assert
;
import
org.testng.Assert
;
...
@@ -264,38 +263,29 @@ public class ExportServiceTest {
...
@@ -264,38 +263,29 @@ public class ExportServiceTest {
public
void
verifyOverallStatus
()
throws
Exception
{
public
void
verifyOverallStatus
()
throws
Exception
{
// ExportService service = new ExportService(typeRegistry);
// ExportService service = new ExportService(typeRegistry);
assertEquals
(
AtlasExportResult
.
OperationStatus
.
FAIL
,
Whitebox
.
invokeMethod
(
exportService
,
assertEquals
(
AtlasExportResult
.
OperationStatus
.
FAIL
,
exportService
.
getOverallOperationStatus
());
"getOverallOperationStatus"
));
assertEquals
(
AtlasExportResult
.
OperationStatus
.
SUCCESS
,
Whitebox
.
invokeMethod
(
exportService
,
assertEquals
(
AtlasExportResult
.
OperationStatus
.
SUCCESS
,
exportService
.
getOverallOperationStatus
(
AtlasExportResult
.
OperationStatus
.
SUCCESS
));
"getOverallOperationStatus"
,
AtlasExportResult
.
OperationStatus
.
SUCCESS
));
assertEquals
(
AtlasExportResult
.
OperationStatus
.
SUCCESS
,
Whitebox
.
invokeMethod
(
exportService
,
assertEquals
(
AtlasExportResult
.
OperationStatus
.
SUCCESS
,
exportService
.
getOverallOperationStatus
(
"getOverallOperationStatus"
,
AtlasExportResult
.
OperationStatus
.
SUCCESS
,
AtlasExportResult
.
OperationStatus
.
SUCCESS
,
AtlasExportResult
.
OperationStatus
.
SUCCESS
,
AtlasExportResult
.
OperationStatus
.
SUCCESS
,
AtlasExportResult
.
OperationStatus
.
SUCCESS
));
AtlasExportResult
.
OperationStatus
.
SUCCESS
));
assertEquals
(
AtlasExportResult
.
OperationStatus
.
PARTIAL_SUCCESS
,
Whitebox
.
invokeMethod
(
exportService
,
assertEquals
(
AtlasExportResult
.
OperationStatus
.
PARTIAL_SUCCESS
,
exportService
.
getOverallOperationStatus
(
"getOverallOperationStatus"
,
AtlasExportResult
.
OperationStatus
.
FAIL
,
AtlasExportResult
.
OperationStatus
.
FAIL
,
AtlasExportResult
.
OperationStatus
.
PARTIAL_SUCCESS
,
AtlasExportResult
.
OperationStatus
.
PARTIAL_SUCCESS
,
AtlasExportResult
.
OperationStatus
.
SUCCESS
));
AtlasExportResult
.
OperationStatus
.
SUCCESS
));
assertEquals
(
AtlasExportResult
.
OperationStatus
.
PARTIAL_SUCCESS
,
Whitebox
.
invokeMethod
(
exportService
,
assertEquals
(
AtlasExportResult
.
OperationStatus
.
PARTIAL_SUCCESS
,
exportService
.
getOverallOperationStatus
(
"getOverallOperationStatus"
,
AtlasExportResult
.
OperationStatus
.
FAIL
,
AtlasExportResult
.
OperationStatus
.
FAIL
,
AtlasExportResult
.
OperationStatus
.
FAIL
,
AtlasExportResult
.
OperationStatus
.
FAIL
,
AtlasExportResult
.
OperationStatus
.
PARTIAL_SUCCESS
));
AtlasExportResult
.
OperationStatus
.
PARTIAL_SUCCESS
));
assertEquals
(
AtlasExportResult
.
OperationStatus
.
FAIL
,
Whitebox
.
invokeMethod
(
exportService
,
assertEquals
(
AtlasExportResult
.
OperationStatus
.
FAIL
,
exportService
.
getOverallOperationStatus
(
"getOverallOperationStatus"
,
AtlasExportResult
.
OperationStatus
.
FAIL
,
AtlasExportResult
.
OperationStatus
.
FAIL
,
AtlasExportResult
.
OperationStatus
.
FAIL
,
AtlasExportResult
.
OperationStatus
.
FAIL
,
AtlasExportResult
.
OperationStatus
.
FAIL
));
AtlasExportResult
.
OperationStatus
.
FAIL
));
}
}
@Test
@Test
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/impexp/TypeAttributeDifferenceTest.java
View file @
1dee77af
...
@@ -21,7 +21,6 @@ import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
...
@@ -21,7 +21,6 @@ import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasEnumDef
;
import
org.apache.atlas.model.typedef.AtlasEnumDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.powermock.reflect.Whitebox
;
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
;
...
@@ -76,11 +75,11 @@ public class TypeAttributeDifferenceTest {
...
@@ -76,11 +75,11 @@ public class TypeAttributeDifferenceTest {
}
}
private
List
<
AtlasStructDef
.
AtlasAttributeDef
>
invokeGetAttributesAbsentInExisting
(
AtlasStructDef
existing
,
AtlasStructDef
incoming
)
throws
Exception
{
private
List
<
AtlasStructDef
.
AtlasAttributeDef
>
invokeGetAttributesAbsentInExisting
(
AtlasStructDef
existing
,
AtlasStructDef
incoming
)
throws
Exception
{
return
Whitebox
.
invokeMethod
(
typeAttributeDifference
,
"getElementsAbsentInExisting"
,
existing
,
incoming
);
return
typeAttributeDifference
.
getElementsAbsentInExisting
(
existing
,
incoming
);
}
}
private
List
<
AtlasEnumDef
.
AtlasEnumElementDef
>
invokeGetAttributesAbsentInExisting
(
AtlasEnumDef
existing
,
AtlasEnumDef
incoming
)
throws
Exception
{
private
List
<
AtlasEnumDef
.
AtlasEnumElementDef
>
invokeGetAttributesAbsentInExisting
(
AtlasEnumDef
existing
,
AtlasEnumDef
incoming
)
throws
Exception
{
return
Whitebox
.
invokeMethod
(
typeAttributeDifference
,
"getElementsAbsentInExisting"
,
existing
,
incoming
);
return
typeAttributeDifference
.
getElementsAbsentInExisting
(
existing
,
incoming
);
}
}
private
AtlasEnumDef
getAtlasEnumWithAttributes
(
String
...
elements
)
{
private
AtlasEnumDef
getAtlasEnumWithAttributes
(
String
...
elements
)
{
...
@@ -146,6 +145,6 @@ public class TypeAttributeDifferenceTest {
...
@@ -146,6 +145,6 @@ public class TypeAttributeDifferenceTest {
}
}
private
boolean
invokeUpdate
(
AtlasEnumDef
existing
,
AtlasEnumDef
incoming
)
throws
Exception
{
private
boolean
invokeUpdate
(
AtlasEnumDef
existing
,
AtlasEnumDef
incoming
)
throws
Exception
{
return
Whitebox
.
invokeMethod
(
typeAttributeDifference
,
"addElements"
,
existing
,
incoming
);
return
typeAttributeDifference
.
addElements
(
existing
,
incoming
);
}
}
}
}
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