Compare commits

..

11 commits

11 changed files with 84 additions and 46 deletions

View file

@ -1,3 +0,0 @@
# BAIS-E2E-MIG-001-attempt-2
Forge 이슈 작업 브랜치 `forge/BAIS-E2E-MIG-001-attempt-2`.

View file

@ -0,0 +1,3 @@
# BAIS-NATIVE-1783698057-attempt-1
Forge 이슈 작업 브랜치 `forge/BAIS-NATIVE-1783698057-attempt-1`.

View file

@ -0,0 +1,3 @@
# BAIS-SOURCE-1783702539-attempt-1
Forge 이슈 작업 브랜치 `forge/BAIS-SOURCE-1783702539-attempt-1`.

View file

@ -1,5 +1,5 @@
name: ci
on: [push, pull_request]
on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest

28
pom.xml
View file

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>bais-authorization-service</artifactId>
<artifactId>bais-gate-e2e</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>17</java.version>
</properties>
@ -28,18 +32,8 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

View file

@ -1,11 +0,0 @@
package com.example;
import org.springframework.stereotype.Service;
@Service
public class AuthorizationService {
public boolean hasAccess(String userId, String resource) {
// 권한 로직을 여기에 구현합니다.
return true; // 예시로 항상 true를 반환
}
}

View file

@ -0,0 +1,11 @@
package com.example.baisgate;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BaisGateApplication {
public static void main(String[] args) {
SpringApplication.run(BaisGateApplication.class, args);
}
}

View file

@ -0,0 +1,10 @@
package com.example.baisgate;
public class PaymentService {
public String approve(String transactionId) {
if (transactionId == null || transactionId.trim().isEmpty()) {
throw new IllegalArgumentException("Transaction ID cannot be blank");
}
return "APPROVED:" + transactionId;
}
}

View file

@ -1,13 +0,0 @@
package com.example;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
class AuthorizationServiceTest {
@Test
void testHasAccess() {
AuthorizationService service = new AuthorizationService();
assertTrue(service.hasAccess("user1", "resource1"));
}
}

View file

@ -0,0 +1,12 @@
package com.example.baisgate;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class BaisGateApplicationTests {
@Test
void contextLoads() {
}
}

View file

@ -0,0 +1,32 @@
package com.example.baisgate;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class PaymentServiceTest {
@Test
void testApprove_WithValidTransactionId_ReturnsApproved() {
PaymentService paymentService = new PaymentService();
String result = paymentService.approve("12345");
assertEquals("APPROVED:12345", result);
}
@Test
void testApprove_WithBlankTransactionId_ThrowsIllegalArgumentException() {
PaymentService paymentService = new PaymentService();
Exception exception = assertThrows(IllegalArgumentException.class, () -> {
paymentService.approve("");
});
assertEquals("Transaction ID cannot be blank", exception.getMessage());
}
@Test
void testApprove_WithNullTransactionId_ThrowsIllegalArgumentException() {
PaymentService paymentService = new PaymentService();
Exception exception = assertThrows(IllegalArgumentException.class, () -> {
paymentService.approve(null);
});
assertEquals("Transaction ID cannot be blank", exception.getMessage());
}
}