Skip to content

Commit 750949f

Browse files
authored
Create 2.x branch and update accordingly (#38)
Create 2.x branch and update accordingly (#38) Signed-off-by: YANGDB <[email protected]>
1 parent 0e8de37 commit 750949f

File tree

6 files changed

+67
-92
lines changed

6 files changed

+67
-92
lines changed

TODOs.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

build.gradle

Lines changed: 45 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* Copyright OpenSearch Contributors
33
* SPDX-License-Identifier: Apache-2.0
44
*/
5-
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
65

76

87
buildscript {
@@ -22,7 +21,7 @@ plugins {
2221
id 'signing'
2322
}
2423

25-
group 'org.opensearch.driver'
24+
group 'org.opensearch.client'
2625

2726
// keep version in sync with version in Driver source
2827
version '2.0.0.0'
@@ -47,49 +46,29 @@ repositories {
4746

4847
dependencies {
4948
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.13'
50-
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: "2.13.3"
49+
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: "2.13.4.2"
5150
implementation group: 'com.amazonaws', name: 'aws-java-sdk-core', version: '1.11.452'
5251

5352
testImplementation('org.junit.jupiter:junit-jupiter-api:5.3.1')
5453
testImplementation('org.junit.jupiter:junit-jupiter-params:5.3.1')
55-
testImplementation('com.github.tomakehurst:wiremock:2.27.2')
54+
testImplementation('com.github.tomakehurst:wiremock-jre8-standalone:2.34.0')
5655
testImplementation('org.mockito:mockito-core:2.23.0')
5756
testImplementation('org.junit.jupiter:junit-jupiter-engine:5.3.1')
5857
testImplementation('org.junit-pioneer:junit-pioneer:0.3.0')
59-
testImplementation('org.eclipse.jetty:jetty-server:9.2.24.v20180105')
58+
testImplementation('org.eclipse.jetty:jetty-server:9.4.48.v20220622')
6059

61-
// Enforce wiremock to use latest guava and json-smart
60+
// Enforce wiremock to use latest guava
6261
testImplementation('com.google.guava:guava:31.1-jre')
63-
testImplementation('net.minidev:json-smart:2.4.8')
6462

6563
testRuntimeOnly('org.slf4j:slf4j-simple:1.7.25') // capture WireMock logging
66-
67-
// JDBC drivers for comparison test. Somehow Apache Derby throws security permission exception.
68-
testImplementation fileTree('/build/libs') {
69-
include '*.jar'
70-
builtBy 'compileJdbc'
71-
}
72-
testImplementation group: 'com.h2database', name: 'h2', version: '2.1.210'
73-
testImplementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.28.0'
74-
testImplementation group: 'com.google.code.gson', name: 'gson', version: '2.8.9'
75-
}
76-
77-
task compileJdbc(type: Exec) {
78-
if (DefaultNativePlatform.getCurrentOperatingSystem().isWindows()) {
79-
commandLine './gradlew.bat', 'build'
80-
commandLine './gradlew.bat', 'shadowJar'
81-
} else {
82-
commandLine './gradlew', 'build'
83-
commandLine './gradlew', 'shadowJar'
84-
}
8564
}
8665

8766
tasks.withType(JavaCompile) {
8867
options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
8968
}
9069

9170
static def getShadowPath(String path) {
92-
return 'org.opensearch.sql.jdbc.shadow.' + path
71+
return 'com.amazonaws.opensearch.sql.jdbc.shadow.' + path
9372
}
9473

9574
shadowJar {
@@ -107,14 +86,18 @@ shadowJar {
10786
exclude 'META-INF/NOTICE*'
10887
exclude 'META-INF/DEPENDENCIES'
10988

110-
relocate 'com.amazonaws', getShadowPath('com.amazonaws')
89+
relocate('com.amazonaws', getShadowPath('com.amazonaws')) {
90+
exclude 'com.amazonaws.opensearch.*/**'
91+
}
92+
11193
relocate 'org.apache', getShadowPath('org.apache')
11294
relocate 'org.joda', getShadowPath('org.joda')
11395
relocate 'com.fasterxml', getShadowPath('com.fasterxml')
11496
relocate 'software.amazon', getShadowPath('software.amazon')
11597
}
11698

11799
test {
100+
systemProperty("opensearch_jdbc_version", version);
118101
useJUnitPlatform()
119102
}
120103

@@ -136,59 +119,47 @@ publishing {
136119
artifact javadocJar
137120

138121
pom {
139-
name = "OpenSearch SQL JDBC Driver"
140-
packaging = "jar"
141-
url = "https://github.com/opensearch-project/sql/sql-jdbc"
142-
description = "OpenSearch SQL JDBC driver"
143-
scm {
144-
connection = "scm:[email protected]:opensearch-project/sql.git"
145-
developerConnection = "scm:[email protected]:opensearch-project/sql.git"
146-
url = "[email protected]:opensearch-project/sql.git"
147-
}
148-
licenses {
149-
license {
150-
name = "The Apache License, Version 2.0"
151-
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
152-
}
122+
name = "OpenSearch SQL JDBC Driver"
123+
packaging = "jar"
124+
url = "https://github.com/opensearch-project/sql"
125+
description = "OpenSearch SQL JDBC driver"
126+
scm {
127+
connection = "scm:[email protected]:opensearch-project/sql.git"
128+
developerConnection = "scm:[email protected]:opensearch-project/sql.git"
129+
url = "[email protected]:opensearch-project/sql.git"
130+
}
131+
licenses {
132+
license {
133+
name = "The Apache License, Version 2.0"
134+
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
153135
}
154-
developers {
155-
developer {
156-
name = 'OpenSearch'
157-
url = 'https://github.com/opensearch-project/sql'
158-
}
159-
}
160-
}
161-
}
162-
publishMaven(MavenPublication) { publication ->
163-
from components.java
164-
165-
pom {
166-
name = "OpenSearch SQL JDBC Driver"
167-
packaging = "jar"
168-
url = "https://github.com/opensearch-project/sql/sql-jdbc"
169-
description = "OpenSearch SQL JDBC driver"
170-
scm {
171-
connection = "scm:[email protected]:opensearch-project/sql.git"
172-
developerConnection = "scm:[email protected]:opensearch-project/sql.git"
173-
url = "[email protected]:opensearch-project/sql.git"
174-
}
175-
licenses {
176-
license {
177-
name = "The Apache License, Version 2.0"
178-
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
179-
}
180-
}
181-
developers {
182-
developer {
183-
name = 'OpenSearch'
184-
url = 'https://github.com/opensearch-project/sql'
185-
}
136+
}
137+
developers {
138+
developer {
139+
id = "amazonwebservices"
140+
organization = "Amazon Web Services"
141+
organizationUrl = "https://aws.amazon.com"
186142
}
143+
}
187144
}
188145
}
189146
}
190147

191148
repositories {
149+
maven {
150+
name = "internal-snapshots"
151+
url = "s3://snapshots.opendistroforelasticsearch.amazon.com/maven"
152+
authentication {
153+
awsIm(AwsImAuthentication) // load from EC2 role or env var
154+
}
155+
}
156+
maven {
157+
name = "internal-releases"
158+
url = "s3://artifacts.opendistroforelasticsearch.amazon.com/maven"
159+
authentication {
160+
awsIm(AwsImAuthentication) // load from EC2 role or env var
161+
}
162+
}
192163
maven {
193164
name = "sonatype-staging"
194165
url "https://aws.oss.sonatype.org/service/local/staging/deploy/maven2"
@@ -197,10 +168,6 @@ publishing {
197168
password project.hasProperty('ossrhPassword') ? project.property('ossrhPassword') : ''
198169
}
199170
}
200-
maven {
201-
name = "localRepo"
202-
url "${project.buildDir}/repository"
203-
}
204171
}
205172

206173
// TODO - enabled debug logging for the time being, remove this eventually
@@ -234,6 +201,4 @@ jacocoTestCoverageVerification {
234201
}
235202
}
236203

237-
238-
239204
check.dependsOn jacocoTestCoverageVerification

src/main/java/org/opensearch/jdbc/ConnectionImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ public Logger getLog() {
507507
}
508508

509509
private String getUserAgent() {
510-
return String.format("openes-jdbc/%s (Java %s)",
510+
return String.format("opensearch-jdbc/%s (Java %s)",
511511
Version.Current.getFullVersion(), JavaUtil.getJavaVersion());
512512
}
513513
}

src/main/java/org/opensearch/jdbc/internal/Version.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
public enum Version {
1010

11-
// keep this in sync with the gradle version
12-
Current(1, 0, 0, 0);
11+
// keep this in sync with the sql-jdbc/build.gradle file
12+
Current(2, 0, 0, 0);
1313

1414
private int major;
1515
private int minor;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.opensearch.jdbc.internal;
2+
/*
3+
* Copyright OpenSearch Contributors
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import org.junit.jupiter.api.Test;
8+
import org.opensearch.jdbc.internal.Version;
9+
import static org.junit.jupiter.api.Assertions.assertEquals;
10+
11+
public class VersionMatchTest {
12+
13+
@Test
14+
void testVersionMatchesBuildGradleVersion() {
15+
assertEquals(Version.Current.getFullVersion(), System.getProperty("opensearch_jdbc_version"));
16+
}
17+
}

src/test/java/org/opensearch/jdbc/test/TLSServer.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import org.eclipse.jetty.server.handler.AbstractHandler;
2121
import org.eclipse.jetty.util.ssl.SslContextFactory;
2222

23-
import javax.servlet.ServletException;
2423
import javax.servlet.http.HttpServletRequest;
2524
import javax.servlet.http.HttpServletResponse;
25+
import javax.servlet.ServletException;
2626
import java.io.IOException;
2727

2828
public class TLSServer {
@@ -70,7 +70,7 @@ public static Server startSecureServer(
7070
ServerConnector httpsConnector = null;
7171

7272
// setup ssl
73-
SslContextFactory sslContextFactory = new SslContextFactory();
73+
SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
7474
sslContextFactory.setKeyStorePath(keyStorePath);
7575
sslContextFactory.setKeyStorePassword(keyStorePassword);
7676
sslContextFactory.setKeyStoreType(keyStoreType);
@@ -132,8 +132,6 @@ private static ServerConnector createServerConnector(
132132
connectionFactories
133133
);
134134
connector.setPort(port);
135-
connector.setStopTimeout(0);
136-
connector.getSelectorManager().setStopTimeout(0);
137135
connector.setHost(bindAddress);
138136

139137
return connector;

0 commit comments

Comments
 (0)