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
679199bd
Commit
679199bd
authored
3 years ago
by
Nikhil Singh[MicroSoft]
Browse files
Options
Downloads
Patches
Plain Diff
Commit 21 Contents:
1- Uts Continued
parent
0d0b59ea
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
#55113
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
+49
-0
49 additions, 0 deletions
...ister/provider/azure/subscriber/PullSubscriptionTest.java
with
49 additions
and
0 deletions
provider/register-azure/src/test/java/org/opengroup/osdu/register/provider/azure/subscriber/PullSubscriptionTest.java
+
49
−
0
View file @
679199bd
...
...
@@ -70,6 +70,7 @@ public class PullSubscriptionTest {
verify
(
serviceBusManager
,
times
(
1
)).
createSubscription
(
topicName
,
subscriptionId
);
verify
(
logger
,
times
(
1
)).
debug
(
String
.
format
(
"Pull Subscription with id %s created successfully"
,
subscriptionId
));
}
@Test
public
void
shouldReturn500WhenPullSubscriptionCreationFailed
()
throws
Exception
{
lenient
().
when
(
factory
.
getManager
()).
thenReturn
(
serviceBusManager
);
...
...
@@ -84,6 +85,7 @@ public class PullSubscriptionTest {
verify
(
factory
,
times
(
1
)).
getManager
();
verify
(
serviceBusManager
,
times
(
1
)).
createSubscription
(
topicName
,
subscriptionId
);
}
@Test
public
void
shouldDeletePullSubscription
()
throws
Exception
{
lenient
().
when
(
factory
.
getManager
()).
thenReturn
(
serviceBusManager
);
...
...
@@ -111,4 +113,51 @@ public class PullSubscriptionTest {
verify
(
factory
,
times
(
1
)).
getManager
();
verify
(
serviceBusManager
,
times
(
1
)).
deleteSubscription
(
topicName
,
subscriptionId
);
}
@Test
public
void
shouldThrow500ExceptionWhenDeletingPullSubscription
()
throws
ServiceBusException
,
InterruptedException
{
lenient
().
when
(
factory
.
getManager
()).
thenReturn
(
serviceBusManager
);
when
(
serviceBusManager
.
deleteSubscription
(
topicName
,
subscriptionId
)).
thenThrow
(
new
ServiceBusException
(
true
,
SERVICE_BUS_ERROR_MESSAGE
));
AppException
exception
=
assertThrows
(
AppException
.
class
,
()
->
{
pullSubscription
.
deleteSubscription
(
subscriptionId
,
topicName
);
});
assertNotNull
(
exception
);
assertEquals
(
500
,
exception
.
getError
().
getCode
());
assertEquals
(
"Server Error"
,
exception
.
getError
().
getReason
());
assertEquals
(
"Unexpected error deleting Pull subscription"
,
exception
.
getError
().
getMessage
());
verify
(
factory
,
times
(
1
)).
getManager
();
verify
(
serviceBusManager
,
times
(
1
)).
deleteSubscription
(
topicName
,
subscriptionId
);
verify
(
logger
,
times
(
1
)).
error
(
"Deleting Pull Subscription failed with error: "
+
new
ServiceBusException
(
true
,
SERVICE_BUS_ERROR_MESSAGE
).
toString
());
}
@Test
public
void
shouldThrow500NullPointerExceptionWhenDeletingPullSubscription
()
throws
ServiceBusException
,
InterruptedException
{
lenient
().
when
(
factory
.
getManager
()).
thenThrow
(
new
AppException
(
500
,
"Null Pointer Exception"
,
MANAGEMENT_CLIENT_ERROR_MESSAGE
));
AppException
exception
=
assertThrows
(
AppException
.
class
,
()
->
{
pullSubscription
.
deleteSubscription
(
subscriptionId
,
topicName
);
});
assertNotNull
(
exception
);
assertEquals
(
500
,
exception
.
getError
().
getCode
());
assertEquals
(
"Null Pointer Exception"
,
exception
.
getError
().
getReason
());
assertEquals
(
MANAGEMENT_CLIENT_ERROR_MESSAGE
,
exception
.
getError
().
getMessage
());
verify
(
factory
,
times
(
1
)).
getManager
();
verify
(
serviceBusManager
,
times
(
0
)).
deleteSubscription
(
topicName
,
subscriptionId
);
}
@Test
public
void
shouldGetPullSubscription
()
throws
ServiceBusException
,
InterruptedException
{
lenient
().
when
(
factory
.
getManager
()).
thenReturn
(
serviceBusManager
);
SubscriptionDescription
subscriptionDescription
=
new
SubscriptionDescription
(
topicName
,
subscriptionId
);
when
(
serviceBusManager
.
getSubscription
(
topicName
,
subscriptionId
)).
thenReturn
(
subscriptionDescription
);
pullSubscription
.
checkIfSubscriptionExists
(
subscriptionId
,
topicName
);
verify
(
factory
,
times
(
1
)).
getManager
();
verify
(
serviceBusManager
,
times
(
1
)).
getSubscription
(
topicName
,
subscriptionId
);
verify
(
logger
,
times
(
1
)).
debug
(
String
.
format
(
"Pull Subscription with id %s fetched 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