diff --git a/testing/register-test-core/src/main/java/org/opengroup/osdu/register/util/HealthCheckTest.java b/testing/register-test-core/src/main/java/org/opengroup/osdu/register/util/HealthCheckTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e7004e10f9d9f2df28eefe31d507bf1fd0c37269 --- /dev/null +++ b/testing/register-test-core/src/main/java/org/opengroup/osdu/register/util/HealthCheckTest.java @@ -0,0 +1,64 @@ +/* + * Copyright 2017-2020, Schlumberger + * + * 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.register.util; + +import com.sun.jersey.api.client.ClientResponse; +import org.junit.Test; +import org.springframework.http.HttpMethod; + +import static org.junit.Assert.assertEquals; + +public abstract class HealthCheckTest extends BaseTestTemplate { + + public HealthCheckTest(RestDescriptor getDescriptor) { + super(getDescriptor); + } + + private String id = "retrievetest" + System.currentTimeMillis(); + + @Override + protected String getId() { + return id; + } + + @Override + protected void deleteResource() throws Exception { + } + + @Override + protected void deleteResourcewitharg(String ext) throws Exception { + } + + @Override + protected void createResource() throws Exception { + } + @Override + protected void createResourcewitharg(String ext) throws Exception { + } + + @Override + protected int expectedOkResponseCode() { + return 200; + } + + @Test + public void should_returnTrailingOk() throws Exception { + ClientResponse response = + TestUtils.send("api/register/v1/ah/liveness_check/", HttpMethod.GET.name(), this.testUtils.getOpsAccessToken(), "", ""); + assertEquals(expectedOkResponseCode(), response.getStatus()); + } +} diff --git a/testing/register-test-core/src/main/java/org/opengroup/osdu/register/util/RetrieveApiTestTemplate.java b/testing/register-test-core/src/main/java/org/opengroup/osdu/register/util/RetrieveApiTestTemplate.java index 0f0e3bd6d6de15f16d714f0f156008eb2bad39eb..fc83aeff743d8b3b16a99fb818774cd531d8b761 100644 --- a/testing/register-test-core/src/main/java/org/opengroup/osdu/register/util/RetrieveApiTestTemplate.java +++ b/testing/register-test-core/src/main/java/org/opengroup/osdu/register/util/RetrieveApiTestTemplate.java @@ -19,8 +19,6 @@ package org.opengroup.osdu.register.util; import com.sun.jersey.api.client.ClientResponse; import org.junit.Ignore; import org.junit.Test; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; import java.util.ArrayList; import java.util.List; @@ -112,11 +110,4 @@ public abstract class RetrieveApiTestTemplate extends BaseTestTemplate { assertEquals(error("Expected all successful responses. Actual " + sucessResponseCount), 10, sucessResponseCount); assertEquals(error("Unexpected error response returned"), 0, errorResponseCount); } - - @Test - public void should_returnTrailingOk() throws Exception { - ClientResponse response = - TestUtils.send("api/register/v1/ah/liveness_check/", HttpMethod.GET.name(), this.testUtils.getOpsAccessToken(), "", ""); - assertEquals(expectedOkResponseCode(), response.getStatus()); - } }