-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add table configuration class (#196)
* feat: add table configuration class * fix: apply remarks after review
- Loading branch information
Showing
2 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* Copyright (c) 2023, Samsung Electronics Co., Ltd. All rights reserved. | ||
* | ||
* Use of this source code is governed by a MIT license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
package com.lpvs.util; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class LPVSTableConfiguration { | ||
@Value("${app.table.detectedLicenseName}") | ||
private String detectedLicenseName; | ||
|
||
@Value("${app.table.detectedLicenseSchema}") | ||
private String detectedLicenseSchema; | ||
|
||
@Value("${app.table.diffFileName}") | ||
private String diffFileName; | ||
|
||
@Value("${app.table.pullRequestsName}") | ||
private String pulLRequestsName; | ||
|
||
@Value("${app.table.queueName}") | ||
private String queueName; | ||
|
||
// Configuration for detected license name | ||
public String getDetectedLicenseName() { | ||
return detectedLicenseName; | ||
} | ||
|
||
// Configuration for detected license schema | ||
public String getDetectedLicenseSchema() { | ||
return detectedLicenseSchema; | ||
} | ||
|
||
// Configuration for diff file name table | ||
public String getDiffFileName() { | ||
return diffFileName; | ||
} | ||
|
||
// Configuration for pull request name table | ||
public String getPullRequestsName() { | ||
return pulLRequestsName; | ||
} | ||
|
||
// Configurations for queue name | ||
public String getQueueName() { | ||
return queueName; | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/test/java/com/lpvs/util/LPVSTableConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* Copyright (c) 2023, Samsung Electronics Co., Ltd. All rights reserved. | ||
* | ||
* Use of this source code is governed by a MIT license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
package com.lpvs.util; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.TestPropertySource; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
@SpringBootTest(classes = LPVSTableConfiguration.class) | ||
@TestPropertySource(properties = { | ||
"app.table.detectedLicenseName=mockDetectedLicenseName", | ||
"app.table.detectedLicenseSchema=mockDetectedLicenseSchema", | ||
"app.table.diffFileName=mockDiffFileName", | ||
"app.table.pullRequestsName=mockPullRequestsName", | ||
"app.table.queueName=mockQueueName" | ||
}) | ||
public class LPVSTableConfigurationTest { | ||
|
||
@Autowired | ||
private LPVSTableConfiguration config; | ||
|
||
@Test | ||
public void testGetDetectedLicenseName() { | ||
assertEquals("mockDetectedLicenseName", config.getDetectedLicenseName()); | ||
} | ||
|
||
@Test | ||
public void testGetDetectedLicenseSchema() { | ||
assertEquals("mockDetectedLicenseSchema", config.getDetectedLicenseSchema()); | ||
} | ||
|
||
@Test | ||
public void testGetDiffFileName() { | ||
assertEquals("mockDiffFileName", config.getDiffFileName()); | ||
} | ||
|
||
@Test | ||
public void testGetPullRequestsName() { | ||
assertEquals("mockPullRequestsName", config.getPullRequestsName()); | ||
} | ||
|
||
@Test | ||
public void testGetQueueName() { | ||
assertEquals("mockQueueName", config.getQueueName()); | ||
} | ||
} |