Skip to content
Snippets Groups Projects
Commit 542d73b0 authored by Rostislav Dublin (EPAM)'s avatar Rostislav Dublin (EPAM)
Browse files

NOTICE update on fossa-check-notice findings

parents 58660584 f2466c1d
No related branches found
No related tags found
1 merge request!54Move Search Config out of os-core-common (GONRG-744)
Pipeline #16860 failed
......@@ -29,3 +29,5 @@ chmod +x "${INTEGRATION_TEST_OUTPUT_BIN_DIR}"/install-deps.sh
mvn clean -f "$INTEGRATION_TEST_SOURCE_DIR_AWS"/pom.xml
cp -R "$INTEGRATION_TEST_SOURCE_DIR_AWS"/* "${INTEGRATION_TEST_OUTPUT_DIR}"/
#copy testing parent pom to output
cp "$INTEGRATION_TEST_SOURCE_DIR/pom.xml" "${OUTPUT_DIR}/testing"
\ No newline at end of file
/* Copyright 2017-2019, Schlumberger
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.*/
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.opengroup.osdu.common;
......@@ -52,7 +55,7 @@ public class CleanupIndiciesSteps extends TestsBase {
super(httpClient);
}
public void the_schema_is_created_with_the_following_kind(DataTable dataTable) {
public void theSchemaIsCreatedWithTheFollowingKind(DataTable dataTable) {
List<Setup> inputList = dataTable.asList(Setup.class);
for (Setup input : inputList) {
TestIndex testIndex = getTextIndex();
......@@ -71,7 +74,7 @@ public class CleanupIndiciesSteps extends TestsBase {
}
}
public void i_ingest_records_with_the_for_a_given(String record, String dataGroup, String kind) {
public void iIngestRecordsWithTheforAGiven(String record, String dataGroup, String kind) {
String actualKind = generateActualName(kind, timeStamp);
try {
String fileContent = FileHandler.readFile(String.format("%s.%s", record, "json"));
......@@ -93,11 +96,11 @@ public class CleanupIndiciesSteps extends TestsBase {
}
}
public void i_check_that_the_index_for_has_been_created(String kind) throws IOException, InterruptedException {
public void iCheckThatTheIndexForHasBeenCreated(String kind) throws IOException, InterruptedException {
assertTrue(isNewIndexCreated(generateActualName(kind, timeStamp)));
}
public void i_should_delete_the_records_for_i_created_earlier() {
public void iShouldDeleteTheRecordsForICreatedEarlier() {
List<Map<String, Object>> deletedRecords = new ArrayList<>();
if (records != null && !records.isEmpty()) {
for (Map<String, Object> testRecord : records) {
......@@ -113,25 +116,27 @@ public class CleanupIndiciesSteps extends TestsBase {
}
}
public void i_should_delete_the_schema_for_i_created_earlier(String kind) {
public void iShouldDeleteTheSchemaForICreatedEarlier(String kind) {
ClientResponse response = httpClient.send(HttpMethod.DELETE,
String.format("%sschemas%s", getStorageBaseURL(), "/" + generateActualName(kind, timeStamp)),null,
headers, httpClient.getAccessToken());
headers, httpClient.getAccessToken());
assertEquals(HttpStatus.SC_NO_CONTENT, response.getStatus());
}
public void i_should_check_that_the_index_for_has_not_been_deleted(String kind) throws IOException, InterruptedException {
public void iShouldCheckThetTheIndexforHasNotBeenDeleted(String kind) throws IOException, InterruptedException {
assertTrue(isNewIndexExist(generateActualName(kind, timeStamp)));
}
public void i_should_to_run_cleanup_of_indexes_for_and(String kind, String message) {
public void iShouldToRunCleanupOfIndexesForAnd(String kind, String message) {
ClientResponse response = httpClient.send(HttpMethod.POST, String.format("%sindex-cleanup", getIndexerBaseURL()),
String url = getIndexerBaseURL() + "index-cleanup";
log.info("URL: " + url);
ClientResponse response = httpClient.send(HttpMethod.POST, url,
convertMessageIntoJson(kind, message), headers, httpClient.getAccessToken());
assertEquals(HttpStatus.SC_OK, response.getStatus());
}
public void i_should_check_that_the_index_for_has_been_deleted(String kind) throws IOException, InterruptedException {
public void iShouldCheckThatTheIndexForHasBeenDeleted(String kind) throws IOException, InterruptedException {
assertFalse(isNewIndexExist(generateActualName(kind, timeStamp)));
}
......
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.opengroup.osdu.util;
import com.google.gson.Gson;
......@@ -298,17 +315,24 @@ public class ElasticUtils {
return builder;
}
public boolean isIndexExist(String index) throws IOException {
public boolean isIndexExist(String index) {
boolean exists = false;
try {
try (RestHighLevelClient client = this.createClient(username, password, host)) {
GetIndexRequest request = new GetIndexRequest();
request.indices(index);
exists = client.indices().exists(request, RequestOptions.DEFAULT);
}
exists = createRestClientAndCheckIndexExist(index);
} catch (ElasticsearchStatusException e) {
log.log(Level.INFO, String.format("Error getting index: %s status", index));
log.log(Level.INFO, String.format("Error getting index: %s %s", index, e.getMessage()));
}
return exists;
}
private boolean createRestClientAndCheckIndexExist(String index) {
try (RestHighLevelClient client = this.createClient(username, password, host)) {
GetIndexRequest request = new GetIndexRequest();
request.indices(index);
return client.indices().exists(request, RequestOptions.DEFAULT);
} catch (IOException e) {
log.log(Level.INFO, String.format("Error getting index: %s %s", index, e.getMessage()));
}
return false;
}
}
\ No newline at end of file
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.opengroup.osdu.step_definitions.index.cleanup;
import cucumber.api.CucumberOptions;
......
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.opengroup.osdu.step_definitions.index.cleanup;
import cucumber.api.DataTable;
......@@ -25,42 +42,42 @@ public class Steps extends CleanupIndiciesSteps {
}
@Given("^the schema is created with the following kind$")
public void the_schema_is_created_with_the_following_kind(DataTable dataTable) {
super.the_schema_is_created_with_the_following_kind(dataTable);
public void theSchemaIsCreatedWithTheFollowingKind(DataTable dataTable) {
super.theSchemaIsCreatedWithTheFollowingKind(dataTable);
}
@When("^I ingest records with the \"(.*?)\" with \"(.*?)\" for a given \"(.*?)\"$")
public void i_ingest_records_with_the_for_a_given(String record, String dataGroup, String kind) {
super.i_ingest_records_with_the_for_a_given(record, dataGroup, kind);
public void iIngestRecordsWithTheforAGiven(String record, String dataGroup, String kind) {
super.iIngestRecordsWithTheforAGiven(record, dataGroup, kind);
}
@Then("^I check that the index for \"(.*?)\" has been created$")
public void i_check_that_the_index_for_has_been_created(String kind) throws IOException, InterruptedException {
super.i_check_that_the_index_for_has_been_created(kind);
public void iCheckThatTheIndexForHasBeenCreated(String kind) throws IOException, InterruptedException {
super.iCheckThatTheIndexForHasBeenCreated(kind);
}
@Then("^I should delete the records I created earlier$")
public void i_should_delete_the_records_for_i_created_earlier() {
super.i_should_delete_the_records_for_i_created_earlier();
public void iShouldDeleteTheRecordsForICreatedEarlier() {
super.iShouldDeleteTheRecordsForICreatedEarlier();
}
@Then("^I should delete the schema for \"(.*?)\" I created earlier$")
public void i_should_delete_the_schema_for_i_created_earlier(String kind) {
super.i_should_delete_the_schema_for_i_created_earlier(kind);
public void iShouldDeleteTheSchemaForICreatedEarlier(String kind) {
super.iShouldDeleteTheSchemaForICreatedEarlier(kind);
}
@Then("^I should check that the index for \"(.*?)\" has not been deleted$")
public void i_should_check_that_the_index_for_has_not_been_deleted(String kind) throws IOException, InterruptedException {
super.i_should_check_that_the_index_for_has_not_been_deleted(kind);
public void iShouldCheckThetTheIndexforHasNotBeenDeleted(String kind) throws IOException, InterruptedException {
super.iShouldCheckThetTheIndexforHasNotBeenDeleted(kind);
}
@Then("^I should to run cleanup of indexes for \"(.*?)\" and \"(.*?)\"$")
public void i_should_to_run_cleanup_of_indexes_for_and(String kind, String message) {
super.i_should_to_run_cleanup_of_indexes_for_and(kind, message);
public void iShouldToRunCleanupOfIndexesForAnd(String kind, String message) {
super.iShouldToRunCleanupOfIndexesForAnd(kind, message);
}
@Then("^I should check that the index for \"(.*?)\" has been deleted$")
public void i_should_check_that_the_index_for_has_been_deleted(String kind) throws IOException, InterruptedException {
super.i_should_check_that_the_index_for_has_been_deleted(kind);
public void iShouldCheckThatTheIndexForHasBeenDeleted(String kind) throws IOException, InterruptedException {
super.iShouldCheckThatTheIndexForHasBeenDeleted(kind);
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment