Search in sources :

Example 1 with DbKbCredentials

use of org.folio.repository.kbcredentials.DbKbCredentials in project mod-kb-ebsco-java by folio-org.

the class KbCredentialsNotSecuredCollectionConverterTest method shouldConvertKbCredentialsCollectionWithDefaultUrl.

@Test
public void shouldConvertKbCredentialsCollectionWithDefaultUrl() {
    Collection<DbKbCredentials> credentialsCollection = getCredentialsCollectionNoUrl();
    final KbCredentialsCollection kbCredentials = nonSecuredConverter.convert(credentialsCollection);
    assertThat(kbCredentials.getMeta().getTotalResults(), equalTo(1));
    assertThat(kbCredentials.getData().get(0).getType(), equalTo(KbCredentials.Type.KB_CREDENTIALS));
    assertThat(kbCredentials.getData().get(0).getAttributes().getName(), equalTo(STUB_CREDENTIALS_NAME));
    assertThat(kbCredentials.getData().get(0).getAttributes().getApiKey(), equalTo(STUB_API_KEY));
    assertThat(kbCredentials.getData().get(0).getAttributes().getCustomerId(), equalTo(STUB_CUSTOMER_ID));
    assertThat(kbCredentials.getData().get(0).getAttributes().getUrl(), equalTo(defaultUrl));
}
Also used : DbKbCredentials(org.folio.repository.kbcredentials.DbKbCredentials) KbCredentialsCollection(org.folio.rest.jaxrs.model.KbCredentialsCollection) Test(org.junit.Test)

Example 2 with DbKbCredentials

use of org.folio.repository.kbcredentials.DbKbCredentials in project mod-kb-ebsco-java by folio-org.

the class KbCredentialsNotSecuredCollectionConverterTest method shouldConvertKbCredentialsCollection.

@Test
public void shouldConvertKbCredentialsCollection() {
    Collection<DbKbCredentials> credentialsCollection = getCredentialsCollection();
    final KbCredentialsCollection kbCredentials = nonSecuredConverter.convert(credentialsCollection);
    assertThat(kbCredentials.getMeta().getTotalResults(), equalTo(1));
    assertThat(kbCredentials.getData().get(0).getType(), equalTo(KbCredentials.Type.KB_CREDENTIALS));
    assertThat(kbCredentials.getData().get(0).getAttributes().getName(), equalTo(STUB_CREDENTIALS_NAME));
    assertThat(kbCredentials.getData().get(0).getAttributes().getApiKey(), equalTo(STUB_API_KEY));
    assertThat(kbCredentials.getData().get(0).getAttributes().getCustomerId(), equalTo(STUB_CUSTOMER_ID));
    assertThat(kbCredentials.getData().get(0).getAttributes().getUrl(), equalTo(STUB_API_URL));
}
Also used : DbKbCredentials(org.folio.repository.kbcredentials.DbKbCredentials) KbCredentialsCollection(org.folio.rest.jaxrs.model.KbCredentialsCollection) Test(org.junit.Test)

Example 3 with DbKbCredentials

use of org.folio.repository.kbcredentials.DbKbCredentials in project mod-kb-ebsco-java by folio-org.

the class KbCredentialsNotSecuredConverterTest method shouldConvertKbCredentialsWithDefaultUrl.

@Test
public void shouldConvertKbCredentialsWithDefaultUrl() {
    DbKbCredentials holding = getCredentialsNoUrl();
    final KbCredentials kbCredentials = notSecuredConverter.convert(holding);
    assertThat(kbCredentials.getType(), equalTo(KbCredentials.Type.KB_CREDENTIALS));
    assertThat(kbCredentials.getAttributes().getName(), equalTo(STUB_CREDENTIALS_NAME));
    assertThat(kbCredentials.getAttributes().getApiKey(), equalTo(STUB_API_KEY));
    assertThat(kbCredentials.getAttributes().getCustomerId(), equalTo(STUB_CUSTOMER_ID));
    assertThat(kbCredentials.getAttributes().getUrl(), equalTo(defaultUrl));
}
Also used : DbKbCredentials(org.folio.repository.kbcredentials.DbKbCredentials) KbCredentials(org.folio.rest.jaxrs.model.KbCredentials) DbKbCredentials(org.folio.repository.kbcredentials.DbKbCredentials) Test(org.junit.Test)

