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
Sep 18, 2017
by
Ashutosh Mestry
Committed by
Madhan Neethiraj
Sep 18, 2017
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
Hide 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 @@
<dependencies>
<dependency>
<groupId>
org.powermock
</groupId>
<artifactId>
powermock-reflect
</artifactId>
<version>
1.6.1
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.atlas
</groupId>
<artifactId>
atlas-intg
</artifactId>
</dependency>
...
...
repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
View file @
1dee77af
...
...
@@ -17,6 +17,7 @@
*/
package
org
.
apache
.
atlas
.
discovery
;
import
com.google.common.annotations.VisibleForTesting
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasConfiguration
;
import
org.apache.atlas.AtlasErrorCode
;
...
...
@@ -770,7 +771,8 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
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
);
String
typeAndSubTypesQryStr
=
type
!=
null
?
type
.
getTypeAndAllSubTypesQryStr
()
:
null
;
...
...
repository/src/main/java/org/apache/atlas/repository/impexp/ExportService.java
View file @
1dee77af
...
...
@@ -17,6 +17,7 @@
*/
package
org
.
apache
.
atlas
.
repository
.
impexp
;
import
com.google.common.annotations.VisibleForTesting
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.AtlasServiceException
;
...
...
@@ -167,7 +168,8 @@ public class ExportService {
return
statuses
;
}
private
AtlasExportResult
.
OperationStatus
getOverallOperationStatus
(
AtlasExportResult
.
OperationStatus
...
statuses
)
{
@VisibleForTesting
AtlasExportResult
.
OperationStatus
getOverallOperationStatus
(
AtlasExportResult
.
OperationStatus
...
statuses
)
{
AtlasExportResult
.
OperationStatus
overall
=
(
statuses
.
length
==
0
)
?
AtlasExportResult
.
OperationStatus
.
FAIL
:
statuses
[
0
];
...
...
repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java
View file @
1dee77af
...
...
@@ -17,6 +17,7 @@
*/
package
org
.
apache
.
atlas
.
repository
.
impexp
;
import
com.google.common.annotations.VisibleForTesting
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.impexp.AtlasImportResult
;
...
...
@@ -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
));
}
...
...
@@ -100,7 +102,8 @@ public class TypeAttributeDifference {
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
<>();
for
(
AtlasStructDef
.
AtlasAttributeDef
attr
:
incoming
.
getAttributeDefs
())
{
updateCollectionWithDifferingAttributes
(
difference
,
existing
,
attr
);
...
...
@@ -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
<>();
for
(
AtlasEnumDef
.
AtlasEnumElementDef
ed
:
incoming
.
getElementDefs
())
{
updateCollectionWithDifferingAttributes
(
existing
,
difference
,
ed
);
...
...
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 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
services
;
package
org
.
apache
.
atlas
.
discovery
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.discovery.EntityDiscoveryService
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.commons.lang.StringUtils
;
import
org.powermock.reflect.Whitebox
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
javax.inject.Inject
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
static
org
.
testng
.
Assert
.*;
@Guice
(
modules
=
TestModules
.
TestOnlyModule
.
class
)
public
class
EntityDiscoveryServiceTest
{
...
...
@@ -121,7 +117,7 @@ public class EntityDiscoveryServiceTest {
}
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
);
return
s
;
...
...
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;
import
org.apache.atlas.repository.store.graph.v1.SoftDeleteHandlerV1
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.powermock.reflect.Whitebox
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.testng.Assert
;
...
...
@@ -264,38 +263,29 @@ public class ExportServiceTest {
public
void
verifyOverallStatus
()
throws
Exception
{
// ExportService service = new ExportService(typeRegistry);
assertEquals
(
AtlasExportResult
.
OperationStatus
.
FAIL
,
Whitebox
.
invokeMethod
(
exportService
,
"getOverallOperationStatus"
));
assertEquals
(
AtlasExportResult
.
OperationStatus
.
FAIL
,
exportService
.
getOverallOperationStatus
());
assertEquals
(
AtlasExportResult
.
OperationStatus
.
SUCCESS
,
Whitebox
.
invokeMethod
(
exportService
,
"getOverallOperationStatus"
,
AtlasExportResult
.
OperationStatus
.
SUCCESS
));
assertEquals
(
AtlasExportResult
.
OperationStatus
.
SUCCESS
,
exportService
.
getOverallOperationStatus
(
AtlasExportResult
.
OperationStatus
.
SUCCESS
));
assertEquals
(
AtlasExportResult
.
OperationStatus
.
SUCCESS
,
Whitebox
.
invokeMethod
(
exportService
,
"getOverallOperationStatus"
,
assertEquals
(
AtlasExportResult
.
OperationStatus
.
SUCCESS
,
exportService
.
getOverallOperationStatus
(
AtlasExportResult
.
OperationStatus
.
SUCCESS
,
AtlasExportResult
.
OperationStatus
.
SUCCESS
,
AtlasExportResult
.
OperationStatus
.
SUCCESS
));
assertEquals
(
AtlasExportResult
.
OperationStatus
.
PARTIAL_SUCCESS
,
Whitebox
.
invokeMethod
(
exportService
,
"getOverallOperationStatus"
,
assertEquals
(
AtlasExportResult
.
OperationStatus
.
PARTIAL_SUCCESS
,
exportService
.
getOverallOperationStatus
(
AtlasExportResult
.
OperationStatus
.
FAIL
,
AtlasExportResult
.
OperationStatus
.
PARTIAL_SUCCESS
,
AtlasExportResult
.
OperationStatus
.
SUCCESS
));
assertEquals
(
AtlasExportResult
.
OperationStatus
.
PARTIAL_SUCCESS
,
Whitebox
.
invokeMethod
(
exportService
,
"getOverallOperationStatus"
,
assertEquals
(
AtlasExportResult
.
OperationStatus
.
PARTIAL_SUCCESS
,
exportService
.
getOverallOperationStatus
(
AtlasExportResult
.
OperationStatus
.
FAIL
,
AtlasExportResult
.
OperationStatus
.
FAIL
,
AtlasExportResult
.
OperationStatus
.
PARTIAL_SUCCESS
));
assertEquals
(
AtlasExportResult
.
OperationStatus
.
FAIL
,
Whitebox
.
invokeMethod
(
exportService
,
"getOverallOperationStatus"
,
assertEquals
(
AtlasExportResult
.
OperationStatus
.
FAIL
,
exportService
.
getOverallOperationStatus
(
AtlasExportResult
.
OperationStatus
.
FAIL
,
AtlasExportResult
.
OperationStatus
.
FAIL
,
AtlasExportResult
.
OperationStatus
.
FAIL
));
}
@Test
...
...
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;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasEnumDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.powermock.reflect.Whitebox
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
...
...
@@ -76,11 +75,11 @@ public class TypeAttributeDifferenceTest {
}
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
{
return
Whitebox
.
invokeMethod
(
typeAttributeDifference
,
"getElementsAbsentInExisting"
,
existing
,
incoming
);
return
typeAttributeDifference
.
getElementsAbsentInExisting
(
existing
,
incoming
);
}
private
AtlasEnumDef
getAtlasEnumWithAttributes
(
String
...
elements
)
{
...
...
@@ -146,6 +145,6 @@ public class TypeAttributeDifferenceTest {
}
private
boolean
invokeUpdate
(
AtlasEnumDef
existing
,
AtlasEnumDef
incoming
)
throws
Exception
{
return
Whitebox
.
invokeMethod
(
typeAttributeDifference
,
"addElements"
,
existing
,
incoming
);
return
typeAttributeDifference
.
addElements
(
existing
,
incoming
);
}
}
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