Skip to content

Commit

Permalink
Enhancement: v0.0.4 (#17)
Browse files Browse the repository at this point in the history
* Create gradle.yml for Actions (#1) (#2)

* Create gradle.yml for Actions

* Update gradle.yml

* actions exectute denied

* Syncing (#4)

* Create gradle.yml for Actions (#1)

* Create gradle.yml for Actions

* Update gradle.yml

* actions exectute denied

* modify action build to publish built to packages (#3)

* Updating old dependencies (#10)

* Create gradle.yml for Actions (#1)

* Create gradle.yml for Actions

* Update gradle.yml

* actions exectute denied

* modify action build to publish built to packages (#3)

* Create dependabot.yml

* Bump org.junit:junit-bom from 5.9.1 to 5.10.1 (#8)

Bumps [org.junit:junit-bom](https://github.com/junit-team/junit5) from 5.9.1 to 5.10.1.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](junit-team/junit5@r5.9.1...r5.10.1)

---
updated-dependencies:
- dependency-name: org.junit:junit-bom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump org.apache.kafka:kafka-streams from 3.2.3 to 3.6.0 (#7)

Bumps org.apache.kafka:kafka-streams from 3.2.3 to 3.6.0.

---
updated-dependencies:
- dependency-name: org.apache.kafka:kafka-streams
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fragmenting html using thymeleaf, added dataTables with xlsx,pdf,csv export for consumer table, added errors rejected to return

* added errors rejected to return

* Updating dependabot deps, added xss purify demo, logback->log4j2, field injection->constructor injection

* syncing branch with java21 enhancements

Signed-off-by: mibracy <crusty512@yahoo.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: mibracy <crusty512@yahoo.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
mibracy and dependabot[bot] authored Dec 10, 2023
1 parent 709ef76 commit 76a6f25
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 21 deletions.
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id "java"
id "war"
id("org.sonarqube") version "4.0.0.2929"
id("org.springframework.boot") version "2.7.17"
id ("org.sonarqube") version "4.0.0.2929"
id ("org.springframework.boot") version "2.7.18"
}

group = "org.example"
Expand All @@ -23,18 +23,19 @@ repositories {
dependencies {
implementation 'org.apache.avro:avro:1.11.3'
implementation 'org.apache.poi:poi-ooxml:5.2.5'
implementation 'org.apache.kafka:kafka-streams:3.6.0'
implementation 'org.apache.kafka:kafka-streams:3.6.1'
implementation 'org.springframework.kafka:spring-kafka:2.9.13'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.yaml:snakeyaml:2.2' // due to vulnerabilities when transiently pulled from spring-boot-starter-web:2.7.17
implementation 'org.springframework.boot:spring-boot-starter-websocket'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5:3.1.2.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-log4j2'
implementation 'org.springframework.security:spring-security-core:5.8.8'

implementation 'com.oracle.database.jdbc:ojdbc11:23.3.0.23.09'
implementation 'com.h2database:h2:2.2.224'
implementation 'com.thoughtworks.xstream:xstream:1.4.20'
implementation 'net.datafaker:datafaker:1.9.0'
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/org/example/config/DataSourceConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,27 @@
public class DataSourceConfig {

@Value("${sql.connector:jdbc:h2:file:../temp/h2}")
// @Value("${ora.sql.connector:jdbc:oracle:thin:@localhost:1521:ORCLCDB}")
public String server;

@Value("${sql.driver:org.h2.Driver}")
// @Value("${ora.sql.driver:oracle.jdbc.driver.OracleDriver}")
public String driver;

@Value("${sql.user:SA}")
// @Value("${ora.sql.user:SYSTEM}")
private String user;

@Value("${sql.password:}")
// @Value("${ora.sql.password:}")
private String password;

@Bean
public DataSource getDataSource() {
DataSourceBuilder<?> ds = DataSourceBuilder.create();
ds.driverClassName("org.h2.Driver");
ds.driverClassName(driver);
ds.url(server);
ds.username("SA");
ds.username(user);
ds.password(password);
return ds.build();
}
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/org/example/data/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.*;

@Data
@AllArgsConstructor
Expand All @@ -16,7 +13,8 @@
public class Event {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "event_GEN")
@SequenceGenerator(name = "event_GEN", sequenceName = "event_SEQ", allocationSize = 1)
private long id;
private String kafka_topic;
private String kafka_key;
Expand All @@ -37,6 +35,6 @@ public Event isError() {

// CREATE TABLE EVENT(ID INT PRIMARY KEY, KAFKA_TOPIC VARCHAR(255), KAFKA_KEY VARCHAR(255), KAFKA_VALUE VARCHAR(255), ERROR BOOLEAN);

// CREATE SEQUENCE HIBERNATE_SEQUENCE START WITH 1 INCREMENT BY 1;
// CREATE SEQUENCE EVENT_SEQ START WITH 1 INCREMENT BY 1;
// https://www.h2database.com/html/commands.html
}
5 changes: 3 additions & 2 deletions src/main/java/org/example/data/H2User.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
public class H2User {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "h2user_GEN")
@SequenceGenerator(name = "h2user_GEN", sequenceName = "h2user_SEQ", allocationSize = 1)
private long id;

@NotBlank
Expand All @@ -34,6 +35,6 @@ public H2User(String name, String email) {

// CREATE TABLE H2USER(ID INT PRIMARY KEY, NAME VARCHAR(255), EMAIL VARCHAR(255));

// CREATE SEQUENCE HIBERNATE_SEQUENCE START WITH 1 INCREMENT BY 1;
// CREATE SEQUENCE H2USER_SEQ START WITH 1 INCREMENT BY 1;
// https://www.h2database.com/html/commands.html
}
6 changes: 3 additions & 3 deletions src/main/java/org/example/service/FileExportService.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void export(String name, ObjectDB odb) {
}

// send Event to Kafka Topic
producer.sendEvent(new KafkaPayload(type + "_events", fileName, converted.get()));
producer.sendEvent(new KafkaPayload(type + "_events", fileName, "size=" + odb.getData().size()));
});
}

Expand Down Expand Up @@ -109,8 +109,8 @@ private static String convertObjectToxStreamXML(Object data, String rootName) th
return stream.toString("UTF-8")
.replace("<singleton-set>", "")
.replace("</singleton-set>", "")
.replace("<list>", "<"+rootName+">")
.replace("</list>", "</"+rootName+">").trim();
.replace("<list>", "<" + rootName + ">")
.replace("</list>", "</" + rootName + ">").trim();
}

}
9 changes: 9 additions & 0 deletions src/main/resources/static/js/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ let table;
const getCurrentTime = () => new Date()
.toLocaleString('en-US', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false })
.replaceAll(`,`,``);

const h2DB = function() {
const currentUrl = window.location.href;
document.location.href = currentUrl.replace("/home","/h2-console");
}
/* Document Ready Event */
$(document).ready(function() {
table = $('#kafkaTable').DataTable({
Expand Down Expand Up @@ -97,6 +102,10 @@ $(document).ready(function() {
$("#inject").on('click', function () {
triggerMe();
});

$("#h2-console").on('click', function () {
h2DB();
});
});

function triggerMe() {
Expand Down
13 changes: 9 additions & 4 deletions src/main/resources/templates/home.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head th:replace="fragments/head :: default" />
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org"
xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head th:replace="~{fragments/head :: default}" />
<body>
<div th:replace="fragments/demos :: temperature" />
<div th:replace="fragments/demos :: liveTable" />
<div class="float-end m-2 me-5">
<button id="h2-console" class="btn btn-sm btn-outline-dark">Console</button>
</div>
<div th:replace="~{fragments/demos :: temperature}" />
<div th:replace="~{fragments/demos :: liveTable}" />
</body>
</html>

0 comments on commit 76a6f25

Please sign in to comment.