Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add table configuration class #196

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
}
}
Loading