Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Register
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
System
Register
Commits
183cd1fc
Commit
183cd1fc
authored
3 years ago
by
Nikhil Singh[MicroSoft]
Browse files
Options
Downloads
Patches
Plain Diff
Commit 19 Contents:
1-UT Cosmos
parent
ac8efa38
No related branches found
No related tags found
2 merge requests
!102
Locking down maven central
,
!97
Service Bus Create and Delete Support for Subscriptions
Pipeline
#55106
failed
3 years ago
Stage: .pre
Stage: review
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
provider/register-azure/src/test/java/org/opengroup/osdu/register/provider/azure/subscriber/PullSubscriptionTest.java
+74
-0
74 additions, 0 deletions
...ister/provider/azure/subscriber/PullSubscriptionTest.java
with
74 additions
and
0 deletions
provider/register-azure/src/test/java/org/opengroup/osdu/register/provider/azure/subscriber/PullSubscriptionTest.java
0 → 100644
+
74
−
0
View file @
183cd1fc
// 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.register.provider.azure.subscriber
;
import
com.microsoft.azure.servicebus.management.ManagementClient
;
import
com.microsoft.azure.servicebus.management.SubscriptionDescription
;
import
com.microsoft.azure.servicebus.primitives.MessagingEntityNotFoundException
;
import
com.microsoft.azure.servicebus.primitives.ServiceBusException
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.mockito.InjectMocks
;
import
org.mockito.Mock
;
import
org.mockito.junit.jupiter.MockitoExtension
;
import
org.opengroup.osdu.core.common.logging.JaxRsDpsLog
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.register.provider.azure.subscriber.messageBus.IManagementClientFactory
;
import
org.opengroup.osdu.register.provider.azure.subscriber.pubsub.PullSubscription
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertThrows
;
import
static
org
.
mockito
.
Mockito
.
lenient
;
import
static
org
.
mockito
.
Mockito
.
times
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
when
;
@ExtendWith
(
MockitoExtension
.
class
)
public
class
PullSubscriptionTest
{
private
static
final
String
subscriptionId
=
"subscription-id"
;
private
static
final
String
topicName
=
"topic-name"
;
private
static
final
String
errorMessage
=
"some error message"
;
private
static
final
String
RESOURCE_PROVISIONING_ERROR_MESSAGE
=
"Resource cannot be updated during provisioning"
;
private
static
final
String
MANAGEMENT_CLIENT_ERROR_MESSAGE
=
"Unable to create management client"
;
private
static
final
String
SERVICE_BUS_ERROR_MESSAGE
=
"Server can not be reached"
;
@Mock
private
IManagementClientFactory
factory
;
@Mock
private
JaxRsDpsLog
logger
;
@Mock
private
ManagementClient
serviceBusManager
;
@InjectMocks
private
PullSubscription
pullSubscription
;
@Test
public
void
shouldCreatePullSubscription
()
throws
Exception
{
lenient
().
when
(
factory
.
getManager
()).
thenReturn
(
serviceBusManager
);
SubscriptionDescription
subscriptionDescription
=
new
SubscriptionDescription
(
topicName
,
subscriptionId
);
lenient
().
when
(
serviceBusManager
.
createSubscription
(
topicName
,
subscriptionId
)).
thenReturn
(
subscriptionDescription
);
pullSubscription
.
createSubscription
(
subscriptionId
,
topicName
);
verify
(
factory
,
times
(
1
)).
getManager
();
verify
(
serviceBusManager
,
times
(
1
)).
createSubscription
(
topicName
,
subscriptionId
);
verify
(
logger
,
times
(
1
)).
debug
(
String
.
format
(
"Pull Subscription with id %s created successfully"
,
subscriptionId
));
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Morris Estepa
@estepamo
mentioned in commit
9b6eaa9c
·
2 years ago
mentioned in commit
9b6eaa9c
mentioned in commit 9b6eaa9cabc1af6538b17b6f76382473f6467c69
Toggle commit list
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