-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from skodjob/merge
Merge all tooling into one new repository
- Loading branch information
Showing
94 changed files
with
1,772 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# dmt-schema | ||
Library with dmt objects representing database entries (rows) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>database-manipulation-tool-schema</artifactId> | ||
<version>${project.parent.version}</version> | ||
<name>database-manipulation-tool-schema</name> | ||
<description>Library with database manipulation tool objects representing database entries (rows)</description> | ||
|
||
|
||
<parent> | ||
<artifactId>database-performance-hub</artifactId> | ||
<groupId>io.skodjob</groupId> | ||
<version>1.0.0</version> | ||
</parent> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.release>17</maven.compiler.release> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.15.1</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> | ||
<plugins> | ||
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --> | ||
<plugin> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>3.1.0</version> | ||
</plugin> | ||
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging --> | ||
<plugin> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<version>3.0.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.0</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>3.0.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<version>2.5.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<version>2.8.2</version> | ||
</plugin> | ||
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> | ||
<plugin> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<version>3.7.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-project-info-reports-plugin</artifactId> | ||
<version>3.0.0</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
</project> |
33 changes: 33 additions & 0 deletions
33
database-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/App.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
...ase-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/DatabaseColumnEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
||
} |
107 changes: 107 additions & 0 deletions
107
database-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/DatabaseEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<DatabaseColumnEntry> columnEntries; | ||
private String name; | ||
private String primary; | ||
|
||
public DatabaseEntry(List<DatabaseColumnEntry> 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<DatabaseColumnEntry> getColumnEntries() { | ||
return columnEntries; | ||
} | ||
|
||
public void setColumnEntries(List<DatabaseColumnEntry> 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); | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
database-manipulation-tool-schema/src/main/java/io/skodjob/dmt/schema/LoadResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 + | ||
'}'; | ||
} | ||
} |
Oops, something went wrong.