Example 4 with DbKbCredentials

use of org.folio.repository.kbcredentials.DbKbCredentials in project mod-kb-ebsco-java by folio-org.

the class KbCredentialsSecuredCollectionConverterTest method shouldConvertKbCredentialsCollectionWithDefaultUrl.

@Test
public void shouldConvertKbCredentialsCollectionWithDefaultUrl() {
    Collection<DbKbCredentials> credentialsCollection = getCredentialsCollectionNoUrl();
    final KbCredentialsCollection kbCredentials = securedConverter.convert(credentialsCollection);
    assertThat(kbCredentials.getMeta().getTotalResults(), equalTo(1));
    assertThat(kbCredentials.getData().get(0).getType(), equalTo(KbCredentials.Type.KB_CREDENTIALS));
    assertThat(kbCredentials.getData().get(0).getAttributes().getName(), equalTo(STUB_CREDENTIALS_NAME));
    assertThat(kbCredentials.getData().get(0).getAttributes().getApiKey(), containsString("*"));
    assertThat(kbCredentials.getData().get(0).getAttributes().getCustomerId(), equalTo(STUB_CUSTOMER_ID));
    assertThat(kbCredentials.getData().get(0).getAttributes().getUrl(), equalTo(defaultUrl));
}
Also used : DbKbCredentials(org.folio.repository.kbcredentials.DbKbCredentials) KbCredentialsCollection(org.folio.rest.jaxrs.model.KbCredentialsCollection) Test(org.junit.Test)

Example 5 with DbKbCredentials

use of org.folio.repository.kbcredentials.DbKbCredentials in project mod-kb-ebsco-java by folio-org.

the class KbCredentialsSecuredConverterTest method shouldConvertKbCredentialsWithDefaultUrl.

@Test
public void shouldConvertKbCredentialsWithDefaultUrl() {
    DbKbCredentials holding = getCredentialsNoUrl();
    final KbCredentials kbCredentials = securedConverter.convert(holding);
    assertThat(kbCredentials.getType(), equalTo(KbCredentials.Type.KB_CREDENTIALS));
    assertThat(kbCredentials.getAttributes().getName(), equalTo(STUB_CREDENTIALS_NAME));
    assertThat(kbCredentials.getAttributes().getApiKey(), containsString("*"));
    assertThat(kbCredentials.getAttributes().getCustomerId(), equalTo(STUB_CUSTOMER_ID));
    assertThat(kbCredentials.getAttributes().getUrl(), equalTo(defaultUrl));
}
Also used : DbKbCredentials(org.folio.repository.kbcredentials.DbKbCredentials) KbCredentials(org.folio.rest.jaxrs.model.KbCredentials) DbKbCredentials(org.folio.repository.kbcredentials.DbKbCredentials) Test(org.junit.Test)

Aggregations

DbKbCredentials (org.folio.repository.kbcredentials.DbKbCredentials)10 Test (org.junit.Test)8 KbCredentials (org.folio.rest.jaxrs.model.KbCredentials)6 KbCredentialsCollection (org.folio.rest.jaxrs.model.KbCredentialsCollection)6 Context (io.vertx.core.Context)2 OffsetDateTime (java.time.OffsetDateTime)2 Collection (java.util.Collection)2 Map (java.util.Map)2 Objects.requireNonNull (java.util.Objects.requireNonNull)2 Optional (java.util.Optional)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 CompletableFuture.completedFuture (java.util.concurrent.CompletableFuture.completedFuture)2 BiFunction (java.util.function.BiFunction)2 Function (java.util.function.Function)2 StringUtils.defaultIfBlank (org.apache.commons.lang3.StringUtils.defaultIfBlank)2 RowSetUtils.fromUUID (org.folio.db.RowSetUtils.fromUUID)2 RowSetUtils.toUUID (org.folio.db.RowSetUtils.toUUID)2 Configuration (org.folio.holdingsiq.model.Configuration)2 OkapiData (org.folio.holdingsiq.model.OkapiData)2 ConfigurationService (org.folio.holdingsiq.service.ConfigurationService)2