Skip to content

Commit

Permalink
#54: removed JsonHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
AnastasiiaSergienko committed Jul 30, 2020
1 parent 7fe9497 commit cbcd2ea
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 39 deletions.
17 changes: 14 additions & 3 deletions doc/changes/changes-5.0.3.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# Virtual Schema Common JDBC 5.0.3, unreleased yyyy-mm-dd
# Virtual Schema Common JDBC 5.0.3, released 2020-07-30

## Features / Enhancements

* #52: Improve the warning message with possible user access restrictions when
remote table scan result is empty.
* #52: Improve the warning message with possible user access restrictions when remote table scan result is empty.
* #54: Removed 'JsonHelper' usage.

## Dependency updates

<details>
<summary>Click to expand</summary>

* Added `org.junit.jupiter:junit-jupiter:5.6.2`
* Updated `com.exasol:virtual-schema-common-java` from 10.1.0 to 11.0.0
* Removed `org.junit.jupiter:junit-jupiter-engine`
* Removed `org.junit.platform:junit-platform-runner`

</details>
28 changes: 6 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.exasol</groupId>
<artifactId>virtual-schema-common-jdbc</artifactId>
<version>5.0.2</version>
<version>5.0.3</version>
<name>Virtual Schema Common JDBC</name>
<description>Common module for JDBC-based data access from Virtual Schemas.</description>
<url>https://github.com/exasol/virtual-schema-common-jdbc</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>11</java.version>
<junit.version>5.6.2</junit.version>
<junit.platform.version>1.6.2</junit.platform.version>
<maven.surefire.version>3.0.0-M4</maven.surefire.version>
<vscommon.version>10.1.0</vscommon.version>
<gpg.skip>true</gpg.skip>
</properties>
<licenses>
Expand Down Expand Up @@ -68,7 +64,7 @@
<dependency>
<groupId>com.exasol</groupId>
<artifactId>virtual-schema-common-java</artifactId>
<version>${vscommon.version}</version>
<version>11.0.0</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
Expand All @@ -94,20 +90,8 @@
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit.platform.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit.version}</version>
<artifactId>junit-jupiter</artifactId>
<version>5.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -119,7 +103,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>3.3.3</version>
<version>3.4.6</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -134,7 +118,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<version>3.0.0-M4</version>
<configuration>
<!-- Set the highest log level for coverage testing, so that we
have a chance to reach branches in the logging lambdas too. -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package com.exasol.adapter.adapternotes;

import java.io.StringReader;
import java.util.Collections;

import javax.json.*;

import com.exasol.adapter.AdapterException;
import com.exasol.utils.JsonHelper;

/**
* Converts column adapter Notes into JSON format and back.
*/
public final class ColumnAdapterNotesJsonConverter {
protected static final String JDBC_DATA_TYPE = "jdbcDataType";
protected static final String TYPE_NAME = "typeName";
private static final ColumnAdapterNotesJsonConverter COLUMN_ADAPTER_NOTES_JSON_CONVERTER = new ColumnAdapterNotesJsonConverter();
static final String JDBC_DATA_TYPE = "jdbcDataType";
public static final String TYPE_NAME = "typeName";
private final JsonBuilderFactory factory = Json.createBuilderFactory(Collections.emptyMap());

/**
* Returns instance of {@link ColumnAdapterNotesJsonConverter} singleton class.
Expand All @@ -33,8 +36,7 @@ private ColumnAdapterNotesJsonConverter() {
* @return string representation of a JSON Object
*/
public String convertToJson(final ColumnAdapterNotes columnAdapterNotes) {
final JsonBuilderFactory factory = JsonHelper.getBuilderFactory();
final JsonObjectBuilder builder = factory.createObjectBuilder() //
final JsonObjectBuilder builder = this.factory.createObjectBuilder() //
.add(JDBC_DATA_TYPE, columnAdapterNotes.getJdbcDataType());
final String typeName = columnAdapterNotes.getTypeName();
if (typeName != null) {
Expand All @@ -58,8 +60,8 @@ public ColumnAdapterNotes convertFromJsonToColumnAdapterNotes(final String adapt
+ "Please refresh the virtual schema.");
}
final JsonObject root;
try {
root = JsonHelper.getJsonObject(adapterNotes);
try (final JsonReader jr = Json.createReader(new StringReader(adapterNotes))) {
root = jr.readObject();
} catch (final Exception exception) {
throw new AdapterException("Could not parse the column adapter notes of column \"" + columnName + "\"." //
+ "Please refresh the virtual schema.", exception);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.exasol.adapter.adapternotes;

import java.io.StringReader;
import java.util.Collections;

import javax.json.*;

import com.exasol.adapter.AdapterException;
import com.exasol.utils.JsonHelper;

/**
* Converts schema adapter Notes into JSON format and back.
Expand All @@ -24,6 +26,7 @@ public final class SchemaAdapterNotesJsonConverter {
private static final String NULLS_ARE_SORTED_HIGH = "areNullsSortedHigh";
private static final String NULLS_ARE_SORTED_LOW = "areNullsSortedLow";
private static final SchemaAdapterNotesJsonConverter SCHEMA_ADAPTER_NOTES_JSON_CONVERTER = new SchemaAdapterNotesJsonConverter();
private final JsonBuilderFactory factory = Json.createBuilderFactory(Collections.emptyMap());

/**
* Returns instance of {@link SchemaAdapterNotesJsonConverter} singleton class.
Expand All @@ -45,7 +48,6 @@ private SchemaAdapterNotesJsonConverter() {
* @return string representation of a JSON Object
*/
public String convertToJson(final SchemaAdapterNotes schemaAdapterNotes) {
final JsonBuilderFactory factory = JsonHelper.getBuilderFactory();
final JsonObjectBuilder builder = factory.createObjectBuilder()
.add(CATALOG_SEPARATOR, schemaAdapterNotes.getCatalogSeparator())
.add(IDENTIFIER_QUOTE_STRING, schemaAdapterNotes.getIdentifierQuoteString())
Expand Down Expand Up @@ -79,8 +81,8 @@ public SchemaAdapterNotes convertFromJsonToSchemaAdapterNotes(final String adapt
+ "Please refresh the virtual schema.");
}
final JsonObject root;
try {
root = JsonHelper.getJsonObject(adapterNotes);
try (final JsonReader jr = Json.createReader(new StringReader(adapterNotes))) {
root = jr.readObject();
} catch (final Exception exception) {
throw new AdapterException("Could not parse the schema adapter notes of virtual schema \"" + schemaName
+ "\". Please refresh the virtual schema.", exception);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.exasol.adapter.dialects;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.exasol.adapter.dialects;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.math.BigDecimal;
import java.sql.SQLException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.exasol.adapter.dialects;

import static com.exasol.adapter.dialects.SqlGenerationHelper.addMetadata;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.ArrayList;
import java.util.List;
Expand Down

0 comments on commit cbcd2ea

Please sign in to comment.