diff --git a/hofund-spring-boot-e2e/pom.xml b/hofund-spring-boot-e2e/pom.xml index 37e5ff7..c2c6bf6 100644 --- a/hofund-spring-boot-e2e/pom.xml +++ b/hofund-spring-boot-e2e/pom.xml @@ -38,6 +38,16 @@ spring-boot-starter-web + + + + + + + + + + org.springframework.boot spring-boot-starter-actuator @@ -59,6 +69,7 @@ org.springframework.boot spring-boot-starter-test + test diff --git a/hofund-spring-boot-e2e/src/main/java/dev/logchange/hofund/HofundE2E.java b/hofund-spring-boot-e2e/src/main/java/dev/logchange/hofund/HofundE2E.java index 4e8845c..a424c78 100644 --- a/hofund-spring-boot-e2e/src/main/java/dev/logchange/hofund/HofundE2E.java +++ b/hofund-spring-boot-e2e/src/main/java/dev/logchange/hofund/HofundE2E.java @@ -2,10 +2,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; -@RestController @SpringBootApplication public class HofundE2E { @@ -13,9 +10,4 @@ public static void main(String[] args) { SpringApplication.run(HofundE2E.class, args); } - - @GetMapping("/test") - public String test() { - return "test"; - } } diff --git a/hofund-spring-boot-e2e/src/main/java/dev/logchange/hofund/TestController.java b/hofund-spring-boot-e2e/src/main/java/dev/logchange/hofund/TestController.java new file mode 100644 index 0000000..23eeb38 --- /dev/null +++ b/hofund-spring-boot-e2e/src/main/java/dev/logchange/hofund/TestController.java @@ -0,0 +1,22 @@ +package dev.logchange.hofund; + +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +public class TestController { + +// private final TestRepository testRepository; + + @GetMapping("/test") + public String test() { + return "test"; + } + +// @GetMapping("/testEntity") +// public Iterable testEntity() { +// return testRepository.findAll(); +// } +} diff --git a/hofund-spring-boot-e2e/src/main/java/dev/logchange/hofund/TestEntity.java b/hofund-spring-boot-e2e/src/main/java/dev/logchange/hofund/TestEntity.java new file mode 100644 index 0000000..835447e --- /dev/null +++ b/hofund-spring-boot-e2e/src/main/java/dev/logchange/hofund/TestEntity.java @@ -0,0 +1,16 @@ +//package dev.logchange.hofund; +// +//import jakarta.persistence.Entity; +//import jakarta.persistence.Id; +//import lombok.Getter; +//import lombok.Setter; +// +//@Getter +//@Setter +//@Entity +//public class TestEntity { +// +// @Id +// private Long id; +// +//} diff --git a/hofund-spring-boot-e2e/src/main/java/dev/logchange/hofund/TestRepository.java b/hofund-spring-boot-e2e/src/main/java/dev/logchange/hofund/TestRepository.java new file mode 100644 index 0000000..7c5759a --- /dev/null +++ b/hofund-spring-boot-e2e/src/main/java/dev/logchange/hofund/TestRepository.java @@ -0,0 +1,8 @@ +//package dev.logchange.hofund; +// +//import org.springframework.data.repository.CrudRepository; +//import org.springframework.stereotype.Repository; +// +//@Repository +//public interface TestRepository extends CrudRepository { +//} diff --git a/hofund-spring-boot-e2e/src/main/resources/application.properties b/hofund-spring-boot-e2e/src/main/resources/application.properties index b15bed4..0156cdb 100644 --- a/hofund-spring-boot-e2e/src/main/resources/application.properties +++ b/hofund-spring-boot-e2e/src/main/resources/application.properties @@ -1,2 +1,11 @@ server.port=8626 management.endpoints.web.exposure.include=prometheus + +#spring.jpa.hibernate.ddl-auto=none + +#spring.datasource.url=jdbc:oracle:thin:@localhost:1521:xe +#spring.datasource.username=maindb +#spring.datasource.password=password +#spring.datasource.driver-class-name=oracle.jdbc.OracleDriver +# +#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.OracleDialect \ No newline at end of file diff --git a/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/connection/spring/datasources/oracle/OracleDataSourceE2ETest.java b/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/connection/spring/datasources/oracle/OracleDataSourceE2ETest.java new file mode 100644 index 0000000..4f18f3c --- /dev/null +++ b/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/connection/spring/datasources/oracle/OracleDataSourceE2ETest.java @@ -0,0 +1,42 @@ +//package dev.logchange.hofund.connection.spring.datasources.oracle; +// +//import lombok.extern.slf4j.Slf4j; +//import org.junit.jupiter.api.Assertions; +//import org.junit.jupiter.api.Test; +//import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability; +//import org.springframework.boot.test.context.SpringBootTest; +//import org.springframework.boot.test.web.client.TestRestTemplate; +//import org.springframework.boot.test.web.server.LocalServerPort; +// +//@Slf4j +//@AutoConfigureObservability +//@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +// properties = { +// "spring.datasource.url=jdbc:oracle:thin:@localhost:1521:xe", +// "spring.datasource.username=system", +// "spring.datasource.password=password", +// "spring.datasource.driver-class-name=oracle.jdbc.OracleDriver" +// }) +//public class OracleDataSourceE2ETest { +// private final TestRestTemplate template = new TestRestTemplate(); +// +// @LocalServerPort +// private int port; +// +// @Test +// void shouldContainsHofundConnectionForOracleDatabase() { +// //given: +// String path = "http://localhost:" + port + "/actuator/prometheus"; +// +// String expected = "# HELP hofund_info Basic information about application\n" + +// "# TYPE hofund_info gauge\n" + +// "hofund_info{application_name=\"testapp\",application_version=\"1.2.3\",id=\"testapp\",} 1.0"; +// +// //when: +// String response = template.getForObject(path, String.class); +// +// //then: +// log.info("Expecting: \n{}\nResponse: \n{}", expected, response); +// Assertions.assertTrue(response.contains(expected)); +// } +//}