Skip to content

Commit

Permalink
[Spotless] Applying Google Code Format for integ-tests #9 (#1966)
Browse files Browse the repository at this point in the history
* Add spotless apply 60 files. (#328)

rebase changes.



Addressed PR comments.

Signed-off-by: Mitchell Gale <[email protected]>

* Apply suggestions from code review

Co-authored-by: Yury-Fridlyand <[email protected]>
Co-authored-by: Guian Gumpac <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>

* Update integ-test/src/test/java/org/opensearch/sql/legacy/QueryIT.java

Co-authored-by: Guian Gumpac <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>

* Update integ-test/src/test/java/org/opensearch/sql/legacy/QueryIT.java

Co-authored-by: Guian Gumpac <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>

* Update integ-test/src/test/java/org/opensearch/sql/legacy/QueryIT.java

Co-authored-by: Guian Gumpac <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>

* Update integ-test/src/test/java/org/opensearch/sql/legacy/QueryIT.java

Co-authored-by: Guian Gumpac <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>

* Update integ-test/src/test/java/org/opensearch/sql/legacy/QueryIT.java

Co-authored-by: Guian Gumpac <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>

* Apply suggestions from code review

Co-authored-by: Guian Gumpac <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>

* Apply suggestions from code review

Co-authored-by: Guian Gumpac <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>

* Apply suggestions from code review

Co-authored-by: Guian Gumpac <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>

* Apply suggestions from code review

Co-authored-by: Guian Gumpac <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>

* Update integ-test/src/test/java/org/opensearch/sql/legacy/QueryIT.java

Co-authored-by: Guian Gumpac <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>

---------

Signed-off-by: Mitchell Gale <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>
Co-authored-by: Yury-Fridlyand <[email protected]>
Co-authored-by: Guian Gumpac <[email protected]>
  • Loading branch information
3 people authored Aug 16, 2023
1 parent b035b13 commit 983d77d
Show file tree
Hide file tree
Showing 60 changed files with 3,847 additions and 3,357 deletions.
5 changes: 5 additions & 0 deletions integ-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ repositories {
}
}

// Being ignored as a temporary measure before being removed in favour of
// spotless https://github.com/opensearch-project/sql/issues/1101
checkstyleTest.ignoreFailures = true
checkstyleMain.ignoreFailures = true

ext {
projectSubstitutions = [:]
licenseFile = rootProject.file('LICENSE.TXT')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
* SPDX-License-Identifier: Apache-2.0
*/


package org.opensearch.sql.bwc;


import static org.opensearch.sql.legacy.TestUtils.createIndexByRestClient;
import static org.opensearch.sql.legacy.TestUtils.isIndexExist;
import static org.opensearch.sql.legacy.TestUtils.loadDataByRestClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/


package org.opensearch.sql.correctness.runner.connection;

import java.io.IOException;
Expand All @@ -16,18 +15,15 @@
import org.opensearch.sql.correctness.runner.resultset.DBResult;

/**
* OpenSearch database connection for insertion. This class wraps JDBCConnection to delegate query method.
* OpenSearch database connection for insertion. This class wraps JDBCConnection to delegate query
* method.
*/
public class OpenSearchConnection implements DBConnection {

/**
* Connection via our OpenSearch JDBC driver
*/
/** Connection via our OpenSearch JDBC driver */
private final DBConnection connection;

/**
* Native OpenSearch REST client for operation unsupported by driver such as CREATE/INSERT
*/
/** Native OpenSearch REST client for operation unsupported by driver such as CREATE/INSERT */
private final RestClient client;

public OpenSearchConnection(String connectionUrl, RestClient client) {
Expand Down Expand Up @@ -112,10 +108,8 @@ private String buildBulkBody(String[] columnNames, List<Object[]> batch) {
}
}

body.append("{\"index\":{}}\n").
append(json).append("\n");
body.append("{\"index\":{}}\n").append(json).append("\n");
}
return body.toString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/


package org.opensearch.sql.correctness.runner.resultset;

import java.math.BigDecimal;
Expand All @@ -15,9 +14,7 @@
import lombok.Getter;
import lombok.ToString;

/**
* Row in result set.
*/
/** Row in result set. */
@EqualsAndHashCode
@ToString
@Getter
Expand Down Expand Up @@ -77,5 +74,4 @@ public int compareTo(Row other) {
}
return 0;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/


package org.opensearch.sql.correctness.tests;

import static org.junit.Assert.assertEquals;
Expand All @@ -30,14 +29,11 @@
import org.opensearch.client.RestClient;
import org.opensearch.sql.correctness.runner.connection.OpenSearchConnection;

/**
* Tests for {@link OpenSearchConnection}
*/
/** Tests for {@link OpenSearchConnection} */
@RunWith(MockitoJUnitRunner.class)
public class OpenSearchConnectionTest {

@Mock
private RestClient client;
@Mock private RestClient client;

private OpenSearchConnection conn;

Expand All @@ -63,36 +59,30 @@ public void testCreateTable() throws IOException {

@Test
public void testInsertData() throws IOException {
conn.insert("test", new String[] {"name"},
Arrays.asList(new String[] {"John"}, new String[] {"Hank"}));
conn.insert(
"test", new String[] {"name"}, Arrays.asList(new String[] {"John"}, new String[] {"Hank"}));

Request actual = captureActualArg();
assertEquals("POST", actual.getMethod());
assertEquals("/test/_bulk?refresh=true", actual.getEndpoint());
assertEquals(
"{\"index\":{}}\n"
+ "{\"name\":\"John\"}\n"
+ "{\"index\":{}}\n"
+ "{\"name\":\"Hank\"}\n",
getBody(actual)
);
"{\"index\":{}}\n{\"name\":\"John\"}\n{\"index\":{}}\n{\"name\":\"Hank\"}\n",
getBody(actual));
}

@Test
public void testInsertNullData() throws IOException {
conn.insert("test", new String[] {"name", "age"},
conn.insert(
"test",
new String[] {"name", "age"},
Arrays.asList(new Object[] {null, 30}, new Object[] {"Hank", null}));

Request actual = captureActualArg();
assertEquals("POST", actual.getMethod());
assertEquals("/test/_bulk?refresh=true", actual.getEndpoint());
assertEquals(
"{\"index\":{}}\n"
+ "{\"age\":30}\n"
+ "{\"index\":{}}\n"
+ "{\"name\":\"Hank\"}\n",
getBody(actual)
);
"{\"index\":{}}\n{\"age\":30}\n{\"index\":{}}\n{\"name\":\"Hank\"}\n",
getBody(actual));
}

@Test
Expand All @@ -114,5 +104,4 @@ private String getBody(Request request) throws IOException {
InputStream inputStream = request.getEntity().getContent();
return CharStreams.toString(new InputStreamReader(inputStream));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/


package org.opensearch.sql.correctness.tests;

import static org.junit.Assert.assertEquals;
Expand All @@ -12,9 +11,7 @@
import org.junit.Test;
import org.opensearch.sql.correctness.runner.resultset.Row;

/**
* Unit test {@link Row}
*/
/** Unit test {@link Row} */
public class RowTest {

@Test
Expand Down Expand Up @@ -47,5 +44,4 @@ public void shouldConsiderNullGreater() {
row2.add("world");
assertEquals(1, row1.compareTo(row2));
}

}
Loading

0 comments on commit 983d77d

Please sign in to comment.