Search in sources :

Example 1 with ConfigurationStatus

use of org.folio.rest.jaxrs.model.ConfigurationStatus in project mod-kb-ebsco-java by folio-org.

the class EholdingsStatusTest method shouldReturnFalseWhenRMAPIRequestCompletesWithErrorStatus.

@Test
public void shouldReturnFalseWhenRMAPIRequestCompletesWithErrorStatus() {
    setupDefaultKBConfiguration(getWiremockUrl(), vertx);
    stubFor(get(new UrlPathPattern(new RegexPattern("/rm/rmaccounts.*"), true)).willReturn(new ResponseDefinitionBuilder().withStatus(401)));
    final ConfigurationStatus status = getWithOk(EHOLDINGS_STATUS_PATH, STUB_TOKEN_HEADER).as(ConfigurationStatus.class);
    assertThat(status.getData().getAttributes().getIsConfigurationValid(), equalTo(false));
}
Also used : ResponseDefinitionBuilder(com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder) UrlPathPattern(com.github.tomakehurst.wiremock.matching.UrlPathPattern) RegexPattern(com.github.tomakehurst.wiremock.matching.RegexPattern) ConfigurationStatus(org.folio.rest.jaxrs.model.ConfigurationStatus) Test(org.junit.Test)

Example 2 with ConfigurationStatus

use of org.folio.rest.jaxrs.model.ConfigurationStatus in project mod-kb-ebsco-java by folio-org.

the class EholdingsStatusTest method shouldReturnFalseIfEmptyConfig.

@Test
public void shouldReturnFalseIfEmptyConfig() {
    final ConfigurationStatus status = getWithOk(EHOLDINGS_STATUS_PATH, STUB_TOKEN_HEADER).as(ConfigurationStatus.class);
    assertThat(status.getData().getAttributes().getIsConfigurationValid(), equalTo(false));
}
Also used : ConfigurationStatus(org.folio.rest.jaxrs.model.ConfigurationStatus) Test(org.junit.Test)

Example 3 with ConfigurationStatus

use of org.folio.rest.jaxrs.model.ConfigurationStatus in project mod-kb-ebsco-java by folio-org.

the class EholdingsStatusTest method shouldReturnTrueWhenRMAPIRequestCompletesWith200Status.

@Test
public void shouldReturnTrueWhenRMAPIRequestCompletesWith200Status() throws IOException, URISyntaxException {
    setupDefaultKBConfiguration(getWiremockUrl(), vertx);
    stubFor(get(new UrlPathPattern(new RegexPattern("/rm/rmaccounts.*"), true)).willReturn(new ResponseDefinitionBuilder().withBody(readFile("responses/rmapi/vendors/get-zero-vendors-response.json"))));
    final ConfigurationStatus status = getWithOk(EHOLDINGS_STATUS_PATH, STUB_TOKEN_HEADER).as(ConfigurationStatus.class);
    assertThat(status.getData().getAttributes().getIsConfigurationValid(), equalTo(true));
}
Also used : ResponseDefinitionBuilder(com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder) UrlPathPattern(com.github.tomakehurst.wiremock.matching.UrlPathPattern) RegexPattern(com.github.tomakehurst.wiremock.matching.RegexPattern) ConfigurationStatus(org.folio.rest.jaxrs.model.ConfigurationStatus) Test(org.junit.Test)

Aggregations

ConfigurationStatus (org.folio.rest.jaxrs.model.ConfigurationStatus)3 Test (org.junit.Test)3 ResponseDefinitionBuilder (com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder)2 RegexPattern (com.github.tomakehurst.wiremock.matching.RegexPattern)2 UrlPathPattern (com.github.tomakehurst.wiremock.matching.UrlPathPattern)2