Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
javaazureappconfig
Project
Project
Details
Activity
Releases
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
Jalaluddin Shaikh
javaazureappconfig
Commits
f0084040
Commit
f0084040
authored
May 19, 2020
by
jashaikh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Jacoco Code Coverage For Sonar.
parent
f42a7cb8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
8 deletions
+22
-8
AzureAppConfigService.java
src/main/java/com/example/service/AzureAppConfigService.java
+3
-6
AzureAppConfigServiceTest.java
...t/java/com/example/service/AzureAppConfigServiceTest.java
+19
-2
No files found.
src/main/java/com/example/service/AzureAppConfigService.java
View file @
f0084040
...
...
@@ -47,6 +47,8 @@ public class AzureAppConfigService {
public
String
writeValueByKey
(
String
key
,
String
value
)
{
try
{
LOGGER
.
info
(
"Writing Single Value by key"
);
if
(
key
==
null
||
value
==
null
)
throw
new
Exception
(
"Key and Value cannot be null"
);
ConfigurationSetting
configurationSetting
=
configurationClient
.
setConfigurationSetting
(
key
,
null
,
value
);
return
configurationSetting
.
getValue
();
}
catch
(
Exception
e
)
{
...
...
@@ -61,12 +63,7 @@ public class AzureAppConfigService {
*/
public
PagedIterable
<
ConfigurationSetting
>
readAllKeyValue
()
{
LOGGER
.
info
(
"Read All Values..."
);
try
{
return
configurationClient
.
listConfigurationSettings
(
settingSelector
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
.
getMessage
());
return
null
;
}
}
/**
...
...
src/test/java/com/example/service/AzureAppConfigServiceTest.java
View file @
f0084040
...
...
@@ -11,8 +11,7 @@ import org.junit.jupiter.api.TestMethodOrder;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
@TestMethodOrder
(
OrderAnnotation
.
class
)
class
AzureAppConfigServiceTest
{
...
...
@@ -40,6 +39,12 @@ class AzureAppConfigServiceTest {
assertEquals
(
EXISTING_VALUE
,
valueByKey
);
}
@Test
@Order
(
5
)
void
getValueByKeyException
()
{
assertNull
(
azureAppConfigService
.
getValueByKey
(
null
));
}
@Test
@Order
(
2
)
void
writeValueByKey
()
{
...
...
@@ -49,6 +54,12 @@ class AzureAppConfigServiceTest {
assertEquals
(
NEW_VALUE
,
writeValueByKey
);
}
@Test
@Order
(
6
)
void
writeValueByKeyException
()
{
assertNull
(
azureAppConfigService
.
writeValueByKey
(
null
,
null
));
}
@Test
@Order
(
4
)
void
readAllKeyValue
()
{
...
...
@@ -64,4 +75,10 @@ class AzureAppConfigServiceTest {
assertNotNull
(
valueByKey
);
assertEquals
(
NEW_VALUE
,
valueByKey
);
}
@Test
@Order
(
7
)
void
deleteValueByKeyException
()
{
assertNull
(
azureAppConfigService
.
deleteValueByKey
(
null
));
}
}
\ No newline at end of file
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