Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
Legal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSDU
OSDU Data Platform
Security and Compliance
Legal
Commits
7bd2140e
Commit
7bd2140e
authored
4 years ago
by
Aalekh Jain
Browse files
Options
Downloads
Patches
Plain Diff
Removed tests for `TenantFactoryImpl.java`
parent
56d4ab17
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!61
Improve code coverage
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
provider/legal-azure/src/test/java/org/opengroup/osdu/legal/azure/di/TenantFactoryImplTest.java
+0
-100
0 additions, 100 deletions
.../opengroup/osdu/legal/azure/di/TenantFactoryImplTest.java
with
0 additions
and
100 deletions
provider/legal-azure/src/test/java/org/opengroup/osdu/legal/azure/di/TenantFactoryImplTest.java
deleted
100644 → 0
+
0
−
100
View file @
56d4ab17
// Copyright © Microsoft Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package
org.opengroup.osdu.legal.azure.di
;
import
org.apache.commons.lang.ArrayUtils
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.InjectMocks
;
import
org.mockito.Mock
;
import
org.mockito.junit.MockitoJUnitRunner
;
import
org.opengroup.osdu.azure.CosmosStore
;
import
org.opengroup.osdu.core.common.cache.ICache
;
import
org.opengroup.osdu.core.common.model.http.DpsHeaders
;
import
org.opengroup.osdu.core.common.provider.interfaces.ITenantFactory
;
import
org.opengroup.osdu.core.common.model.tenant.TenantInfo
;
import
org.opengroup.osdu.legal.azure.tags.dataaccess.LegalTagRepositoryImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
ArgumentMatchers
.
eq
;
import
static
org
.
mockito
.
Mockito
.
doReturn
;
import
static
org
.
mockito
.
Mockito
.*;
@RunWith
(
MockitoJUnitRunner
.
class
)
public
class
TenantFactoryImplTest
{
private
static
final
String
dataPartitionId
=
"data-partition-id"
;
private
final
String
[]
ids
=
{
"id1"
,
"id2"
};
private
final
String
[]
complianceRuleSets
=
{
"compliance-rule-set-1"
,
"compliance-rule-set-2"
};
@Mock
private
CosmosStore
cosmosStore
;
@Mock
private
DpsHeaders
headers
;
@InjectMocks
private
TenantFactoryImpl
sut
;
@Before
public
void
init
()
{
lenient
().
doReturn
(
dataPartitionId
).
when
(
headers
).
getPartitionId
();
List
<
TenantInfoDoc
>
tenantInfoDocs
=
new
ArrayList
<>();
assertEquals
(
ids
.
length
,
complianceRuleSets
.
length
);
for
(
int
i
=
0
;
i
<
ids
.
length
;
i
++)
{
TenantInfoDoc
tenantInfoDoc
=
new
TenantInfoDoc
(
ids
[
i
],
complianceRuleSets
[
i
]);
tenantInfoDocs
.
add
(
tenantInfoDoc
);
}
doReturn
(
tenantInfoDocs
).
when
(
cosmosStore
).
findAllItems
(
eq
(
dataPartitionId
),
any
(),
any
(),
any
());
}
@Test
public
void
testExists_whenExistingTenantNameGiven
()
{
for
(
String
tenantName:
ids
)
{
assertTrue
(
sut
.
exists
(
tenantName
));
}
}
@Test
public
void
testExists_whenNonExistingTenantNameGiven
()
{
assertFalse
(
sut
.
exists
(
"id-that-does-not-exist"
));
assertFalse
(
sut
.
exists
(
""
));
}
@Test
public
void
testGetTenantInfo_whenExistingTenantNameGiven
()
{
for
(
int
i
=
0
;
i
<
ids
.
length
;
i
++)
{
TenantInfo
tenantInfo
=
sut
.
getTenantInfo
(
ids
[
i
]);
assertEquals
(
tenantInfo
.
getName
(),
ids
[
i
]);
assertEquals
(
tenantInfo
.
getComplianceRuleSet
(),
complianceRuleSets
[
i
]);
}
}
@Test
public
void
testListTenantInfo
()
{
List
<
TenantInfo
>
tenantInfoList
=
new
ArrayList
<
TenantInfo
>
(
sut
.
listTenantInfo
());
for
(
TenantInfo
tenantInfo:
tenantInfoList
)
{
assertTrue
(
ArrayUtils
.
contains
(
ids
,
tenantInfo
.
getName
()));
assertTrue
(
ArrayUtils
.
contains
(
complianceRuleSets
,
tenantInfo
.
getComplianceRuleSet
()));
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment