Updated to files to fit the Standard.

This commit is contained in:
Glenn Renfro
2022-07-25 11:41:43 -04:00
parent 39908bb499
commit 76a5d12136
200 changed files with 2839 additions and 4125 deletions

View File

@@ -47,4 +47,5 @@ public class TaskRunComponent {
this.taskRunRepository.save(new TaskRunOutput("Executed at " + execDate));
logger.info("Executed at : " + execDate);
}
}

View File

@@ -31,6 +31,7 @@ import jakarta.persistence.Table;
@Entity
@Table(name = "TASK_RUN_OUTPUT")
public class TaskRunOutput {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@@ -64,4 +65,5 @@ public class TaskRunOutput {
public String toString() {
return "TaskRunOutput{" + "id=" + this.id + ", output='" + this.output + '\'' + '}';
}
}

View File

@@ -23,4 +23,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
* @author Glenn Renfro
*/
public interface TaskRunRepository extends JpaRepository<TaskRunOutput, Long> {
}

View File

@@ -27,7 +27,6 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.test.system.CapturedOutput;
import org.springframework.boot.test.system.OutputCaptureExtension;
@@ -59,11 +58,13 @@ public class JpaApplicationTests {
static {
randomPort = TestSocketUtils.findAvailableTcpPort();
DATASOURCE_URL = "jdbc:h2:tcp://localhost:" + randomPort + "/mem:dataflow;DB_CLOSE_DELAY=-1;"
+ "DB_CLOSE_ON_EXIT=FALSE";
+ "DB_CLOSE_ON_EXIT=FALSE";
}
private ConfigurableApplicationContext context;
private DataSource dataSource;
private Server server;
@BeforeEach
@@ -76,9 +77,8 @@ public class JpaApplicationTests {
this.dataSource = dataSource;
try {
this.server = Server
.createTcpServer("-tcp", "-ifNotExists", "-tcpAllowOthers", "-tcpPort", String
.valueOf(randomPort))
.start();
.createTcpServer("-tcp", "-ifNotExists", "-tcpAllowOthers", "-tcpPort", String.valueOf(randomPort))
.start();
}
catch (SQLException e) {
throw new IllegalStateException(e);
@@ -96,18 +96,14 @@ public class JpaApplicationTests {
@Test
public void testBatchJobApp(CapturedOutput capturedOutput) {
final String INSERT_MESSAGE = "Hibernate: insert into task_run_output (";
this.context = SpringApplication
.run(JpaApplication.class, "--spring.datasource.url=" + DATASOURCE_URL,
this.context = SpringApplication.run(JpaApplication.class, "--spring.datasource.url=" + DATASOURCE_URL,
"--spring.datasource.username=" + DATASOURCE_USER_NAME,
"--spring.datasource.driverClassName=" + DATASOURCE_DRIVER_CLASS_NAME,
"--spring.jpa.database-platform=org.hibernate.dialect.H2Dialect");
String output = capturedOutput.toString();
assertThat(output
.contains(INSERT_MESSAGE)).as("Unable to find the insert message: " + output)
.isTrue();
assertThat(output.contains(INSERT_MESSAGE)).as("Unable to find the insert message: " + output).isTrue();
JdbcTemplate template = new JdbcTemplate(this.dataSource);
Map<String, Object> result = template
.queryForMap("Select * from TASK_RUN_OUTPUT");
Map<String, Object> result = template.queryForMap("Select * from TASK_RUN_OUTPUT");
assertThat(result.get("ID")).isEqualTo(1L);
assertThat(((String) result.get("OUTPUT"))).contains("Executed at");
}