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
cb33214c
Commit
cb33214c
authored
Mar 23, 2020
by
Jalaluddin Shaikh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added JUnit Test Cases.
parent
6a8de120
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
AzureAppConfigServiceTest.java
...t/java/com/example/service/AzureAppConfigServiceTest.java
+13
-12
No files found.
src/test/java/com/example/service/AzureAppConfigServiceTest.java
View file @
cb33214c
...
...
@@ -14,29 +14,34 @@ import static org.junit.Assert.assertNotNull;
public
class
AzureAppConfigServiceTest
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
AzureAppConfigServiceTest
.
class
);
AzureAppConfigService
azureAppConfigService
;
private
static
final
String
APP_CONFIGURATION_CONNECTION_STRING
=
"APP_CONFIGURATION_CONNECTION_STRING"
;
private
static
final
String
EXISTING_KEY
=
"config.message"
;
private
static
final
String
EXISTING_VALUE
=
"This is Azure App Config"
;
private
static
final
String
NEW_KEY
=
"config.dataSource"
;
private
static
final
String
NEW_VALUE
=
"Data Source URL"
;
private
AzureAppConfigService
azureAppConfigService
;
@Before
public
void
setUp
()
{
String
app_configuration_connection_string
=
System
.
getenv
(
"APP_CONFIGURATION_CONNECTION_STRING"
);
String
app_configuration_connection_string
=
System
.
getenv
(
APP_CONFIGURATION_CONNECTION_STRING
);
ConfigurationClient
configurationClient
=
new
ConfigurationClientBuilder
().
connectionString
(
app_configuration_connection_string
).
buildClient
();
azureAppConfigService
=
new
AzureAppConfigService
(
configurationClient
,
new
SettingSelector
());
}
@Test
public
void
getValueByKey
()
{
String
valueByKey
=
azureAppConfigService
.
getValueByKey
(
"config.message"
);
String
valueByKey
=
azureAppConfigService
.
getValueByKey
(
EXISTING_KEY
);
LOGGER
.
info
(
valueByKey
);
assertNotNull
(
valueByKey
);
assertEquals
(
"This is Azure App Config"
,
valueByKey
);
assertEquals
(
EXISTING_VALUE
,
valueByKey
);
}
@Test
public
void
writeValueByKey
()
{
String
writeValueByKey
=
azureAppConfigService
.
writeValueByKey
(
"config.dataSource"
,
"Data Source URL"
);
String
writeValueByKey
=
azureAppConfigService
.
writeValueByKey
(
NEW_KEY
,
NEW_VALUE
);
LOGGER
.
info
(
writeValueByKey
);
assertNotNull
(
writeValueByKey
);
assertEquals
(
"Data Source URL"
,
writeValueByKey
);
assertEquals
(
NEW_VALUE
,
writeValueByKey
);
}
@Test
...
...
@@ -47,13 +52,9 @@ public class AzureAppConfigServiceTest {
@Test
public
void
deleteValueByKey
()
{
String
valueByKey
=
azureAppConfigService
.
deleteValueByKey
(
"config.dataSource"
);
String
valueByKey
=
azureAppConfigService
.
deleteValueByKey
(
NEW_KEY
);
LOGGER
.
info
(
valueByKey
);
assertNotNull
(
valueByKey
);
assertEquals
(
"Data Source URL"
,
valueByKey
);
}
@Test
public
void
azureAppConfiguration
()
{
assertEquals
(
NEW_VALUE
,
valueByKey
);
}
}
\ 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