Search in sources :

Example 6 with PricePlanDefaults

use of io.codekvast.common.customer.PricePlanDefaults in project codekvast by crispab.

the class MariadbIntegrationTest method assertConfigPollResponse.

private void assertConfigPollResponse(GetConfigResponse1 response, String publisherConfig) {
    PricePlanDefaults pp = PricePlanDefaults.DEMO;
    assertThat(response, is(GetConfigResponse1.sample().toBuilder().codeBasePublisherCheckIntervalSeconds(pp.getPublishIntervalSeconds()).codeBasePublisherConfig(publisherConfig).codeBasePublisherName("http").codeBasePublisherRetryIntervalSeconds(pp.getRetryIntervalSeconds()).configPollIntervalSeconds(pp.getPollIntervalSeconds()).configPollRetryIntervalSeconds(pp.getRetryIntervalSeconds()).invocationDataPublisherConfig(publisherConfig).invocationDataPublisherIntervalSeconds(pp.getPublishIntervalSeconds()).invocationDataPublisherName("http").invocationDataPublisherRetryIntervalSeconds(pp.getRetryIntervalSeconds()).build()));
}
Also used : PricePlanDefaults(io.codekvast.common.customer.PricePlanDefaults)

Example 7 with PricePlanDefaults

use of io.codekvast.common.customer.PricePlanDefaults in project codekvast by crispab.

the class DashboardServiceImplTest method should_getStatus_after_trial_period.

@Test
public void should_getStatus_after_trial_period() {
    // given
    when(customerIdProvider.getCustomerId()).thenReturn(1L);
    PricePlanDefaults ppd = PricePlanDefaults.TEST;
    Instant collectionStartedAt = now.minus(3, DAYS);
    Instant trialPeriodEndsAt = now.minus(1, MILLIS);
    CustomerData customerData = CustomerData.builder().customerId(1L).customerName("customerName").pricePlan(PricePlan.of(ppd).toBuilder().retentionPeriodDays(-1).build()).source("source").collectionStartedAt(collectionStartedAt).trialPeriodEndsAt(trialPeriodEndsAt).build();
    when(customerService.getCustomerDataByCustomerId(eq(1L))).thenReturn(customerData);
    when(customerService.countMethods(eq(1L))).thenReturn(1000);
    // when
    GetStatusResponse status = dashboardService.getStatus();
    // then
    assertNotNull(status);
    assertThat(status.getCollectedSinceMillis(), is(collectionStartedAt.toEpochMilli()));
    assertThat(status.getTrialPeriodEndsAtMillis(), is(trialPeriodEndsAt.toEpochMilli()));
    assertThat(status.getTrialPeriodPercent(), is(100));
    assertThat(status.getTrialPeriodExpired(), is(true));
}
Also used : GetStatusResponse(io.codekvast.dashboard.dashboard.model.status.GetStatusResponse) CustomerData(io.codekvast.common.customer.CustomerData) Instant(java.time.Instant) PricePlanDefaults(io.codekvast.common.customer.PricePlanDefaults) Test(org.junit.jupiter.api.Test)

Example 8 with PricePlanDefaults

use of io.codekvast.common.customer.PricePlanDefaults in project codekvast by crispab.

the class IntakeIntegrationTest method assertConfigPollResponse.

private void assertConfigPollResponse(GetConfigResponse1 response) {
    PricePlanDefaults pp = PricePlanDefaults.DEMO;
    assertThat(response, is(GetConfigResponse1.sample().toBuilder().codeBasePublisherCheckIntervalSeconds(pp.getPublishIntervalSeconds()).codeBasePublisherConfig("enabled=true").codeBasePublisherName("http").codeBasePublisherRetryIntervalSeconds(pp.getRetryIntervalSeconds()).configPollIntervalSeconds(pp.getPollIntervalSeconds()).configPollRetryIntervalSeconds(pp.getRetryIntervalSeconds()).invocationDataPublisherConfig("enabled=true").invocationDataPublisherIntervalSeconds(pp.getPublishIntervalSeconds()).invocationDataPublisherName("http").invocationDataPublisherRetryIntervalSeconds(pp.getRetryIntervalSeconds()).build()));
}
Also used : PricePlanDefaults(io.codekvast.common.customer.PricePlanDefaults)

Aggregations

PricePlanDefaults (io.codekvast.common.customer.PricePlanDefaults)8 CustomerData (io.codekvast.common.customer.CustomerData)4 Test (org.junit.jupiter.api.Test)4 GetStatusResponse (io.codekvast.dashboard.dashboard.model.status.GetStatusResponse)3 Instant (java.time.Instant)2 GetMethodsFormData (io.codekvast.dashboard.dashboard.model.methods.GetMethodsFormData)1 Timestamp (java.sql.Timestamp)1 Mockito.anyString (org.mockito.Mockito.anyString)1