diff --git a/LICENSE b/LICENSE index 3a4e9b5..24fa7cb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) [2023] [Jiri Novotny ] +Copyright (c) [2023] [Jiri Novotny , Ondrej Babec ] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/database-manipulation-tool-schema/README.md b/database-manipulation-tool-schema/README.md new file mode 100644 index 0000000..f1c5931 --- /dev/null +++ b/database-manipulation-tool-schema/README.md @@ -0,0 +1,2 @@ +# dmt-schema +Library with dmt objects representing database entries (rows) diff --git a/database-manipulation-tool-schema/pom.xml b/database-manipulation-tool-schema/pom.xml new file mode 100644 index 0000000..6dc7bc8 --- /dev/null +++ b/database-manipulation-tool-schema/pom.xml @@ -0,0 +1,77 @@ + + + 4.0.0 + + database-manipulation-tool-schema + ${project.parent.version} + database-manipulation-tool-schema + Library with database manipulation tool objects representing database entries (rows) + + + + database-performance-hub + io.skodjob + 1.0.0 + + + + UTF-8 + 17 + + + + + com.fasterxml.jackson.core + jackson-databind + 2.15.1 + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + + + \ No newline at end of file diff --git a/database-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/App.java b/database-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/App.java new file mode 100644 index 0000000..c8c00c3 --- /dev/null +++ b/database-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/App.java @@ -0,0 +1,33 @@ +package io.skodjob.dmt.schema; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class App +{ + public static void main( String[] args ) + { + System.out.println( "TEST RUN FOR DMT SCHEMA" ); + DatabaseEntry entry = new DatabaseEntry("TestTableName", "name"); + entry.addColumnEntry(new DatabaseColumnEntry("testValue1", "name", "testDataType1")); + entry.addColumnEntry(new DatabaseColumnEntry("testValue2", "name2", "testDataType2")); + try { + var str = new ObjectMapper().writeValueAsString(entry); + System.out.println("STRING: " + str); + var parsedString = new ObjectMapper().readValue(str, DatabaseEntry.class); + System.out.println("DATABASE_ENTRY: " + parsedString); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + System.out.println( "TEST RUN FOR DMT LOAD RESULT SCHEMA" ); + LoadResult loadResult = new LoadResult(1000, 100, 950); + try { + var str = new ObjectMapper().writeValueAsString(loadResult); + System.out.println("STRING: " + str); + var parsedString = new ObjectMapper().readValue(str, LoadResult.class); + System.out.println("LOAD_RESULT: " + parsedString); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } +} diff --git a/database-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/DatabaseColumnEntry.java b/database-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/DatabaseColumnEntry.java new file mode 100644 index 0000000..7b5a46f --- /dev/null +++ b/database-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/DatabaseColumnEntry.java @@ -0,0 +1,84 @@ +package io.skodjob.dmt.schema; + +import java.util.Objects; + +public final class DatabaseColumnEntry { + private String value; + private String columnName; + private String dataType; + + public DatabaseColumnEntry(String value, String columnName, String dataType) { + this.value = value; + this.columnName = columnName; + this.dataType = dataType; + } + + public DatabaseColumnEntry() { + this.value = "UNDEFINED"; + this.columnName = "UNDEFINED"; + this.dataType = "UNDEFINED"; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getColumnName() { + return columnName; + } + + public void setColumnName(String columnName) { + this.columnName = columnName; + } + + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } + + @Override + public String toString() { + return "DatabaseColumnEntry{" + + "value='" + value + '\'' + + ", columnName='" + columnName + '\'' + + ", dataType='" + dataType + '\'' + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DatabaseColumnEntry entry = (DatabaseColumnEntry) o; + return Objects.equals(value, entry.value) && Objects.equals(columnName, entry.columnName) && Objects.equals(dataType, entry.dataType); + } + + @Override + public int hashCode() { + return Objects.hash(value, columnName, dataType); + } + + public String value() { + return value; + } + + public String columnName() { + return columnName; + } + + public String dataType() { + return dataType; + } + +} diff --git a/database-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/DatabaseEntry.java b/database-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/DatabaseEntry.java new file mode 100644 index 0000000..654ef93 --- /dev/null +++ b/database-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/DatabaseEntry.java @@ -0,0 +1,107 @@ +package io.skodjob.dmt.schema; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +public class DatabaseEntry { + + private List columnEntries; + private String name; + private String primary; + + public DatabaseEntry(List columnEntries, String name, String primary) { + this.columnEntries = columnEntries; + this.name = name; + this.primary = primary; + } + + public DatabaseEntry(String name, String primary) { + this.name = name; + this.primary = primary; + columnEntries = new ArrayList<>(); + } + + public DatabaseEntry() { + this.name = "UNDEFINED"; + this.primary = "UNDEFINED"; + columnEntries = new ArrayList<>(); + } + + public List getColumnEntries() { + return columnEntries; + } + + public void setColumnEntries(List columnEntries) { + this.columnEntries = columnEntries; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPrimary() { + return primary; + } + + public void setPrimary(String primary) { + this.primary = primary; + } + + public void addColumnEntry(DatabaseColumnEntry columnEntry) { + columnEntries.add(columnEntry); + } + + + /** + * @return DatabaseColumnEntry which is the primary in this DatabaseEntry + */ + @JsonIgnore + public DatabaseColumnEntry getPrimaryColumnEntry() { + String primaryColumnName = getPrimary(); + for (DatabaseColumnEntry columnEntry : columnEntries) { + if (columnEntry.columnName().equals(primaryColumnName)) { + return columnEntry; + } + } + return null; + } + + @Override + public String toString() { + return "DatabaseEntry{" + + "columnEntries=" + columnEntries + + ", name='" + name + '\'' + + ", primary='" + primary + '\'' + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DatabaseEntry that = (DatabaseEntry) o; + return columnEntries.equals(that.columnEntries); + } + + @Override + public int hashCode() { + return Objects.hash(columnEntries); + } + + public String toJsonString() throws JsonProcessingException { + return new ObjectMapper().writeValueAsString(this); + } +} diff --git a/database-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/LoadResult.java b/database-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/LoadResult.java new file mode 100644 index 0000000..0dd10be --- /dev/null +++ b/database-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/LoadResult.java @@ -0,0 +1,82 @@ +package io.skodjob.dmt.schema; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.util.Objects; + +/** + * Model class for time results from load generation in DMT. Every property is in milliseconds. + */ +public class LoadResult { + long totalTime; + long lastExecutorStarted; + long LastExecutorFinished; + + /** + * @param totalTime Total time it took to generate the queries/requests and to send it through the client/JDBC to database. + * @param lastExecutorStarted Time it took to start executing queries/request on all connections without the data generation. + * @param lastExecutorFinished Time it took to finish executing queries/requests on all connections without the data generation. + */ + public LoadResult(long totalTime, long lastExecutorStarted, long lastExecutorFinished) { + this.totalTime = totalTime; + this.lastExecutorStarted = lastExecutorStarted; + this.LastExecutorFinished = lastExecutorFinished; + } + + public LoadResult() { + this.totalTime = 0; + this.LastExecutorFinished = 0; + this.lastExecutorStarted = 0; + } + + public long getTotalTime() { + return totalTime; + } + + public void setTotalTime(long totalTime) { + this.totalTime = totalTime; + } + + public long getLastExecutorStarted() { + return lastExecutorStarted; + } + + public void setLastExecutorStarted(long lastExecutorStarted) { + this.lastExecutorStarted = lastExecutorStarted; + } + + public long getLastExecutorFinished() { + return LastExecutorFinished; + } + + public void setLastExecutorFinished(long lastExecutorFinished) { + this.LastExecutorFinished = lastExecutorFinished; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + LoadResult that = (LoadResult) o; + return totalTime == that.totalTime && lastExecutorStarted == that.lastExecutorStarted && LastExecutorFinished == that.LastExecutorFinished; + } + + @Override + public int hashCode() { + return Objects.hash(totalTime, lastExecutorStarted, LastExecutorFinished); + } + + public String toJsonString() throws JsonProcessingException { + return new ObjectMapper().writeValueAsString(this); + } + + @Override + public String toString() { + return "LoadResult{" + + "totalTime=" + totalTime + + ", lastExecutorStarted=" + lastExecutorStarted + + ", LastExecutorFinished=" + LastExecutorFinished + + '}'; + } +} diff --git a/database-manipulation-tool-schema/src/test/java/io/skodjob/performance/dmt/schema/AppTest.java b/database-manipulation-tool-schema/src/test/java/io/skodjob/performance/dmt/schema/AppTest.java new file mode 100644 index 0000000..5797ef1 --- /dev/null +++ b/database-manipulation-tool-schema/src/test/java/io/skodjob/performance/dmt/schema/AppTest.java @@ -0,0 +1,9 @@ +package io.skodjob.performance.dmt.schema; + + +/** + * Unit test for simple App. + */ +public class AppTest +{ +} diff --git a/.dockerignore b/database-manipulation-tool/.dockerignore similarity index 100% rename from .dockerignore rename to database-manipulation-tool/.dockerignore diff --git a/database-manipulation-tool/.gitignore b/database-manipulation-tool/.gitignore new file mode 100644 index 0000000..693002a --- /dev/null +++ b/database-manipulation-tool/.gitignore @@ -0,0 +1,40 @@ +#Maven +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +release.properties +.flattened-pom.xml + +# Eclipse +.project +.classpath +.settings/ +bin/ + +# IntelliJ +.idea +*.ipr +*.iml +*.iws + +# NetBeans +nb-configuration.xml + +# Visual Studio Code +.vscode +.factorypath + +# OSX +.DS_Store + +# Vim +*.swp +*.swo + +# patch +*.orig +*.rej + +# Local environment +.env diff --git a/README.md b/database-manipulation-tool/README.md similarity index 100% rename from README.md rename to database-manipulation-tool/README.md diff --git a/create_images.sh b/database-manipulation-tool/create_images.sh similarity index 100% rename from create_images.sh rename to database-manipulation-tool/create_images.sh diff --git a/deployment-instructions b/database-manipulation-tool/deployment-instructions similarity index 100% rename from deployment-instructions rename to database-manipulation-tool/deployment-instructions diff --git a/my.cnf b/database-manipulation-tool/my.cnf similarity index 100% rename from my.cnf rename to database-manipulation-tool/my.cnf diff --git a/database-manipulation-tool/pom.xml b/database-manipulation-tool/pom.xml new file mode 100644 index 0000000..d041d37 --- /dev/null +++ b/database-manipulation-tool/pom.xml @@ -0,0 +1,192 @@ + + + 4.0.0 + database-manipulation-tool + ${project.parent.version} + + + database-performance-hub + io.skodjob + 1.0.0 + + + + 3.11.0 + 17 + UTF-8 + UTF-8 + quarkus-bom + io.quarkus.platform + 2.16.6.Final + true + 3.1.2 + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-resteasy-reactive-jackson + + + io.quarkus + quarkus-agroal + + + + io.skodjob + database-manipulation-tool-schema + ${project.parent.version} + + + + io.skodjob + load-generator + ${project.parent.version} + compile + + + + + + + + + + + + + + + io.quarkus + quarkus-jdbc-postgresql + + + io.quarkus + quarkus-jdbc-mysql + + + io.quarkus + quarkus-mongodb-client + + + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + + -parameters + + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + + native + + + native + + + + + io.quarkus + quarkus-kubernetes + + + io.quarkus + quarkus-kubernetes-config + + + + false + native + + + + nativeTest + + + nativeTest + + + + false + native + + + + diff --git a/src/main/docker/Dockerfile.jvm b/database-manipulation-tool/src/main/docker/Dockerfile.jvm similarity index 100% rename from src/main/docker/Dockerfile.jvm rename to database-manipulation-tool/src/main/docker/Dockerfile.jvm diff --git a/src/main/docker/Dockerfile.legacy-jar b/database-manipulation-tool/src/main/docker/Dockerfile.legacy-jar similarity index 100% rename from src/main/docker/Dockerfile.legacy-jar rename to database-manipulation-tool/src/main/docker/Dockerfile.legacy-jar diff --git a/src/main/docker/Dockerfile.native b/database-manipulation-tool/src/main/docker/Dockerfile.native similarity index 100% rename from src/main/docker/Dockerfile.native rename to database-manipulation-tool/src/main/docker/Dockerfile.native diff --git a/src/main/docker/Dockerfile.native-micro b/database-manipulation-tool/src/main/docker/Dockerfile.native-micro similarity index 100% rename from src/main/docker/Dockerfile.native-micro rename to database-manipulation-tool/src/main/docker/Dockerfile.native-micro diff --git a/src/main/docker/database/docker-compose.yml b/database-manipulation-tool/src/main/docker/database/docker-compose.yml similarity index 100% rename from src/main/docker/database/docker-compose.yml rename to database-manipulation-tool/src/main/docker/database/docker-compose.yml diff --git a/src/main/docker/database/prometheus.yaml b/database-manipulation-tool/src/main/docker/database/prometheus.yaml similarity index 100% rename from src/main/docker/database/prometheus.yaml rename to database-manipulation-tool/src/main/docker/database/prometheus.yaml diff --git a/src/main/java/io/debezium/performance/dmt/async/ExecutorPool.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/async/ExecutorPool.java similarity index 93% rename from src/main/java/io/debezium/performance/dmt/async/ExecutorPool.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/async/ExecutorPool.java index 9c7f0f4..4426b3f 100644 --- a/src/main/java/io/debezium/performance/dmt/async/ExecutorPool.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/async/ExecutorPool.java @@ -1,8 +1,8 @@ -package io.debezium.performance.dmt.async; +package io.skodjob.dmt.async; -import io.debezium.performance.dmt.dao.Dao; -import io.debezium.performance.dmt.dao.DaoManager; -import io.debezium.performance.dmt.dao.MongoDao; +import io.skodjob.dmt.dao.Dao; +import io.skodjob.dmt.dao.DaoManager; +import io.skodjob.dmt.dao.MongoDao; import io.quarkus.runtime.Startup; import org.eclipse.microprofile.config.ConfigProvider; import org.eclipse.microprofile.config.inject.ConfigProperty; diff --git a/src/main/java/io/debezium/performance/dmt/async/RunnableBatchUpsert.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/async/RunnableBatchUpsert.java similarity index 88% rename from src/main/java/io/debezium/performance/dmt/async/RunnableBatchUpsert.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/async/RunnableBatchUpsert.java index da9e90e..9e2f634 100644 --- a/src/main/java/io/debezium/performance/dmt/async/RunnableBatchUpsert.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/async/RunnableBatchUpsert.java @@ -1,6 +1,6 @@ -package io.debezium.performance.dmt.async; +package io.skodjob.dmt.async; -import io.debezium.performance.dmt.dao.Dao; +import io.skodjob.dmt.dao.Dao; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/io/debezium/performance/dmt/async/RunnablePreparedUpsert.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/async/RunnablePreparedUpsert.java similarity index 76% rename from src/main/java/io/debezium/performance/dmt/async/RunnablePreparedUpsert.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/async/RunnablePreparedUpsert.java index c1ee0fd..80e7ac4 100644 --- a/src/main/java/io/debezium/performance/dmt/async/RunnablePreparedUpsert.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/async/RunnablePreparedUpsert.java @@ -1,6 +1,6 @@ -package io.debezium.performance.dmt.async; +package io.skodjob.dmt.async; -import io.debezium.performance.dmt.dao.Dao; +import io.skodjob.dmt.dao.Dao; import java.util.List; diff --git a/src/main/java/io/debezium/performance/dmt/async/RunnableUpsert.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/async/RunnableUpsert.java similarity index 87% rename from src/main/java/io/debezium/performance/dmt/async/RunnableUpsert.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/async/RunnableUpsert.java index e2e0817..1def66e 100644 --- a/src/main/java/io/debezium/performance/dmt/async/RunnableUpsert.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/async/RunnableUpsert.java @@ -1,6 +1,6 @@ -package io.debezium.performance.dmt.async; +package io.skodjob.dmt.async; -import io.debezium.performance.dmt.dao.Dao; +import io.skodjob.dmt.dao.Dao; import java.util.List; import java.util.function.Consumer; diff --git a/src/main/java/io/debezium/performance/dmt/async/RunnableUpsertSecond.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/async/RunnableUpsertSecond.java similarity index 88% rename from src/main/java/io/debezium/performance/dmt/async/RunnableUpsertSecond.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/async/RunnableUpsertSecond.java index 62e5549..4bd9399 100644 --- a/src/main/java/io/debezium/performance/dmt/async/RunnableUpsertSecond.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/async/RunnableUpsertSecond.java @@ -1,7 +1,7 @@ -package io.debezium.performance.dmt.async; +package io.skodjob.dmt.async; -import io.debezium.performance.dmt.dao.Dao; -import io.debezium.performance.dmt.dao.MongoDao; +import io.skodjob.dmt.dao.Dao; +import io.skodjob.dmt.dao.MongoDao; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/io/debezium/performance/dmt/dao/AbstractBasicDao.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/AbstractBasicDao.java similarity index 92% rename from src/main/java/io/debezium/performance/dmt/dao/AbstractBasicDao.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/AbstractBasicDao.java index cb21f41..7b83485 100644 --- a/src/main/java/io/debezium/performance/dmt/dao/AbstractBasicDao.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/AbstractBasicDao.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.dao; +package io.skodjob.dmt.dao; import java.sql.Connection; import java.sql.PreparedStatement; @@ -14,14 +14,14 @@ import javax.enterprise.context.Dependent; +import io.skodjob.dmt.exception.RuntimeSQLException; import org.jboss.logging.Logger; -import io.debezium.performance.dmt.dataSource.DataSourceWrapper; -import io.debezium.performance.dmt.exception.RuntimeSQLException; -import io.debezium.performance.dmt.model.DatabaseColumn; -import io.debezium.performance.dmt.model.DatabaseEntry; -import io.debezium.performance.dmt.model.DatabaseTableMetadata; -import io.debezium.performance.dmt.queryCreator.QueryCreator; +import io.skodjob.dmt.dataSource.DataSourceWrapper; +import io.skodjob.dmt.model.DatabaseColumn; +import io.skodjob.dmt.model.DatabaseEntry; +import io.skodjob.dmt.model.DatabaseTableMetadata; +import io.skodjob.dmt.queryCreator.QueryCreator; @SuppressWarnings("CdiManagedBeanInconsistencyInspection") @Dependent diff --git a/src/main/java/io/debezium/performance/dmt/dao/Dao.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/Dao.java similarity index 78% rename from src/main/java/io/debezium/performance/dmt/dao/Dao.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/Dao.java index f4c4dbc..892b050 100644 --- a/src/main/java/io/debezium/performance/dmt/dao/Dao.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/Dao.java @@ -3,14 +3,14 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.dao; +package io.skodjob.dmt.dao; import java.time.Instant; import java.util.List; -import io.debezium.performance.dmt.model.DatabaseColumn; -import io.debezium.performance.dmt.model.DatabaseEntry; -import io.debezium.performance.dmt.model.DatabaseTableMetadata; +import io.skodjob.dmt.model.DatabaseColumn; +import io.skodjob.dmt.model.DatabaseEntry; +import io.skodjob.dmt.model.DatabaseTableMetadata; public interface Dao { diff --git a/src/main/java/io/debezium/performance/dmt/dao/DaoManager.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/DaoManager.java similarity index 98% rename from src/main/java/io/debezium/performance/dmt/dao/DaoManager.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/DaoManager.java index d1f0bbe..25a1657 100644 --- a/src/main/java/io/debezium/performance/dmt/dao/DaoManager.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/DaoManager.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.dao; +package io.skodjob.dmt.dao; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/io/debezium/performance/dmt/dao/MongoDao.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/MongoDao.java similarity index 93% rename from src/main/java/io/debezium/performance/dmt/dao/MongoDao.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/MongoDao.java index 0462049..c7afbaa 100644 --- a/src/main/java/io/debezium/performance/dmt/dao/MongoDao.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/MongoDao.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.dao; +package io.skodjob.dmt.dao; import java.time.Instant; import java.util.List; @@ -12,6 +12,8 @@ import javax.inject.Inject; import com.mongodb.client.model.WriteModel; +import io.skodjob.dmt.model.DatabaseColumnEntry; +import io.skodjob.dmt.queryCreator.MongoBsonCreator; import org.bson.Document; import org.bson.conversions.Bson; import org.eclipse.microprofile.config.inject.ConfigProperty; @@ -20,11 +22,9 @@ import com.mongodb.client.MongoClient; import com.mongodb.client.MongoDatabase; -import io.debezium.performance.dmt.model.DatabaseColumn; -import io.debezium.performance.dmt.model.DatabaseColumnEntry; -import io.debezium.performance.dmt.model.DatabaseEntry; -import io.debezium.performance.dmt.model.DatabaseTableMetadata; -import io.debezium.performance.dmt.queryCreator.MongoBsonCreator; +import io.skodjob.dmt.model.DatabaseColumn; +import io.skodjob.dmt.model.DatabaseEntry; +import io.skodjob.dmt.model.DatabaseTableMetadata; import io.quarkus.arc.Unremovable; import io.quarkus.arc.lookup.LookupIfProperty; import io.quarkus.mongodb.MongoClientName; diff --git a/src/main/java/io/debezium/performance/dmt/dao/MysqlDao.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/MysqlDao.java similarity index 85% rename from src/main/java/io/debezium/performance/dmt/dao/MysqlDao.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/MysqlDao.java index eddf0f5..5ef81c1 100644 --- a/src/main/java/io/debezium/performance/dmt/dao/MysqlDao.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/MysqlDao.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.dao; +package io.skodjob.dmt.dao; import java.sql.Connection; import java.sql.SQLException; @@ -13,9 +13,9 @@ import javax.inject.Inject; -import io.debezium.performance.dmt.dataSource.MysqlDataSource; -import io.debezium.performance.dmt.exception.RuntimeSQLException; -import io.debezium.performance.dmt.queryCreator.MysqlQueryCreator; +import io.skodjob.dmt.dataSource.MysqlDataSource; +import io.skodjob.dmt.exception.RuntimeSQLException; +import io.skodjob.dmt.queryCreator.MysqlQueryCreator; import io.quarkus.arc.Unremovable; import io.quarkus.arc.lookup.LookupIfProperty; diff --git a/src/main/java/io/debezium/performance/dmt/dao/PostgresDao.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/PostgresDao.java similarity index 84% rename from src/main/java/io/debezium/performance/dmt/dao/PostgresDao.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/PostgresDao.java index 1b2d301..9504a0e 100644 --- a/src/main/java/io/debezium/performance/dmt/dao/PostgresDao.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dao/PostgresDao.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.dao; +package io.skodjob.dmt.dao; import java.sql.Connection; import java.sql.SQLException; @@ -14,9 +14,9 @@ import javax.inject.Inject; -import io.debezium.performance.dmt.dataSource.PostgresDataSource; -import io.debezium.performance.dmt.exception.RuntimeSQLException; -import io.debezium.performance.dmt.queryCreator.PostgresQueryCreator; +import io.skodjob.dmt.dataSource.PostgresDataSource; +import io.skodjob.dmt.exception.RuntimeSQLException; +import io.skodjob.dmt.queryCreator.PostgresQueryCreator; import io.quarkus.arc.Unremovable; import io.quarkus.arc.lookup.LookupIfProperty; diff --git a/src/main/java/io/debezium/performance/dmt/dataSource/DataSourceWrapper.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dataSource/DataSourceWrapper.java similarity index 86% rename from src/main/java/io/debezium/performance/dmt/dataSource/DataSourceWrapper.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/dataSource/DataSourceWrapper.java index ceddb59..920ffda 100644 --- a/src/main/java/io/debezium/performance/dmt/dataSource/DataSourceWrapper.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dataSource/DataSourceWrapper.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.dataSource; +package io.skodjob.dmt.dataSource; import java.sql.Connection; import java.sql.SQLException; diff --git a/src/main/java/io/debezium/performance/dmt/dataSource/MysqlDataSource.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dataSource/MysqlDataSource.java similarity index 92% rename from src/main/java/io/debezium/performance/dmt/dataSource/MysqlDataSource.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/dataSource/MysqlDataSource.java index cf43efb..434d5dc 100644 --- a/src/main/java/io/debezium/performance/dmt/dataSource/MysqlDataSource.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dataSource/MysqlDataSource.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.dataSource; +package io.skodjob.dmt.dataSource; import java.sql.Connection; import java.sql.SQLException; diff --git a/src/main/java/io/debezium/performance/dmt/dataSource/PostgresDataSource.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dataSource/PostgresDataSource.java similarity index 92% rename from src/main/java/io/debezium/performance/dmt/dataSource/PostgresDataSource.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/dataSource/PostgresDataSource.java index c676600..f487b0c 100644 --- a/src/main/java/io/debezium/performance/dmt/dataSource/PostgresDataSource.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/dataSource/PostgresDataSource.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.dataSource; +package io.skodjob.dmt.dataSource; import java.sql.Connection; import java.sql.SQLException; diff --git a/src/main/java/io/debezium/performance/dmt/exception/InnerDatabaseException.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/exception/InnerDatabaseException.java similarity index 86% rename from src/main/java/io/debezium/performance/dmt/exception/InnerDatabaseException.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/exception/InnerDatabaseException.java index 5ebcb7e..c013c55 100644 --- a/src/main/java/io/debezium/performance/dmt/exception/InnerDatabaseException.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/exception/InnerDatabaseException.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.exception; +package io.skodjob.dmt.exception; public class InnerDatabaseException extends RuntimeException { public InnerDatabaseException(String message) { diff --git a/src/main/java/io/debezium/performance/dmt/exception/RuntimeSQLException.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/exception/RuntimeSQLException.java similarity index 86% rename from src/main/java/io/debezium/performance/dmt/exception/RuntimeSQLException.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/exception/RuntimeSQLException.java index 76eee48..ef41770 100644 --- a/src/main/java/io/debezium/performance/dmt/exception/RuntimeSQLException.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/exception/RuntimeSQLException.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.exception; +package io.skodjob.dmt.exception; public class RuntimeSQLException extends RuntimeException { public RuntimeSQLException(Throwable cause) { diff --git a/src/main/java/io/debezium/performance/dmt/generator/Generator.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/generator/Generator.java similarity index 73% rename from src/main/java/io/debezium/performance/dmt/generator/Generator.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/generator/Generator.java index 039560a..d6088cb 100644 --- a/src/main/java/io/debezium/performance/dmt/generator/Generator.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/generator/Generator.java @@ -1,11 +1,11 @@ -package io.debezium.performance.dmt.generator; +package io.skodjob.dmt.generator; -import io.debezium.performance.dmt.parser.DmtSchemaParser; -import io.debezium.performance.dmt.model.DatabaseEntry; -import io.debezium.performance.load.data.builder.AviationDataBuilder; -import io.debezium.performance.load.data.builder.ByteDataBuilder; -import io.debezium.performance.load.data.builder.RequestBuilder; -import io.debezium.performance.load.scenarios.builder.ConstantScenarioBuilder; +import io.skodjob.dmt.parser.DmtSchemaParser; +import io.skodjob.dmt.model.DatabaseEntry; +import io.skodjob.load.data.builder.AviationDataBuilder; +import io.skodjob.load.data.builder.ByteDataBuilder; +import io.skodjob.load.data.builder.RequestBuilder; +import io.skodjob.load.scenarios.builder.ConstantScenarioBuilder; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; @@ -20,7 +20,7 @@ public List generateAviationBatch(int count, int maxRows) { RequestBuilder requestBuilder = new RequestBuilder<>(new AviationDataBuilder(), new ConstantScenarioBuilder(1, 1)); - List entries = requestBuilder + List entries = requestBuilder .setRequestCount(count) .setMaxRows(maxRows) .buildPlain(); @@ -32,7 +32,7 @@ public List generateByteBatch(int count, int maxRows, int message RequestBuilder requestBuilder = new RequestBuilder<>(new ByteDataBuilder(1), new ConstantScenarioBuilder(1,1)); AtomicInteger i = new AtomicInteger(1); String message = "a".repeat(messageSize); - List entries = requestBuilder + List entries = requestBuilder .setRequestCount(count) .setMaxRows(maxRows) .buildPlain(); diff --git a/src/main/java/io/debezium/performance/dmt/model/Database.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/model/Database.java similarity index 97% rename from src/main/java/io/debezium/performance/dmt/model/Database.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/model/Database.java index 33cfc3c..72c31c3 100644 --- a/src/main/java/io/debezium/performance/dmt/model/Database.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/model/Database.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.model; +package io.skodjob.dmt.model; import java.util.ArrayList; import java.util.HashMap; @@ -12,9 +12,9 @@ import javax.enterprise.context.ApplicationScoped; +import io.skodjob.dmt.exception.InnerDatabaseException; import org.jboss.logging.Logger; -import io.debezium.performance.dmt.exception.InnerDatabaseException; import io.quarkus.arc.Lock; @Lock diff --git a/src/main/java/io/debezium/performance/dmt/model/DatabaseColumn.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/model/DatabaseColumn.java similarity index 97% rename from src/main/java/io/debezium/performance/dmt/model/DatabaseColumn.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/model/DatabaseColumn.java index db1bcaa..9dff164 100644 --- a/src/main/java/io/debezium/performance/dmt/model/DatabaseColumn.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/model/DatabaseColumn.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.model; +package io.skodjob.dmt.model; import java.util.Objects; diff --git a/src/main/java/io/debezium/performance/dmt/model/DatabaseColumnEntry.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/model/DatabaseColumnEntry.java similarity index 96% rename from src/main/java/io/debezium/performance/dmt/model/DatabaseColumnEntry.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/model/DatabaseColumnEntry.java index 36e0c3d..354d758 100644 --- a/src/main/java/io/debezium/performance/dmt/model/DatabaseColumnEntry.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/model/DatabaseColumnEntry.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.model; +package io.skodjob.dmt.model; import java.util.Objects; diff --git a/src/main/java/io/debezium/performance/dmt/model/DatabaseEntry.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/model/DatabaseEntry.java similarity index 98% rename from src/main/java/io/debezium/performance/dmt/model/DatabaseEntry.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/model/DatabaseEntry.java index f8251aa..b57e716 100644 --- a/src/main/java/io/debezium/performance/dmt/model/DatabaseEntry.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/model/DatabaseEntry.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.model; +package io.skodjob.dmt.model; import java.util.List; import java.util.Objects; diff --git a/src/main/java/io/debezium/performance/dmt/model/DatabaseTable.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/model/DatabaseTable.java similarity index 94% rename from src/main/java/io/debezium/performance/dmt/model/DatabaseTable.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/model/DatabaseTable.java index d42ab59..cfad067 100644 --- a/src/main/java/io/debezium/performance/dmt/model/DatabaseTable.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/model/DatabaseTable.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.model; +package io.skodjob.dmt.model; import java.util.ArrayList; import java.util.HashMap; @@ -12,7 +12,7 @@ import org.jboss.logging.Logger; -import io.debezium.performance.dmt.exception.InnerDatabaseException; +import io.skodjob.dmt.exception.InnerDatabaseException; public class DatabaseTable { private Map rows; diff --git a/src/main/java/io/debezium/performance/dmt/model/DatabaseTableMetadata.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/model/DatabaseTableMetadata.java similarity index 98% rename from src/main/java/io/debezium/performance/dmt/model/DatabaseTableMetadata.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/model/DatabaseTableMetadata.java index 6f04259..12d7d64 100644 --- a/src/main/java/io/debezium/performance/dmt/model/DatabaseTableMetadata.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/model/DatabaseTableMetadata.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.model; +package io.skodjob.dmt.model; import java.util.ArrayList; import java.util.HashSet; diff --git a/src/main/java/io/debezium/performance/dmt/model/QueryType.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/model/QueryType.java similarity index 53% rename from src/main/java/io/debezium/performance/dmt/model/QueryType.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/model/QueryType.java index 5f8f9fa..a404879 100644 --- a/src/main/java/io/debezium/performance/dmt/model/QueryType.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/model/QueryType.java @@ -1,4 +1,4 @@ -package io.debezium.performance.dmt.model; +package io.skodjob.dmt.model; public enum QueryType { INSERT, diff --git a/src/main/java/io/debezium/performance/dmt/utils/DataParser.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/parser/DataParser.java similarity index 86% rename from src/main/java/io/debezium/performance/dmt/utils/DataParser.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/parser/DataParser.java index 8c56a2d..fe96bc5 100644 --- a/src/main/java/io/debezium/performance/dmt/utils/DataParser.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/parser/DataParser.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.utils; +package io.skodjob.dmt.parser; import javax.json.JsonException; diff --git a/src/main/java/io/debezium/performance/dmt/parser/DatabaseEntryParser.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/parser/DatabaseEntryParser.java similarity index 87% rename from src/main/java/io/debezium/performance/dmt/parser/DatabaseEntryParser.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/parser/DatabaseEntryParser.java index d810c31..a65b680 100644 --- a/src/main/java/io/debezium/performance/dmt/parser/DatabaseEntryParser.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/parser/DatabaseEntryParser.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.parser; +package io.skodjob.dmt.parser; import java.util.ArrayList; import java.util.List; @@ -14,12 +14,12 @@ import javax.json.JsonObject; import javax.json.JsonValue; +import io.skodjob.dmt.model.DatabaseColumnEntry; import org.jboss.logging.Logger; -import io.debezium.performance.dmt.model.DatabaseColumn; -import io.debezium.performance.dmt.model.DatabaseColumnEntry; -import io.debezium.performance.dmt.model.DatabaseEntry; -import io.debezium.performance.dmt.model.DatabaseTableMetadata; +import io.skodjob.dmt.model.DatabaseColumn; +import io.skodjob.dmt.model.DatabaseEntry; +import io.skodjob.dmt.model.DatabaseTableMetadata; @Deprecated @ApplicationScoped diff --git a/src/main/java/io/debezium/performance/dmt/parser/DmtSchemaJsonParser.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/parser/DmtSchemaJsonParser.java similarity index 75% rename from src/main/java/io/debezium/performance/dmt/parser/DmtSchemaJsonParser.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/parser/DmtSchemaJsonParser.java index 29cead4..ceddab9 100644 --- a/src/main/java/io/debezium/performance/dmt/parser/DmtSchemaJsonParser.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/parser/DmtSchemaJsonParser.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.parser; +package io.skodjob.dmt.parser; import javax.enterprise.context.ApplicationScoped; import javax.json.JsonException; @@ -13,9 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; -import io.debezium.performance.dmt.model.DatabaseEntry; - -import static io.debezium.performance.dmt.parser.ParseUtils.fromSchema; +import io.skodjob.dmt.model.DatabaseEntry; @ApplicationScoped public class DmtSchemaJsonParser implements DataParser { @@ -26,15 +24,15 @@ public class DmtSchemaJsonParser implements DataParser{ + @Override + public DatabaseEntry parse(io.skodjob.dmt.schema.DatabaseEntry inputObject) { + return ParseUtils.fromSchema(inputObject); + } +} diff --git a/src/main/java/io/debezium/performance/dmt/parser/ParseUtils.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/parser/ParseUtils.java similarity index 68% rename from src/main/java/io/debezium/performance/dmt/parser/ParseUtils.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/parser/ParseUtils.java index a7bd042..136d7e5 100644 --- a/src/main/java/io/debezium/performance/dmt/parser/ParseUtils.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/parser/ParseUtils.java @@ -1,15 +1,16 @@ -package io.debezium.performance.dmt.parser; +package io.skodjob.dmt.parser; -import io.debezium.performance.dmt.model.DatabaseColumn; -import io.debezium.performance.dmt.model.DatabaseEntry; -import io.debezium.performance.dmt.model.DatabaseTableMetadata; -import io.debezium.performance.dmt.model.DatabaseColumnEntry; + +import io.skodjob.dmt.model.DatabaseColumn; +import io.skodjob.dmt.model.DatabaseColumnEntry; +import io.skodjob.dmt.model.DatabaseEntry; +import io.skodjob.dmt.model.DatabaseTableMetadata; import java.util.ArrayList; import java.util.List; public class ParseUtils { - public static DatabaseEntry fromSchema (io.debezium.performance.dmt.schema.DatabaseEntry inputObject) { + public static DatabaseEntry fromSchema (io.skodjob.dmt.schema.DatabaseEntry inputObject) { DatabaseEntry databaseEntry; List entries = new ArrayList<>(); DatabaseTableMetadata table = new DatabaseTableMetadata(); diff --git a/src/main/java/io/debezium/performance/dmt/queryCreator/AbstractBasicQueryCreator.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/queryCreator/AbstractBasicQueryCreator.java similarity index 93% rename from src/main/java/io/debezium/performance/dmt/queryCreator/AbstractBasicQueryCreator.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/queryCreator/AbstractBasicQueryCreator.java index 9b5305d..4da42d9 100644 --- a/src/main/java/io/debezium/performance/dmt/queryCreator/AbstractBasicQueryCreator.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/queryCreator/AbstractBasicQueryCreator.java @@ -3,16 +3,16 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.queryCreator; +package io.skodjob.dmt.queryCreator; import java.util.List; import org.jboss.logging.Logger; -import io.debezium.performance.dmt.model.DatabaseColumn; -import io.debezium.performance.dmt.model.DatabaseColumnEntry; -import io.debezium.performance.dmt.model.DatabaseEntry; -import io.debezium.performance.dmt.model.DatabaseTableMetadata; +import io.skodjob.dmt.model.DatabaseColumn; +import io.skodjob.dmt.model.DatabaseColumnEntry; +import io.skodjob.dmt.model.DatabaseEntry; +import io.skodjob.dmt.model.DatabaseTableMetadata; public abstract class AbstractBasicQueryCreator implements QueryCreator { diff --git a/src/main/java/io/debezium/performance/dmt/queryCreator/MongoBsonCreator.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/queryCreator/MongoBsonCreator.java similarity index 91% rename from src/main/java/io/debezium/performance/dmt/queryCreator/MongoBsonCreator.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/queryCreator/MongoBsonCreator.java index b1e9beb..b20a6d7 100644 --- a/src/main/java/io/debezium/performance/dmt/queryCreator/MongoBsonCreator.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/queryCreator/MongoBsonCreator.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.queryCreator; +package io.skodjob.dmt.queryCreator; import java.util.ArrayList; import java.util.List; @@ -11,19 +11,18 @@ import javax.enterprise.context.ApplicationScoped; -import com.mongodb.bulk.BulkWriteUpsert; import com.mongodb.client.model.Filters; import com.mongodb.client.model.UpdateOneModel; import com.mongodb.client.model.UpdateOptions; import com.mongodb.client.model.WriteModel; -import io.debezium.performance.dmt.model.DatabaseColumnEntry; +import io.skodjob.dmt.model.DatabaseColumnEntry; import org.bson.Document; import org.bson.conversions.Bson; import org.jboss.logging.Logger; import com.mongodb.client.model.Updates; -import io.debezium.performance.dmt.model.DatabaseEntry; +import io.skodjob.dmt.model.DatabaseEntry; @ApplicationScoped public class MongoBsonCreator { diff --git a/src/main/java/io/debezium/performance/dmt/queryCreator/MysqlQueryCreator.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/queryCreator/MysqlQueryCreator.java similarity index 94% rename from src/main/java/io/debezium/performance/dmt/queryCreator/MysqlQueryCreator.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/queryCreator/MysqlQueryCreator.java index 4971f3f..963a9c3 100644 --- a/src/main/java/io/debezium/performance/dmt/queryCreator/MysqlQueryCreator.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/queryCreator/MysqlQueryCreator.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.queryCreator; +package io.skodjob.dmt.queryCreator; import javax.enterprise.context.ApplicationScoped; diff --git a/src/main/java/io/debezium/performance/dmt/queryCreator/PostgresQueryCreator.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/queryCreator/PostgresQueryCreator.java similarity index 91% rename from src/main/java/io/debezium/performance/dmt/queryCreator/PostgresQueryCreator.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/queryCreator/PostgresQueryCreator.java index 2be592c..5d84a18 100644 --- a/src/main/java/io/debezium/performance/dmt/queryCreator/PostgresQueryCreator.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/queryCreator/PostgresQueryCreator.java @@ -3,14 +3,14 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.queryCreator; +package io.skodjob.dmt.queryCreator; import javax.enterprise.context.ApplicationScoped; import org.jboss.logging.Logger; -import io.debezium.performance.dmt.model.DatabaseColumn; -import io.debezium.performance.dmt.model.DatabaseTableMetadata; +import io.skodjob.dmt.model.DatabaseColumn; +import io.skodjob.dmt.model.DatabaseTableMetadata; @ApplicationScoped public class PostgresQueryCreator extends AbstractBasicQueryCreator { diff --git a/src/main/java/io/debezium/performance/dmt/queryCreator/QueryCreator.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/queryCreator/QueryCreator.java similarity index 73% rename from src/main/java/io/debezium/performance/dmt/queryCreator/QueryCreator.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/queryCreator/QueryCreator.java index 90922b0..5e8f08f 100644 --- a/src/main/java/io/debezium/performance/dmt/queryCreator/QueryCreator.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/queryCreator/QueryCreator.java @@ -3,13 +3,13 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.queryCreator; +package io.skodjob.dmt.queryCreator; import java.util.List; -import io.debezium.performance.dmt.model.DatabaseColumn; -import io.debezium.performance.dmt.model.DatabaseEntry; -import io.debezium.performance.dmt.model.DatabaseTableMetadata; +import io.skodjob.dmt.model.DatabaseColumn; +import io.skodjob.dmt.model.DatabaseEntry; +import io.skodjob.dmt.model.DatabaseTableMetadata; public interface QueryCreator { String insertQuery(DatabaseEntry databaseEntry); diff --git a/src/main/java/io/debezium/performance/dmt/resource/MainResource.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/resource/MainResource.java similarity index 96% rename from src/main/java/io/debezium/performance/dmt/resource/MainResource.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/resource/MainResource.java index 1e5face..60cf053 100644 --- a/src/main/java/io/debezium/performance/dmt/resource/MainResource.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/resource/MainResource.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.resource; +package io.skodjob.dmt.resource; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.Observes; @@ -20,13 +20,13 @@ import javax.ws.rs.core.Response; import com.fasterxml.jackson.core.JsonProcessingException; -import io.debezium.performance.dmt.schema.LoadResult; -import io.debezium.performance.dmt.service.AsyncMainService; +import io.skodjob.dmt.schema.LoadResult; +import io.skodjob.dmt.service.AsyncMainService; import org.eclipse.microprofile.config.inject.ConfigProperty; import org.jboss.logging.Logger; -import io.debezium.performance.dmt.model.DatabaseEntry; -import io.debezium.performance.dmt.parser.DmtSchemaJsonParser; +import io.skodjob.dmt.model.DatabaseEntry; +import io.skodjob.dmt.parser.DmtSchemaJsonParser; import io.quarkus.runtime.StartupEvent; import io.quarkus.runtime.annotations.RegisterForReflection; import org.jboss.resteasy.reactive.RestQuery; diff --git a/src/main/java/io/debezium/performance/dmt/resource/UtilityResource.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/resource/UtilityResource.java similarity index 89% rename from src/main/java/io/debezium/performance/dmt/resource/UtilityResource.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/resource/UtilityResource.java index 613d089..7844a70 100644 --- a/src/main/java/io/debezium/performance/dmt/resource/UtilityResource.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/resource/UtilityResource.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.resource; +package io.skodjob.dmt.resource; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; @@ -18,9 +18,9 @@ import org.jboss.logging.Logger; -import io.debezium.performance.dmt.model.DatabaseEntry; -import io.debezium.performance.dmt.service.UtilityService; -import io.debezium.performance.dmt.parser.DmtSchemaJsonParser; +import io.skodjob.dmt.model.DatabaseEntry; +import io.skodjob.dmt.service.UtilityService; +import io.skodjob.dmt.parser.DmtSchemaJsonParser; import io.quarkus.runtime.annotations.RegisterForReflection; @Path("Utility") diff --git a/src/main/java/io/debezium/performance/dmt/service/AsyncMainService.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/service/AsyncMainService.java similarity index 92% rename from src/main/java/io/debezium/performance/dmt/service/AsyncMainService.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/service/AsyncMainService.java index c7c2375..0bf9e45 100644 --- a/src/main/java/io/debezium/performance/dmt/service/AsyncMainService.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/service/AsyncMainService.java @@ -1,12 +1,12 @@ -package io.debezium.performance.dmt.service; +package io.skodjob.dmt.service; import com.mongodb.client.model.WriteModel; -import io.debezium.performance.dmt.async.ExecutorPool; -import io.debezium.performance.dmt.dao.MongoDao; -import io.debezium.performance.dmt.generator.Generator; -import io.debezium.performance.dmt.model.DatabaseEntry; -import io.debezium.performance.dmt.queryCreator.MongoBsonCreator; -import io.debezium.performance.dmt.queryCreator.MysqlQueryCreator; +import io.skodjob.dmt.queryCreator.MongoBsonCreator; +import io.skodjob.dmt.queryCreator.MysqlQueryCreator; +import io.skodjob.dmt.async.ExecutorPool; +import io.skodjob.dmt.dao.MongoDao; +import io.skodjob.dmt.generator.Generator; +import io.skodjob.dmt.model.DatabaseEntry; import io.quarkus.runtime.Startup; import org.bson.Document; import org.jboss.logging.Logger; diff --git a/src/main/java/io/debezium/performance/dmt/service/MainService.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/service/MainService.java similarity index 90% rename from src/main/java/io/debezium/performance/dmt/service/MainService.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/service/MainService.java index c1bf19e..f3370f5 100644 --- a/src/main/java/io/debezium/performance/dmt/service/MainService.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/service/MainService.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.service; +package io.skodjob.dmt.service; import java.time.Instant; import java.util.List; @@ -16,14 +16,14 @@ import org.jboss.logging.Logger; -import io.debezium.performance.dmt.dao.Dao; -import io.debezium.performance.dmt.dao.DaoManager; -import io.debezium.performance.dmt.exception.InnerDatabaseException; -import io.debezium.performance.dmt.model.Database; -import io.debezium.performance.dmt.model.DatabaseColumn; -import io.debezium.performance.dmt.model.DatabaseEntry; -import io.debezium.performance.dmt.model.DatabaseTableMetadata; -import io.debezium.performance.dmt.utils.TimeJsonBuilder; +import io.skodjob.dmt.dao.Dao; +import io.skodjob.dmt.dao.DaoManager; +import io.skodjob.dmt.exception.InnerDatabaseException; +import io.skodjob.dmt.model.Database; +import io.skodjob.dmt.model.DatabaseColumn; +import io.skodjob.dmt.model.DatabaseEntry; +import io.skodjob.dmt.model.DatabaseTableMetadata; +import io.skodjob.dmt.utils.TimeJsonBuilder; @RequestScoped @Named("main") diff --git a/src/main/java/io/debezium/performance/dmt/service/UtilityService.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/service/UtilityService.java similarity index 76% rename from src/main/java/io/debezium/performance/dmt/service/UtilityService.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/service/UtilityService.java index 51a0ce2..b745208 100644 --- a/src/main/java/io/debezium/performance/dmt/service/UtilityService.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/service/UtilityService.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.service; +package io.skodjob.dmt.service; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; @@ -11,9 +11,9 @@ import org.jboss.logging.Logger; -import io.debezium.performance.dmt.dao.DaoManager; -import io.debezium.performance.dmt.model.Database; -import io.debezium.performance.dmt.utils.ResponseJsonBuilder; +import io.skodjob.dmt.dao.DaoManager; +import io.skodjob.dmt.model.Database; +import io.skodjob.dmt.utils.ResponseJsonBuilder; @ApplicationScoped public class UtilityService { diff --git a/src/main/java/io/debezium/performance/dmt/parser/DataParser.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/utils/DataParser.java similarity index 86% rename from src/main/java/io/debezium/performance/dmt/parser/DataParser.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/utils/DataParser.java index 23c04af..278668f 100644 --- a/src/main/java/io/debezium/performance/dmt/parser/DataParser.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/utils/DataParser.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.parser; +package io.skodjob.dmt.utils; import javax.json.JsonException; diff --git a/src/main/java/io/debezium/performance/dmt/utils/DmtSchemaParser.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/utils/DmtSchemaParser.java similarity index 84% rename from src/main/java/io/debezium/performance/dmt/utils/DmtSchemaParser.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/utils/DmtSchemaParser.java index 1e4ccc6..867e01a 100644 --- a/src/main/java/io/debezium/performance/dmt/utils/DmtSchemaParser.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/utils/DmtSchemaParser.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.utils; +package io.skodjob.dmt.utils; import java.util.ArrayList; import java.util.List; @@ -12,14 +12,14 @@ import javax.json.JsonException; import javax.json.JsonObject; +import io.skodjob.dmt.model.DatabaseColumnEntry; import org.jboss.logging.Logger; import com.fasterxml.jackson.databind.ObjectMapper; -import io.debezium.performance.dmt.model.DatabaseColumn; -import io.debezium.performance.dmt.model.DatabaseColumnEntry; -import io.debezium.performance.dmt.model.DatabaseEntry; -import io.debezium.performance.dmt.model.DatabaseTableMetadata; +import io.skodjob.dmt.model.DatabaseColumn; +import io.skodjob.dmt.model.DatabaseEntry; +import io.skodjob.dmt.model.DatabaseTableMetadata; @ApplicationScoped public class DmtSchemaParser implements DataParser { @@ -32,7 +32,7 @@ public class DmtSchemaParser implements DataParser { public DatabaseEntry parse(JsonObject inputObject) throws JsonException { DatabaseEntry databaseEntry; try { - var schemaEntry = objectMapper.readValue(inputObject.toString(), io.debezium.performance.dmt.schema.DatabaseEntry.class); + var schemaEntry = objectMapper.readValue(inputObject.toString(), io.skodjob.dmt.schema.DatabaseEntry.class); List entries = new ArrayList<>(); DatabaseTableMetadata table = new DatabaseTableMetadata(); diff --git a/src/main/java/io/debezium/performance/dmt/utils/ReflectionConfiguration.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/utils/ReflectionConfiguration.java similarity index 67% rename from src/main/java/io/debezium/performance/dmt/utils/ReflectionConfiguration.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/utils/ReflectionConfiguration.java index 109133b..891ace1 100644 --- a/src/main/java/io/debezium/performance/dmt/utils/ReflectionConfiguration.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/utils/ReflectionConfiguration.java @@ -4,10 +4,10 @@ * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.utils; +package io.skodjob.dmt.utils; -import io.debezium.performance.dmt.schema.DatabaseColumnEntry; -import io.debezium.performance.dmt.schema.DatabaseEntry; +import io.skodjob.dmt.schema.DatabaseColumnEntry; +import io.skodjob.dmt.schema.DatabaseEntry; import io.quarkus.runtime.annotations.RegisterForReflection; @RegisterForReflection(targets = { DatabaseEntry.class, DatabaseColumnEntry.class }) diff --git a/src/main/java/io/debezium/performance/dmt/utils/ResponseJsonBuilder.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/utils/ResponseJsonBuilder.java similarity index 89% rename from src/main/java/io/debezium/performance/dmt/utils/ResponseJsonBuilder.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/utils/ResponseJsonBuilder.java index 2ba156e..df8e2ae 100644 --- a/src/main/java/io/debezium/performance/dmt/utils/ResponseJsonBuilder.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/utils/ResponseJsonBuilder.java @@ -3,7 +3,7 @@ * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.utils; +package io.skodjob.dmt.utils; import java.util.List; @@ -12,11 +12,11 @@ import javax.json.JsonObject; import javax.json.JsonObjectBuilder; -import io.debezium.performance.dmt.model.Database; -import io.debezium.performance.dmt.model.DatabaseColumn; -import io.debezium.performance.dmt.model.DatabaseColumnEntry; -import io.debezium.performance.dmt.model.DatabaseEntry; -import io.debezium.performance.dmt.model.DatabaseTable; +import io.skodjob.dmt.model.Database; +import io.skodjob.dmt.model.DatabaseColumnEntry; +import io.skodjob.dmt.model.DatabaseTable; +import io.skodjob.dmt.model.DatabaseColumn; +import io.skodjob.dmt.model.DatabaseEntry; public class ResponseJsonBuilder { JsonObjectBuilder mainBuilder; diff --git a/src/main/java/io/debezium/performance/dmt/utils/TimeJsonBuilder.java b/database-manipulation-tool/src/main/java/io/skodjob/dmt/utils/TimeJsonBuilder.java similarity index 93% rename from src/main/java/io/debezium/performance/dmt/utils/TimeJsonBuilder.java rename to database-manipulation-tool/src/main/java/io/skodjob/dmt/utils/TimeJsonBuilder.java index cd5f42c..8ff9fe6 100644 --- a/src/main/java/io/debezium/performance/dmt/utils/TimeJsonBuilder.java +++ b/database-manipulation-tool/src/main/java/io/skodjob/dmt/utils/TimeJsonBuilder.java @@ -4,7 +4,7 @@ * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ -package io.debezium.performance.dmt.utils; +package io.skodjob.dmt.utils; import java.time.Instant; diff --git a/src/main/resources/META-INF/resources/index.html b/database-manipulation-tool/src/main/resources/META-INF/resources/index.html similarity index 99% rename from src/main/resources/META-INF/resources/index.html rename to database-manipulation-tool/src/main/resources/META-INF/resources/index.html index 14515b6..9b9c5ff 100644 --- a/src/main/resources/META-INF/resources/index.html +++ b/database-manipulation-tool/src/main/resources/META-INF/resources/index.html @@ -303,7 +303,7 @@
Application
    -
  • GroupId: io.debezium
  • +
  • GroupId: io.skodjob
  • ArtifactId: database-manipulation-tool
  • Version: 1.0-SNAPSHOT
  • Quarkus Version: 2.16.3.Final
  • diff --git a/src/main/resources/application.properties b/database-manipulation-tool/src/main/resources/application.properties similarity index 100% rename from src/main/resources/application.properties rename to database-manipulation-tool/src/main/resources/application.properties diff --git a/testing-automation/Pipfile b/dmt-tuning/Pipfile similarity index 100% rename from testing-automation/Pipfile rename to dmt-tuning/Pipfile diff --git a/testing-automation/main.py b/dmt-tuning/main.py similarity index 100% rename from testing-automation/main.py rename to dmt-tuning/main.py diff --git a/load-generator/pom.xml b/load-generator/pom.xml new file mode 100644 index 0000000..dd24258 --- /dev/null +++ b/load-generator/pom.xml @@ -0,0 +1,106 @@ + + + 4.0.0 + + load-generator + ${project.parent.version} + load-generator + Load generator for performance testing debezium connectors + + + database-performance-hub + io.skodjob + 1.0.0 + + + + 17 + 2.0.3 + 2.13.4.2 + 1.9.0 + + + + + + org.slf4j + slf4j-simple + ${slf4j.version} + + + + org.slf4j + slf4j-api + ${slf4j.version} + + + + net.datafaker + datafaker + ${datafaker.version} + + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + + com.indvd00m.ascii.render + ascii-render + 2.2.0 + + + + io.skodjob + database-manipulation-tool-schema + ${project.parent.version} + + + + com.squareup.okhttp3 + okhttp + 4.10.0 + + + + + + org.testcontainers + junit-jupiter + 1.17.3 + test + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 3.0.0 + + + + integration-test + verify + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 17 + 17 + + + + + + \ No newline at end of file diff --git a/load-generator/src/main/java/io/skodjob/load/data/DataTypeConvertor.java b/load-generator/src/main/java/io/skodjob/load/data/DataTypeConvertor.java new file mode 100644 index 0000000..d5b54b4 --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/data/DataTypeConvertor.java @@ -0,0 +1,18 @@ +package io.skodjob.load.data; + +public class DataTypeConvertor { + + public static String convertDataType(Object object) { + if (object instanceof String) { + //return String.format("VarChar(%s)", ((String) object).length()); + return "VarChar(255)"; + } else if (object instanceof Integer) { + return "Integer"; + } else if (object instanceof Double) { + return "Double"; + } else { + return "Null"; + } + } + +} diff --git a/load-generator/src/main/java/io/skodjob/load/data/builder/AddressDataBuilder.java b/load-generator/src/main/java/io/skodjob/load/data/builder/AddressDataBuilder.java new file mode 100644 index 0000000..6dce8d0 --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/data/builder/AddressDataBuilder.java @@ -0,0 +1,57 @@ +package io.skodjob.load.data.builder; + +import io.skodjob.dmt.schema.DatabaseColumnEntry; +import io.skodjob.dmt.schema.DatabaseEntry; +import io.skodjob.load.data.DataTypeConvertor; +import io.skodjob.load.data.enums.Tables; + +public class AddressDataBuilder extends DataBuilder { + + public AddressDataBuilder() { + super(); + super.table = Tables.ADDRESS; + } + + @Override + public DatabaseEntry generateDataRow(Integer idPool) { + DatabaseEntry schema = createDefaultScheme(RANDOM.nextInt(idPool), table.toString().toLowerCase()); + //schema.setOperation(randomEnum(Operations.class, RANDOM).toString().toLowerCase()); + + String city = dataFaker.address().cityName(); + String cityPref = dataFaker.address().cityPrefix(); + String street = dataFaker.address().streetName(); + Integer streetNumber = Integer.valueOf(dataFaker.address().streetAddressNumber()); + String zipCode = dataFaker.address().zipCode(); + Integer floor = RANDOM.nextInt(72); + Double latitude = Double.valueOf(dataFaker.address().latitude()); + Double longtitude = Double.valueOf(dataFaker.address().longitude()); + + + schema.getColumnEntries().add(new DatabaseColumnEntry(city, "city", + DataTypeConvertor.convertDataType(city))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(cityPref, "city_prefix", + DataTypeConvertor.convertDataType(cityPref))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(street, "street", + DataTypeConvertor.convertDataType(street))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(streetNumber.toString(), "street_number", + DataTypeConvertor.convertDataType(streetNumber))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(zipCode, "zip_code", + DataTypeConvertor.convertDataType(zipCode))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(floor.toString(), "floor", + DataTypeConvertor.convertDataType(floor))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(latitude.toString(), "latitude", + DataTypeConvertor.convertDataType(latitude))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(longtitude.toString(), "longtitude", + DataTypeConvertor.convertDataType(longtitude))); + + normalise(schema); + return schema; + } +} diff --git a/load-generator/src/main/java/io/skodjob/load/data/builder/AviationDataBuilder.java b/load-generator/src/main/java/io/skodjob/load/data/builder/AviationDataBuilder.java new file mode 100644 index 0000000..2429d09 --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/data/builder/AviationDataBuilder.java @@ -0,0 +1,54 @@ +package io.skodjob.load.data.builder; + +import io.skodjob.dmt.schema.DatabaseColumnEntry; +import io.skodjob.dmt.schema.DatabaseEntry; +import io.skodjob.load.data.DataTypeConvertor; +import io.skodjob.load.data.enums.Tables; + +public class AviationDataBuilder extends DataBuilder { + + public AviationDataBuilder() { + super(); + super.table = Tables.AVIATION; + } + + @Override + public DatabaseEntry generateDataRow(Integer idPool) { + DatabaseEntry schema = createDefaultScheme(RANDOM.nextInt(idPool), table.toString().toLowerCase()); + //schema.setOperation(randomEnum(Operations.class, RANDOM).toString().toLowerCase()); + + + String aircraft = dataFaker.aviation().aircraft(); + String airline = dataFaker.aviation().airline(); + Integer passengers = RANDOM.nextInt(374); + String airport = dataFaker.aviation().airport(); + String flight = dataFaker.aviation().flight(); + String metar = dataFaker.aviation().METAR(); + Double flightDistance = RANDOM.nextDouble(4000.0); + + + schema.getColumnEntries().add(new DatabaseColumnEntry(aircraft, "aircraft", + DataTypeConvertor.convertDataType(aircraft))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(airline, "airline", + DataTypeConvertor.convertDataType(airline))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(passengers.toString(), "passengers", + DataTypeConvertor.convertDataType(passengers))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(airport, "airport", + DataTypeConvertor.convertDataType(airport))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(flight, "flight", + DataTypeConvertor.convertDataType(flight))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(metar, "metar", + DataTypeConvertor.convertDataType(metar))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(flightDistance.toString(), "flight_distance", + DataTypeConvertor.convertDataType(flightDistance))); + + normalise(schema); + return schema; + } +} diff --git a/load-generator/src/main/java/io/skodjob/load/data/builder/BeerDataBuilder.java b/load-generator/src/main/java/io/skodjob/load/data/builder/BeerDataBuilder.java new file mode 100644 index 0000000..c5b8f28 --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/data/builder/BeerDataBuilder.java @@ -0,0 +1,49 @@ +package io.skodjob.load.data.builder; + +import io.skodjob.dmt.schema.DatabaseColumnEntry; +import io.skodjob.dmt.schema.DatabaseEntry; +import io.skodjob.load.data.DataTypeConvertor; +import io.skodjob.load.data.enums.Tables; + +public class BeerDataBuilder extends DataBuilder { + + public BeerDataBuilder() { + super(); + super.table = Tables.BEER; + } + + @Override + public DatabaseEntry generateDataRow(Integer idPool) { + DatabaseEntry schema = createDefaultScheme(RANDOM.nextInt(idPool), table.toString().toLowerCase()); + //schema.setOperation(randomEnum(Operations.class, RANDOM).toString().toLowerCase()); + + + String name = dataFaker.beer().name(); + String brand = dataFaker.beer().brand(); + String hop = dataFaker.beer().hop(); + String malt = dataFaker.beer().malt(); + String yeast = dataFaker.beer().yeast(); + String style = dataFaker.beer().style(); + + schema.getColumnEntries().add(new DatabaseColumnEntry(name, "name", + DataTypeConvertor.convertDataType(name))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(brand, "brand", + DataTypeConvertor.convertDataType(brand))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(hop, "hop", + DataTypeConvertor.convertDataType(hop))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(malt, "malt", + DataTypeConvertor.convertDataType(malt))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(yeast, "yeast", + DataTypeConvertor.convertDataType(yeast))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(style, "style", + DataTypeConvertor.convertDataType(style))); + + normalise(schema); + return schema; + } +} diff --git a/load-generator/src/main/java/io/skodjob/load/data/builder/ByteDataBuilder.java b/load-generator/src/main/java/io/skodjob/load/data/builder/ByteDataBuilder.java new file mode 100644 index 0000000..2d0e803 --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/data/builder/ByteDataBuilder.java @@ -0,0 +1,37 @@ +package io.skodjob.load.data.builder; + +import io.skodjob.dmt.schema.DatabaseColumnEntry; +import io.skodjob.dmt.schema.DatabaseEntry; +import io.skodjob.load.data.enums.Tables; + +/** + * Creates messages with arbitrary sized data payload in a single column + */ +public class ByteDataBuilder extends DataBuilder { + int dataSize; + + /** + * @param dataSize Size of the payload + */ + public ByteDataBuilder(int dataSize) { + super(); + super.table = Tables.BYTE_TABLE; + this.dataSize = dataSize; + } + + @Override + public DatabaseEntry generateDataRow(Integer idPool) { + DatabaseEntry schema = createDefaultScheme(RANDOM.nextInt(idPool), table.toString().toLowerCase()); + String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + StringBuilder builder = new StringBuilder(); + for ( int i = 0; i < dataSize; i++ ) { + builder.append(alphabet.charAt(RANDOM.nextInt(alphabet.length()))); + } + + schema.getColumnEntries().add(new DatabaseColumnEntry(builder.toString(), "payload", + String.format("Varchar(%s)", dataSize + 5))); + + normalise(schema); + return schema; + } +} diff --git a/load-generator/src/main/java/io/skodjob/load/data/builder/DataBuilder.java b/load-generator/src/main/java/io/skodjob/load/data/builder/DataBuilder.java new file mode 100644 index 0000000..013a220 --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/data/builder/DataBuilder.java @@ -0,0 +1,59 @@ +package io.skodjob.load.data.builder; + +import io.skodjob.dmt.schema.DatabaseColumnEntry; +import io.skodjob.dmt.schema.DatabaseEntry; +import io.skodjob.load.data.DataTypeConvertor; +import io.skodjob.load.data.enums.Tables; +import net.datafaker.Faker; + +import java.security.SecureRandom; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public abstract class DataBuilder { + protected static final Random RANDOM = new SecureRandom(); + protected Tables table = Tables.PERSON; + protected Faker dataFaker = new Faker(); + protected List requests; + + public DataBuilder() { + this.requests = new ArrayList<>(); + } + + public abstract DatabaseEntry generateDataRow(Integer idPool); + + + protected void normalise(DatabaseEntry entry) { + for (DatabaseColumnEntry column : entry.getColumnEntries()) { + if (column.dataType().contains("VarChar")) { + column.setValue(column.getValue().replace("'", " ")); + } + } + } + + DataBuilder addRequests(Integer idPool, int count) { + for (int i = 0; i < count; i++) { + this.requests.add(this.generateDataRow(idPool)); + } + return this; + } + + List build() { + return this.requests; + } + + protected DatabaseEntry createDefaultScheme(Integer value, String tableName) { + DatabaseEntry schema = new DatabaseEntry(new ArrayList<>(), tableName, "id"); + schema.getColumnEntries().add(new DatabaseColumnEntry(value.toString(), "id", + DataTypeConvertor.convertDataType(value))); + return schema; + } + + protected > T randomEnum(Class clazz, Random random) { + int x = random.nextInt(clazz.getEnumConstants().length); + return clazz.getEnumConstants()[x]; + } + + +} diff --git a/load-generator/src/main/java/io/skodjob/load/data/builder/FoodDataBuilder.java b/load-generator/src/main/java/io/skodjob/load/data/builder/FoodDataBuilder.java new file mode 100644 index 0000000..1932694 --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/data/builder/FoodDataBuilder.java @@ -0,0 +1,57 @@ +package io.skodjob.load.data.builder; + +import io.skodjob.dmt.schema.DatabaseColumnEntry; +import io.skodjob.dmt.schema.DatabaseEntry; +import io.skodjob.load.data.DataTypeConvertor; +import io.skodjob.load.data.enums.Tables; + +public class FoodDataBuilder extends DataBuilder { + + public FoodDataBuilder() { + super(); + super.table = Tables.FOOD; + } + + @Override + public DatabaseEntry generateDataRow(Integer idPool) { + DatabaseEntry schema = createDefaultScheme(RANDOM.nextInt(idPool), table.toString().toLowerCase()); + //schema.setOperation(randomEnum(Operations.class, RANDOM).toString().toLowerCase()); + + String dish = dataFaker.food().dish(); + + schema.getColumnEntries().add(new DatabaseColumnEntry(dish, "dish", + DataTypeConvertor.convertDataType(dish))); + + + int counterI = 0; + for (; counterI < RANDOM.nextInt(7); counterI++) { + String ing = dataFaker.food().ingredient(); + schema.getColumnEntries().add(new DatabaseColumnEntry(ing, String.format("ingredient_%d", counterI), + DataTypeConvertor.convertDataType(ing))); + } + schema.getColumnEntries().add(new DatabaseColumnEntry(String.valueOf(counterI), "ingredients", + DataTypeConvertor.convertDataType(counterI))); + + + int counterV = 0; + for (; counterV < RANDOM.nextInt(5); counterV++) { + String ing = dataFaker.food().vegetable(); + schema.getColumnEntries().add(new DatabaseColumnEntry(ing, String.format("vegetable_%d", counterI), + DataTypeConvertor.convertDataType(ing))); + } + schema.getColumnEntries().add(new DatabaseColumnEntry(String.valueOf(counterV), "vegetables", + DataTypeConvertor.convertDataType(counterV))); + + int counterS = 0; + for (; counterS < RANDOM.nextInt(6); counterS++) { + String ing = dataFaker.food().spice(); + schema.getColumnEntries().add(new DatabaseColumnEntry(ing, String.format("spice_%d", counterS), + DataTypeConvertor.convertDataType(ing))); + } + schema.getColumnEntries().add(new DatabaseColumnEntry(String.valueOf(counterS), "spices", + DataTypeConvertor.convertDataType(counterS))); + + normalise(schema); + return schema; + } +} diff --git a/load-generator/src/main/java/io/skodjob/load/data/builder/PersonDataBuilder.java b/load-generator/src/main/java/io/skodjob/load/data/builder/PersonDataBuilder.java new file mode 100644 index 0000000..b345ee1 --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/data/builder/PersonDataBuilder.java @@ -0,0 +1,54 @@ +package io.skodjob.load.data.builder; + +import io.skodjob.dmt.schema.DatabaseColumnEntry; +import io.skodjob.dmt.schema.DatabaseEntry; +import io.skodjob.load.data.DataTypeConvertor; +import io.skodjob.load.data.enums.Tables; + +public class PersonDataBuilder extends DataBuilder { + + public PersonDataBuilder() { + super(); + super.table = Tables.PERSON; + } + + @Override + public DatabaseEntry generateDataRow(Integer idPool) { + DatabaseEntry schema = createDefaultScheme(RANDOM.nextInt(idPool), table.toString().toLowerCase()); + //schema.setOperation(randomEnum(Operations.class, RANDOM).toString().toLowerCase()); + + String firstName = dataFaker.name().firstName(); + String lastName = dataFaker.name().lastName(); + // AGE + Integer age = RANDOM.nextInt(100); + // Average day computer work + Double avg = RANDOM.nextDouble(); + String city = dataFaker.address().city(); + String company = dataFaker.company().name(); + String color = dataFaker.color().name(); + + schema.getColumnEntries().add(new DatabaseColumnEntry(firstName, "name", + DataTypeConvertor.convertDataType(firstName))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(lastName, "lastname", + DataTypeConvertor.convertDataType(lastName))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(age.toString(), "age", + DataTypeConvertor.convertDataType(age))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(avg.toString(), "computeraverage", + DataTypeConvertor.convertDataType(avg))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(city, "city", + DataTypeConvertor.convertDataType(city))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(company, "company", + DataTypeConvertor.convertDataType(company))); + + schema.getColumnEntries().add(new DatabaseColumnEntry(color, "favouritecolor", + DataTypeConvertor.convertDataType(color))); + + normalise(schema); + return schema; + } +} diff --git a/load-generator/src/main/java/io/skodjob/load/data/builder/RequestBuilder.java b/load-generator/src/main/java/io/skodjob/load/data/builder/RequestBuilder.java new file mode 100644 index 0000000..020ad2f --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/data/builder/RequestBuilder.java @@ -0,0 +1,82 @@ +package io.skodjob.load.data.builder; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.skodjob.dmt.schema.DatabaseEntry; +import io.skodjob.load.scenarios.ScenarioRequestExecutor; +import io.skodjob.load.scenarios.builder.ScenarioBuilder; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +public class RequestBuilder { + private final DataBuilder dataBuilder; + private final G scenarioBuilder; + private String endpoint; + private Integer maximalRowCount; + private int requestCount; + + + public RequestBuilder(DataBuilder dataBuilder, G scenarioBuilder) { + this.dataBuilder = dataBuilder; + this.scenarioBuilder = scenarioBuilder; + } + + public RequestBuilder setEndpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + + public RequestBuilder setMaxRows(Integer maximalRowCount) { + this.maximalRowCount = maximalRowCount; + return this; + } + + public RequestBuilder setRequestCount(int requestCount) { + this.requestCount = requestCount; + return this; + } + + private List generateRequests(List payloads, int rate) throws MalformedURLException, JsonProcessingException { + List requests = new ArrayList<>(); + for (DatabaseEntry schema : payloads) { + + String serializedRequest = new ObjectMapper().writeValueAsString(schema); + + requests.add(new Request.Builder() + .url(new URL(endpoint)) + .header("Content-Type", "application/json") + .post(RequestBody.create(serializedRequest, MediaType.parse("application/json"))) + .build()); + } + return requests; + } + + public void buildAndExecute(int rate) throws MalformedURLException, JsonProcessingException { + List payloads = dataBuilder.addRequests(maximalRowCount, requestCount).build(); + List requests = this.generateRequests(payloads, rate); + scenarioBuilder.prepareScenario(requests).run(); + } + + public ScenarioRequestExecutor buildScenario(int rate) throws MalformedURLException, JsonProcessingException { + List payloads = dataBuilder.addRequests(maximalRowCount, requestCount).build(); + List requests = this.generateRequests(payloads, rate); + return scenarioBuilder.prepareScenario(requests); + } + + public List build(int rate) throws MalformedURLException, JsonProcessingException { + List payloads = dataBuilder.addRequests(maximalRowCount, requestCount).build(); + return this.generateRequests(payloads, rate); + } + + public List buildPlain() { + return dataBuilder.addRequests(maximalRowCount, requestCount).build(); + } + +} diff --git a/load-generator/src/main/java/io/skodjob/load/data/enums/GenerationStyles.java b/load-generator/src/main/java/io/skodjob/load/data/enums/GenerationStyles.java new file mode 100644 index 0000000..bac3cd5 --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/data/enums/GenerationStyles.java @@ -0,0 +1,8 @@ +package io.skodjob.load.data.enums; + +public enum GenerationStyles { + LINEAR, + CONSTANT, + CHAOS, + BURST +} diff --git a/load-generator/src/main/java/io/skodjob/load/data/enums/Operations.java b/load-generator/src/main/java/io/skodjob/load/data/enums/Operations.java new file mode 100644 index 0000000..9b2bfc5 --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/data/enums/Operations.java @@ -0,0 +1,6 @@ +package io.skodjob.load.data.enums; + +public enum Operations { + UPSERT, + //DELETE +} diff --git a/load-generator/src/main/java/io/skodjob/load/data/enums/Tables.java b/load-generator/src/main/java/io/skodjob/load/data/enums/Tables.java new file mode 100644 index 0000000..ad59165 --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/data/enums/Tables.java @@ -0,0 +1,10 @@ +package io.skodjob.load.data.enums; + +public enum Tables { + PERSON, + ADDRESS, + FOOD, + AVIATION, + BEER, + BYTE_TABLE +} diff --git a/load-generator/src/main/java/io/skodjob/load/graph/GraphVisualisation.java b/load-generator/src/main/java/io/skodjob/load/graph/GraphVisualisation.java new file mode 100644 index 0000000..c62596a --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/graph/GraphVisualisation.java @@ -0,0 +1,54 @@ +package io.skodjob.load.graph; + +import com.indvd00m.ascii.render.Point; +import com.indvd00m.ascii.render.Region; +import com.indvd00m.ascii.render.Render; +import com.indvd00m.ascii.render.api.ICanvas; +import com.indvd00m.ascii.render.api.IContextBuilder; +import com.indvd00m.ascii.render.api.IRender; +import com.indvd00m.ascii.render.elements.Rectangle; +import com.indvd00m.ascii.render.elements.plot.Axis; +import com.indvd00m.ascii.render.elements.plot.AxisLabels; +import com.indvd00m.ascii.render.elements.plot.Plot; +import com.indvd00m.ascii.render.elements.plot.api.AxisType; +import com.indvd00m.ascii.render.elements.plot.api.IPlotPoint; +import com.indvd00m.ascii.render.elements.plot.misc.AxisLabel; +import com.indvd00m.ascii.render.elements.plot.misc.PlotPoint; +import io.skodjob.load.scenarios.ScenarioRequest; +import io.skodjob.load.scenarios.ScenarioRequestExecutor; + +import java.util.ArrayList; +import java.util.List; + +public class GraphVisualisation { + public static String drawGraph(ScenarioRequestExecutor executor) { + List points = new ArrayList(); + int pos = 0; + int maxHeight = 0; + List scs = executor.getRequestScenario(); + int roundCount = scs.size(); + + for (ScenarioRequest sc : scs) { + maxHeight = Math.max(maxHeight, sc.getBatchSize()); + points.add(new PlotPoint(pos, sc.getBatchSize())); + pos += 5; + } + + maxHeight = Math.min(30, maxHeight); + roundCount = Math.max(roundCount, 200); + IRender render = new Render(); + IContextBuilder builder = render.newBuilder(); + builder.width(roundCount + 14).height(maxHeight + 10); + builder.element(new Rectangle(0, 0, roundCount + 14, maxHeight + 10)); + builder.layer(new Region(1, 2, roundCount + 10, maxHeight + 10)); + + builder.element(new Axis(points, new Region(12, 0, roundCount, maxHeight + 4))); + builder.element(new AxisLabels(points, new Region(12, 0, roundCount, maxHeight + 4))); + builder.element(new AxisLabel("Requests", 2, 2, AxisType.Y, new Point(0, 0))); + builder.element(new AxisLabel("Rate step", roundCount - 2, maxHeight + 4, AxisType.X, new Point(0, 0))); + builder.element(new Plot(points, new Region(12, 0, roundCount + 10, maxHeight + 4))); + + ICanvas canvas = render.render(builder.build()); + return canvas.toString(); + } +} diff --git a/load-generator/src/main/java/io/skodjob/load/scenarios/ScenarioRequest.java b/load-generator/src/main/java/io/skodjob/load/scenarios/ScenarioRequest.java new file mode 100644 index 0000000..2e874c4 --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/scenarios/ScenarioRequest.java @@ -0,0 +1,38 @@ +package io.skodjob.load.scenarios; + +import okhttp3.Request; + +import java.net.http.HttpRequest; +import java.util.List; + +public class ScenarioRequest { + private final int batchSize; + private List requests; + private Runnable wait; + + public ScenarioRequest(List requests, Runnable wait) { + this.requests = requests; + this.batchSize = requests.size(); + this.wait = wait; + } + + public List getRequests() { + return requests; + } + + public void setRequests(List requests) { + this.requests = requests; + } + + public Runnable getWait() { + return wait; + } + + public void setWait(Runnable wait) { + this.wait = wait; + } + + public int getBatchSize() { + return batchSize; + } +} diff --git a/load-generator/src/main/java/io/skodjob/load/scenarios/ScenarioRequestExecutor.java b/load-generator/src/main/java/io/skodjob/load/scenarios/ScenarioRequestExecutor.java new file mode 100644 index 0000000..a3cbcc1 --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/scenarios/ScenarioRequestExecutor.java @@ -0,0 +1,109 @@ +package io.skodjob.load.scenarios; + +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.ConnectionPool; +import okhttp3.Dispatcher; +import okhttp3.EventListener; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import org.jetbrains.annotations.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; + +public class ScenarioRequestExecutor implements Runnable { + + private static final Logger LOGGER = LoggerFactory.getLogger(ScenarioRequestExecutor.class); + List requestScenario; + + public ScenarioRequestExecutor(List requestScenario) { + this.requestScenario = requestScenario; + } + + @Override + public void run() { + //LOGGER.info("I am in run now"); + + AtomicInteger numberOfSucc = new AtomicInteger(0); + AtomicInteger numberOfFailed = new AtomicInteger(0); + AtomicInteger endCalls = new AtomicInteger(0); + AtomicLong startTime = new AtomicLong(0); + AtomicLong end = new AtomicLong(0); + int numberOfCalls = requestScenario.get(0).getBatchSize(); + + + + Dispatcher disp = new Dispatcher(Executors.newCachedThreadPool()); + disp.setMaxRequests(1000); + disp.setMaxRequestsPerHost(1000); + + EventListener eventListener = new EventListener() { + @Override + public void callEnd(@NotNull Call call) { + if (numberOfCalls == endCalls.incrementAndGet()) { + end.set(System.currentTimeMillis()); + long elapsed = startTime.get() - end.get(); + LOGGER.info(String.format("Executor sent %d successful requests and %d failed requests.", numberOfSucc.get(), numberOfFailed.get())); + LOGGER.info("Requests took around" + elapsed + " miliseconds"); + } + super.callEnd(call); + } + + @Override + public void callStart(@NotNull Call call) { + startTime.compareAndSet(0, System.currentTimeMillis()); + super.callStart(call); + } + }; + + OkHttpClient client = new OkHttpClient.Builder() + .connectTimeout(Duration.of(2, ChronoUnit.SECONDS)) + .retryOnConnectionFailure(true) + .connectionPool(new ConnectionPool(400, 15, TimeUnit.MINUTES)) + .dispatcher(disp) + .eventListener(eventListener) + .build(); + + for (ScenarioRequest sr : requestScenario) { + LOGGER.info(String.format("Sending %s requests in this batch", sr.getBatchSize())); + + for (Request r : sr.getRequests()) { + client.newCall(r).enqueue(new Callback() { + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + LOGGER.error("Found exception during send: " + e.getMessage()); + numberOfFailed.incrementAndGet(); + } + + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + //LOGGER.info("Sent was successful"); + if (response.isSuccessful()) { + //LOGGER.debug("Request was sent successfully"); + numberOfSucc.incrementAndGet(); + } else { + LOGGER.error("Received error status code: " + response); + } + } + }); + } + if (sr.getWait() != null) { + sr.getWait().run(); + } + } + } + + public List getRequestScenario() { + return requestScenario; + } +} diff --git a/load-generator/src/main/java/io/skodjob/load/scenarios/builder/ConstantScenarioBuilder.java b/load-generator/src/main/java/io/skodjob/load/scenarios/builder/ConstantScenarioBuilder.java new file mode 100644 index 0000000..08e447e --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/scenarios/builder/ConstantScenarioBuilder.java @@ -0,0 +1,50 @@ +package io.skodjob.load.scenarios.builder; + +import io.skodjob.load.scenarios.ScenarioRequest; +import io.skodjob.load.scenarios.ScenarioRequestExecutor; +import okhttp3.Request; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; + +public class ConstantScenarioBuilder implements ScenarioBuilder { + + private static final Logger LOGGER = LoggerFactory.getLogger(ConstantScenarioBuilder.class); + private final int rounds; + + private final int rate; + + public ConstantScenarioBuilder(int rounds, int rate) { + this.rounds = rounds; + this.rate = rate; + } + + @Override + public ScenarioRequestExecutor prepareScenario(List requestList) { + + int requestCounter = 0; + int requestCnt = requestList.size(); + int roundLevel = requestCnt / rounds; + + List result = new ArrayList<>(); + + while (requestCounter < requestCnt) { + List batchList = new ArrayList<>(); + for (int i = 0; i < roundLevel && requestCounter < requestList.size(); i++) { + batchList.add(requestList.get(i)); + requestCounter++; + } + result.add(new ScenarioRequest(batchList, () -> { + try { + LOGGER.debug("Waiting " + rate + " until next request"); + Thread.sleep(rate); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + })); + } + return new ScenarioRequestExecutor(result); + } +} diff --git a/load-generator/src/main/java/io/skodjob/load/scenarios/builder/LinearScenarioBuilder.java b/load-generator/src/main/java/io/skodjob/load/scenarios/builder/LinearScenarioBuilder.java new file mode 100644 index 0000000..3a3754a --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/scenarios/builder/LinearScenarioBuilder.java @@ -0,0 +1,50 @@ +package io.skodjob.load.scenarios.builder; + +import io.skodjob.load.scenarios.ScenarioRequest; +import io.skodjob.load.scenarios.ScenarioRequestExecutor; +import okhttp3.Request; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; + +public class LinearScenarioBuilder implements ScenarioBuilder { + + private static final Logger LOGGER = LoggerFactory.getLogger(LinearScenarioBuilder.class); + private final int delta; + + private final int rate; + + public LinearScenarioBuilder(int delta, int rate) { + this.delta = delta; + this.rate = rate; + } + + @Override + public ScenarioRequestExecutor prepareScenario(List requestList) { + + int requestCounter = 0; + int expectedAmount = delta; + + List result = new ArrayList<>(); + + while (requestCounter < requestList.size()) { + List batchList = new ArrayList<>(); + for (int i = 0; i < expectedAmount && requestCounter < requestList.size(); i++) { + batchList.add(requestList.get(i)); + requestCounter++; + } + expectedAmount += delta; + result.add(new ScenarioRequest(batchList, () -> { + try { + LOGGER.debug("Waiting " + rate + " until next request"); + Thread.sleep(rate); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + })); + } + return new ScenarioRequestExecutor(result); + } +} diff --git a/load-generator/src/main/java/io/skodjob/load/scenarios/builder/PeakScenarioBuilder.java b/load-generator/src/main/java/io/skodjob/load/scenarios/builder/PeakScenarioBuilder.java new file mode 100644 index 0000000..9f3bfd9 --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/scenarios/builder/PeakScenarioBuilder.java @@ -0,0 +1,67 @@ +package io.skodjob.load.scenarios.builder; + +import io.skodjob.load.scenarios.ScenarioRequest; +import io.skodjob.load.scenarios.ScenarioRequestExecutor; +import okhttp3.Request; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public class PeakScenarioBuilder implements ScenarioBuilder { + + private static final Logger LOGGER = LoggerFactory.getLogger(PeakScenarioBuilder.class); + private final int peakLevel; + private final int peakRounds; + private final int rate; + + private final int quietRounds; + + + public PeakScenarioBuilder(int peakLevel, int peakRounds, int rate, int quietRounds) { + this.peakLevel = peakLevel; + this.peakRounds = peakRounds; + this.rate = rate; + this.quietRounds = quietRounds; + } + + @Override + public ScenarioRequestExecutor prepareScenario(List requestList) { + + int peakRequiredCnt = peakRounds * peakLevel; + int requestSize = requestList.size(); + int quietRoundLevel = (requestSize - peakRequiredCnt) / quietRounds; + + int peakStart = new Random().nextInt(quietRounds); + + int requestCounter = 0; + + List result = new ArrayList<>(); + + for (int currentRound = 0; currentRound < (quietRounds + peakRounds); currentRound++) { + List batchList = new ArrayList<>(); + if (currentRound >= peakStart && currentRound < (peakStart + peakRounds)) { + for (int i = 0; i < peakLevel && requestCounter < requestSize; i++) { + batchList.add(requestList.get(requestCounter)); + requestCounter++; + } + } else { + for (int i = 0; i < quietRoundLevel && requestCounter < requestSize; i++) { + batchList.add(requestList.get(requestCounter)); + requestCounter++; + } + } + result.add(new ScenarioRequest(batchList, () -> { + try { + LOGGER.debug("Waiting " + rate + " until next request"); + Thread.sleep(rate); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + })); + } + return new ScenarioRequestExecutor(result); + } +} diff --git a/load-generator/src/main/java/io/skodjob/load/scenarios/builder/ScenarioBuilder.java b/load-generator/src/main/java/io/skodjob/load/scenarios/builder/ScenarioBuilder.java new file mode 100644 index 0000000..49422d1 --- /dev/null +++ b/load-generator/src/main/java/io/skodjob/load/scenarios/builder/ScenarioBuilder.java @@ -0,0 +1,10 @@ +package io.skodjob.load.scenarios.builder; + +import io.skodjob.load.scenarios.ScenarioRequestExecutor; +import okhttp3.Request; + +import java.util.List; + +public interface ScenarioBuilder { + ScenarioRequestExecutor prepareScenario(List requestList); +} diff --git a/mvnw b/mvnw index eaa3d30..8a8fb22 100755 --- a/mvnw +++ b/mvnw @@ -216,9 +216,9 @@ else echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." fi if [ -n "$MVNW_REPOURL" ]; then - jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" else - jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" fi while IFS="=" read key value; do case "$key" in (wrapperUrl) jarUrl="$value"; break ;; diff --git a/mvnw.cmd b/mvnw.cmd index abb7c32..1d8ab01 100644 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -120,7 +120,7 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B @@ -134,7 +134,7 @@ if exist %WRAPPER_JAR% ( ) ) else ( if not "%MVNW_REPOURL%" == "" ( - SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" ) if "%MVNW_VERBOSE%" == "true" ( echo Couldn't find %WRAPPER_JAR%, downloading it ... diff --git a/pom.xml b/pom.xml index aac44d4..d1c23c7 100644 --- a/pom.xml +++ b/pom.xml @@ -3,192 +3,22 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - database-manipulation-tool + database-performance-hub Tool used for manipulation with multiple different dbs at once - io.debezium + io.skodjob 1.0.0 + pom + + + database-manipulation-tool + load-generator + database-manipulation-tool-schema + - 3.10.1 17 - UTF-8 - UTF-8 - quarkus-bom - io.quarkus.platform - 2.16.6.Final - true - 3.0.0-M7 - - - - ${quarkus.platform.group-id} - ${quarkus.platform.artifact-id} - ${quarkus.platform.version} - pom - import - - - - - io.quarkus - quarkus-arc - - - io.quarkus - quarkus-resteasy-reactive-jackson - - - io.quarkus - quarkus-agroal - - - - - - - - - - - io.quarkus - quarkus-jdbc-postgresql - - - io.quarkus - quarkus-jdbc-mysql - - - io.quarkus - quarkus-mongodb-client - - - io.debezium.performance - dmt-schema - 0.3.0-SNAPSHOT - - - io.debezium.performance - data-generator - 0.3.1-SNAPSHOT - - - io.quarkus - quarkus-junit5 - test - - - io.rest-assured - rest-assured - test - - - - github - https://maven.pkg.github.com/Debezium-performance/dmt-schema - - true - always - - - true - - - - - - - ${quarkus.platform.group-id} - quarkus-maven-plugin - ${quarkus.platform.version} - true - - - - build - generate-code - generate-code-tests - - - - - - maven-compiler-plugin - ${compiler-plugin.version} - - - -parameters - - - - - maven-surefire-plugin - ${surefire-plugin.version} - - - org.jboss.logmanager.LogManager - ${maven.home} - - - - - maven-failsafe-plugin - ${surefire-plugin.version} - - - - integration-test - verify - - - - ${project.build.directory}/${project.build.finalName}-runner - org.jboss.logmanager.LogManager - ${maven.home} - - - - - - - - - - native - - - native - - - - - io.quarkus - quarkus-kubernetes - - - io.quarkus - quarkus-kubernetes-config - - - - false - native - - - - nativeTest - - - nativeTest - - - - false - native - - - diff --git a/src/main/java/io/debezium/performance/dmt/parser/DmtSchemaParser.java b/src/main/java/io/debezium/performance/dmt/parser/DmtSchemaParser.java deleted file mode 100644 index a753aeb..0000000 --- a/src/main/java/io/debezium/performance/dmt/parser/DmtSchemaParser.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.debezium.performance.dmt.parser; - -import io.debezium.performance.dmt.model.DatabaseEntry; - -import javax.enterprise.context.ApplicationScoped; - -import static io.debezium.performance.dmt.parser.ParseUtils.fromSchema; - -@ApplicationScoped -public class DmtSchemaParser implements DataParser{ - @Override - public DatabaseEntry parse(io.debezium.performance.dmt.schema.DatabaseEntry inputObject) { - return fromSchema(inputObject); - } -}