Skip to content

Commit

Permalink
Add table configuration class (#196)
Browse files Browse the repository at this point in the history
* feat: add table configuration class

* fix: apply remarks after review
  • Loading branch information
m-rudyk authored Aug 28, 2023
1 parent 5a36f9a commit c2f49ae
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/main/java/com/lpvs/util/LPVSTableConfiguration.java
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 src/test/java/com/lpvs/util/LPVSTableConfigurationTest.java
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());
}
}

0 comments on commit c2f49ae

Please sign in to comment.